110 const SLchar*
name = (
const char*)
"Uniform color");
155 return (
_textures[tt].size() > texIndex &&
156 _textures[tt][texIndex]->uvIndex() == uvIndex);
179 if (shin < 0.0f) shin = 0.0;
186 if (
kr < 0.0f)
kr = 0.0f;
187 if (
kr > 1.0f)
kr = 1.0f;
192 if (
kt < 0.0f)
kt = 0.0f;
193 if (
kt > 1.0f)
kt = 1.0f;
SLReflectionModel
Light Reflection Models for shader generation usd in SLMaterial.
SLTextureType
Texture type enumeration & their filename appendix for auto type detection.
vector< SLGLTexture * > SLVGLTexture
STL vector of SLGLTexture pointers.
vector< SLLight * > SLVLight
STL vector of light pointers.
vector< SLMaterial * > SLVMaterial
STL vector of material pointers.
deque< SLNode * > SLVNode
SLVNode typedef for a vector of SLNodes.
Toplevel holder of the assets meshes, materials, textures and shaders.
Active or visible camera node class.
Encapsulation of an OpenGL shader program object.
static SLGLProgramGeneric * get(SLStdShaderProg id)
Get program reference for given id.
Texture object for OpenGL texturing.
Global default color attribute material for meshes that have colors per vertex.
SLMaterialDefaultColorAttribute()
static void deleteInstance()
static SLMaterialDefaultColorAttribute * _instance
static SLMaterialDefaultColorAttribute * instance()
Global default gray color material for meshes that don't define their own.
static SLMaterialDefaultGray * _instance
static void deleteInstance()
static SLMaterialDefaultGray * instance()
Defines a standard CG material with textures and a shader program.
void ps(SLParticleSystem *ps)
SLCol4f _emissive
emissive color coefficients
SLCol4f _specular
specular color (RGB reflection coefficients)
SLfloat shininess() const
SLfloat _kt
transmission coefficient 0.0 - 1.0 used for ray and path tracing
SLMaterial(SLAssetManager *am, const SLchar *name, const SLCol4f &amdi=SLCol4f::WHITE, const SLCol4f &spec=SLCol4f::WHITE, SLfloat shininess=100.0f, SLfloat kr=0.0, SLfloat kt=0.0f, SLfloat kn=1.0f, SLGLProgram *program=nullptr)
Default ctor for Blinn-Phong reflection model materials without textures.
static SLfloat K
PM: Constant of gloss calibration (slope of point light at dist 1)
SLbool getsShadows() const
SLstring texturesString()
Returns a unique string that represent all textures used.
void translucency(SLfloat transl)
SLfloat _kr
reflection coefficient 0.0 - 1.0 used for ray and path tracing
static SLfloat PERFECT
PM: shininess/translucency limit.
void reflectionModel(SLReflectionModel rm)
SLVNode & nodesVisible2D()
SLVGLTexture _textures[TT_numTextureType]
array of texture vectors one for each type
void specular(const SLCol4f &spec)
SLAssetManager * _assetManager
pointer to the asset manager (the owner) if available
SLint passToUniforms(SLGLProgram *program, SLint nextTexUnit)
Passes all material parameters as uniforms to the passed shader program.
SLVGLTexture _textures3d
texture vector for diffuse 3D textures
SLbool has3DTexture()
Returns true if a material has a 3D texture.
SLfloat _metalness
metallic property (0-1) in Cook-Torrance model
void programTF(SLGLProgram *sp)
void removeTextureType(SLTextureType tt)
void skybox(SLSkybox *sb)
SLGLProgram * _programTF
pointer to a GLSL shader program for transformFeedback
SLfloat _roughness
roughness property (0-1) in Cook-Torrance model
void diffuse(const SLCol4f &diff)
SLVNode _nodesVisible3D
Vector of all visible 3D nodes of with this material.
void generateProgramPS(bool drawInstanced=false)
SLCol4f _ambient
ambient color (RGB reflection coefficients)
SLCol4f _diffuse
diffuse color (RGB reflection coefficients)
SLbool _getsShadows
true if shadows are visible on this material
SLfloat roughness() const
SLfloat metalness() const
void assetManager(SLAssetManager *am)
void addTexture(SLGLTexture *texture)
Adds the passed texture to the equivalent texture type vector.
SLbool hasTextureTypeWithUVIndex(SLTextureType tt, SLuint texIndex, SLbyte uvIndex)
void activate(SLCamera *cam, SLVLight *lights, SLbool supportGPUSkinning)
SLbool hasAlpha()
Returns true if there is any transparency in diffuse alpha or textures.
void shininess(SLfloat shin)
void ambient(const SLCol4f &ambi)
void ambientDiffuse(const SLCol4f &am_di)
SLAssetManager * assetManager()
SLVNode _nodesVisible2D
Vector of all visible 2D nodes of with this material.
SLVNode & nodesVisible3D()
SLVGLTexture & textures(SLTextureType type)
SLCol4f _transmissive
transmissive color (RGB reflection coefficients) for path tracing
SLParticleSystem * _ps
pointer to a particle system
void transmissive(const SLCol4f &transm)
SLGLProgram * _program
pointer to a GLSL shader program
SLfloat translucency() const
SLVGLTexture & textures3d()
void roughness(SLfloat r)
SLbool hasTextureType(SLTextureType tt)
void emissive(const SLCol4f &emis)
SLSkybox * _skybox
pointer to the skybox
SLfloat _kn
refraction index
SLbool usesUVIndex(SLbyte uvIndex)
Returns true if the specified uvIndex is used by one of the textures.
SLReflectionModel _reflectionModel
reflection model (RM_BlinnPhong or RM_CookTorrance)
void metalness(SLfloat m)
void program(SLGLProgram *sp)
SLGLTexture * _errorTexture
pointer to error texture that is shown if another texture fails
void getsShadows(SLbool receivesShadows)
SLint _numTextures
number of textures in all _textures vectors array
SLfloat _shininess
shininess exponent in Blinn-Phong model
SLGLProgram * programTF()
SLstring _compileErrorTexFilePath
path to the error texture
SLReflectionModel reflectionModel()
SLfloat _translucency
translucency exponent for light refraction for path tracing
Base class for all other classes.
const SLstring & name() const
SLParticleSystem creates a particle meshes from a point primitive buffer.
SceneView class represents a dynamic real time 3D view onto the scene.
Skybox node class with a SLBox mesh.
T clamp(T a, T min, T max)