aboutsummaryrefslogtreecommitdiffstats
path: root/src/world.hpp
diff options
context:
space:
mode:
authorAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-14 00:30:05 -0400
committerAndy Belle-Isle <drumsetmonkey@gmail.com>2019-09-14 00:30:05 -0400
commit0e19992b820158f8e9c0fc16ddc372a5ea596f53 (patch)
tree222d9256992f0107db694a8246aed471b1d7301b /src/world.hpp
parentc89b9aad8eadb3bfebaf4e6ae65ee6650e313fc7 (diff)
Lua can now modify world size and world data
Diffstat (limited to 'src/world.hpp')
-rw-r--r--src/world.hpp37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/world.hpp b/src/world.hpp
index cb9995e..7a7461f 100644
--- a/src/world.hpp
+++ b/src/world.hpp
@@ -44,7 +44,6 @@ struct WorldMaterial
std::string nor = tab["normal"];
normal = Texture(nor);
}
-
if (tab["passable"] == sol::type::boolean) {
passable = tab["passable"];
}
@@ -57,12 +56,20 @@ private:
unsigned int seed;
unsigned int layers;
+ unsigned int height;
+ unsigned int width;
+
std::vector<std::vector<std::vector<unsigned int>>> data;
std::unordered_map<std::string, unsigned int> string_registry;
std::vector<WorldMaterial> registry;
+ std::vector<float> mesh;
public:
+ /* VARS */
+ sol::function generate;
+ sol::function registerMat;
+
World() {}
World(sol::object ref);
~World() {
@@ -72,26 +79,24 @@ public:
data.clear();
}
- sol::function generate;
- sol::function registerMat;
-
/* SEED */
- unsigned int getSeed() {return seed;}
- void setSeed(unsigned int s) {seed = s;}
-
- /* LAYERS */
- unsigned int getLayers() {return layers;}
- // If we change the amount of layers, we have to regenerate the world
- void setLayers(unsigned int l) {
- layers = l;
- generate();
- }
+ unsigned int getSeed();
+ unsigned int setSeed(unsigned int);
+
+ /* REGISTRY */
+ void registerMaterial(std::string, sol::object);
/* DATA */
void setData(unsigned int, unsigned int, unsigned int, std::string);
- /* REGISTRY */
- void registerMaterial(std::string, sol::object);
+ /* SIZE */
+ std::tuple<unsigned int, unsigned int, unsigned int> setSize(unsigned int,
+ unsigned int,
+ unsigned int);
+ std::tuple<unsigned int, unsigned int, unsigned int> getSize();
+
+ /* RENDERING */
+ void generateMesh();
};
/**