14#include <unordered_map>
74 areaSQ = (v2-v1).crossProduct(v3-v1).getLengthSQ() / 4;
82 return (v2-v1).crossProduct(v3-v1);
119 s32
buildTree(
v3f normal,
v3f origin,
float delta,
const std::vector<s32> &list, u32 depth);
120 void traverse(s32 node,
v3f viewpoint, std::vector<s32> &output)
const;
139 m_indices->Data = std::move(vertex_indices);
140 m_indices->setHardwareMappingHint(scene::EHM_STATIC);
145 void draw(video::IVideoDriver *driver)
const;
176 bool animate(
bool faraway,
float time,
int crack, u32 daynight_ratio);
185 return m_mesh[layer].get();
190 std::vector<MinimapMapblock*> minimap_mapblocks;
192 return minimap_mapblocks;
280video::SColor
encode_light(u16 light, u8 emissive_light);
302 u16 light, u32 daynight_ratio);
312 const video::SColor &data,
const video::SColorf &dayLight);
static v2f dir(const v2f &pos_dist)
Definition camera.cpp:191
Definition texturesource.h:36
Implements a binary space partitioning tree See also: https://en.wikipedia.org/wiki/Binary_space_part...
Definition mapblock_mesh.h:91
std::vector< TreeNode > nodes
Definition mapblock_mesh.h:123
void buildTree(const std::vector< MeshTriangle > *triangles, u16 side_lingth)
Definition mapblock_mesh.cpp:426
const std::vector< MeshTriangle > * triangles
Definition mapblock_mesh.h:122
s32 root
Definition mapblock_mesh.h:124
void traverse(v3f viewpoint, std::vector< s32 > &output) const
Definition mapblock_mesh.h:97
MapBlockBspTree()
Definition mapblock_mesh.h:93
Definition mapblock_mesh.h:164
std::vector< MinimapMapblock * > m_minimap_mapblocks
Definition mapblock_mesh.h:236
~MapBlockMesh()
Definition mapblock_mesh.cpp:750
MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offset)
Definition mapblock_mesh.cpp:593
f32 getBoundingRadius() const
Radius of the bounding-sphere, in BS-space.
Definition mapblock_mesh.h:207
bool isAnimationForced() const
Definition mapblock_mesh.h:195
const std::vector< PartialMeshBuffer > & getTransparentBuffers() const
get the list of transparent buffers
Definition mapblock_mesh.h:223
v3f getBoundingSphereCenter() const
Center of the bounding-sphere, in BS-space, relative to block pos.
Definition mapblock_mesh.h:210
int m_animation_force_timer
Definition mapblock_mesh.h:245
std::map< std::pair< u8, u32 >, std::string > m_crack_materials
Definition mapblock_mesh.h:251
MapBlockBspTree m_bsp_tree
Definition mapblock_mesh.h:261
std::vector< MinimapMapblock * > moveMinimapMapblocks()
Definition mapblock_mesh.h:188
void consolidateTransparentBuffers()
Definition mapblock_mesh.cpp:891
f32 m_bounding_radius
Definition mapblock_mesh.h:240
scene::IMesh * getMesh()
Definition mapblock_mesh.h:178
bool animate(bool faraway, float time, int crack, u32 daynight_ratio)
Definition mapblock_mesh.cpp:764
void decreaseAnimationForceTimer()
Definition mapblock_mesh.h:200
void updateTransparentBuffers(v3f camera_pos, v3s16 block_pos, bool group_by_buffers)
Update transparent buffers to render towards the camera.
Definition mapblock_mesh.cpp:822
std::vector< MeshTriangle > m_transparent_triangles
Definition mapblock_mesh.h:259
irr_ptr< scene::IMesh > m_mesh[MAX_TILE_LAYERS]
Definition mapblock_mesh.h:235
bool m_transparent_buffers_consolidated
Definition mapblock_mesh.h:265
IShaderSource * m_shdrsrc
Definition mapblock_mesh.h:238
ITextureSource * m_tsrc
Definition mapblock_mesh.h:237
int m_last_crack
Definition mapblock_mesh.h:249
bool m_has_animation
Definition mapblock_mesh.h:244
scene::IMesh * getMesh(u8 layer)
Definition mapblock_mesh.h:183
std::map< std::pair< u8, u32 >, AnimationInfo > m_animation_info
Definition mapblock_mesh.h:256
v3f m_bounding_sphere_center
Definition mapblock_mesh.h:241
std::vector< PartialMeshBuffer > m_transparent_buffers
Definition mapblock_mesh.h:263
Definition mapblock_mesh.h:60
scene::SMeshBuffer * buffer
Definition mapblock_mesh.h:62
u16 p3
Definition mapblock_mesh.h:63
float areaSQ
Definition mapblock_mesh.h:65
v3f getNormal() const
Definition mapblock_mesh.h:77
u16 p2
Definition mapblock_mesh.h:63
v3f centroid
Definition mapblock_mesh.h:64
void updateAttributes()
Definition mapblock_mesh.h:67
u16 p1
Definition mapblock_mesh.h:63
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:540
Definition mapblock_mesh.h:134
void draw(video::IVideoDriver *driver) const
Definition mapblock_mesh.cpp:582
irr_ptr< scene::SIndexBuffer > m_indices
Definition mapblock_mesh.h:149
scene::SMeshBuffer * m_buffer
Definition mapblock_mesh.h:148
PartialMeshBuffer(scene::SMeshBuffer *buffer, std::vector< u16 > &&vertex_indices)
Definition mapblock_mesh.h:136
auto * getBuffer() const
Definition mapblock_mesh.h:143
core::vector3d< s16 > v3s16
Definition irr_v3d.h:13
core::vector3df v3f
Definition irr_v3d.h:11
void getNodeTileN(MapNode mn, const v3s16 &p, u8 tileindex, MeshMakeData *data, TileSpec &tile)
Definition mapblock_mesh.cpp:322
u8 get_solid_sides(MeshMakeData *data)
Return bitset of the sides of the mesh that consist of solid nodes only Bits: 0 0 -Z +Z -X +X -Y +Y.
Definition mapblock_mesh.cpp:949
u16 getSmoothLightTransparent(const v3s16 &p, const v3s16 &corner, MeshMakeData *data)
Definition mapblock_mesh.cpp:252
void final_color_blend(video::SColor *result, u16 light, u32 daynight_ratio)
Definition mapblock_mesh.cpp:279
video::SColor encode_light(u16 light, u8 emissive_light)
Definition mapblock_mesh.cpp:921
u16 getInteriorLight(MapNode n, s32 increment, const NodeDefManager *ndef)
Definition mapblock_mesh.cpp:86
u16 getFaceLight(MapNode n, MapNode n2, const NodeDefManager *ndef)
Definition mapblock_mesh.cpp:122
void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *data, TileSpec &tile)
Definition mapblock_mesh.cpp:342
void get_sunlight_color(video::SColorf *sunlight, u32 daynight_ratio)
Definition mapblock_mesh.cpp:270
u16 getSmoothLightSolid(const v3s16 &p, const v3s16 &face_dir, const v3s16 &corner, MeshMakeData *data)
Definition mapblock_mesh.cpp:242
Definition activeobjectmgr.cpp:11
Definition mapblock_mesh.h:105
v3f normal
Definition mapblock_mesh.h:106
std::vector< s32 > triangle_refs
Definition mapblock_mesh.h:108
v3f origin
Definition mapblock_mesh.h:107
s32 front_ref
Definition mapblock_mesh.h:109
s32 back_ref
Definition mapblock_mesh.h:110
TreeNode(v3f normal, v3f origin, const std::vector< s32 > &triangle_refs, s32 front_ref, s32 back_ref)
Definition mapblock_mesh.h:113
Definition mapblock_mesh.h:229
int frame_offset
Definition mapblock_mesh.h:231
TileLayer tile
Definition mapblock_mesh.h:232
int frame
Definition mapblock_mesh.h:230
Definition mapblock_mesh.h:30
void fillBlockDataBegin(const v3s16 &blockpos)
Definition mapblock_mesh.cpp:34
v3s16 m_crack_pos_relative
Definition mapblock_mesh.h:33
const NodeDefManager * nodedef
Definition mapblock_mesh.h:37
bool m_smooth_lighting
Definition mapblock_mesh.h:34
VoxelManipulator m_vmanip
Definition mapblock_mesh.h:31
void setSmoothLighting(bool smooth_lighting)
Definition mapblock_mesh.cpp:61
void setCrack(int crack_level, v3s16 crack_pos)
Definition mapblock_mesh.cpp:55
MeshMakeData(const NodeDefManager *ndef, u16 side_length)
Definition mapblock_mesh.cpp:29
u16 side_length
Definition mapblock_mesh.h:35
void fillBlockData(const v3s16 &bp, MapNode *data)
Definition mapblock_mesh.cpp:46
v3s16 m_blockpos
Definition mapblock_mesh.h:32
Defines a layer of a tile.
Definition tile.h:56
static std::string p(std::string path)
Definition test_filesys.cpp:53
#define MAX_TILE_LAYERS
Definition tile.h:52