summaryrefslogtreecommitdiff
path: root/scene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene.cpp')
-rw-r--r--scene.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/scene.cpp b/scene.cpp
index 4e884a6..41b5ce8 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -11,6 +11,8 @@
#include <cmath>
+using models::ModelManager;
+
Scene::Scene() {
running = true;
grid = false;
@@ -70,7 +72,8 @@ Scene::Scene() {
marker_texture = load_texture("textures/cross.png");
placeholder_texture = load_texture("textures/placeholder.png");
- tree_scene = ai_importer.ReadFile("models/trees.blend", aiProcess_Triangulate);
+ Assimp::Importer ai_importer;
+ const aiScene *tree_scene = ai_importer.ReadFile("models/trees.blend", aiProcess_Triangulate);
for(unsigned int i = 0; i < tree_scene->mNumTextures; i++) {
aiTexture *texture = tree_scene->mTextures[i];
@@ -79,7 +82,8 @@ Scene::Scene() {
scene_textures.insert(std::pair<std::string, GLuint>(name, tx));
}
- tree = new models::Tree(tree_scene, scene_textures);
+ Model::p tree = Model::p(new models::Tree(tree_scene, scene_textures));
+ ModelManager::get_instance().add_model("tree", tree);
/* init terrain */
terrain = new Terrain();
@@ -105,7 +109,6 @@ Scene::~Scene() {
delete lua;
if(tool)
delete tool;
- delete tree;
if(terrain)
delete terrain;
delete font;
@@ -621,8 +624,8 @@ void Scene::render() {
float height = font->LineHeight();
glColor3f(1, 1, 1);
glTranslatef(0, video::height-height, 0);
- font->Render((boost::format("chunks: %d cache: %d gravity: %d flying: %d water: %d steps: %d")
- % terrain->chunks.size() % terrain->tc->get_size() % gravity % flying % underwater % steps).str().c_str());
+ font->Render((boost::format("chunks: %d cache: %d gravity: %d flying: %d water: %d steps: %d trees: %d")
+ % terrain->chunks.size() % terrain->tc->get_size() % gravity % flying % underwater % steps % trees.size()).str().c_str());
glTranslatef(0, -height, 0);
font->Render(move_str.c_str());
glTranslatef(0, -height, 0);