diff options
Diffstat (limited to 'src/client/clientmap.h')
-rw-r--r-- | src/client/clientmap.h | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/src/client/clientmap.h b/src/client/clientmap.h index b4dc42395..d8554313d 100644 --- a/src/client/clientmap.h +++ b/src/client/clientmap.h @@ -56,6 +56,7 @@ struct MeshBufListList class Client; class ITextureSource; +class PartialMeshBuffer; /* ClientMap @@ -85,21 +86,7 @@ public: ISceneNode::drop(); } - void updateCamera(const v3f &pos, const v3f &dir, f32 fov, const v3s16 &offset) - { - v3s16 previous_block = getContainerPos(floatToInt(m_camera_position, BS) + m_camera_offset, MAP_BLOCKSIZE); - - m_camera_position = pos; - m_camera_direction = dir; - m_camera_fov = fov; - m_camera_offset = offset; - - v3s16 current_block = getContainerPos(floatToInt(m_camera_position, BS) + m_camera_offset, MAP_BLOCKSIZE); - - // reorder the blocks when camera crosses block boundary - if (previous_block != current_block) - m_needs_update_drawlist = true; - } + void updateCamera(v3f pos, v3f dir, f32 fov, v3s16 offset); /* Forcefully get a sector from somewhere @@ -150,6 +137,10 @@ public: f32 getCameraFov() const { return m_camera_fov; } private: + + // update the vertex order in transparent mesh buffers + void updateTransparentMeshBuffers(); + // Orders blocks by distance to the camera class MapBlockComparer { @@ -167,6 +158,26 @@ private: v3s16 m_camera_block; }; + + // reference to a mesh buffer used when rendering the map. + struct DrawDescriptor { + v3s16 m_pos; + union { + scene::IMeshBuffer *m_buffer; + const PartialMeshBuffer *m_partial_buffer; + }; + bool m_reuse_material:1; + bool m_use_partial_buffer:1; + + DrawDescriptor(v3s16 pos, scene::IMeshBuffer *buffer, bool reuse_material) : + m_pos(pos), m_buffer(buffer), m_reuse_material(reuse_material), m_use_partial_buffer(false) + {} + + DrawDescriptor(v3s16 pos, const PartialMeshBuffer *buffer) : + m_pos(pos), m_partial_buffer(buffer), m_reuse_material(false), m_use_partial_buffer(true) + {} + }; + Client *m_client; RenderingEngine *m_rendering_engine; @@ -179,6 +190,7 @@ private: v3f m_camera_direction = v3f(0,0,1); f32 m_camera_fov = M_PI; v3s16 m_camera_offset; + bool m_needs_update_transparent_meshes = true; std::map<v3s16, MapBlock*, MapBlockComparer> m_drawlist; std::map<v3s16, MapBlock*> m_drawlist_shadow; @@ -190,4 +202,5 @@ private: bool m_cache_bilinear_filter; bool m_cache_anistropic_filter; bool m_added_to_shadow_renderer{false}; + u16 m_cache_transparency_sorting_distance; }; |