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

Ray buffer class. Stores rays. More...

#include <RayBuffer.hpp>

Public Member Functions

 RayBuffer (S32 n=0, bool closestHit=true)
 Constructor. More...
 
S32 getSize () const
 Gets size of the buffer (number of rays). More...
 
void resize (S32 n)
 Resizes the buffer. More...
 
void setRay (S32 slot, const Ray &ray)
 Assigns ray to a slot. Id is same as slot. More...
 
void setRay (S32 slot, const Ray &ray, S32 id)
 Assigns ray to a slot and to an id. More...
 
void setResult (S32 slot, const RayResult &r)
 Assigns ray result to a slot. More...
 
const RaygetRayForSlot (S32 slot) const
 Gets a ray assigned to a given slot. More...
 
const RaygetRayForID (S32 id) const
 Gets a ray with a given id. More...
 
const RayResultgetResultForSlot (S32 slot) const
 Gets a ray result assigned to a given slot. More...
 
RayResultgetMutableResultForSlot (S32 slot)
 Gets a mutable ray assigned to a given slot. More...
 
const RayResultgetResultForID (S32 id) const
 Gets a ray result with a given id. More...
 
RayResultgetMutableResultForID (S32 id)
 Gets a mutable ray result with a given id. More...
 
S32 getSlotForID (S32 id) const
 Gets a ray slot for a given id. More...
 
S32 getIDForSlot (S32 slot) const
 Gets an id for a given ray slot. More...
 
void setNeedClosestHit (bool c)
 Sets whether the closet hit is needed. More...
 
bool getNeedClosestHit () const
 Returns whether the closest hit is needed. More...
 
void mortonSort ()
 Performs morton sort. More...
 
void randomSort (U32 randomSeed=0)
 Shuffles rays in the buffer. More...
 
BuffergetRayBuffer ()
 Gets ray buffer. More...
 
BuffergetResultBuffer ()
 Gets ray result buffer. More...
 
BuffergetIDToSlotBuffer ()
 Gets buffer mapping ids to slots. More...
 
BuffergetSlotToIDBuffer ()
 Gets buffer slots to ids. More...
 

Detailed Description

Ray buffer class. Stores rays.

Definition at line 38 of file RayBuffer.hpp.

Constructor & Destructor Documentation

FW::RayBuffer::RayBuffer ( S32  n = 0,
bool  closestHit = true 
)
inline

Constructor.

Parameters
[in]nSize of the buffer (number of rays).
[in]closestHitFlag whether closest hit is required.

Definition at line 46 of file RayBuffer.hpp.

Member Function Documentation

S32 FW::RayBuffer::getIDForSlot ( S32  slot) const
inline

Gets an id for a given ray slot.

Parameters
[in]slotSlot with the desired id. return Id of the given slot.

Definition at line 138 of file RayBuffer.hpp.

Buffer& FW::RayBuffer::getIDToSlotBuffer ( )
inline

Gets buffer mapping ids to slots.

Returns
Buffer mapping ids to slots.

Definition at line 179 of file RayBuffer.hpp.

RayResult& FW::RayBuffer::getMutableResultForID ( S32  id)
inline

Gets a mutable ray result with a given id.

Parameters
[in]idId of the mutable ray result.
Returns
Mutable ray result with the given id.

Definition at line 124 of file RayBuffer.hpp.

RayResult& FW::RayBuffer::getMutableResultForSlot ( S32  slot)
inline

Gets a mutable ray assigned to a given slot.

Parameters
[in]slotSlot where the mutable ray is saved.
Returns
Mutable ray from the given slot.

Definition at line 110 of file RayBuffer.hpp.

bool FW::RayBuffer::getNeedClosestHit ( ) const
inline

Returns whether the closest hit is needed.

Returns
Closest hit flag.

Definition at line 150 of file RayBuffer.hpp.

Buffer& FW::RayBuffer::getRayBuffer ( )
inline

Gets ray buffer.

Returns
Ray buffer.

Definition at line 167 of file RayBuffer.hpp.

const Ray& FW::RayBuffer::getRayForID ( S32  id) const
inline

Gets a ray with a given id.

Parameters
[in]idId of the ray.
Returns
Ray with the given id.

Definition at line 96 of file RayBuffer.hpp.

const Ray& FW::RayBuffer::getRayForSlot ( S32  slot) const
inline

Gets a ray assigned to a given slot.

Parameters
[in]slotSlot where the ray is saved.
Returns
Ray from the given slot.

Definition at line 89 of file RayBuffer.hpp.

Buffer& FW::RayBuffer::getResultBuffer ( )
inline

Gets ray result buffer.

Returns
Ray result buffer.

Definition at line 173 of file RayBuffer.hpp.

const RayResult& FW::RayBuffer::getResultForID ( S32  id) const
inline

Gets a ray result with a given id.

Parameters
[in]idId of the ray.
Returns
Ray result with the given id.

Definition at line 117 of file RayBuffer.hpp.

const RayResult& FW::RayBuffer::getResultForSlot ( S32  slot) const
inline

Gets a ray result assigned to a given slot.

Parameters
[in]slotSlot where the ray result is saved.
Returns
Ray result from the given slot.

Definition at line 103 of file RayBuffer.hpp.

S32 FW::RayBuffer::getSize ( void  ) const
inline

Gets size of the buffer (number of rays).

Returns
Size of the buffer.

Definition at line 52 of file RayBuffer.hpp.

S32 FW::RayBuffer::getSlotForID ( S32  id) const
inline

Gets a ray slot for a given id.

Parameters
idId of the slot.
Returns
Slot with the given id.

Definition at line 131 of file RayBuffer.hpp.

Buffer& FW::RayBuffer::getSlotToIDBuffer ( )
inline

Gets buffer slots to ids.

Returns
Buffer mapping slots to ids.

Definition at line 185 of file RayBuffer.hpp.

void FW::RayBuffer::mortonSort ( )

Performs morton sort.

Definition at line 103 of file RayBuffer.cpp.

void FW::RayBuffer::randomSort ( U32  randomSeed = 0)

Shuffles rays in the buffer.

Parameters
randomSeedRandom seed.

Definition at line 66 of file RayBuffer.cpp.

void FW::RayBuffer::resize ( S32  n)

Resizes the buffer.

Parameters
[in]nNew size (number of rays).

Definition at line 38 of file RayBuffer.cpp.

void FW::RayBuffer::setNeedClosestHit ( bool  c)
inline

Sets whether the closet hit is needed.

Parameters
[in]cClosest hit flag.

Definition at line 144 of file RayBuffer.hpp.

void FW::RayBuffer::setRay ( S32  slot,
const Ray ray 
)
inline

Assigns ray to a slot. Id is same as slot.

Parameters
[in]slotSlot for the ray.
[in]rayRay to be assigned.

Definition at line 65 of file RayBuffer.hpp.

void FW::RayBuffer::setRay ( S32  slot,
const Ray ray,
S32  id 
)

Assigns ray to a slot and to an id.

Parameters
[in]slotSlot for the ray.
[in]rayRay to be assigned.
[in]idId of the ray.

Definition at line 54 of file RayBuffer.cpp.

void FW::RayBuffer::setResult ( S32  slot,
const RayResult r 
)
inline

Assigns ray result to a slot.

Parameters
[in]slotSlot for the ray.
[in]rRay result to be assigned.

Definition at line 80 of file RayBuffer.hpp.


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