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

#include <mapblock_mesh.h>

+ Collaboration diagram for MapBlockMesh:

Public Member Functions

 MapBlockMesh (Client *client, MeshMakeData *data)
 
 ~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 isEmpty () const
 
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
 

Static Public Member Functions

static float packCrackMaterialParam (int crack, u8 layer_scale)
 
static std::pair< int, u8 > unpackCrackMaterialParam (float param)
 

Static Public Attributes

static const int TEXTURE_LAYER_CRACK = 1
 Texture layer in SMaterial where the crack texture is put.
 

Private Types

typedef std::pair< u8, u32 > MeshIndex
 

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::vector< MeshIndexm_crack_materials
 
std::map< MeshIndex, AnimationInfom_animation_info
 
std::vector< MeshTrianglem_transparent_triangles
 
MapBlockBspTree m_bsp_tree
 
std::vector< PartialMeshBufferm_transparent_buffers
 
bool m_transparent_buffers_consolidated = false
 

Member Typedef Documentation

◆ MeshIndex

typedef std::pair<u8 , u32 > MapBlockMesh::MeshIndex
private

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 m_animation_force_timer, m_animation_info, m_crack_materials, m_has_animation, m_last_crack, m_mesh, myrand_range(), packCrackMaterialParam(), and unpackCrackMaterialParam().

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
Warning
ClientMap requires that the vertex and index data is not modified

References m_mesh.

◆ getMesh() [2/2]

scene::IMesh * MapBlockMesh::getMesh ( u8 layer)
inline
Parameters
layerlayer index
Warning
ClientMap requires that the vertex and index data is not modified

References m_mesh, and MAX_TILE_LAYERS.

◆ 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:

◆ isEmpty()

bool MapBlockMesh::isEmpty ( ) const
inline
Returns
true if the mesh contains nothing to draw

References m_mesh, and m_transparent_triangles.

Referenced by Client::step().

+ 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:

◆ packCrackMaterialParam()

static float MapBlockMesh::packCrackMaterialParam ( int crack,
u8 layer_scale )
inlinestatic

Referenced by MapBlockMesh(), and animate().

+ Here is the caller graph for this function:

◆ unpackCrackMaterialParam()

static std::pair< int, u8 > MapBlockMesh::unpackCrackMaterialParam ( float param)
inlinestatic

Referenced by animate(), and GameGlobalShaderUniformSetter::onSetMaterial().

+ 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<MeshIndex, 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::vector<MeshIndex> 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().

◆ TEXTURE_LAYER_CRACK

const int MapBlockMesh::TEXTURE_LAYER_CRACK = 1
static

Texture layer in SMaterial where the crack texture is put.

Referenced by MapBlockMesh().


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