NTrace
GPU ray tracing framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
FW::RayGen Class Reference

Ray generator class. Generates rays for both the GPU and the CPU. More...

#include <RayGen.hpp>

Public Member Functions

 RayGen (S32 maxBatchSize=8 *1024 *1024)
 Constructor. More...
 
void primary (RayBuffer &orays, const Vec3f &origin, const Mat4f &nscreenToWorld, S32 w, S32 h, float maxDist)
 Generates primary rays on the GPU. More...
 
bool shadow (RayBuffer &orays, RayBuffer &irays, int numSamples, const Vec3f &lightPos, float lightRadius, bool &newBatch, U32 randomSeed=0)
 Generates shadow rays on the GPU. Batches rays if necessary. More...
 
bool ao (RayBuffer &orays, RayBuffer &irays, Scene &scene, int numSamples, float maxDist, bool &newBatch, U32 randomSeed=0)
 Generates ao rays on the GPU. Batches rays if necessary. More...
 
void primaryCPU (RayBuffer &orays, const Vec3f &origin, const Mat4f &nscreenToWorld, S32 w, S32 h, float maxDist)
 Generates primary rays on the CPU. More...
 
bool shadowCPU (RayBuffer &orays, RayBuffer &irays, int numSamples, const Vec3f &lightPos, float lightRadius, bool &newBatch, U32 randomSeed=0)
 Generates shadow rays on the CPU. Batches rays if necessary. More...
 
bool aoCPU (RayBuffer &orays, RayBuffer &irays, Scene &scene, int numSamples, float maxDist, bool &newBatch, U32 randomSeed=0)
 Generates ao rays on the CPU. Batches rays if necessary. More...
 
bool random (RayBuffer &orays, const AABB &bounds, int numRays, bool closestHit, bool PosDir=false, U32 randomSeed=0)
 Generates random rays. Used for various tests. More...
 
bool random (RayBuffer &orays, const AABB &bounds, int numRays, bool closestHit, bool PosDir, bool &newBatch, U32 randomSeed=0)
 Generates random rays. More...
 
bool randomReflection (RayBuffer &orays, RayBuffer &irays, Scene &scene, int numSamples, float maxDist, bool &newBatch, U32 randomSeed=0)
 Generates random reflection rays. More...
 

Detailed Description

Ray generator class. Generates rays for both the GPU and the CPU.

Definition at line 47 of file RayGen.hpp.

Constructor & Destructor Documentation

FW::RayGen::RayGen ( S32  maxBatchSize = 8*1024*1024)

Constructor.

Parameters
[in]maxBatchSizeMaximum number of secondary rays in one batch.

Definition at line 35 of file RayGen.cpp.

Member Function Documentation

bool FW::RayGen::ao ( RayBuffer orays,
RayBuffer irays,
Scene scene,
int  numSamples,
float  maxDist,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates ao rays on the GPU. Batches rays if necessary.

Parameters
[in,out]oraysGenerated rays.
[in]iraysSource rays.
[in]sceneSource scene.
[in]numSamplesNumber of ao rays for each source ray.
[in]maxDistMaximum length of generated rays.
[in,out]newBatchBatching flag. [aram[in] randomSeed Random seed.
Returns
True if batch contiunes.

Definition at line 196 of file RayGen.cpp.

bool FW::RayGen::aoCPU ( RayBuffer orays,
RayBuffer irays,
Scene scene,
int  numSamples,
float  maxDist,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates ao rays on the CPU. Batches rays if necessary.

Parameters
[in,out]oraysGenerated rays.
[in]iraysSource rays.
[in]sceneSource scene.
[in]numSamplesNumber of ao rays for each source ray.
[in]maxDistMaximum length of generated rays.
[in,out]newBatchBatching flag.
[in]randomSeedRandom seed.
Returns
True if batch contiunes.

Definition at line 232 of file RayGen.cpp.

void FW::RayGen::primary ( RayBuffer orays,
const Vec3f origin,
const Mat4f nscreenToWorld,
S32  w,
S32  h,
float  maxDist 
)

Generates primary rays on the GPU.

Parameters
[in,out]Generatedrays.
[in]originPoint from which rays will be cast.
[in]nscreenToWorldTransformation view matrix.
[in]wHorizontal resolution.
[in]hVertical resolution.
[in]maxDistMaximum length of generated rays.

Definition at line 44 of file RayGen.cpp.

void FW::RayGen::primaryCPU ( RayBuffer orays,
const Vec3f origin,
const Mat4f nscreenToWorld,
S32  w,
S32  h,
float  maxDist 
)

Generates primary rays on the CPU.

Parameters
[in,out]Generatedrays.
[in]originPoint from which rays will be cast.
[in]nscreenToWorldTransformation view matrix.
[in]wHorizontal resolution.
[in]hVertical resolution.
[in]maxDistMaximum length of generated rays.

Definition at line 74 of file RayGen.cpp.

bool FW::RayGen::random ( RayBuffer orays,
const AABB bounds,
int  numRays,
bool  closestHit,
bool  PosDir = false,
U32  randomSeed = 0 
)

Generates random rays. Used for various tests.

Parameters
[in,out]oraysGenerated rays.
[in]boundsBox in which rays will be generated.
[in]numRaysNumber of generated rays.
[in]closestHitFlag whether rays require closest hit.
[in]PosDirIf false, direction of generated rays will be absolute position in the scene.
[in]randomSeedRandom seed.
Returns
True if batch continues.

Definition at line 340 of file RayGen.cpp.

bool FW::RayGen::random ( RayBuffer orays,
const AABB bounds,
int  numRays,
bool  closestHit,
bool  PosDir,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates random rays.

Parameters
[in,out]oraysGenerated rays.
[in]boundsBox in which rays will be generated.
[in]numRaysNumber of generated rays.
[in]closestHitFlag whether rays require closest hit.
[in]PosDirIf false, direction of generated rays will be absolute position in the scene.
[in,out]newBatchBatching flag.
[in]randomSeedRandom seed.
Returns
True if batch continues.

Definition at line 346 of file RayGen.cpp.

bool FW::RayGen::randomReflection ( RayBuffer orays,
RayBuffer irays,
Scene scene,
int  numSamples,
float  maxDist,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates random reflection rays.

Parameters
[in,out]oraysGenerated rays.
[in]iraysSource rays.
[in]sceneSource scene, necessary for normals.
[in]numSamplesNumber of reflection rays for each source ray.
[in]maxDistMaximum length of reflection rays.
[in,out]newBatchBatching flag.
[in]randomSeedRandom seed.
Returns
True if batch continues.

Definition at line 374 of file RayGen.cpp.

bool FW::RayGen::shadow ( RayBuffer orays,
RayBuffer irays,
int  numSamples,
const Vec3f lightPos,
float  lightRadius,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates shadow rays on the GPU. Batches rays if necessary.

Parameters
[in,out]oraysGenerated rays.
[in]iraysSource rays.
[in]numSamplesNumber of shadow rays for each source ray.
[in]lightPosPosition of a light source that casts these shadow rays.
[in]lightRadiusRadius of the light source.
[in,out]newBatchBatching flag.
[in]randomSeedRandom seed.
Returns
True if batch continues.

Definition at line 112 of file RayGen.cpp.

bool FW::RayGen::shadowCPU ( RayBuffer orays,
RayBuffer irays,
int  numSamples,
const Vec3f lightPos,
float  lightRadius,
bool &  newBatch,
U32  randomSeed = 0 
)

Generates shadow rays on the CPU. Batches rays if necessary.

Parameters
[in,out]oraysGenerated rays.
[in]iraysSource rays.
[in]numSamplesNumber of shadow rays for each source ray.
[in]lightPosPosition of a light source that casts these shadow rays.
[in]lightRadiusRadius of the light source.
[in,out]newBatchBatching flag.
[in]randomSeedRandom seed.
Returns
True if batch continues.

Definition at line 150 of file RayGen.cpp.


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