summaryrefslogtreecommitdiffstats
path: root/src/View
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2008-04-15 03:04:02 +0200
committerneoraider <devnull@localhost>2008-04-15 03:04:02 +0200
commit85e58bd658d3b572ed598e0460965d7827f4e901 (patch)
treebe287042825b16183ab41f51138a2f97e1df21da /src/View
parent7df8aa74c6d11458248c5f5f3dd28eb762a2b407 (diff)
downloadzoomedit-85e58bd658d3b572ed598e0460965d7827f4e901.tar
zoomedit-85e58bd658d3b572ed598e0460965d7827f4e901.zip
zoomedit:
* Connected TopView to RenderArea
Diffstat (limited to 'src/View')
-rw-r--r--src/View/TopView.cpp31
-rw-r--r--src/View/TopView.h10
-rw-r--r--src/View/View.h12
3 files changed, 24 insertions, 29 deletions
diff --git a/src/View/TopView.cpp b/src/View/TopView.cpp
index 43f0bc1..38d4824 100644
--- a/src/View/TopView.cpp
+++ b/src/View/TopView.cpp
@@ -18,28 +18,29 @@
*/
#include "TopView.h"
-#include "../Data/Level.h"
-#include "../Data/Room.h"
-#include "../Data/Triangle.h"
-#include <cmath>
+#include <Data/Level.h>
+#include <Data/Room.h>
+#include <Data/Triangle.h>
+#include <GL/gl.h>
namespace ZoomEdit {
namespace View {
void TopView::renderRoom(Data::Room *room) {
- const std::list<Data::Triangle*> &triangles = room->getTriangles();
- std::list<Data::Triangle*> floor;
+ const std::list<Data::Triangle*> &floor = room->getFloorTriangles();
- for(std::list<Data::Triangle*>::const_iterator t = triangles.begin(); t != triangles.end(); ++t) {
- Data::Vector v1 = (*t)->getVertex(1) - (*t)->getVertex(0);
- Data::Vector v2 = (*t)->getVertex(2) - (*t)->getVertex(0);
-
- Data::Vector n = (v1 % v2);
- n.normalize();
-
- if(n*Data::Vector(0, 1, 0) > std::cos(45))
- floor.push_back(*t);
+ glColor4f(0.0f, 0.7f, 1.0f, 0.3f);
+
+ glBegin(GL_TRIANGLES);
+
+ for(std::list<Data::Triangle*>::const_iterator t = floor.begin(); t != floor.end(); ++t) {
+ for(int i = 0; i < 3; ++i) {
+ const Data::Vertex &v = (*t)->getVertex(i);
+ glVertex2f(v.getX(), v.getZ());
+ }
}
+
+ glEnd();
}
void TopView::render() {
diff --git a/src/View/TopView.h b/src/View/TopView.h
index c5af1de..5141e51 100644
--- a/src/View/TopView.h
+++ b/src/View/TopView.h
@@ -25,6 +25,7 @@
namespace ZoomEdit {
namespace Data {
+class Level;
class Room;
}
@@ -32,12 +33,17 @@ namespace View {
class TopView : public View {
private:
+ Data::Level *level;
+
void renderRoom(Data::Room *room);
public:
- TopView(Data::Level *level0 = 0) : View(level0) {}
+ TopView(Data::Level *level0 = 0) : level(level0) {}
+
+ Data::Level* getLevel() {return level;}
+ void setLevel(Data::Level *level0) {level = level0;}
- void render();
+ virtual void render();
};
}
diff --git a/src/View/View.h b/src/View/View.h
index c7755f2..32c201e 100644
--- a/src/View/View.h
+++ b/src/View/View.h
@@ -21,24 +21,12 @@
#define ZOOMEDIT_VIEW_H_
namespace ZoomEdit {
-
-namespace Data {
-class Level;
-}
-
namespace View {
class View {
- protected:
- Data::Level *level;
-
public:
- View(Data::Level *level0) : level(level0) {}
virtual ~View() {}
- virtual Data::Level* getLevel() {return level;}
- virtual void setLevel(Data::Level *level0) {level = level0;}
-
virtual void render() = 0;
};