22 :
SLScene(
"Cook-Torrance Shading")
24 info(
"Cook-Torrance reflection model. Left-Right: roughness 0.05-1, Top-Down: metallic: 1-0. "
25 "The center sphere has roughness and metallic encoded in textures. "
26 "The reflection model produces a more physically based light reflection "
27 "than the standard Blinn-Phong reflection model.");
35 "rusty-metal_2048_C.jpg");
38 "rusty-metal_2048_N.jpg");
41 "rusty-metal_2048_M.jpg");
44 "rusty-metal_2048_R.jpg");
70 const SLint nrRows = 7;
71 const SLint nrCols = 7;
73 SLfloat maxX = (float)(nrCols - 1) * spacing * 0.5f;
74 SLfloat maxY = (float)(nrRows - 1) * spacing * 0.5f;
75 SLfloat deltaR = 1.0f / (float)(nrRows - 1);
76 SLfloat deltaM = 1.0f / (float)(nrCols - 1);
81 for (
SLint m = 0; m < nrRows; ++m)
84 for (
SLint r = 0; r < nrCols; ++r)
86 if (m == nrRows / 2 && r == nrCols / 2)
The AppCommon class holds the top-level instances of the app-demo.
Class declaration for an SLScene inherited class.
static SLDeviceRotation devRot
Mobile device rotation from IMU.
static SLDeviceLocation devLoc
Mobile device location from GPS.
static SLstring texturePath
Path to texture images.
static SLstring shaderPath
Path to GLSL shader programs.
void assemble(SLAssetManager *am, SLSceneView *sv) override
After parallel loading of the assets the scene gets assembled in here.
void registerAssetsToLoad(SLAssetLoader &al) override
All scene specific assets have to be registered for async loading in here.
void addProgramToLoad(SLGLProgram *&program, const SLstring &vertShaderFile, const SLstring &fragShaderFile)
Add generic GLSL program with shader files to load.
void addTextureToLoad(SLGLTexture *&texture, const SLstring &path, SLint min_filter=GL_LINEAR_MIPMAP_LINEAR, SLint mag_filter=GL_LINEAR, SLTextureType type=TT_unknown, SLint wrapS=GL_REPEAT, SLint wrapT=GL_REPEAT)
Add 2D textures with internal image allocation.
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()
SLLightDirect class for a directional light source.
static SLfloat gamma
final output gamma value
void attenuation(const SLfloat kConstant, const SLfloat kLinear, const SLfloat kQuadratic)
SLLightSpot class for a spot light source.
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 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)
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 SLRevolver.
T clamp(T a, T min, T max)