C++ / OpenCL Raytracer
Box Class Reference

#include <box.h>

Inheritance diagram for Box:
Object

Public Member Functions

 Box (Vector3D bound1, Vector3D bound2, Material *pm)
 
virtual bool Hit (const Ray &r, HitRecord &rec, double tMin, double tMax) const
 
int clType () const
 
Vector3D clCenter () const
 
double clRadius () const
 
Vector3D clBound1 () const
 
Vector3D clBound2 () const
 
virtual cl_double8 CurMat () const
 
virtual Vector3D NormalCalc (const Vector3D inter) const
 

Public Attributes

Materialm_pmCurMat
 Pointer to Material that the box should render.
 
Vector3D m_vBounds [2]
 Array of Vector3D bounds for box.
 
Vector3D m_vCenter = Vector3D((m_vBounds[0].x() + m_vBounds[1].x()) / 2, (m_vBounds[0].y() + m_vBounds[1].y()) / 2, (m_vBounds[0].z() + m_vBounds[1].z()) / 2)
 Vector3D center of Box Object.
 

Detailed Description

Box creation and intersection functions

Constructor & Destructor Documentation

◆ Box()

Box::Box ( Vector3D  bound1,
Vector3D  bound2,
Material pm 
)
inline

Box Shaped Object

Example:

Box(Vector3D(-1), Vector3D(1), new Lambertian(Vector3D(1, 0, 0)));

Member Function Documentation

◆ clBound1()

Vector3D Box::clBound1 ( ) const
inlinevirtual

Returns first Vector3D bound of object.

Example:

clBound1();

Implements Object.

◆ clBound2()

Vector3D Box::clBound2 ( ) const
inlinevirtual

Returns second Vector3D bound of object.

Example:

clBound2();

Implements Object.

◆ clCenter()

Vector3D Box::clCenter ( ) const
inlinevirtual

Returns Vector3D center of object.

Example:

clCenter();

Implements Object.

◆ clRadius()

double Box::clRadius ( ) const
inlinevirtual

Returns double radius of object.

Example:

clRadius();

Implements Object.

◆ clType()

int Box::clType ( ) const
inlinevirtual

Returns type of object as int. Sphere (0) or Box (1).

Example:

clType();

Implements Object.

◆ CurMat()

virtual cl_double8 Box::CurMat ( ) const
inlinevirtual

Returns cl_double8 formatted object material.

Example:

CurMat();

Implements Object.

◆ Hit()

bool Box::Hit ( const Ray r,
HitRecord rec,
double  tMin,
double  tMax 
) const
virtual

Return boolean value if box is hit by specified ray.

Example:

Box::Hit(ray, hitrec, 0.001, DBL_MAX);

Implements Object.

◆ NormalCalc()

Vector3D Box::NormalCalc ( const Vector3D  vP) const
virtual

Return Vector3D surface normal for specified Vector3D point on ray.

Example:

Box::NormalCalc(vP);

The documentation for this class was generated from the following files: