]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/overlay.cpp
Rename Point to Vector
[r2c2.git] / source / 3d / overlay.cpp
index 3f2d621d6b8aade208f8517488a0f3585f2117fc..ed413cd4f943cb59e7dbaed00481889d8363b230 100644 (file)
@@ -1,13 +1,14 @@
 /* $Id$
 
-This file is part of the MSP Märklin suite
-Copyright © 2010 Mikkosoft Productions, Mikko Rasa
+This file is part of R²C²
+Copyright © 2010-2011  Mikkosoft Productions, Mikko Rasa
 Distributed under the GPL
 */
 
 #include <algorithm>
 #include <cmath>
 #include <msp/fs/path.h>
+#include <msp/gl/immediate.h>
 #include <msp/gl/matrix.h>
 #include <msp/gl/texture.h>
 #include <msp/io/print.h>
@@ -18,7 +19,7 @@ Distributed under the GPL
 using namespace std;
 using namespace Msp;
 
-namespace Marklin {
+namespace R2C2 {
 
 Overlay3D::Overlay3D(const Graphics::Window &w, const GL::Camera &c, const GL::Font &f):
        window(w),
@@ -98,9 +99,12 @@ void Overlay3D::render(const GL::Tag &tag) const
 
                for(map<const Object3D *, Icon *>::const_iterator i=icons.begin(); i!=icons.end(); ++i)
                {
+                       if(!i->first->is_visible())
+                               continue;
+
                        const Icon &icon = *i->second;
 
-                       Point node = i->first->get_node();
+                       Vector node = i->first->get_node();
                        GL::Vector3 p = camera.project(GL::Vector3(node.x, node.y, node.z));
 
                        GL::PushMatrix push_mat;
@@ -119,7 +123,9 @@ void Overlay3D::render(const GL::Tag &tag) const
                        }
 
                        GL::translate(0, baseline, 0);
-                       font.draw_string(icon.label);
+                       GL::Immediate imm((GL::TEXCOORD2, GL::COLOR4_UBYTE, GL::VERTEX2));
+                       imm.color(0.0f, 1.0f, 0.0f);
+                       font.draw_string(icon.label, imm);
                        GL::Texture::unbind();
                }
 
@@ -127,6 +133,8 @@ void Overlay3D::render(const GL::Tag &tag) const
                GL::pop_matrix();
                GL::matrix_mode(GL::MODELVIEW);
                GL::pop_matrix();
+
+               glColor3f(1.0, 1.0, 1.0);
        }
 }
 
@@ -192,4 +200,4 @@ Overlay3D::Icon::Icon():
        background((GL::COLOR4_UBYTE, GL::VERTEX2))
 { }
 
-} // namespace Marklin
+} // namespace R2C2