summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-06-10 13:20:04 +0200
committerStanislaw Halik <sthalik@misaki.pl>2023-06-10 13:20:04 +0200
commit2204f113710319ae6d735e3d511dd1d75d42a07d (patch)
treed21bb92cddf4c511239a773efc54f9aa94935b2b /src
parent587d492a03275e95d518850d2e44949b73e1980e (diff)
wip
Diffstat (limited to 'src')
-rw-r--r--src/chunk-render.cpp2
-rw-r--r--src/entity.cpp6
-rw-r--r--src/entity.hpp1
-rw-r--r--src/light.hpp6
4 files changed, 11 insertions, 4 deletions
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp
index 87f44e79..38d35030 100644
--- a/src/chunk-render.cpp
+++ b/src/chunk-render.cpp
@@ -40,7 +40,7 @@ auto chunk::ensure_ground_mesh() noexcept -> ground_mesh_tuple
const local_coords pos{i};
const auto quad = atlas->floor_quad(Vector3(pos) * TILE_SIZE, TILE_SIZE2);
const auto texcoords = atlas->texcoords_for_id(_ground_variants[i]);
- const float depth = tile_shader::depth_value(pos);
+ const float depth = tile_shader::depth_value(pos, tile_shader::ground_depth_offset);
auto& v = vertexes[k];
for (auto j = 0uz; j < 4; j++)
v[j] = { quad[j], texcoords[j], depth };
diff --git a/src/entity.cpp b/src/entity.cpp
index 6361c118..905fc8d0 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -239,6 +239,12 @@ size_t entity::move_to(size_t& i, Vector2i delta, rotation new_r)
return i;
}
+void entity::move_to(Magnum::Vector2i delta)
+{
+ auto i = index();
+ (void)move_to(i, delta, r);
+}
+
void entity::set_bbox_(Vector2b offset_, Vector2b bbox_offset_, Vector2ub bbox_size_, pass_mode pass_)
{
const_cast<Vector2b&>(offset) = offset_;
diff --git a/src/entity.hpp b/src/entity.hpp
index 21628a19..29777c13 100644
--- a/src/entity.hpp
+++ b/src/entity.hpp
@@ -77,6 +77,7 @@ struct entity
bool can_rotate(rotation new_r);
bool can_move_to(Vector2i delta);
size_t move_to(size_t& i, Vector2i delta, rotation new_r);
+ void move_to(Vector2i delta);
protected:
entity(object_id id, struct chunk& c, const entity_proto& proto);
diff --git a/src/light.hpp b/src/light.hpp
index 1332efc3..45c8390e 100644
--- a/src/light.hpp
+++ b/src/light.hpp
@@ -16,7 +16,7 @@ struct light_proto : entity_proto
bool operator==(const light_proto&) const;
float max_distance = 0;
- Color3ub color{255, 255, 255};
+ Color4ub color{255, 255, 255, 255};
light_falloff falloff : 3 = light_falloff::linear;
uint8_t enabled : 1 = true;
};
@@ -24,9 +24,9 @@ struct light_proto : entity_proto
struct light final : entity
{
float max_distance;
- Color3ub color;
+ Color4ub color;
light_falloff falloff : 2;
- uint8_t enabled : 1 = true;
+ uint8_t enabled : 1;
light(object_id id, struct chunk& c, const light_proto& proto);