27 info(
"Per-vertex lighting with Blinn-Phong reflection model. "
28 "The reflection of 5 light sources is calculated per vertex. "
29 "The green and the white light are attached to the camera, the others are in the scene. "
30 "The light calculation per vertex is the fastest but leads to artefacts with spot lights");
34 info(
"Per-pixel lighting with Blinn-Phong reflection model. "
35 "The reflection of 5 light sources is calculated per pixel. "
36 "The light calculation is done in the fragment shader.");
45 "earth2048_C_Q95.jpg");
108 lightW->
rotate(-90, 1, 0, 0);
162 sphereL->
rotate(90, -1, 0, 0);
166 sphereR->
rotate(90, -1, 0, 0);
The AppCommon class holds the top-level instances of the app-demo.
Class declaration for an SLScene inherited class.
@ EC_outQuad
quadratic easing out, decelerating to zero velocity
@ AL_pingPongLoop
loop forward and backwards
SLVec3< SLfloat > SLVec3f
SLVec4< SLfloat > SLCol4f
static SLstring texturePath
Path to texture images.
static SLstring shaderPath
Path to GLSL shader programs.
AppDemoSceneShaderBlinn(SLstring name, bool perVertex)
void registerAssetsToLoad(SLAssetLoader &al) override
All scene specific assets have to be registered for async loading in here.
void assemble(SLAssetManager *am, SLSceneView *sv) override
After parallel loading of the assets the scene gets assembled in here.
SLAnimation * createNodeAnimation(SLfloat duration)
SLAnimation is the base container for all animation data.
SLNodeAnimTrack * createNodeAnimTrackForTranslation(SLNode *target, const SLVec3f &endPos)
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 focalDist(const SLfloat f)
SLBackground & background()
void addUniform1f(SLGLUniform1f *u)
add float uniform
SLLightDirect class for a directional light source.
void ambientColor(const SLCol4f &ambi)
void ambiDiffPowers(SLfloat ambiPow, SLfloat diffPow, const SLCol4f &ambiDiffCol=SLCol4f::WHITE)
Sets the ambient and diffuse powers with the same color.
void diffuseColor(const SLCol4f &diff)
void specularColor(const SLCol4f &spec)
void attenuation(const SLfloat kConstant, const SLfloat kLinear, const SLfloat kQuadratic)
Light node class for a rectangular light source.
SLLightSpot class for a spot light source.
Defines a standard CG material with textures and a shader program.
void shininess(SLfloat shin)
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 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.
SLAnimManager & animManager()
SceneView class represents a dynamic real time 3D view onto the scene.
void camera(SLCamera *camera)
SLSphere creates a sphere mesh based on SLRevolver.