summaryrefslogtreecommitdiff
path: root/model.h
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-07-01 17:20:53 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-07-02 18:10:14 +0200
commit75a90df8bf7f38e746e021c23248e1607931132c (patch)
treedf2b4f48d5157f775c719192484188a2b0b8a04a /model.h
parent90d570822f85f70c31f80789ad6791cebd904468 (diff)
Import and render tree models.
Trees are loaded from the new trees.blend using assimp. Tree objects are then received from the server and rendered on the given terrain locations. Each chunk now holds a list of objects and coordinates, which can be used to easily add other models as well. Also moded the GLSL fog code to its own shader which can be linked in different programs.
Diffstat (limited to 'model.h')
-rw-r--r--model.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/model.h b/model.h
new file mode 100644
index 0000000..7659d9c
--- /dev/null
+++ b/model.h
@@ -0,0 +1,50 @@
+#ifndef MODEL_H
+#define MODEL_H
+
+#include "gl.h"
+
+#include <assimp/assimp.hpp>
+#include <assimp/aiScene.h>
+
+#include <map>
+#include <string>
+#include <vector>
+
+namespace models {
+
+class Mesh {
+ private:
+ GLuint vbo;
+ GLuint vertices;
+
+ public:
+ Mesh(const aiScene *scene, const aiMesh *mesh, std::map<std::string, GLuint>& scene_textures);
+ virtual ~Mesh();
+
+ void render();
+
+ std::vector<GLuint> textures;
+};
+
+class Model {
+ public:
+ virtual ~Model() {};
+
+ virtual void render() = 0;
+};
+
+class Tree : public Model {
+ private:
+ Mesh *trunk;
+ Mesh *leaves;
+
+ public:
+ Tree(const aiScene *scene, std::map<std::string, GLuint>& scene_textures);
+ virtual ~Tree();
+
+ virtual void render();
+};
+
+}
+
+#endif