From 9041ec6a1cce451f3537141549b1520a41031762 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 28 Jan 2009 21:41:19 +0000 Subject: [PATCH] shapes/Shape.h now including specific shape headers (after base class definition), test/tests.cc fixed compiler warning, main/Scene drawing demo Plane, util/Transform not needlessly re-initializing m_matrix git-svn-id: svn://anubis/fart/trunk@62 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- main/Scene.cc | 4 +++- shapes/Shape.h | 3 +++ test/tests.cc | 2 +- util/Transform.cc | 1 - 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/main/Scene.cc b/main/Scene.cc index 55327af..4373370 100644 --- a/main/Scene.cc +++ b/main/Scene.cc @@ -10,7 +10,6 @@ #include #include "BMP.h" #include "shapes/Shape.h" -#include "shapes/Sphere.h" #include "PointLight.h" using namespace std; @@ -86,6 +85,9 @@ Scene::~Scene() void Scene::load(const char * filename) { /* TODO: parse file somehow */ + Shape * plane = new Plane(0, 0, 1, -2); + m_shapes.push_back(plane); + Shape * shape = new Sphere(1.0); m_transform.translate(1.0, 5.0, 0.5); shape->setTransform(m_transform); diff --git a/shapes/Shape.h b/shapes/Shape.h index 1fb9a72..ccc2b58 100644 --- a/shapes/Shape.h +++ b/shapes/Shape.h @@ -32,5 +32,8 @@ class Shape double m_transparency; }; +#include "Sphere.h" +#include "Plane.h" + #endif diff --git a/test/tests.cc b/test/tests.cc index 452f7d1..4cffcce 100644 --- a/test/tests.cc +++ b/test/tests.cc @@ -12,7 +12,7 @@ int main() Shape::IntersectList res = s.intersect(ray); - for (int i = 0; i < res.size(); i++) + for (unsigned int i = 0; i < res.size(); i++) { cout << "t: " << res[i] << endl; } diff --git a/util/Transform.cc b/util/Transform.cc index 1e9e6ed..20cdd49 100644 --- a/util/Transform.cc +++ b/util/Transform.cc @@ -4,7 +4,6 @@ Transform::Transform() { - m_matrix = Matrix::identity(); } Transform Transform::getInverse()