aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.cpp')
-rw-r--r--src/world.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/world.cpp b/src/world.cpp
index cd89a22..8cfd906 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -134,6 +134,8 @@ World::getSize()
void World::generateMesh()
{
//const unsigned int voxelLength = 6; // 2 triangles @ 3 points each
+ if (!data.size())
+ return;
// Preallocate size of vertexes
mesh = std::basic_string<WorldMeshData>();
@@ -221,6 +223,29 @@ double World::getHeight(double x, double y, double z)
return Y;
}
+/*********
+* NEW *
+*********/
+void World::registerLayer(float z, sol::object obj)
+{
+ if (obj.get_type() == sol::type::table) {
+ sol::table tab = obj;
+ solidLayers.push_back(SolidLayer(z, tab));
+ } else {
+ throw std::string("Layer must receive a table");
+ }
+}
+
+void World::registerDecoLayer(float z, sol::object obj)
+{
+ if (obj.get_type() == sol::type::table) {
+ sol::table tab = obj;
+ drawLayers.push_back(Layer(z, tab));
+ } else {
+ throw std::string("Layer must receive a table");
+ }
+}
+
/******************
* WORLD SYSTEM *