Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
wieldmesh.cpp File Reference
#include "wieldmesh.h"
#include "settings.h"
#include "shader.h"
#include "inventory.h"
#include "client.h"
#include "itemdef.h"
#include "nodedef.h"
#include "mesh.h"
#include "content_mapblock.h"
#include "mapblock_mesh.h"
#include "client/meshgen/collector.h"
#include "client/tile.h"
#include "client/texturesource.h"
#include "log.h"
#include "util/numeric.h"
#include <map>
#include <IMeshManipulator.h>
#include "client/renderingengine.h"
+ Include dependency graph for wieldmesh.cpp:

Classes

class  ExtrusionMeshCache
 

Macros

#define WIELD_SCALE_FACTOR   30.0
 
#define WIELD_SCALE_FACTOR_EXTRUDED   40.0
 
#define MIN_EXTRUSION_MESH_RESOLUTION   16
 
#define MAX_EXTRUSION_MESH_RESOLUTION   512
 

Functions

static scene::IMesh * createExtrusionMesh (int resolution_x, int resolution_y)
 
static scene::SMesh * createSpecialNodeMesh (Client *client, MapNode n, std::vector< ItemPartColor > *colors, const ContentFeatures &f)
 
void getItemMesh (Client *client, const ItemStack &item, ItemMesh *result)
 
scene::SMesh * getExtrudedMesh (ITextureSource *tsrc, const std::string &imagename, const std::string &overlay_name)
 
void postProcessNodeMesh (scene::SMesh *mesh, const ContentFeatures &f, bool use_shaders, bool set_material, const video::E_MATERIAL_TYPE *mattype, std::vector< ItemPartColor > *colors, bool apply_scale)
 

Variables

static ExtrusionMeshCacheg_extrusion_mesh_cache = nullptr
 

Macro Definition Documentation

◆ MAX_EXTRUSION_MESH_RESOLUTION

#define MAX_EXTRUSION_MESH_RESOLUTION   512

◆ MIN_EXTRUSION_MESH_RESOLUTION

#define MIN_EXTRUSION_MESH_RESOLUTION   16

◆ WIELD_SCALE_FACTOR

#define WIELD_SCALE_FACTOR   30.0

◆ WIELD_SCALE_FACTOR_EXTRUDED

#define WIELD_SCALE_FACTOR_EXTRUDED   40.0

Function Documentation

◆ createExtrusionMesh()

static scene::IMesh * createExtrusionMesh ( int resolution_x,
int resolution_y )
static

References scaleMesh().

Referenced by ExtrusionMeshCache::ExtrusionMeshCache(), and ExtrusionMeshCache::create().

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

◆ createSpecialNodeMesh()

static scene::SMesh * createSpecialNodeMesh ( Client * client,
MapNode n,
std::vector< ItemPartColor > * colors,
const ContentFeatures & f )
static

References BS, CPT2_COLORED_WALLMOUNTED, CPT2_WALLMOUNTED, ContentFeatures::drawtype, MapNode::getContent(), MapNode::getParam2(), MATERIAL_FLAG_ANIMATION, NDT_MESH, NDT_NODEBOX, NDT_SIGNLIKE, NDT_TORCHLIKE, p(), ContentFeatures::param_type_2, MeshCollector::prebuffers, MapblockMeshGenerator::renderSingle(), MapNode::setParam2(), MeshMakeData::setSmoothLighting(), and FrameSpec::texture.

Referenced by getItemMesh(), and WieldMeshSceneNode::setItem().

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

◆ getExtrudedMesh()

scene::SMesh * getExtrudedMesh ( ITextureSource * tsrc,
const std::string & imagename,
const std::string & overlay_name )

References cloneMesh(), cloneMeshBuffer(), ExtrusionMeshCache::create(), g_extrusion_mesh_cache, ITextureSource::getTexture(), ITextureSource::getTextureForMesh(), and scaleMesh().

Referenced by getItemMesh().

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

◆ getItemMesh()

◆ postProcessNodeMesh()

void postProcessNodeMesh ( scene::SMesh * mesh,
const ContentFeatures & f,
bool use_shaders,
bool set_material,
const video::E_MATERIAL_TYPE * mattype,
std::vector< ItemPartColor > * colors,
bool apply_scale = false )

Applies overlays, textures and optionally materials to the given mesh and extracts tile colors for colorization.

Parameters
mattypeoverrides the buffer's material type, but can also be NULL to leave the original material.
colorsreturns the colors of the mesh buffers in the mesh.

References TileLayer::animation_frame_count, TileLayer::applyMaterialOptions(), cloneMeshBuffer(), TileLayer::color, TileLayer::frames, TileLayer::has_color, TileSpec::layers, MAX_TILE_LAYERS, TileLayer::scale, FrameSpec::texture, TileLayer::texture, TileLayer::texture_id, and TileSpec::world_aligned.

Referenced by getItemMesh(), and WieldMeshSceneNode::setCube().

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

Variable Documentation

◆ g_extrusion_mesh_cache