X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Fmapblock_mesh.h;h=7f52317383a02435930a98983e7525299f7667c4;hb=dec8c43de3afdbd2e257a031f5e053e7f1e74aa0;hp=82268efd2948ad8e836dca639e34e06b343a6e74;hpb=9f031a67594162a53b07acbfbc65faf8c4938e99;p=oweals%2Fminetest.git diff --git a/src/mapblock_mesh.h b/src/mapblock_mesh.h index 82268efd2..7f5231738 100644 --- a/src/mapblock_mesh.h +++ b/src/mapblock_mesh.h @@ -1,6 +1,6 @@ /* -Minetest-c55 -Copyright (C) 2010-2011 celeron55, Perttu Ahola +Minetest +Copyright (C) 2010-2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -81,7 +81,7 @@ class MapBlockMesh { public: // Builds the mesh given - MapBlockMesh(MeshMakeData *data); + MapBlockMesh(MeshMakeData *data, v3s16 camera_offset); ~MapBlockMesh(); // Main animation function, parameters: @@ -107,6 +107,8 @@ public: if(m_animation_force_timer > 0) m_animation_force_timer--; } + + void updateCameraOffset(v3s16 camera_offset); private: scene::SMesh *m_mesh; @@ -133,6 +135,9 @@ private: u32 m_last_daynight_ratio; // For each meshbuffer, maps vertex indices to (day,night) pairs std::map > > m_daynight_diffs; + + // Camera offset info -> do we have to translate the mesh? + v3s16 m_camera_offset; }; @@ -143,13 +148,13 @@ private: struct PreMeshBuffer { TileSpec tile; - core::array indices; - core::array vertices; + std::vector indices; + std::vector vertices; }; struct MeshCollector { - core::array prebuffers; + std::vector prebuffers; void append(const TileSpec &material, const video::S3DVertex *vertices, u32 numVertices, @@ -160,14 +165,15 @@ struct MeshCollector // alpha in the A channel of the returned SColor // day light (0-255) in the R channel of the returned SColor // night light (0-255) in the G channel of the returned SColor -inline video::SColor MapBlock_LightColor(u8 alpha, u16 light) +// light source (0-255) in the B channel of the returned SColor +inline video::SColor MapBlock_LightColor(u8 alpha, u16 light, u8 light_source=0) { - return video::SColor(alpha, (light & 0xff), (light >> 8), 0); + return video::SColor(alpha, (light & 0xff), (light >> 8), light_source); } // Compute light at node -u16 getInteriorLight(MapNode n, s32 increment, MeshMakeData *data); -u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, MeshMakeData *data); +u16 getInteriorLight(MapNode n, s32 increment, INodeDefManager *ndef); +u16 getFaceLight(MapNode n, MapNode n2, v3s16 face_dir, INodeDefManager *ndef); u16 getSmoothLight(v3s16 p, v3s16 corner, MeshMakeData *data); // Retrieves the TileSpec of a face of a node