summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/camera-offset.cpp2
-rw-r--r--src/chunk-render.cpp2
-rw-r--r--src/chunk-scenery.cpp4
-rw-r--r--src/entity-type.hpp2
-rw-r--r--src/scenery.cpp7
5 files changed, 9 insertions, 8 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp
index e8c80861..0aab5ea1 100644
--- a/src/camera-offset.cpp
+++ b/src/camera-offset.cpp
@@ -19,6 +19,8 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, chun
const int z = c.z - chunk_z_min;
depth_offset += tile_shader::depth_value(local_coords{z, z});
+ // wip
+
if (c.z == chunk_z_max)
depth_offset = 1;
diff --git a/src/chunk-render.cpp b/src/chunk-render.cpp
index 28bdc759..802cb11a 100644
--- a/src/chunk-render.cpp
+++ b/src/chunk-render.cpp
@@ -71,7 +71,7 @@ GL::Mesh chunk::make_wall_mesh(size_t count)
const local_coords pos{i / 2u};
const auto center = Vector3(pos) * TILE_SIZE;
const auto quad = i & 1 ? atlas->wall_quad_W(center, TILE_SIZE) : atlas->wall_quad_N(center, TILE_SIZE);
- const float depth = tile_shader::depth_value(pos, tile_shader::wall_depth_offset);
+ const float depth = tile_shader::depth_value(pos);
const auto texcoords = atlas->texcoords_for_id(variant);
auto& v = vertexes[k];
for (auto j = 0uz; j < 4; j++)
diff --git a/src/chunk-scenery.cpp b/src/chunk-scenery.cpp
index 6c4a1b7c..b17b2e2a 100644
--- a/src/chunk-scenery.cpp
+++ b/src/chunk-scenery.cpp
@@ -159,7 +159,9 @@ auto chunk::ensure_scenery_mesh(scenery_scratch_buffers buffers) noexcept -> sce
const auto quad = atlas->frame_quad(coord, fr.r, fr.frame);
const auto& group = atlas->group(fr.r);
const auto texcoords = atlas->texcoords_for_frame(fr.r, fr.frame, !group.mirror_from.isEmpty());
- const float depth = tile_shader::depth_value(pos, tile_shader::scenery_depth_offset);
+ const auto depth2 = e->depth_offset();
+ const auto d = depth2.y() * TILE_MAX_DIM + depth2.x();
+ const float depth = tile_shader::depth_value(pos, d);
for (auto j = 0uz; j < 4; j++)
scenery_vertexes[i][j] = { quad[j], texcoords[j], depth };
diff --git a/src/entity-type.hpp b/src/entity-type.hpp
index 70490645..308bc8a6 100644
--- a/src/entity-type.hpp
+++ b/src/entity-type.hpp
@@ -3,7 +3,7 @@
namespace floormat {
enum class entity_type : unsigned char {
- none, character, scenery,
+ none, character, scenery, light,
};
constexpr inline size_t entity_type_BITS = 3;
diff --git a/src/scenery.cpp b/src/scenery.cpp
index fadc0471..a07a69a5 100644
--- a/src/scenery.cpp
+++ b/src/scenery.cpp
@@ -90,22 +90,19 @@ Vector2 scenery::ordinal_offset(Vector2b offset) const
Vector2 scenery::depth_offset() const
{
- constexpr auto sc_offset = tile_shader::scenery_depth_offset;
constexpr auto inv_tile_size = 1.f/TILE_SIZE2;
Vector2 ret;
ret += Vector2(atlas->group(r).depth_offset) * inv_tile_size;
if (sc_type == scenery_type::door)
{
const bool is_open = frame != atlas->info().nframes-1;
- ret += Vector2(sc_offset * is_open, 0);
- constexpr auto off_opened = Vector2(-1, 0);
+ constexpr auto off_opened = Vector2(-1, 0) + Vector2();
constexpr auto off_closed = Vector2(0, 0);
const auto vec = is_open ? off_opened : off_closed;
const auto offset = rotate_point(vec, rotation::N, r);
ret += offset;
}
- else
- ret += Vector2(sc_offset, 0);
+ ret += Vector2(tile_shader::scenery_depth_offset, 0);
return ret;
}