30 #define SL_MAXTRACE 15
56 SLRay* rayFromHitPoint);
178 if (nLenSqr > 1.0f + FLT_EPSILON || nLenSqr < 1.0f - FLT_EPSILON)
198 return ((mat->
specular().r > 0.0f) ||
220 return ((mat->
diffuse().r > 0.0f) ||
SLRayType
SLRayType enumeration for specifying ray type in ray tracing.
Defines a standard CG material with textures and a shader program.
void specular(const SLCol4f &spec)
void diffuse(const SLCol4f &diff)
void transmissive(const SLCol4f &transm)
An SLMesh object is a triangulated mesh, drawn with one draw call.
SLNode represents a node in a hierarchical scene graph.
Ray class with ray and intersection properties.
SLfloat tmax
max. dist. of last AABB intersection
SLint sign[3]
Sign of invDir for fast AABB hit in WS.
SLint hitTriangle
Points to the intersected triangle.
SLbool hitMatIsTransparent() const
Returns true if the hit material transmission color is not black.
SLVec3f origin
Vector to the origin of ray in WS.
static SLint depthReached
depth reached for a primary ray
static SLuint intersections
NO. of intersection.
static SLuint primaryRays
NO. of primary rays shot.
bool reflectMC(SLRay *reflected, const SLMat3f &rotMat) const
SLfloat lightDist
Distance to light for shadow rays.
static SLuint tirRays
NO. of TIR refraction rays.
SLRayType type
PRIMARY, REFLECTED, REFRACTED, SHADOW.
SLint srcTriangle
Points to the triangle at ray origin.
SLCol4f backgroundColor
Background color at pixel x,y.
static SLuint tests
NO. of intersection tests.
SLMesh * hitMesh
Points to the intersected mesh.
SLbool isOutside
Flag if ray is inside of a material.
static SLuint reflectedRays
NO. of reflected rays.
SLint depth
Recursion depth for ray tracing.
SLfloat hitAO
Ambient occlusion factor at intersection point.
SLVec3f dir
Direction vector of ray in WS.
SLVec3f invDirOS
Inverse ray dir for fast AABB hit in OS.
SLMesh * srcMesh
Points to the mesh at ray origin.
void refract(SLRay *refracted)
SLbool hitMatIsReflective() const
Returns true if the hit material specular color is not black.
SLfloat tmin
min. dist. of last AABB intersection
static SLint maxDepthReached
max. depth reached for all rays
static SLuint refractedRays
NO. of refracted rays.
SLfloat length
length from origin to an intersection
SLNode * hitNode
Points to the intersected node.
void setDirOS(const SLVec3f &Dir)
Setter for the rays direction in object space also setting the inverse direction.
static SLuint ignoredRays
NO. of ignore refraction rays.
SLfloat contrib
Current contribution of ray to color.
static SLuint subsampledPixels
NO. of of subsampled pixels.
SLbool isInsideVolume
Flag if ray is in Volume.
SLVec3f hitPoint
Point of intersection.
void diffuseMC(SLRay *scattered) const
static SLuint totalNumRays()
Total NO. of rays shot during RT.
SLNode * srcNode
Points to the node at ray origin.
void setDir(const SLVec3f &Dir)
Setter for the rays direction in world space also setting the inverse direction.
SLVec3f dirOS
Direction vector of ray in OS.
static SLfloat avgDepth
average depth reached
static SLfloat minContrib
Min. contibution to color (1/256)
void reflect(SLRay *reflected) const
SLint signOS[3]
Sign of invDir for fast AABB hit in OS.
static SLuint subsampledRays
NO. of of subsampled rays.
SLCol4f hitTexColor
Color at intersection for texture or color attributes.
SLfloat y
Pixel position for primary rays.
SLVec3f invDir
Inverse ray dir for fast AABB hit in WS.
SLVec3f originOS
Vector to the origin of ray in OS.
void refractMC(SLRay *refracted, const SLMat3f &rotMat) const
static SLuint shadowRays
NO. of shadow rays.
SLVec3f hitNormal
Surface normal at intersection point.
SLSceneView * sv
Pointer to the sceneview.
SLbool hitMatIsDiffuse() const
Returns true if the hit material diffuse color is not black.
SLbool isShaded() const
Returns true if a shadow ray hits an object on the ray to the light.
static SLint maxDepth
Max. recursion depth.
SLfloat hitV
barycentric coords in hit triangle
SceneView class represents a dynamic real time 3D view onto the scene.