diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/client/mapblock_mesh.h | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/client/mapblock_mesh.h')
-rw-r--r-- | src/client/mapblock_mesh.h | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/src/client/mapblock_mesh.h b/src/client/mapblock_mesh.h index dd08433a1..6af23a656 100644 --- a/src/client/mapblock_mesh.h +++ b/src/client/mapblock_mesh.h @@ -32,21 +32,23 @@ class IShaderSource; Mesh making stuff */ + class MapBlock; struct MinimapMapblock; struct MeshMakeData { VoxelManipulator m_vmanip; - v3s16 m_blockpos = v3s16(-1337, -1337, -1337); - v3s16 m_crack_pos_relative = v3s16(-1337, -1337, -1337); + v3s16 m_blockpos = v3s16(-1337,-1337,-1337); + v3s16 m_crack_pos_relative = v3s16(-1337,-1337,-1337); bool m_smooth_lighting = false; Client *m_client; bool m_use_shaders; bool m_use_tangent_vertices; - MeshMakeData(Client *client, bool use_shaders, bool use_tangent_vertices = false); + MeshMakeData(Client *client, bool use_shaders, + bool use_tangent_vertices = false); /* Copy block data manually (to allow optimizations by the caller) @@ -102,9 +104,15 @@ public: // Returns true if anything has been changed. bool animate(bool faraway, float time, int crack, u32 daynight_ratio); - scene::IMesh *getMesh() { return m_mesh[0]; } + scene::IMesh *getMesh() + { + return m_mesh[0]; + } - scene::IMesh *getMesh(u8 layer) { return m_mesh[layer]; } + scene::IMesh *getMesh(u8 layer) + { + return m_mesh[layer]; + } MinimapMapblock *moveMinimapMapblock() { @@ -113,11 +121,14 @@ public: return p; } - bool isAnimationForced() const { return m_animation_force_timer == 0; } + bool isAnimationForced() const + { + return m_animation_force_timer == 0; + } void decreaseAnimationForceTimer() { - if (m_animation_force_timer > 0) + if(m_animation_force_timer > 0) m_animation_force_timer--; } @@ -156,7 +167,7 @@ private: // For each mesh and mesh buffer, stores pre-baked colors // of sunlit vertices // Keys are pairs of (mesh index, buffer index in the mesh) - std::map<std::pair<u8, u32>, std::map<u32, video::SColor>> m_daynight_diffs; + std::map<std::pair<u8, u32>, std::map<u32, video::SColor > > m_daynight_diffs; // Camera offset info -> do we have to translate the mesh? v3s16 m_camera_offset; @@ -178,10 +189,9 @@ video::SColor encode_light(u16 light, u8 emissive_light); // Compute light at node u16 getInteriorLight(MapNode n, s32 increment, const NodeDefManager *ndef); -u16 getFaceLight( - MapNode n, MapNode n2, const v3s16 &face_dir, const NodeDefManager *ndef); -u16 getSmoothLightSolid(const v3s16 &p, const v3s16 &face_dir, const v3s16 &corner, - MeshMakeData *data); +u16 getFaceLight(MapNode n, MapNode n2, const v3s16 &face_dir, + const NodeDefManager *ndef); +u16 getSmoothLightSolid(const v3s16 &p, const v3s16 &face_dir, const v3s16 &corner, MeshMakeData *data); u16 getSmoothLightTransparent(const v3s16 &p, const v3s16 &corner, MeshMakeData *data); /*! @@ -197,7 +207,8 @@ void get_sunlight_color(video::SColorf *sunlight, u32 daynight_ratio); * \param light first 8 bits are day light, second 8 bits are * night light */ -void final_color_blend(video::SColor *result, u16 light, u32 daynight_ratio); +void final_color_blend(video::SColor *result, + u16 light, u32 daynight_ratio); /*! * Gives the final SColor shown on screen. @@ -206,14 +217,12 @@ void final_color_blend(video::SColor *result, u16 light, u32 daynight_ratio); * \param data the half-baked vertex color * \param dayLight color of the sunlight */ -void final_color_blend(video::SColor *result, const video::SColor &data, - const video::SColorf &dayLight); +void final_color_blend(video::SColor *result, + const video::SColor &data, const video::SColorf &dayLight); // Retrieves the TileSpec of a face of a node // Adds MATERIAL_FLAG_CRACK if the node is cracked // TileSpec should be passed as reference due to the underlying TileFrame and its vector // TileFrame vector copy cost very much to client -void getNodeTileN(MapNode mn, const v3s16 &p, u8 tileindex, MeshMakeData *data, - TileSpec &tile); -void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *data, - TileSpec &tile); +void getNodeTileN(MapNode mn, const v3s16 &p, u8 tileindex, MeshMakeData *data, TileSpec &tile); +void getNodeTile(MapNode mn, const v3s16 &p, const v3s16 &dir, MeshMakeData *data, TileSpec &tile); |