Ray Class Reference

#include <Ray.h>

Collaboration diagram for Ray:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Ray ()
void init (const Vec3f &origin, const Vec3f &direction, float t=INFINITY)
const Vec3forg () const
const Vec3fdir () const
float t () const
Vec3f hitPoint (float eps) const
const Primitivehit () const
void setHit (const Primitive *hit, float t)
const Objectobj () const
void setObj (const Object *object)
float u () const
float v () const
void setUV (float u, float v)
float influence () const
int recDeep () const
void setInfluence (float infl, int recursionDeep)
void updateInfluence (const Ray &ray, float infl=1.0f)

Private Attributes

Vec3f mOrg
 Origin.
Vec3f mDir
 Direction.
float mT
 Current / maximum hit distance.
const PrimitivemHit
 Currently closest primitive.
const ObjectmHitObj
 Currently closest object.
float mU
 Barycentric u coordinate of the hit point.
float mV
 Barycentric v coordinate of the hit point.
float mInfluence
 Influence on the resulting color (used in adaptive recursion termination).
int mRecursionDeep
 Recursion deep of this ray.

Detailed Description

Represents a light ray. Stores closest Primitive, direction to it and barycentric coordinates of the hit point

Author:
Alex Busenius

Christian Engels

Definition at line 22 of file Ray.h.


Constructor & Destructor Documentation

Ray::Ray (  )  [inline]

Default constructor

Definition at line 27 of file Ray.h.


Member Function Documentation

void Ray::init ( const Vec3f origin,
const Vec3f direction,
float  t = INFINITY 
) [inline]

Initialize the ray. Should be called before starting tracing

Parameters:
origin New ray origin
direction New ray direction, normalized if needed
t New current hit distance

Definition at line 46 of file Ray.h.

References EPSILON, mDir, mHit, mHitObj, mInfluence, mOrg, mRecursionDeep, mT, mU, mV, Vec3f::normal(), and t().

Referenced by QuadAreaLight::illuminate(), PointLight::illuminate(), PerspectiveCamera::initRay(), DepthOfFieldCamera::initRay(), operator *(), TransparentShader::shade(), RefractiveShader::shade(), and MirrorShader::shade().

const Vec3f& Ray::org (  )  const [inline]

Get ray origin

Definition at line 64 of file Ray.h.

References mOrg.

Referenced by Node::distanceToSplitPlane(), Triangle::intersect(), Sphere::intersect(), InfinitePlane::intersect(), Box::intersect(), Node::nearFar(), operator *(), operator<<(), and CookTorranceShader::shade().

const Vec3f& Ray::dir (  )  const [inline]

Get ray direction

Definition at line 71 of file Ray.h.

References mDir.

Referenced by Node::distanceToSplitPlane(), Triangle::intersect(), Sphere::intersect(), InfinitePlane::intersect(), Box::intersect(), operator *(), operator<<(), TransparentShader::shade(), RefractiveShader::shade(), PhongShader::shade(), MirrorShader::shade(), and CookTorranceShader::shade().

float Ray::t (  )  const [inline]

Get current hit distance

Definition at line 78 of file Ray.h.

References mT.

Referenced by QuadAreaLight::illuminate(), PointLight::illuminate(), init(), Triangle::intersect(), Sphere::intersect(), InfinitePlane::intersect(), Node::leafIntersect(), operator *(), RefractiveShader::shade(), and CookTorranceShader::shade().

Vec3f Ray::hitPoint ( float  eps  )  const [inline]

Get current hit point

Parameters:
eps Offset to add to t

Definition at line 87 of file Ray.h.

References mDir, mOrg, and mT.

Referenced by DepthOfFieldCamera::initRay(), Sphere::intersect(), WoodShader::shade(), TransparentShader::shade(), RefractiveShader::shade(), PhongShader::shade(), and MirrorShader::shade().

const Primitive* Ray::hit (  )  const [inline]

Get currently closest primitive

Definition at line 94 of file Ray.h.

References mHit.

Referenced by Sphere::axes(), QuadAreaLight::illuminate(), PointLight::illuminate(), Triangle::normal(), TexturedSmoothTriangle::normal(), Sphere::normal(), Shader::normal(), operator *(), Scene::rayTrace(), setHit(), WoodShader::shade(), RefractiveShader::shade(), PhongShader::shade(), MirrorShader::shade(), DebugShader::shade(), CookTorranceShader::shade(), CombineShader::shade(), CloudShader::shade(), and TexturedSmoothTriangle::texCoord().

void Ray::setHit ( const Primitive hit,
float  t 
) [inline]

Set current hit distance and closest primitive

Definition at line 101 of file Ray.h.

References hit(), mHit, and mT.

Referenced by Triangle::intersect(), Sphere::intersect(), InfinitePlane::intersect(), Node::leafIntersect(), and operator *().

const Object* Ray::obj (  )  const [inline]

Get currently closest object

Definition at line 109 of file Ray.h.

References mHitObj.

Referenced by Sphere::axes(), Triangle::normal(), TexturedSmoothTriangle::normal(), Sphere::normal(), operator *(), RefractiveShader::shade(), PhongShader::shade(), and MirrorShader::shade().

void Ray::setObj ( const Object object  )  [inline]

Set closest object. Object must be NULL if hit() is NULL

Definition at line 116 of file Ray.h.

References mHit, and mHitObj.

Referenced by Object::intersect(), and operator *().

float Ray::u (  )  const [inline]

Get barycentric U coordinate

Definition at line 124 of file Ray.h.

References mU.

Referenced by TexturedSmoothTriangle::normal(), Sphere::normal(), operator *(), TexturedSmoothTriangle::texCoord(), and Sphere::texCoord().

float Ray::v (  )  const [inline]

Get barycentric V coordinate

Definition at line 131 of file Ray.h.

References mV.

Referenced by TexturedSmoothTriangle::normal(), Sphere::normal(), operator *(), TexturedSmoothTriangle::texCoord(), and Sphere::texCoord().

void Ray::setUV ( float  u,
float  v 
) [inline]

Set barycentric coordinates

Definition at line 138 of file Ray.h.

References mU, and mV.

Referenced by Triangle::intersect(), Sphere::intersect(), and operator *().

float Ray::influence (  )  const [inline]

Get ray influence on resulting color

Definition at line 146 of file Ray.h.

References mInfluence.

Referenced by operator *(), RefractiveShader::shade(), MirrorShader::shade(), and updateInfluence().

int Ray::recDeep (  )  const [inline]

Get current recursion deep

Definition at line 153 of file Ray.h.

References mRecursionDeep.

Referenced by operator *(), Scene::rayTrace(), RefractiveShader::shade(), MirrorShader::shade(), and updateInfluence().

void Ray::setInfluence ( float  infl,
int  recursionDeep 
) [inline]

Set ray influence

Parameters:
infl How large influence of this ray is on resulting color
recursionDeep Current recursion deep

Definition at line 163 of file Ray.h.

References mInfluence, and mRecursionDeep.

Referenced by operator *().

void Ray::updateInfluence ( const Ray ray,
float  infl = 1.0f 
) [inline]

Update ray influence of given ray with new values, multiply influence to old influence and increment recursion deep

Parameters:
ray Ray with initial values
infl Value to multiply to the influence of another ray

Definition at line 177 of file Ray.h.

References influence(), mInfluence, mRecursionDeep, and recDeep().

Referenced by TransparentShader::shade(), RefractiveShader::shade(), MirrorShader::shade(), and CombineShader::shade().


Member Data Documentation

Vec3f Ray::mOrg [private]

Origin.

Definition at line 186 of file Ray.h.

Referenced by hitPoint(), init(), and org().

Vec3f Ray::mDir [private]

Direction.

Definition at line 189 of file Ray.h.

Referenced by dir(), hitPoint(), and init().

float Ray::mT [private]

Current / maximum hit distance.

Definition at line 192 of file Ray.h.

Referenced by hitPoint(), init(), setHit(), and t().

const Primitive* Ray::mHit [private]

Currently closest primitive.

Definition at line 195 of file Ray.h.

Referenced by hit(), init(), setHit(), and setObj().

const Object* Ray::mHitObj [private]

Currently closest object.

Definition at line 198 of file Ray.h.

Referenced by init(), obj(), and setObj().

float Ray::mU [private]

Barycentric u coordinate of the hit point.

Definition at line 201 of file Ray.h.

Referenced by init(), setUV(), and u().

float Ray::mV [private]

Barycentric v coordinate of the hit point.

Definition at line 204 of file Ray.h.

Referenced by init(), setUV(), and v().

float Ray::mInfluence [private]

Influence on the resulting color (used in adaptive recursion termination).

Definition at line 207 of file Ray.h.

Referenced by influence(), init(), setInfluence(), and updateInfluence().

int Ray::mRecursionDeep [private]

Recursion deep of this ray.

Definition at line 210 of file Ray.h.

Referenced by init(), recDeep(), setInfluence(), and updateInfluence().


The documentation for this class was generated from the following file:
Generated on Fri Feb 1 00:02:25 2008 for Grayfall by  doxygen 1.5.1