GClasses
GClasses::GRayTraceScene Class Reference

Detailed Description

Represents a scene that you can ray-trace.

#include <GRayTrace.h>

Public Types

Public Member Functions

 GRayTraceScene (GRand *pRand)
 
 GRayTraceScene (GDomNode *pNode, GRand *pRand)
 
 ~GRayTraceScene ()
 
void activateDistanceMap ()
 
void addLight (GRayTraceLight *pLight)
 
void addMaterial (GRayTraceMaterial *pMaterial)
 
void addMesh (GRayTraceTriMesh *pMesh)
 
void addObject (GRayTraceObject *pObject)
 
GRayTraceColorambientLight ()
 
GRayTraceColorbackgroundColor ()
 
GRayTraceBoundingBoxBaseboundingBoxTree ()
 
GRayTraceCameracamera ()
 
G3DRealdistanceMap ()
 
void drawWireFrame ()
 This draws a wire frame of the scene. This is a fast way to ensure your camera is looking where you think it is looking before you perform a long render. More...
 
void flushObjects ()
 Deletes all the materials and objects. (Leaves the lights and camera as they are.) More...
 
GImageimage ()
 Returns the rendered image (or partially rendered image). Returns NULL if Render() or RenderBegin() has not been called yet. More...
 
GRayTraceLightlight (size_t n)
 
size_t lightCount ()
 
GRayTraceMaterialmaterial (size_t n)
 
size_t materialCount ()
 
size_t materialIndex (GRayTraceMaterial *pMaterial) const
 
std::vector< GRayTraceMaterial * > & materials ()
 
GRayTraceTriMeshmesh (size_t n)
 
size_t meshCount ()
 
size_t meshIndex (GRayTraceTriMesh *pMesh) const
 
GRayTraceObjectobject (size_t n)
 
size_t objectCount ()
 
size_t objectIndex (GRayTraceObject *pObj) const
 
GRandrand ()
 
GImagereleaseImage ()
 
void render ()
 This method calls RenderBegin, then calls RenderLine until the whole image has been rendered. More...
 
void renderBegin ()
 Call this before calling RenderLine(). It resets the image and computes values necessary for rendering. More...
 
bool renderLine ()
 Call this to render a singe horizontal line of the image. Returns true if there's still more rendering to do. Returns false if it's done. You must call RenderBegin() once before you start calling this method. More...
 
unsigned int renderPixel (GRayTraceRay *pRay, G3DVector *pScreenPoint, G3DReal *pDistance)
 
unsigned int renderPixelAntiAliassed (GRayTraceRay *pRay, G3DVector *pScreenPoint, G3DReal *pDistance)
 
unsigned int renderPixelPathTrace (GRayTraceRay *pRay, G3DVector *pScreenPoint)
 
unsigned int renderSinglePixel (int x, int y)
 This calls RenderBegine and then renders a single pixel. It's not efficient to call this method for every pixel. The only purpose for this method is to make debugging the ray tracer easier. Pick a pixel that isn't rendered the way you want and step through the ray tracing process to see why. More...
 
GDomNodeserialize (GDom *pDoc) const
 Marshal this object into a DOM, which can then be converted to a variety of serial formats. More...
 
void setAmbientLight (G3DReal r, G3DReal g, G3DReal b)
 
void setBackgroundColor (G3DReal a, G3DReal r, G3DReal g, G3DReal b)
 
void setRenderMode (RenderMode eMode)
 Specify whether to emphasize quality or speed. More...
 
void setToneMappingConstant (G3DReal c)
 
void swapObjects (GRayTraceScene *pOther)
 Swap all matrials, meshes and objects with the other scene. (Leaves the camera and lights as they are.) More...
 

Protected Attributes

GRayTraceColor m_ambientLight
 
GRayTraceColor m_backgroundColor
 
RenderMode m_eMode
 Rendering values. More...
 
std::vector< GRayTraceLight * > m_lights
 
std::vector< GRayTraceMaterial * > m_materials
 
std::vector< GRayTraceTriMesh * > m_meshes
 
int m_nY
 
std::vector< GRayTraceObject * > m_objects
 
GRayTraceBoundingBoxBasem_pBoundingBoxTree
 
GRayTraceCameram_pCamera
 
G3DRealm_pDistanceMap
 
GImagem_pImage
 
G3DVector m_pixDX
 
G3DVector m_pixDY
 
G3DVector m_pixSide
 
GRandm_pRand
 
G3DReal m_toneMappingConstant
 

Member Enumeration Documentation

Enumerator
FAST_RAY_TRACE 
QUALITY_RAY_TRACE 
PATH_TRACE 

Constructor & Destructor Documentation

GClasses::GRayTraceScene::GRayTraceScene ( GRand pRand)
GClasses::GRayTraceScene::GRayTraceScene ( GDomNode pNode,
GRand pRand 
)
GClasses::GRayTraceScene::~GRayTraceScene ( )

Member Function Documentation

void GClasses::GRayTraceScene::activateDistanceMap ( )
void GClasses::GRayTraceScene::addLight ( GRayTraceLight pLight)
void GClasses::GRayTraceScene::addMaterial ( GRayTraceMaterial pMaterial)
void GClasses::GRayTraceScene::addMesh ( GRayTraceTriMesh pMesh)
void GClasses::GRayTraceScene::addObject ( GRayTraceObject pObject)
GRayTraceColor* GClasses::GRayTraceScene::ambientLight ( )
inline
GRayTraceColor* GClasses::GRayTraceScene::backgroundColor ( )
inline
GRayTraceBoundingBoxBase* GClasses::GRayTraceScene::boundingBoxTree ( )
inline
GRayTraceCamera* GClasses::GRayTraceScene::camera ( )
inline
G3DReal* GClasses::GRayTraceScene::distanceMap ( )
inline
void GClasses::GRayTraceScene::drawWireFrame ( )

This draws a wire frame of the scene. This is a fast way to ensure your camera is looking where you think it is looking before you perform a long render.

void GClasses::GRayTraceScene::flushObjects ( )

Deletes all the materials and objects. (Leaves the lights and camera as they are.)

GImage* GClasses::GRayTraceScene::image ( )
inline

Returns the rendered image (or partially rendered image). Returns NULL if Render() or RenderBegin() has not been called yet.

GRayTraceLight* GClasses::GRayTraceScene::light ( size_t  n)
size_t GClasses::GRayTraceScene::lightCount ( )
GRayTraceMaterial* GClasses::GRayTraceScene::material ( size_t  n)
size_t GClasses::GRayTraceScene::materialCount ( )
size_t GClasses::GRayTraceScene::materialIndex ( GRayTraceMaterial pMaterial) const
std::vector<GRayTraceMaterial*>& GClasses::GRayTraceScene::materials ( )
inline
GRayTraceTriMesh* GClasses::GRayTraceScene::mesh ( size_t  n)
size_t GClasses::GRayTraceScene::meshCount ( )
size_t GClasses::GRayTraceScene::meshIndex ( GRayTraceTriMesh pMesh) const
GRayTraceObject* GClasses::GRayTraceScene::object ( size_t  n)
size_t GClasses::GRayTraceScene::objectCount ( )
size_t GClasses::GRayTraceScene::objectIndex ( GRayTraceObject pObj) const
GRand* GClasses::GRayTraceScene::rand ( )
inline
GImage* GClasses::GRayTraceScene::releaseImage ( )
inline
void GClasses::GRayTraceScene::render ( )

This method calls RenderBegin, then calls RenderLine until the whole image has been rendered.

void GClasses::GRayTraceScene::renderBegin ( )

Call this before calling RenderLine(). It resets the image and computes values necessary for rendering.

bool GClasses::GRayTraceScene::renderLine ( )

Call this to render a singe horizontal line of the image. Returns true if there's still more rendering to do. Returns false if it's done. You must call RenderBegin() once before you start calling this method.

unsigned int GClasses::GRayTraceScene::renderPixel ( GRayTraceRay *  pRay,
G3DVector pScreenPoint,
G3DReal pDistance 
)
unsigned int GClasses::GRayTraceScene::renderPixelAntiAliassed ( GRayTraceRay *  pRay,
G3DVector pScreenPoint,
G3DReal pDistance 
)
unsigned int GClasses::GRayTraceScene::renderPixelPathTrace ( GRayTraceRay *  pRay,
G3DVector pScreenPoint 
)
unsigned int GClasses::GRayTraceScene::renderSinglePixel ( int  x,
int  y 
)

This calls RenderBegine and then renders a single pixel. It's not efficient to call this method for every pixel. The only purpose for this method is to make debugging the ray tracer easier. Pick a pixel that isn't rendered the way you want and step through the ray tracing process to see why.

GDomNode* GClasses::GRayTraceScene::serialize ( GDom pDoc) const

Marshal this object into a DOM, which can then be converted to a variety of serial formats.

void GClasses::GRayTraceScene::setAmbientLight ( G3DReal  r,
G3DReal  g,
G3DReal  b 
)
inline
void GClasses::GRayTraceScene::setBackgroundColor ( G3DReal  a,
G3DReal  r,
G3DReal  g,
G3DReal  b 
)
inline
void GClasses::GRayTraceScene::setRenderMode ( RenderMode  eMode)
inline

Specify whether to emphasize quality or speed.

void GClasses::GRayTraceScene::setToneMappingConstant ( G3DReal  c)
inline
void GClasses::GRayTraceScene::swapObjects ( GRayTraceScene pOther)

Swap all matrials, meshes and objects with the other scene. (Leaves the camera and lights as they are.)

Member Data Documentation

GRayTraceColor GClasses::GRayTraceScene::m_ambientLight
protected
GRayTraceColor GClasses::GRayTraceScene::m_backgroundColor
protected
RenderMode GClasses::GRayTraceScene::m_eMode
protected

Rendering values.

std::vector<GRayTraceLight*> GClasses::GRayTraceScene::m_lights
protected
std::vector<GRayTraceMaterial*> GClasses::GRayTraceScene::m_materials
protected
std::vector<GRayTraceTriMesh*> GClasses::GRayTraceScene::m_meshes
protected
int GClasses::GRayTraceScene::m_nY
protected
std::vector<GRayTraceObject*> GClasses::GRayTraceScene::m_objects
protected
GRayTraceBoundingBoxBase* GClasses::GRayTraceScene::m_pBoundingBoxTree
protected
GRayTraceCamera* GClasses::GRayTraceScene::m_pCamera
protected
G3DReal* GClasses::GRayTraceScene::m_pDistanceMap
protected
GImage* GClasses::GRayTraceScene::m_pImage
protected
G3DVector GClasses::GRayTraceScene::m_pixDX
protected
G3DVector GClasses::GRayTraceScene::m_pixDY
protected
G3DVector GClasses::GRayTraceScene::m_pixSide
protected
GRand* GClasses::GRayTraceScene::m_pRand
protected
G3DReal GClasses::GRayTraceScene::m_toneMappingConstant
protected