Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
MapBlockMesh Class Reference

#include <mapblock_mesh.h>

+ Collaboration diagram for MapBlockMesh:

Classes

struct  AnimationInfo
 

Public Member Functions

 MapBlockMesh (Client *client, MeshMakeData *data, v3s16 camera_offset)
 
 ~MapBlockMesh ()
 
bool animate (bool faraway, float time, int crack, u32 daynight_ratio)
 
scene::IMesh * getMesh ()
 
scene::IMesh * getMesh (u8 layer)
 
std::vector< MinimapMapblock * > moveMinimapMapblocks ()
 
bool isAnimationForced () const
 
void decreaseAnimationForceTimer ()
 
f32 getBoundingRadius () const
 Radius of the bounding-sphere, in BS-space.
 
v3f getBoundingSphereCenter () const
 Center of the bounding-sphere, in BS-space, relative to block pos.
 
void updateTransparentBuffers (v3f camera_pos, v3s16 block_pos, bool group_by_buffers)
 Update transparent buffers to render towards the camera.
 
void consolidateTransparentBuffers ()
 
const std::vector< PartialMeshBuffer > & getTransparentBuffers () const
 get the list of transparent buffers
 

Private Attributes

irr_ptr< scene::IMesh > m_mesh [MAX_TILE_LAYERS]
 
std::vector< MinimapMapblock * > m_minimap_mapblocks
 
ITextureSourcem_tsrc
 
IShaderSourcem_shdrsrc
 
f32 m_bounding_radius
 
v3f m_bounding_sphere_center
 
bool m_has_animation
 
int m_animation_force_timer
 
int m_last_crack
 
std::map< std::pair< u8, u32 >, std::string > m_crack_materials
 
std::map< std::pair< u8, u32 >, AnimationInfom_animation_info
 
std::vector< MeshTrianglem_transparent_triangles
 
MapBlockBspTree m_bsp_tree
 
std::vector< PartialMeshBufferm_transparent_buffers
 
bool m_transparent_buffers_consolidated = false
 

Constructor & Destructor Documentation

◆ MapBlockMesh()

◆ ~MapBlockMesh()

MapBlockMesh::~MapBlockMesh ( )

References m_mesh, m_minimap_mapblocks, and porting::TrackFreedMemory().

+ Here is the call graph for this function:

Member Function Documentation

◆ animate()

bool MapBlockMesh::animate ( bool faraway,
float time,
int crack,
u32 daynight_ratio )

References TileLayer::animation_frame_count, TileLayer::animation_frame_length_ms, TileLayer::frames, ITextureSource::getTextureForMesh(), itos(), m_animation_force_timer, m_animation_info, m_crack_materials, m_has_animation, m_last_crack, m_mesh, m_tsrc, myrand_range(), FrameSpec::texture, TileLayer::texture, and TileLayer::texture_id.

Referenced by ClientMap::renderMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ consolidateTransparentBuffers()

void MapBlockMesh::consolidateTransparentBuffers ( )

References m_transparent_buffers, m_transparent_buffers_consolidated, and m_transparent_triangles.

Referenced by ClientMap::updateTransparentMeshBuffers().

+ Here is the caller graph for this function:

◆ decreaseAnimationForceTimer()

void MapBlockMesh::decreaseAnimationForceTimer ( )
inline

References m_animation_force_timer.

Referenced by ClientMap::renderMap().

+ Here is the caller graph for this function:

◆ getBoundingRadius()

f32 MapBlockMesh::getBoundingRadius ( ) const
inline

Radius of the bounding-sphere, in BS-space.

References m_bounding_radius.

Referenced by ClientMap::renderMap(), ClientMap::touchMapBlocks(), ClientMap::updateDrawList(), ClientMap::updateDrawListShadow(), and ClientMap::updateTransparentMeshBuffers().

+ Here is the caller graph for this function:

◆ getBoundingSphereCenter()

v3f MapBlockMesh::getBoundingSphereCenter ( ) const
inline

Center of the bounding-sphere, in BS-space, relative to block pos.

References m_bounding_sphere_center.

Referenced by ClientMap::renderMap(), ClientMap::touchMapBlocks(), ClientMap::updateDrawList(), ClientMap::updateDrawListShadow(), and ClientMap::updateTransparentMeshBuffers().

+ Here is the caller graph for this function:

◆ getMesh() [1/2]

scene::IMesh * MapBlockMesh::getMesh ( )
inline

References m_mesh.

Referenced by ClientMap::renderMap(), ClientMap::renderMapShadows(), and Client::step().

+ Here is the caller graph for this function:

◆ getMesh() [2/2]

scene::IMesh * MapBlockMesh::getMesh ( u8 layer)
inline

References m_mesh.

◆ getTransparentBuffers()

const std::vector< PartialMeshBuffer > & MapBlockMesh::getTransparentBuffers ( ) const
inline

get the list of transparent buffers

References m_transparent_buffers.

Referenced by ClientMap::renderMap(), and ClientMap::updateTransparentMeshBuffers().

+ Here is the caller graph for this function:

◆ isAnimationForced()

bool MapBlockMesh::isAnimationForced ( ) const
inline

References m_animation_force_timer.

Referenced by ClientMap::renderMap().

+ Here is the caller graph for this function:

◆ moveMinimapMapblocks()

std::vector< MinimapMapblock * > MapBlockMesh::moveMinimapMapblocks ( )
inline

References m_minimap_mapblocks.

Referenced by Client::step().

+ Here is the caller graph for this function:

◆ updateTransparentBuffers()

void MapBlockMesh::updateTransparentBuffers ( v3f camera_pos,
v3s16 block_pos,
bool group_by_buffers )

Update transparent buffers to render towards the camera.

Parameters
group_by_buffersIf true, triangles in the same buffer are batched into the same PartialMeshBuffer, resulting in fewer draw calls, but wrong order. Triangles within a single buffer are still ordered, and buffers are ordered relative to each other (with respect to their nearest triangle).

References BS, intToFloat(), m_bsp_tree, m_transparent_buffers, m_transparent_buffers_consolidated, m_transparent_triangles, MAP_BLOCKSIZE, and MapBlockBspTree::traverse().

Referenced by ClientMap::updateTransparentMeshBuffers().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_animation_force_timer

int MapBlockMesh::m_animation_force_timer
private

◆ m_animation_info

std::map<std::pair<u8, u32>, AnimationInfo> MapBlockMesh::m_animation_info
private

Referenced by MapBlockMesh(), and animate().

◆ m_bounding_radius

f32 MapBlockMesh::m_bounding_radius
private

Referenced by MapBlockMesh(), and getBoundingRadius().

◆ m_bounding_sphere_center

v3f MapBlockMesh::m_bounding_sphere_center
private

◆ m_bsp_tree

MapBlockBspTree MapBlockMesh::m_bsp_tree
private

◆ m_crack_materials

std::map<std::pair<u8, u32>, std::string> MapBlockMesh::m_crack_materials
private

Referenced by MapBlockMesh(), and animate().

◆ m_has_animation

bool MapBlockMesh::m_has_animation
private

Referenced by MapBlockMesh(), and animate().

◆ m_last_crack

int MapBlockMesh::m_last_crack
private

Referenced by animate().

◆ m_mesh

irr_ptr<scene::IMesh> MapBlockMesh::m_mesh[MAX_TILE_LAYERS]
private

◆ m_minimap_mapblocks

std::vector<MinimapMapblock*> MapBlockMesh::m_minimap_mapblocks
private

◆ m_shdrsrc

IShaderSource* MapBlockMesh::m_shdrsrc
private

Referenced by MapBlockMesh().

◆ m_transparent_buffers

std::vector<PartialMeshBuffer> MapBlockMesh::m_transparent_buffers
private

◆ m_transparent_buffers_consolidated

bool MapBlockMesh::m_transparent_buffers_consolidated = false
private

◆ m_transparent_triangles

std::vector<MeshTriangle> MapBlockMesh::m_transparent_triangles
private

◆ m_tsrc

ITextureSource* MapBlockMesh::m_tsrc
private

Referenced by MapBlockMesh(), and animate().


The documentation for this class was generated from the following files: