14#include <unordered_map>
75 areaSQ = (v2-v1).crossProduct(v3-v1).getLengthSQ() / 4;
83 return (v2-v1).crossProduct(v3-v1);
120 s32
buildTree(
v3f normal,
v3f origin,
float delta,
const std::vector<s32> &list, u32 depth);
121 void traverse(s32 node,
v3f viewpoint, std::vector<s32> &output)
const;
140 m_indices->Data = std::move(vertex_indices);
141 m_indices->setHardwareMappingHint(scene::EHM_STATIC);
146 void draw(video::IVideoDriver *driver)
const;
177 bool animate(
bool faraway,
float time,
int crack, u32 daynight_ratio);
186 return m_mesh[layer].get();
191 std::vector<MinimapMapblock*> minimap_mapblocks;
193 return minimap_mapblocks;
285video::SColor
encode_light(u16 light, u8 emissive_light);
307 u16 light, u32 daynight_ratio);
317 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:92
std::vector< TreeNode > nodes
Definition mapblock_mesh.h:124
void buildTree(const std::vector< MeshTriangle > *triangles, u16 side_lingth)
Definition mapblock_mesh.cpp:425
const std::vector< MeshTriangle > * triangles
Definition mapblock_mesh.h:123
s32 root
Definition mapblock_mesh.h:125
void traverse(v3f viewpoint, std::vector< s32 > &output) const
Definition mapblock_mesh.h:98
MapBlockBspTree()
Definition mapblock_mesh.h:94
Definition mapblock_mesh.h:165
std::vector< MinimapMapblock * > m_minimap_mapblocks
Definition mapblock_mesh.h:231
~MapBlockMesh()
Definition mapblock_mesh.cpp:778
void updateTransparentBuffers(v3f camera_pos, v3s16 block_pos)
update transparent buffers to render towards the camera
Definition mapblock_mesh.cpp:868
MapBlockMesh(Client *client, MeshMakeData *data, v3s16 camera_offset)
Definition mapblock_mesh.cpp:592
u32 m_last_daynight_ratio
Definition mapblock_mesh.h:257
f32 getBoundingRadius() const
Radius of the bounding-sphere, in BS-space.
Definition mapblock_mesh.h:208
bool isAnimationForced() const
Definition mapblock_mesh.h:196
const std::vector< PartialMeshBuffer > & getTransparentBuffers() const
get the list of transparent buffers
Definition mapblock_mesh.h:218
bool m_enable_shaders
Definition mapblock_mesh.h:238
v3f getBoundingSphereCenter() const
Center of the bounding-sphere, in BS-space, relative to block pos.
Definition mapblock_mesh.h:211
int m_animation_force_timer
Definition mapblock_mesh.h:242
std::map< std::pair< u8, u32 >, std::string > m_crack_materials
Definition mapblock_mesh.h:248
MapBlockBspTree m_bsp_tree
Definition mapblock_mesh.h:266
std::vector< MinimapMapblock * > moveMinimapMapblocks()
Definition mapblock_mesh.h:189
void consolidateTransparentBuffers()
Definition mapblock_mesh.cpp:904
f32 m_bounding_radius
Definition mapblock_mesh.h:235
scene::IMesh * getMesh()
Definition mapblock_mesh.h:179
bool animate(bool faraway, float time, int crack, u32 daynight_ratio)
Definition mapblock_mesh.cpp:792
void decreaseAnimationForceTimer()
Definition mapblock_mesh.h:201
std::map< std::pair< u8, u32 >, std::map< u32, video::SColor > > m_daynight_diffs
Definition mapblock_mesh.h:261
std::vector< MeshTriangle > m_transparent_triangles
Definition mapblock_mesh.h:264
irr_ptr< scene::IMesh > m_mesh[MAX_TILE_LAYERS]
Definition mapblock_mesh.h:230
bool m_transparent_buffers_consolidated
Definition mapblock_mesh.h:270
IShaderSource * m_shdrsrc
Definition mapblock_mesh.h:233
ITextureSource * m_tsrc
Definition mapblock_mesh.h:232
int m_last_crack
Definition mapblock_mesh.h:246
bool m_has_animation
Definition mapblock_mesh.h:241
scene::IMesh * getMesh(u8 layer)
Definition mapblock_mesh.h:184
std::map< std::pair< u8, u32 >, AnimationInfo > m_animation_info
Definition mapblock_mesh.h:253
v3f m_bounding_sphere_center
Definition mapblock_mesh.h:236
std::vector< PartialMeshBuffer > m_transparent_buffers
Definition mapblock_mesh.h:268
Definition mapblock_mesh.h:61
scene::SMeshBuffer * buffer
Definition mapblock_mesh.h:63
u16 p3
Definition mapblock_mesh.h:64
float areaSQ
Definition mapblock_mesh.h:66
v3f getNormal() const
Definition mapblock_mesh.h:78
u16 p2
Definition mapblock_mesh.h:64
v3f centroid
Definition mapblock_mesh.h:65
void updateAttributes()
Definition mapblock_mesh.h:68
u16 p1
Definition mapblock_mesh.h:64
This class is for getting the actual properties of nodes from their content ID.
Definition nodedef.h:541
Definition mapblock_mesh.h:135
void draw(video::IVideoDriver *driver) const
Definition mapblock_mesh.cpp:581
irr_ptr< scene::SIndexBuffer > m_indices
Definition mapblock_mesh.h:150
scene::SMeshBuffer * m_buffer
Definition mapblock_mesh.h:149
PartialMeshBuffer(scene::SMeshBuffer *buffer, std::vector< u16 > &&vertex_indices)
Definition mapblock_mesh.h:137
auto * getBuffer() const
Definition mapblock_mesh.h:144
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:321
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:962
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:278
video::SColor encode_light(u16 light, u8 emissive_light)
Definition mapblock_mesh.cpp:934
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:341
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:106
v3f normal
Definition mapblock_mesh.h:107
std::vector< s32 > triangle_refs
Definition mapblock_mesh.h:109
v3f origin
Definition mapblock_mesh.h:108
s32 front_ref
Definition mapblock_mesh.h:110
s32 back_ref
Definition mapblock_mesh.h:111
TreeNode(v3f normal, v3f origin, const std::vector< s32 > &triangle_refs, s32 front_ref, s32 back_ref)
Definition mapblock_mesh.h:114
Definition mapblock_mesh.h:224
int frame_offset
Definition mapblock_mesh.h:226
TileLayer tile
Definition mapblock_mesh.h:227
int frame
Definition mapblock_mesh.h:225
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
bool m_use_shaders
Definition mapblock_mesh.h:38
MeshMakeData(const NodeDefManager *ndef, u16 side_length, bool use_shaders)
Definition mapblock_mesh.cpp:28
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
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