added sample Intersect object to sample scene, added Color::magenta constant

git-svn-id: svn://anubis/fart/trunk@155 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
Josh Holtrop 2009-02-24 03:35:20 +00:00
parent f7eb4cd4b9
commit 16f38f1f27
4 changed files with 20 additions and 0 deletions

View File

@ -28,6 +28,23 @@ void Scene::load(const char * filename)
shape->setMaterial(m); shape->setMaterial(m);
m_shapes.push_back(shape); m_shapes.push_back(shape);
m_transform.translate(-2, -2, -1);
refptr<Shape> shape1 = new Sphere(0.8);
shape1->setMaterial(m);
shape1->setTransform(m_transform);
refptr<Shape> 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 = new Material();
m->setDiffuseColor(Color::blue); m->setDiffuseColor(Color::blue);
m->setAmbientColor(Color::blue); m->setAmbientColor(Color::blue);

View File

@ -121,6 +121,7 @@ class Shape
#include "Box.h" #include "Box.h"
#include "Cyl.h" #include "Cyl.h"
#include "Intersect.h"
#include "Plane.h" #include "Plane.h"
#include "Sphere.h" #include "Sphere.h"

View File

@ -8,6 +8,7 @@ const Color Color::green = Color(0, 1, 0);
const Color Color::blue = Color(0, 0, 1); const Color Color::blue = Color(0, 0, 1);
const Color Color::yellow = Color(1, 1, 0); const Color Color::yellow = Color(1, 1, 0);
const Color Color::cyan = Color(0, 1, 1); const Color Color::cyan = Color(0, 1, 1);
const Color Color::magenta = Color(1, 0, 1);
Color::Color() Color::Color()
{ {

View File

@ -27,6 +27,7 @@ class Color
static const Color blue; static const Color blue;
static const Color yellow; static const Color yellow;
static const Color cyan; static const Color cyan;
static const Color magenta;
}; };
Color operator+(const Color & c1, const Color & c2); Color operator+(const Color & c1, const Color & c2);