#include "wieldmesh.h"#include "settings.h"#include "shader.h"#include "inventory.h"#include "client.h"#include "itemdef.h"#include "node_visuals.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 "util/numeric.h"#include <map>#include <IMeshManipulator.h>#include "client/renderingengine.h"#include <SMesh.h>#include <IMeshBuffer.h>#include <CMeshBuffer.h>#include "item_visuals_manager.h"
Include dependency graph for wieldmesh.cpp:Classes | |
| class | ExtrusionMeshCache |
Macros | |
| #define | WIELD_SCALE_FACTOR 30.0f |
| #define | WIELD_SCALE_FACTOR_EXTRUDED 40.0f |
| #define | MIN_EXTRUSION_MESH_RESOLUTION 16 |
| #define | MAX_EXTRUSION_MESH_RESOLUTION 512 |
Functions | |
| static scene::IMesh * | createExtrusionMesh (int resolution_x, int resolution_y) |
| static video::ITexture * | extractTexture (const TileDef &def, const TileLayer &layer, ITextureSource *tsrc) |
| void | getAdHocNodeShader (video::SMaterial &mat, IShaderSource *shdsrc, const char *shader, AlphaMode mode, int layer) |
| Replace the material's shader with a custom one while respecting the usual things expected of node rendering (texture type, alpha mode, overlay). | |
| static scene::SMesh * | createGenericNodeMesh (Client *client, MapNode n, std::vector< ItemMeshBufferInfo > *buffer_info, const ContentFeatures &f) |
| std::vector< FrameSpec > | createAnimationFrames (ITextureSource *tsrc, const std::string &image_name, const TileAnimationParams &animation, int &result_frame_length_ms) |
| void | createItemMesh (Client *client, const ItemDefinition &def, const AnimationInfo &animation_normal, const AnimationInfo &animation_overlay, ItemMesh *result) |
| NOTE: The item mesh is only suitable for inventory rendering (due to its material types). | |
| scene::SMesh * | getExtrudedMesh (video::ITexture *texture, video::ITexture *overlay_texture) |
Variables | |
| static ExtrusionMeshCache * | g_extrusion_mesh_cache = nullptr |
| #define MAX_EXTRUSION_MESH_RESOLUTION 512 |
Referenced by ExtrusionMeshCache::ExtrusionMeshCache(), and ExtrusionMeshCache::create().
| #define MIN_EXTRUSION_MESH_RESOLUTION 16 |
Referenced by ExtrusionMeshCache::ExtrusionMeshCache().
| #define WIELD_SCALE_FACTOR 30.0f |
Referenced by WieldMeshSceneNode::setItem().
| #define WIELD_SCALE_FACTOR_EXTRUDED 40.0f |
Referenced by WieldMeshSceneNode::setExtruded().
| std::vector< FrameSpec > createAnimationFrames | ( | ITextureSource * | tsrc, |
| const std::string & | image_name, | ||
| const TileAnimationParams & | animation, | ||
| int & | result_frame_length_ms ) |
References TileAnimationParams::determineParams(), ITextureSource::getTextureDimensions(), ITextureSource::getTextureForMesh(), TileAnimationParams::getTextureModifer(), TAT_NONE, and TileAnimationParams::type.
Referenced by ItemVisualsManager::createItemVisuals(), fillTileAttribs(), and WieldMeshSceneNode::setItem().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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:
|
static |
References CPT2_COLORED_WALLMOUNTED, CPT2_WALLMOUNTED, ContentFeatures::drawtype, MeshMakeData::fillSingleNode(), MapblockMeshGenerator::generate(), MapNode::getParam2(), MAX_TILE_LAYERS, NDT_MESH, NDT_NODEBOX, NDT_SIGNLIKE, NDT_TORCHLIKE, p(), ContentFeatures::param_type_2, MeshCollector::prebuffers, MapNode::setParam1(), and MapNode::setParam2().
Referenced by createItemMesh(), and WieldMeshSceneNode::setItem().
Here is the call graph for this function:
Here is the caller graph for this function:| void createItemMesh | ( | Client * | client, |
| const ItemDefinition & | def, | ||
| const AnimationInfo & | animation_normal, | ||
| const AnimationInfo & | animation_overlay, | ||
| ItemMesh * | result ) |
NOTE: The item mesh is only suitable for inventory rendering (due to its material types).
In-world rendering of items must go through WieldMeshSceneNode.
References ContentFeatures::alpha, ItemMesh::buffer_info, createGenericNodeMesh(), ContentFeatures::drawtype, extractTexture(), FATAL_ERROR_IF, g_extrusion_mesh_cache, NodeDefManager::get(), getAdHocNodeShader(), getExtrudedMesh(), NodeDefManager::getId(), AnimationInfo::getTexture(), ITextureSource::getTexture(), ITEM_NODE, TileSpec::layers, ItemMesh::mesh, ItemDefinition::name, NDT_AIRLIKE, NDT_PLANTLIKE, NDT_PLANTLIKE_ROOTED, ItemMesh::needs_shading, ItemDefinition::place_param2, rotateMeshXZby(), rotateMeshYZby(), scaleMesh(), MapNode::setParam2(), NodeVisuals::special_tiles, ContentFeatures::tiledef, ContentFeatures::tiledef_special, NodeVisuals::tiles, and ItemDefinition::type.
Referenced by ItemVisualsManager::createItemVisuals().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
References TileLayer::empty(), TileLayer::frames, ITextureSource::getTextureForMesh(), MATERIAL_FLAG_ANIMATION, TileLayer::material_flags, and TileDef::name.
Referenced by createItemMesh().
Here is the call graph for this function:
Here is the caller graph for this function:| void getAdHocNodeShader | ( | video::SMaterial & | mat, |
| IShaderSource * | shdsrc, | ||
| const char * | shader, | ||
| AlphaMode | mode, | ||
| int | layer ) |
Replace the material's shader with a custom one while respecting the usual things expected of node rendering (texture type, alpha mode, overlay).
Call this after TileLayer::applyMaterialOptions.
| mat | material to modify |
| shdsrc | shader source |
| shader | name of shader |
| mode | alpha mode from nodedef |
| layer | index of this layer |
References alpha_mode_to_material_type(), IShaderSource::getShader(), IShaderSource::getShaderInfo(), ShaderInfo::material, material_type_with_alpha(), and NDT_NORMAL.
Referenced by createItemMesh(), generateNodeMesh(), and WieldMeshSceneNode::setItem().
Here is the call graph for this function:
Here is the caller graph for this function:| scene::SMesh * getExtrudedMesh | ( | video::ITexture * | texture, |
| video::ITexture * | overlay_texture ) |
References cloneMeshBuffer(), cloneStaticMesh(), ExtrusionMeshCache::create(), g_extrusion_mesh_cache, and scaleMesh().
Referenced by createItemMesh().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |