summaryrefslogtreecommitdiff
path: root/scene.cpp
diff options
context:
space:
mode:
authorJon Bergli Heier <snakebite@jvnv.net>2011-05-11 19:30:31 +0200
committerJon Bergli Heier <snakebite@jvnv.net>2011-05-11 19:30:31 +0200
commit63e3b825580c8fbf6b84d441c92ed39348e51c17 (patch)
tree1d315af990adf5160554ccf7e2fb615223b44220 /scene.cpp
parentd42ec5c0e89559abd276334b6c4804e1eaa5e9c7 (diff)
Working win32 port.
Diffstat (limited to 'scene.cpp')
-rw-r--r--scene.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/scene.cpp b/scene.cpp
index cc7db04..e371f74 100644
--- a/scene.cpp
+++ b/scene.cpp
@@ -35,10 +35,9 @@ Scene::Scene() {
terrain_program.link();
terrain_program.use();
- GLint tex1loc = glGetUniformLocation(terrain_program.get_program(), "tex[1]");
- glUniform1i(tex1loc, 1);
- GLint tex2loc = glGetUniformLocation(terrain_program.get_program(), "tex[2]");
- glUniform1i(tex2loc, 2);
+ GLint tex = glGetUniformLocation(terrain_program.get_program(), "tex");
+ GLint texv[] = {0, 1, 2};
+ glUniform1iv(tex, 3, texv);
GLint markloc = glGetUniformLocation(terrain_program.get_program(), "marktex");
glUniform1i(markloc, 3);
glUseProgram(0);
@@ -53,8 +52,8 @@ Scene::Scene() {
terrain = new Terrain();
/* load font */
- //font = new FTTextureFont("fonts/VeraMono.ttf");
- //font->FaceSize(10);
+ font = new FTTextureFont("fonts/VeraMono.ttf");
+ font->FaceSize(10);
GUI::init();
}
@@ -64,7 +63,7 @@ Scene::~Scene() {
delete tool;
if(terrain)
delete terrain;
- //delete font;
+ delete font;
}
void Scene::lookat() {
@@ -395,14 +394,8 @@ void Scene::render() {
Terrain::Chunk *chunk = *it;
glPushMatrix();
glTranslatef(-pos.x, -pos.y, -pos.z);
- /*if(!chunk->nodes) {
- for(int i = 0; i < 4; i++)
- q.push(chunk->children[i]);
- continue;
- } else*/ if(chunk->vbo_object) {
- for(unsigned int i = 0; i < chunk->node_count; i++)
- chunk->nodes[i]->draw_grid();
- }
+ for(unsigned int i = 0; i < chunk->node_count; i++)
+ chunk->nodes[i]->draw_grid();
glPopMatrix();
}
}
@@ -448,7 +441,7 @@ void Scene::render() {
glPopMatrix();
video::ortho();
- /*float height = font->LineHeight();
+ float height = font->LineHeight();
glColor3f(1, 1, 1);
glTranslatef(0, video::height-height, 0);
font->Render((boost::format("chunks: %d gravity: %d steps: %d")
@@ -464,7 +457,7 @@ void Scene::render() {
if(tool) {
glTranslatef(0, -height, 0);
font->Render((boost::format("Tool: %s") % tool->get_name()).str().c_str());
- }*/
+ }
/*if(selected) {
glTranslatef(0, height, 0);
//font->Render((boost::format("(%s %s %s %s)") % selected->a->str() % selected->b->str() % selected->c->str() % selected->d->str()).str().c_str());