Luanti 5.19.0-dev
Loading...
Searching...
No Matches
mesh.cpp File Reference
#include "mesh.h"
#include "IMeshBuffer.h"
#include "SSkinMeshBuffer.h"
#include "constants.h"
#include "debug.h"
#include <cmath>
#include <IAnimatedMesh.h>
#include "S3DVertex.h"
#include <SMesh.h>
#include "CMeshBuffer.h"
Include dependency graph for mesh.cpp:

Functions

static void applyShadeFactor (video::SColor &color, f32 factor)
void applyFacesShading (video::SColor &color, v3f normal)
scene::IAnimatedMesh * createCubeMesh (v3f scale)
template<typename F>
static void applyToMeshBuffer (scene::IMeshBuffer *buf, const F &fn)
void scaleMesh (scene::IMesh *mesh, v3f scale)
void translateMesh (scene::IMesh *mesh, v3f vec)
void setMeshBufferColor (scene::IMeshBuffer *buf, video::SColor color)
void setMeshColor (scene::IMesh *mesh, video::SColor color)
template<typename F>
static void applyToMesh (scene::IMesh *mesh, const F &fn)
void colorizeMeshBuffer (scene::IMeshBuffer *buf, video::SColor buf_color, f32 ambient_light, v3f dir_light)
void setMeshColorByNormalXYZ (scene::IMesh *mesh, video::SColor colorX, video::SColor colorY, video::SColor colorZ)
void setMeshColorByNormal (scene::IMesh *mesh, v3f normal, video::SColor color)
template<float v3f::* U, float v3f::* V>
static void rotateMesh (scene::IMesh *mesh, float degrees)
void rotateMeshXYby (scene::IMesh *mesh, f64 degrees)
void rotateMeshXZby (scene::IMesh *mesh, f64 degrees)
void rotateMeshYZby (scene::IMesh *mesh, f64 degrees)
void rotateMeshBy6dFacedir (scene::IMesh *mesh, u8 facedir)
void recalculateBoundingBox (scene::IMesh *src_mesh)
bool checkMeshNormals (scene::IMesh *mesh)
template<class VertexType, class SMeshBufferType>
static scene::IMeshBuffer * cloneMeshBuffer (scene::IMeshBuffer *mesh_buffer)
scene::IMeshBuffer * cloneMeshBuffer (scene::IMeshBuffer *mesh_buffer)
scene::SMesh * cloneStaticMesh (scene::IMesh *src_mesh)
 Clone a mesh. For an animated mesh, this will clone the static pose.
scene::IMesh * convertNodeboxesToMesh (const std::vector< aabb3f > &boxes, const f32 *uv_coords, f32 expand)
void setMaterialFilters (video::SMaterialLayer &tex, bool bilinear, bool trilinear, bool anisotropic)

Function Documentation

◆ applyFacesShading()

void applyFacesShading ( video::SColor & color,
v3f normal )

Applies shading to a color based on the surface's normal vector.

References applyFacesShading(), and applyShadeFactor().

Referenced by applyFacesShading(), MapblockMeshGenerator::blendLightColor(), MapblockMeshGenerator::drawAutoLightedCuboid(), MapblockMeshGenerator::drawMeshNode(), MapblockMeshGenerator::drawQuad(), and MapblockMeshGenerator::drawSolidNode().

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

◆ applyShadeFactor()

void applyShadeFactor ( video::SColor & color,
f32 factor )
inlinestatic

References applyShadeFactor().

Here is the call graph for this function:

◆ applyToMesh()

template<typename F>
void applyToMesh ( scene::IMesh * mesh,
const F & fn )
static

References applyToMesh(), and applyToMeshBuffer().

Referenced by applyToMesh(), rotateMesh(), setMeshColorByNormal(), and setMeshColorByNormalXYZ().

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

◆ applyToMeshBuffer()

template<typename F>
void applyToMeshBuffer ( scene::IMeshBuffer * buf,
const F & fn )
inlinestatic

References applyToMeshBuffer().

Referenced by applyToMesh(), applyToMeshBuffer(), cloneMeshBuffer(), colorizeMeshBuffer(), scaleMesh(), setMeshBufferColor(), and translateMesh().

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

◆ checkMeshNormals()

bool checkMeshNormals ( scene::IMesh * mesh)

References checkMeshNormals().

Referenced by GenericCAO::addToScene(), checkMeshNormals(), and NodeVisuals::updateMesh().

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

◆ cloneMeshBuffer() [1/2]

scene::IMeshBuffer * cloneMeshBuffer ( scene::IMeshBuffer * mesh_buffer)

References cloneMeshBuffer(), and sanity_check.

Referenced by WieldMeshSceneNode::setExtruded().

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

◆ cloneMeshBuffer() [2/2]

template<class VertexType, class SMeshBufferType>
scene::IMeshBuffer * cloneMeshBuffer ( scene::IMeshBuffer * mesh_buffer)
static

References applyToMeshBuffer(), and cloneMeshBuffer().

Referenced by cloneMeshBuffer(), cloneMeshBuffer(), cloneStaticMesh(), and getExtrudedMesh().

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

◆ cloneStaticMesh()

scene::SMesh * cloneStaticMesh ( scene::IMesh * src_mesh)

Clone a mesh. For an animated mesh, this will clone the static pose.

References cloneMeshBuffer(), and cloneStaticMesh().

Referenced by cloneStaticMesh(), MapblockMeshGenerator::drawMeshNode(), getExtrudedMesh(), WieldMeshSceneNode::setExtruded(), and NodeVisuals::updateMesh().

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

◆ colorizeMeshBuffer()

void colorizeMeshBuffer ( scene::IMeshBuffer * buf,
video::SColor buf_color,
f32 ambient_light,
v3f dir_light )

Overwrites the color of a mesh buffer. The color is darkened based on the normal vector of the vertices and the given directional light source + ambient light.

References applyShadeFactor(), applyToMeshBuffer(), and colorizeMeshBuffer().

Referenced by colorizeMeshBuffer(), and drawItemStack().

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

◆ convertNodeboxesToMesh()

scene::IMesh * convertNodeboxesToMesh ( const std::vector< aabb3f > & boxes,
const f32 * uv_coords,
f32 expand )

References BS, and convertNodeboxesToMesh().

Referenced by convertNodeboxesToMesh(), and Hud::updateSelectionMesh().

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

◆ createCubeMesh()

scene::IAnimatedMesh * createCubeMesh ( v3f scale)

References createCubeMesh(), and scaleMesh().

Referenced by ExtrusionMeshCache::ExtrusionMeshCache(), GenericCAO::addToScene(), and createCubeMesh().

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

◆ recalculateBoundingBox()

void recalculateBoundingBox ( scene::IMesh * src_mesh)

References recalculateBoundingBox().

Referenced by MapblockMeshGenerator::drawMeshNode(), recalculateBoundingBox(), and NodeVisuals::updateMesh().

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

◆ rotateMesh()

template<float v3f::* U, float v3f::* V>
void rotateMesh ( scene::IMesh * mesh,
float degrees )
static

References applyToMesh(), and rotateMesh().

Referenced by rotateMesh(), rotateMeshXYby(), rotateMeshXZby(), and rotateMeshYZby().

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

◆ rotateMeshBy6dFacedir()

void rotateMeshBy6dFacedir ( scene::IMesh * mesh,
u8 facedir )

References rotateMeshBy6dFacedir(), rotateMeshXYby(), rotateMeshXZby(), and rotateMeshYZby().

Referenced by MapblockMeshGenerator::drawMeshNode(), and rotateMeshBy6dFacedir().

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

◆ rotateMeshXYby()

void rotateMeshXYby ( scene::IMesh * mesh,
f64 degrees )

References rotateMesh(), and rotateMeshXYby().

Referenced by rotateMeshBy6dFacedir(), and rotateMeshXYby().

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

◆ rotateMeshXZby()

void rotateMeshXZby ( scene::IMesh * mesh,
f64 degrees )

References rotateMesh(), and rotateMeshXZby().

Referenced by createItemMesh(), MapblockMeshGenerator::drawMeshNode(), rotateMeshBy6dFacedir(), and rotateMeshXZby().

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

◆ rotateMeshYZby()

void rotateMeshYZby ( scene::IMesh * mesh,
f64 degrees )

References rotateMesh(), and rotateMeshYZby().

Referenced by createItemMesh(), rotateMeshBy6dFacedir(), and rotateMeshYZby().

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

◆ scaleMesh()

void scaleMesh ( scene::IMesh * mesh,
v3f scale )

References applyToMeshBuffer(), and scaleMesh().

Referenced by createCubeMesh(), createExtrusionMesh(), createItemMesh(), getExtrudedMesh(), scaleMesh(), and NodeVisuals::updateMesh().

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

◆ setMaterialFilters()

void setMaterialFilters ( video::SMaterialLayer & tex,
bool bilinear,
bool trilinear,
bool anisotropic )

References setMaterialFilters().

Referenced by ClientMap::renderMap(), WieldMeshSceneNode::setExtruded(), WieldMeshSceneNode::setItem(), setMaterialFilters(), and setMaterialTextureAndFilters().

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

◆ setMeshBufferColor()

void setMeshBufferColor ( scene::IMeshBuffer * buf,
video::SColor color )

Sets a constant color for all vertices in the mesh buffer.

References applyToMeshBuffer(), and setMeshBufferColor().

Referenced by drawItemStack(), WieldMeshSceneNode::setColor(), setMeshBufferColor(), and setMeshColor().

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

◆ setMeshColor()

void setMeshColor ( scene::IMesh * mesh,
video::SColor color )

References setMeshBufferColor(), and setMeshColor().

Referenced by GenericCAO::addToScene(), Hud::drawSelectionMesh(), setMeshColor(), and GenericCAO::updateTextures().

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

◆ setMeshColorByNormal()

void setMeshColorByNormal ( scene::IMesh * mesh,
v3f normal,
video::SColor color )

References applyToMesh(), and setMeshColorByNormal().

Referenced by Hud::drawSelectionMesh(), and setMeshColorByNormal().

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

◆ setMeshColorByNormalXYZ()

void setMeshColorByNormalXYZ ( scene::IMesh * mesh,
video::SColor colorX,
video::SColor colorY,
video::SColor colorZ )

References applyToMesh(), setMeshColorByNormalXYZ(), x, y, and z.

Referenced by setMeshColorByNormalXYZ().

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

◆ translateMesh()

void translateMesh ( scene::IMesh * mesh,
v3f vec )

References applyToMeshBuffer(), and translateMesh().

Referenced by translateMesh().

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