-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscene_object.h
36 lines (28 loc) · 1.04 KB
/
scene_object.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/***********************************************************
Starter code for Assignment 3
This code was originally written by Jack Wang for
CSC418, SPRING 2005
classes defining primitives in the scene
***********************************************************/
#include "util.h"
// All primitives should provide a intersection function.
// To create more primitives, inherit from SceneObject.
// Namely, you can create, Sphere, Cylinder, etc... classes
// here.
class SceneObject {
public:
// Returns true if an intersection occured, false otherwise.
virtual bool intersect( Ray3D&, const Matrix4x4&, const Matrix4x4& ) = 0;
};
// Example primitive you can create, this is a unit square on
// the xy-plane.
class UnitSquare : public SceneObject {
public:
bool intersect( Ray3D& ray, const Matrix4x4& worldToModel,
const Matrix4x4& modelToWorld );
};
class UnitSphere : public SceneObject {
public:
bool intersect( Ray3D& ray, const Matrix4x4& worldToModel,
const Matrix4x4& modelToWorld );
};