Brought over a bunch of code from the roguelike and now will use it to generate a random map.
This commit is contained in:
parent
8d3d3b4ec3
commit
2daa1c9bd5
59 changed files with 4303 additions and 411 deletions
46
lights.hpp
Normal file
46
lights.hpp
Normal file
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
#include <array>
|
||||
#include "dbc.hpp"
|
||||
#include "point.hpp"
|
||||
#include <algorithm>
|
||||
#include "matrix.hpp"
|
||||
#include "pathing.hpp"
|
||||
|
||||
namespace lighting {
|
||||
|
||||
struct LightSource {
|
||||
int strength = 0;
|
||||
float radius = 1.0f;
|
||||
};
|
||||
|
||||
const int MIN = 30;
|
||||
const int MAX = 105;
|
||||
|
||||
class LightRender {
|
||||
public:
|
||||
size_t $width;
|
||||
size_t $height;
|
||||
Matrix $lightmap;
|
||||
Pathing $paths;
|
||||
|
||||
LightRender(size_t width, size_t height) :
|
||||
$width(width),
|
||||
$height(height),
|
||||
$lightmap(height, matrix::Row(width, 0)),
|
||||
$paths(width, height)
|
||||
{}
|
||||
|
||||
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 render_compass_light(LightSource source, Point at, PointList &has_light);
|
||||
void render_circle_light(LightSource source, Point at, PointList &has_light);
|
||||
Matrix &lighting() { return $lightmap; }
|
||||
Matrix &paths() { return $paths.paths(); }
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue