Clarisse 5.0 SP8 SDK  5.0.5.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
CtxSceneObject Class Reference

This class describes the context of an object in the scene. It allows to raytrace a single object without passing by the GAS of a group. More...

Public Member Functions

 CtxSceneObject (const CtxSceneObject &src)
 
bool init (const GeometryRaytraceCtx &ray_ctx)
 Init from a valid raytracing context.
 
bool init (const GeometryRaytraceCtx &ray_ctx, const int &first_ray, const int &last_ray)
 Init from a valid raytracing context.
 
const unsigned int & get_packet_size () const
 Get the size of the packet.
 
bool ray_hit_nearest (const CtxEval &eval_ctx, CtxShader &shader_ctx, GeometryRaytraceData &ray_data, const bool &overwrite=true) const
 Raytrace the object described by the current context.
 
CtxSceneObject operator[] (const unsigned int &index) const
 Restrain the context to a single element in the packet.
 
CtxSceneObjectoperator= (const CtxSceneObject &src)
 Copy another context.
 

Detailed Description

This class describes the context of an object in the scene. It allows to raytrace a single object without passing by the GAS of a group.

Member Function Documentation

const unsigned int& CtxSceneObject::get_packet_size ( ) const
inline

Get the size of the packet.

Returns
the size of the packet
bool CtxSceneObject::init ( const GeometryRaytraceCtx ray_ctx)

Init from a valid raytracing context.

Parameters
ray_ctxthe raytracing context
Returns
false if the raytracing context is invalid, else true
Note
In order to work correctly, this should be used from an intersection or object filter (see GeometryRaytraceCtx). The function will record only the data corresponding to the current packet (between ray_ctx.get_first_index() and ray_ctx.get_last_index()).
bool CtxSceneObject::init ( const GeometryRaytraceCtx ray_ctx,
const int &  first_ray,
const int &  last_ray 
)

Init from a valid raytracing context.

Parameters
ray_ctxthe raytracing context
first_raythe first ray to consider
last_raythe last ray to consider
Returns
false if the raytracing context is invalid, else true
Note
In order to work correctly, this should be used from an intersection or object filter (see GeometryRaytraceCtx) The function will record only the data corresponding to rays between first_ray and last_ray
CtxSceneObject & CtxSceneObject::operator= ( const CtxSceneObject src)

Copy another context.

Parameters
srcthe source context
Returns
the current context
CtxSceneObject CtxSceneObject::operator[] ( const unsigned int &  index) const

Restrain the context to a single element in the packet.

Parameters
indexthe index of the element to consider
Returns
a restrained context
bool CtxSceneObject::ray_hit_nearest ( const CtxEval eval_ctx,
CtxShader shader_ctx,
GeometryRaytraceData ray_data,
const bool &  overwrite = true 
) const

Raytrace the object described by the current context.

Parameters
eval_ctxa valid evaluation context
shader_ctxa valid shading context
ray_datathe raytracing data to use
overwritewhen true, it overwrites any intersection that already exist, else it appends new ones
Returns
false if the current context is not initialized correctly or if it doesn't match to the given raytracing data.
Note
In order to work correctly, the size of the current context must correspond to the size of the packet in the raytracing data.