summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-04-03 19:50:54 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-04-03 19:50:54 +0300
commite0f7bd4d57bf0c9b497c4d0bb73f7bd4d5cc0643 (patch)
tree756f4451eac9a1446a4b1acd8f5cda3f625eabb3 /src/mapblock.h
parent01c2b003e1efb839ad246eb939af7fa8336b9ad5 (diff)
downloadminetest-e0f7bd4d57bf0c9b497c4d0bb73f7bd4d5cc0643.tar.gz
minetest-e0f7bd4d57bf0c9b497c4d0bb73f7bd4d5cc0643.tar.bz2
minetest-e0f7bd4d57bf0c9b497c4d0bb73f7bd4d5cc0643.zip
Modified block mesh generation to have clearer input and output. Instead of being a messy object oriented cludge, it now is a messy cludge with separate parameters.
Diffstat (limited to 'src/mapblock.h')
-rw-r--r--src/mapblock.h56
1 files changed, 45 insertions, 11 deletions
diff --git a/src/mapblock.h b/src/mapblock.h
index 6af4070bc..1894269bd 100644
--- a/src/mapblock.h
+++ b/src/mapblock.h
@@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "voxel.h"
#include "nodemetadata.h"
+
// Named by looking towards z+
enum{
FACE_BACK=0,
@@ -157,6 +158,23 @@ public:
virtual u16 nodeContainerId() const = 0;
};
+/*
+ Plain functions in mapblock.cpp
+*/
+
+u8 getFaceLight(u32 daynight_ratio, MapNode n, MapNode n2,
+ v3s16 face_dir);
+
+scene::SMesh* makeMapBlockMesh(
+ u32 daynight_ratio,
+ NodeModMap &temp_mods,
+ VoxelManipulator &vmanip,
+ v3s16 blockpos_nodes);
+
+/*
+ MapBlock itself
+*/
+
class MapBlock : public NodeContainer
{
public:
@@ -380,28 +398,35 @@ public:
Graphics-related methods
*/
- // A quick version with nodes passed as parameters
+ /*// A quick version with nodes passed as parameters
u8 getFaceLight(u32 daynight_ratio, MapNode n, MapNode n2,
- v3s16 face_dir);
- // A more convenient version
+ v3s16 face_dir);*/
+ /*// A more convenient version
u8 getFaceLight(u32 daynight_ratio, v3s16 p, v3s16 face_dir)
{
return getFaceLight(daynight_ratio,
getNodeParentNoEx(p),
getNodeParentNoEx(p + face_dir),
face_dir);
+ }*/
+ u8 getFaceLight2(u32 daynight_ratio, v3s16 p, v3s16 face_dir)
+ {
+ return getFaceLight(daynight_ratio,
+ getNodeParentNoEx(p),
+ getNodeParentNoEx(p + face_dir),
+ face_dir);
}
#ifndef SERVER
// light = 0...255
- static void makeFastFace(TileSpec tile, u8 light, v3f p,
+ /*static void makeFastFace(TileSpec tile, u8 light, v3f p,
v3s16 dir, v3f scale, v3f posRelative_f,
- core::array<FastFace> &dest);
+ core::array<FastFace> &dest);*/
- TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir,
- NodeModMap &temp_mods);
- u8 getNodeContent(v3s16 p, MapNode mn,
- NodeModMap &temp_mods);
+ /*TileSpec getNodeTile(MapNode mn, v3s16 p, v3s16 face_dir,
+ NodeModMap &temp_mods);*/
+ /*u8 getNodeContent(v3s16 p, MapNode mn,
+ NodeModMap &temp_mods);*/
/*
Generates the FastFaces of a node row. This has a
@@ -411,7 +436,7 @@ public:
translate_dir: unit vector with only one of x, y or z
face_dir: unit vector with only one of x, y or z
*/
- void updateFastFaceRow(
+ /*void updateFastFaceRow(
u32 daynight_ratio,
v3f posRelative_f,
v3s16 startpos,
@@ -421,12 +446,16 @@ public:
v3s16 face_dir,
v3f face_dir_f,
core::array<FastFace> &dest,
- NodeModMap &temp_mods);
+ NodeModMap &temp_mods);*/
/*
Thread-safely updates the whole mesh of the mapblock.
*/
+#if 1
void updateMesh(u32 daynight_ratio);
+#endif
+
+ void replaceMesh(scene::SMesh *mesh_new);
#endif // !SERVER
@@ -545,6 +574,11 @@ public:
return m_temp_mods.clear();
}
+ void copyTempMods(NodeModMap &dst)
+ {
+ JMutexAutoLock lock(m_temp_mods_mutex);
+ m_temp_mods.copy(dst);
+ }
#endif
/*