From a62d96ad0521b064e6ef61a6f80888e27966502b Mon Sep 17 00:00:00 2001 From: Andy Belle-Isle Date: Tue, 1 Oct 2019 02:01:20 -0400 Subject: Started texture based world definitions --- src/world.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/world.cpp') 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(); @@ -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 * -- cgit v1.2.3