23 :
SLScene(
"Ray Tracing Spheres"),
27 info(
"Classic ray tracing scene with transparent and reflective "
28 "spheres. Be patient on mobile devices.");
31 name(
"Soft Shadow Ray Tracing");
32 info(
"Ray tracing with soft shadow light sampling. Each light "
33 "source is sampled 64x per pixel. Be patient on mobile devices.");
91 rect->
rotate(90, -1, 0, 0);
137 SLCol4f spec(0.8f, 0.8f, 0.8f);
179 rect->
rotate(90, -1, 0, 0);
245 SLNode* sGroup =
new SLNode(
new SLSphere(am, 0.5f * scale, resolution, resolution,
name, matGlass),
"SphereGroupRT");
248 sGroup->
addChild(
SphereGroupRT(am, depth, 0.643951f * scale, 0, 0.172546f * scale, scale / 3, newRes, matRed, matRed));
249 sGroup->
addChild(
SphereGroupRT(am, depth, 0.172546f * scale, 0, 0.643951f * scale, scale / 3, newRes, matRed, matRed));
250 sGroup->
addChild(
SphereGroupRT(am, depth, -0.471405f * scale, 0, 0.471405f * scale, scale / 3, newRes, matRed, matRed));
251 sGroup->
addChild(
SphereGroupRT(am, depth, -0.643951f * scale, 0, -0.172546f * scale, scale / 3, newRes, matRed, matRed));
252 sGroup->
addChild(
SphereGroupRT(am, depth, -0.172546f * scale, 0, -0.643951f * scale, scale / 3, newRes, matRed, matRed));
253 sGroup->
addChild(
SphereGroupRT(am, depth, 0.471405f * scale, 0, -0.471405f * scale, scale / 3, newRes, matRed, matRed));
254 sGroup->
addChild(
SphereGroupRT(am, depth, 0.272166f * scale, 0.544331f * scale, 0.272166f * scale, scale / 3, newRes, matRed, matRed));
255 sGroup->
addChild(
SphereGroupRT(am, depth, -0.371785f * scale, 0.544331f * scale, 0.099619f * scale, scale / 3, newRes, matRed, matRed));
256 sGroup->
addChild(
SphereGroupRT(am, depth, 0.099619f * scale, 0.544331f * scale, -0.371785f * scale, scale / 3, newRes, matRed, matRed));
The AppCommon class holds the top-level instances of the app-demo.
Definition of scene IDs in the demo app.
Class declaration for an SLScene inherited class.
#define SL_EXIT_MSG(message)
int SLSceneID
Scene identifier.
SLScene SLSceneView SLint sceneID
SLVec2< SLfloat > SLVec2f
SLVec4< SLfloat > SLCol4f
static SLDeviceRotation devRot
Mobile device rotation from IMU.
static SLDeviceLocation devLoc
Mobile device location from GPS.
void assemble(SLAssetManager *am, SLSceneView *sv) override
After parallel loading of the assets the scene gets assembled in here.
AppDemoSceneRTSpheres(SLSceneID sceneID)
SLNode * SphereGroupRT(SLAssetManager *am, SLint depth, SLfloat x, SLfloat y, SLfloat z, SLfloat scale, SLuint resolution, SLMaterial *matGlass, SLMaterial *matRed)
Creates a recursive sphere group used for the ray tracing scenes.
void registerAssetsToLoad(SLAssetLoader &al) override
All assets the should be loaded in parallel must be registered in here.
Toplevel holder of the assets meshes, materials, textures and shaders.
void colors(const SLCol4f &uniformColor)
Sets a uniform background color.
Active or visible camera node class.
void devRotLoc(SLDeviceRotation *devRot, SLDeviceLocation *devLoc)
void focalDist(const SLfloat f)
SLBackground & background()
void createsShadows(SLbool createsShadows)
void attenuation(const SLfloat kConstant, const SLfloat kLinear, const SLfloat kQuadratic)
void powers(SLfloat ambiPow, SLfloat diffPow, SLfloat specPow, const SLCol4f &ambiDiffSpecCol=SLCol4f::WHITE)
Sets the ambient, diffuse and specular powers all with the same color.
SLLightSpot class for a spot light source.
void samples(SLuint x, SLuint y)
void createShadowMap(float lightClipNear=0.1f, float lightClipFar=20.0f, SLVec2f size=SLVec2f(8, 8), SLVec2i texSize=SLVec2i(1024, 1024)) override
Defines a standard CG material with textures and a shader program.
SLNode represents a node in a hierarchical scene graph.
void addChild(SLNode *child)
void translation(const SLVec3f &pos, SLTransformSpace relativeTo=TS_parent)
void rotate(const SLQuat4f &rot, SLTransformSpace relativeTo=TS_object)
void castsShadows(SLbool castsShadows)
SLVec3f translationOS() const
void lookAt(SLfloat targetX, SLfloat targetY, SLfloat targetZ, SLfloat upX=0, SLfloat upY=1, SLfloat upZ=0, SLTransformSpace relativeTo=TS_world)
void translate(const SLVec3f &vec, SLTransformSpace relativeTo=TS_object)
const SLstring & name() const
SLRectangle creates a rectangular mesh with a certain resolution.
The SLScene class represents the top level instance holding the scene structure.
SceneView class represents a dynamic real time 3D view onto the scene.
void camera(SLCamera *camera)
SLSphere creates a sphere mesh based on SLSpheric w. 180 deg polar angle.