-
Notifications
You must be signed in to change notification settings - Fork 0
/
scene_object.h
38 lines (30 loc) · 1.12 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
37
38
/***********************************************************
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.
using Ptr = std::shared_ptr<SceneObject>;
virtual bool intersect( Ray3D&, const Matrix4x4&, const Matrix4x4& ) = 0;
virtual ~SceneObject() {}
};
// 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 );
};