Lighting now uses pathing to determine where it can go, but _distance_ to determin strength. Looks way better.
This commit is contained in:
parent
31620adf7a
commit
f46b5f15ef
8 changed files with 72 additions and 63 deletions
16
matrix.cpp
16
matrix.cpp
|
@ -53,9 +53,11 @@ namespace matrix {
|
|||
return at_end(y, height);
|
||||
}
|
||||
|
||||
in_box::in_box(Matrix &mat, size_t from_x, size_t from_y, size_t size) {
|
||||
size_t h = mat.size();
|
||||
size_t w = mat[0].size();
|
||||
in_box::in_box(Matrix &mat, size_t at_x, size_t at_y, size_t size) :
|
||||
from_x(at_x), from_y(at_y)
|
||||
{
|
||||
size_t h = matrix::height(mat);
|
||||
size_t w = matrix::width(mat);
|
||||
|
||||
// keeps it from going below zero
|
||||
// need extra -1 to compensate for the first next()
|
||||
|
@ -78,9 +80,17 @@ namespace matrix {
|
|||
// if x==0 then this moves it to min_x
|
||||
x = max(x, left);
|
||||
// and done
|
||||
|
||||
return at_end(y, bottom);
|
||||
}
|
||||
|
||||
float in_box::distance() {
|
||||
int dx = from_x - x;
|
||||
int dy = from_y - y;
|
||||
|
||||
return sqrt((dx * dx) + (dy * dy));
|
||||
}
|
||||
|
||||
void in_box::dump() {
|
||||
println("BOX: x={},y={}; left={},right={}; top={},bottom={}",
|
||||
x, y, left, right, top, bottom);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue