aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.cpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-10-01 02:01:20 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-10-01 02:01:20 -0400
commita62d96ad0521b064e6ef61a6f80888e27966502b (patch)
treed56045d4330314d608c39b5b1f304a4b99f17975 /src/world.cpp
parent5cceca5ec696e6626cea0ec07f9db1b28bb3b875 (diff)
Started texture based world definitions
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 *