First cut of pulling out the relevant parts of my original game to make a little framework.
This commit is contained in:
commit
6a0c9e8d46
177 changed files with 18197 additions and 0 deletions
40
src/graphics/lights.hpp
Normal file
40
src/graphics/lights.hpp
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include "dbc.hpp"
|
||||
#include "algos/point.hpp"
|
||||
#include <algorithm>
|
||||
#include "algos/matrix.hpp"
|
||||
#include "algos/pathing.hpp"
|
||||
#include "game/components.hpp"
|
||||
|
||||
namespace lighting {
|
||||
using components::LightSource;
|
||||
|
||||
// THESE ARE PERCENTAGES!
|
||||
const int MIN = 20;
|
||||
const int BOOST = 10;
|
||||
|
||||
class LightRender {
|
||||
public:
|
||||
size_t $width;
|
||||
size_t $height;
|
||||
Matrix $lightmap;
|
||||
Matrix $ambient;
|
||||
Pathing $paths;
|
||||
matrix::Matrix $fow;
|
||||
|
||||
LightRender(Matrix& walls);
|
||||
|
||||
void reset_light();
|
||||
void set_light_target(const Point &at, int value=0);
|
||||
void clear_light_target(const Point &at);
|
||||
void path_light(Matrix &walls);
|
||||
void light_box(LightSource source, Point from, Point &min_out, Point &max_out);
|
||||
int light_level(int level, float distance, size_t x, size_t y);
|
||||
void render_light(LightSource source, Point at);
|
||||
void render_square_light(LightSource source, Point at, PointList &has_light);
|
||||
void update_fow(Point player_pos, LightSource source);
|
||||
Matrix &lighting() { return $lightmap; }
|
||||
Matrix &paths() { return $paths.paths(); }
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue