30 #define SL_MAXTRACE 15
56 SLRay* rayFromHitPoint);
181 if (nLenSqr > 1.0f + FLT_EPSILON || nLenSqr < 1.0f - FLT_EPSILON)
201 return ((mat->
specular().r > 0.0f) ||
223 return ((mat->
diffuse().r > 0.0f) ||
float SLfloat
analog to GLfloat
unsigned int SLuint
analog to GLuint
bool SLbool
analog to GLbool
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.
SLint signOS[3]
Sign of invDir for fast AABB hit in OS.
SLfloat tmax
max. dist. of last AABB intersection
static SLint maxDepth
Max. recursion depth.
static SLuint shadowRays
NO. of shadow rays.
SLint hitTriangle
Points to the intersected triangle.
static SLuint tirRays
NO. of TIR refraction rays.
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 SLuint primaryRays
NO. of primary rays shot.
bool reflectMC(SLRay *reflected, const SLMat3f &rotMat) const
SLfloat lightDist
Distance to light for shadow rays.
SLRayType type
PRIMARY, REFLECTED, REFRACTED, SHADOW.
SLint srcTriangle
Points to the triangle at ray origin.
static SLuint intersections
NO. of intersection.
SLCol4f backgroundColor
Background color at pixel x,y.
static SLint depthReached
depth reached for a primary ray
static SLfloat minContrib
Min. contibution to color (1/256)
SLMesh * hitMesh
Points to the intersected mesh.
SLbool isOutside
Flag if ray is inside of a material.
static SLint maxDepthReached
max. depth reached for all 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)
static SLMat3f lobeToWorld(const SLVec3f &lobeAxis)
Rotation matrix that maps a sample drawn around +z onto lobeAxis.
SLbool hitMatIsReflective() const
Returns true if the hit material specular color is not black.
SLint sign[3]
Sign of invDir for fast AABB hit in WS.
SLfloat tmin
min. dist. of last AABB intersection
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.
SLbool isInsideVolume
Flag if ray is in Volume.
SLVec3f hitPoint
Point of intersection.
void diffuseMC(SLRay *scattered) const
static SLuint subsampledPixels
NO. of of subsampled pixels.
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.
bool refractMC(SLRay *refracted, const SLMat3f &rotMat) const
static SLuint tests
NO. of intersection tests.
void reflect(SLRay *reflected) const
static SLuint reflectedRays
NO. of reflected 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.
SLVec3f hitNormal
Surface normal at intersection point.
SLSceneView * sv
Pointer to the sceneview.
static SLfloat avgDepth
average depth reached
SLbool hitMatIsDiffuse() const
Returns true if the hit material diffuse color is not black.
SLRay(SLSceneView *sv=nullptr)
default ctor
SLbool isShaded() const
Returns true if a shadow ray hits an object on the ray to the light.
static SLuint refractedRays
NO. of refracted rays.
SLfloat hitV
barycentric coords in hit triangle
static SLuint subsampledRays
NO. of of subsampled rays.
SceneView class represents a dynamic real time 3D view onto the scene.