Luanti 5.11.0-dev
 
Loading...
Searching...
No Matches
mesh.cpp File Reference
#include "mesh.h"
#include "S3DVertex.h"
#include "debug.h"
#include "log.h"
#include <cmath>
#include <iostream>
#include <IAnimatedMesh.h>
#include <SAnimatedMesh.h>
#include <IAnimatedMeshSceneNode.h>
+ Include dependency graph for mesh.cpp:

Functions

static void applyShadeFactor (video::SColor &color, float factor)
 
void applyFacesShading (video::SColor &color, const v3f normal)
 
scene::IAnimatedMesh * createCubeMesh (v3f scale)
 
void scaleMesh (scene::IMesh *mesh, v3f scale)
 
void translateMesh (scene::IMesh *mesh, v3f vec)
 
void setMeshBufferColor (scene::IMeshBuffer *buf, const video::SColor color)
 
void setMeshColor (scene::IMesh *mesh, const video::SColor color)
 
template<typename F >
static void applyToMesh (scene::IMesh *mesh, const F &fn)
 
void colorizeMeshBuffer (scene::IMeshBuffer *buf, const video::SColor *buffercolor)
 
void setMeshColorByNormalXYZ (scene::IMesh *mesh, const video::SColor &colorX, const video::SColor &colorY, const video::SColor &colorZ)
 
void setMeshColorByNormal (scene::IMesh *mesh, const v3f &normal, const 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, int facedir)
 
void recalculateBoundingBox (scene::IMesh *src_mesh)
 
bool checkMeshNormals (scene::IMesh *mesh)
 
scene::IMeshBuffer * cloneMeshBuffer (scene::IMeshBuffer *mesh_buffer)
 
scene::SMesh * cloneMesh (scene::IMesh *src_mesh)
 
scene::IMesh * convertNodeboxesToMesh (const std::vector< aabb3f > &boxes, const f32 *uv_coords, float expand)
 
void setMaterialFilters (video::SMaterialLayer &tex, bool bilinear, bool trilinear, bool anisotropic)
 

Function Documentation

◆ applyFacesShading()

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

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

References applyShadeFactor().

Referenced by MeshCollector::append(), MapblockMeshGenerator::blendLightColor(), colorizeMeshBuffer(), MapblockMeshGenerator::drawAutoLightedCuboid(), MapblockMeshGenerator::drawQuad(), and MapblockMeshGenerator::drawSolidNode().

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

◆ applyShadeFactor()

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

Referenced by applyFacesShading().

+ Here is the caller graph for this function:

◆ applyToMesh()

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

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

+ Here is the caller graph for this function:

◆ checkMeshNormals()

bool checkMeshNormals ( scene::IMesh * mesh)

Referenced by GenericCAO::addToScene().

+ Here is the caller graph for this function:

◆ cloneMesh()

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

References cloneMeshBuffer().

Referenced by MapblockMeshGenerator::drawMeshNode(), getExtrudedMesh(), getItemMesh(), WieldMeshSceneNode::setCube(), and WieldMeshSceneNode::setExtruded().

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

◆ cloneMeshBuffer()

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

References sanity_check.

Referenced by cloneMesh(), getExtrudedMesh(), postProcessNodeMesh(), and WieldMeshSceneNode::setExtruded().

+ Here is the caller graph for this function:

◆ colorizeMeshBuffer()

void colorizeMeshBuffer ( scene::IMeshBuffer * buf,
const video::SColor * buffercolor )

Overwrites the color of a mesh buffer. The color is darkened based on the normal vector of the vertices.

References applyFacesShading().

Referenced by 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,
float expand )

References BS.

Referenced by Hud::updateSelectionMesh().

+ Here is the caller graph for this function:

◆ createCubeMesh()

scene::IAnimatedMesh * createCubeMesh ( v3f scale)

References scaleMesh().

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

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

◆ recalculateBoundingBox()

void recalculateBoundingBox ( scene::IMesh * src_mesh)

Referenced by MapblockMeshGenerator::drawMeshNode().

+ Here is the caller graph for this function:

◆ rotateMesh()

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

References applyToMesh().

Referenced by 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,
int facedir )

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

Referenced by MapblockMeshGenerator::drawMeshNode().

+ 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().

Referenced by rotateMeshBy6dFacedir().

+ 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().

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

+ 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().

Referenced by getItemMesh(), and rotateMeshBy6dFacedir().

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

◆ scaleMesh()

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

Referenced by createCubeMesh(), createExtrusionMesh(), getExtrudedMesh(), and getItemMesh().

+ Here is the caller graph for this function:

◆ setMaterialFilters()

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

Referenced by ClientMap::renderMap(), WieldMeshSceneNode::setExtruded(), WieldMeshSceneNode::setItem(), and GenericCAO::updateTextures().

+ Here is the caller graph for this function:

◆ setMeshBufferColor()

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

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

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

+ Here is the caller graph for this function:

◆ setMeshColor()

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

References setMeshBufferColor().

Referenced by GenericCAO::addToScene(), Hud::drawSelectionMesh(), 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,
const v3f & normal,
const video::SColor & color )

References applyToMesh().

Referenced by Hud::drawSelectionMesh().

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

◆ setMeshColorByNormalXYZ()

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

References applyToMesh().

+ Here is the call graph for this function:

◆ translateMesh()

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

Referenced by getItemMesh().

+ Here is the caller graph for this function: