C++ / OpenCL Raytracer
Sphere Class Reference

#include <sphere.h>

Inheritance diagram for Sphere:
Object

Public Member Functions

 Sphere (Vector3D cen, double r, 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
 

Public Attributes

Vector3D m_vCenter
 Vector3D center of Sphere Object.
 
double m_dRadius
 Radius of Sphere Object.
 
Materialm_pmCurMat
 Pointer to Material that the Sphere should render.
 

Detailed Description

Sphere creation and intersection functions

Constructor & Destructor Documentation

◆ Sphere()

Sphere::Sphere ( Vector3D  cen,
double  r,
Material pm 
)
inline

Sphere Shaped Object

Example:

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

Member Function Documentation

◆ clBound1()

Vector3D Sphere::clBound1 ( ) const
inlinevirtual

Returns first Vector3D bound of object.

Example:

clBound1();

Implements Object.

◆ clBound2()

Vector3D Sphere::clBound2 ( ) const
inlinevirtual

Returns second Vector3D bound of object.

Example:

clBound2();

Implements Object.

◆ clCenter()

Vector3D Sphere::clCenter ( ) const
inlinevirtual

Returns Vector3D center of object.

Example:

clCenter();

Implements Object.

◆ clRadius()

double Sphere::clRadius ( ) const
inlinevirtual

Returns double radius of object.

Example:

clRadius();

Implements Object.

◆ clType()

int Sphere::clType ( ) const
inlinevirtual

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

Example:

clType();

Implements Object.

◆ CurMat()

virtual cl_double8 Sphere::CurMat ( ) const
inlinevirtual

Returns cl_double8 formatted object material.

Example:

CurMat();

Implements Object.

◆ Hit()

bool Sphere::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.


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