NTrace
GPU ray tracing framework
|
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... | |
Ray generator class. Generates rays for both the GPU and the CPU.
Definition at line 47 of file RayGen.hpp.
FW::RayGen::RayGen | ( | S32 | maxBatchSize = 8*1024*1024 | ) |
Constructor.
[in] | maxBatchSize | Maximum number of secondary rays in one batch. |
Definition at line 35 of file RayGen.cpp.
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.
[in,out] | orays | Generated rays. |
[in] | irays | Source rays. |
[in] | scene | Source scene. |
[in] | numSamples | Number of ao rays for each source ray. |
[in] | maxDist | Maximum length of generated rays. |
[in,out] | newBatch | Batching flag. [aram[in] randomSeed Random seed. |
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.
[in,out] | orays | Generated rays. |
[in] | irays | Source rays. |
[in] | scene | Source scene. |
[in] | numSamples | Number of ao rays for each source ray. |
[in] | maxDist | Maximum length of generated rays. |
[in,out] | newBatch | Batching flag. |
[in] | randomSeed | Random seed. |
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.
[in,out] | Generated | rays. |
[in] | origin | Point from which rays will be cast. |
[in] | nscreenToWorld | Transformation view matrix. |
[in] | w | Horizontal resolution. |
[in] | h | Vertical resolution. |
[in] | maxDist | Maximum 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.
[in,out] | Generated | rays. |
[in] | origin | Point from which rays will be cast. |
[in] | nscreenToWorld | Transformation view matrix. |
[in] | w | Horizontal resolution. |
[in] | h | Vertical resolution. |
[in] | maxDist | Maximum 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.
[in,out] | orays | Generated rays. |
[in] | bounds | Box in which rays will be generated. |
[in] | numRays | Number of generated rays. |
[in] | closestHit | Flag whether rays require closest hit. |
[in] | PosDir | If false, direction of generated rays will be absolute position in the scene. |
[in] | randomSeed | Random seed. |
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.
[in,out] | orays | Generated rays. |
[in] | bounds | Box in which rays will be generated. |
[in] | numRays | Number of generated rays. |
[in] | closestHit | Flag whether rays require closest hit. |
[in] | PosDir | If false, direction of generated rays will be absolute position in the scene. |
[in,out] | newBatch | Batching flag. |
[in] | randomSeed | Random seed. |
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.
[in,out] | orays | Generated rays. |
[in] | irays | Source rays. |
[in] | scene | Source scene, necessary for normals. |
[in] | numSamples | Number of reflection rays for each source ray. |
[in] | maxDist | Maximum length of reflection rays. |
[in,out] | newBatch | Batching flag. |
[in] | randomSeed | Random seed. |
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.
[in,out] | orays | Generated rays. |
[in] | irays | Source rays. |
[in] | numSamples | Number of shadow rays for each source ray. |
[in] | lightPos | Position of a light source that casts these shadow rays. |
[in] | lightRadius | Radius of the light source. |
[in,out] | newBatch | Batching flag. |
[in] | randomSeed | Random seed. |
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.
[in,out] | orays | Generated rays. |
[in] | irays | Source rays. |
[in] | numSamples | Number of shadow rays for each source ray. |
[in] | lightPos | Position of a light source that casts these shadow rays. |
[in] | lightRadius | Radius of the light source. |
[in,out] | newBatch | Batching flag. |
[in] | randomSeed | Random seed. |
Definition at line 150 of file RayGen.cpp.