From 16f38f1f27b2ff9a5c4d8c0b0bd214a6a949adec Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 24 Feb 2009 03:35:20 +0000 Subject: [PATCH] added sample Intersect object to sample scene, added Color::magenta constant git-svn-id: svn://anubis/fart/trunk@155 7f9b0f55-74a9-4bce-be96-3c2cd072584d --- main/Scene-load.cc | 17 +++++++++++++++++ shapes/Shape.h | 1 + util/Color.cc | 1 + util/Color.h | 1 + 4 files changed, 20 insertions(+) diff --git a/main/Scene-load.cc b/main/Scene-load.cc index 3762e07..c62fd80 100644 --- a/main/Scene-load.cc +++ b/main/Scene-load.cc @@ -28,6 +28,23 @@ void Scene::load(const char * filename) shape->setMaterial(m); m_shapes.push_back(shape); + m_transform.translate(-2, -2, -1); + refptr shape1 = new Sphere(0.8); + shape1->setMaterial(m); + shape1->setTransform(m_transform); + refptr shape2 = new Box(new Vector(2, 2, 0.6)); + m = new Material(); + m->setDiffuseColor(Color::magenta); + m->setAmbientColor(Color::magenta); + shape2->setMaterial(m); + m_transform.rotate(20, 0, 1, 0); + shape2->setTransform(m_transform); + shape = new Intersect(shape1, shape2); + m_shapes.push_back(shape); + + m_transform.rotate(-20, 0, 1, 0); + m_transform.translate(2, 2, 1); + m = new Material(); m->setDiffuseColor(Color::blue); m->setAmbientColor(Color::blue); diff --git a/shapes/Shape.h b/shapes/Shape.h index 8f48ed6..c7c09cb 100644 --- a/shapes/Shape.h +++ b/shapes/Shape.h @@ -121,6 +121,7 @@ class Shape #include "Box.h" #include "Cyl.h" +#include "Intersect.h" #include "Plane.h" #include "Sphere.h" diff --git a/util/Color.cc b/util/Color.cc index 92bec6f..f719ec3 100644 --- a/util/Color.cc +++ b/util/Color.cc @@ -8,6 +8,7 @@ const Color Color::green = Color(0, 1, 0); const Color Color::blue = Color(0, 0, 1); const Color Color::yellow = Color(1, 1, 0); const Color Color::cyan = Color(0, 1, 1); +const Color Color::magenta = Color(1, 0, 1); Color::Color() { diff --git a/util/Color.h b/util/Color.h index c50832a..4f28d9f 100644 --- a/util/Color.h +++ b/util/Color.h @@ -27,6 +27,7 @@ class Color static const Color blue; static const Color yellow; static const Color cyan; + static const Color magenta; }; Color operator+(const Color & c1, const Color & c2);