1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +03:00

0032201: Visualization, TKOpenGl - unify Phong/PBR material properties getters

Graphic3d_ShaderManager::stdComputeLighting() - implementation has been adjusted
for better consistency between PBR / non-PBR.

OpenGl_Material definition has been modified to join Front/Back pair into a single uniform variable.
Common material definition now occupies 4x2 vec4 instead of 5x2 vec4.

Getters of Common material properties within Declarations.glsl
have been renamed to match PBR material syntax (e.g. take IsFront flag as function argument).
Auxliary macros (like occTextureColor()) has been renamed (like occMaterialBaseColor())
and adjusted to return material property directly instead of taking it as argument.
This commit is contained in:
kgv
2021-03-05 17:26:47 +03:00
committed by bugmaster
parent a604968547
commit 941f6cae55
23 changed files with 245 additions and 273 deletions

View File

@@ -203,22 +203,15 @@ float occPBRMaterial_Metallic(in bool theIsFront); //!< Metallic coefficient
float occPBRMaterial_NormalizedRoughness(in bool theIsFront); //!< Normalized roughness coefficient
vec3 occPBRMaterial_Emission(in bool theIsFront); //!< Light intensity emitted by material
float occPBRMaterial_IOR(in bool theIsFront); //!< Index of refraction
#define occMaterial_Emission occPBRMaterial_Emission
#define occMaterial_Color occPBRMaterial_Color
#else
// Front material properties accessors
vec4 occFrontMaterial_Emission(void); //!< Emission color
vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection
vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection
vec4 occFrontMaterial_Specular(void); //!< Specular reflection
float occFrontMaterial_Shininess(void); //!< Specular exponent
float occFrontMaterial_Transparency(void); //!< Transparency coefficient
// Back material properties accessors
vec4 occBackMaterial_Emission(void); //!< Emission color
vec4 occBackMaterial_Ambient(void); //!< Ambient reflection
vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection
vec4 occBackMaterial_Specular(void); //!< Specular reflection
float occBackMaterial_Shininess(void); //!< Specular exponent
float occBackMaterial_Transparency(void); //!< Transparency coefficient
vec4 occMaterial_Diffuse(in bool theIsFront); //!< Diffuse reflection
vec3 occMaterial_Specular(in bool theIsFront); //!< Specular reflection
float occMaterial_Shininess(in bool theIsFront); //!< Specular exponent
vec3 occMaterial_Ambient(in bool theIsFront); //!< Ambient reflection
vec3 occMaterial_Emission(in bool theIsFront); //!< Emission color
#define occMaterial_Color occMaterial_Diffuse
#endif
#ifdef THE_HAS_DEFAULT_SAMPLER
@@ -227,24 +220,24 @@ float occBackMaterial_Transparency(void); //!< Transparency coefficient
uniform sampler2D occSampler0; //!< current active sampler;
#endif //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing
#if defined(THE_HAS_TEXTURE_COLOR)
#define occTextureColor(theMatColor, theTexCoord) (theMatColor * occTexture2D(occSamplerBaseColor, theTexCoord))
#if defined(THE_HAS_TEXTURE_COLOR) && defined(FRAGMENT_SHADER)
#define occMaterialBaseColor(theIsFront, theTexCoord) (occMaterial_Color(theIsFront) * occTexture2D(occSamplerBaseColor, theTexCoord))
#else
#define occTextureColor(theMatColor, theTexCoord) theMatColor
#define occMaterialBaseColor(theIsFront, theTexCoord) occMaterial_Color(theIsFront)
#endif
#if defined(THE_HAS_TEXTURE_OCCLUSION) && defined(FRAGMENT_SHADER)
uniform sampler2D occSamplerOcclusion; //!< R occlusion texture sampler
#define occTextureOcclusion(theColor, theTexCoord) theColor *= occTexture2D(occSamplerOcclusion, theTexCoord).r;
#define occMaterialOcclusion(theColor, theTexCoord) theColor *= occTexture2D(occSamplerOcclusion, theTexCoord).r;
#else
#define occTextureOcclusion(theColor, theTexCoord)
#define occMaterialOcclusion(theColor, theTexCoord)
#endif
#if defined(THE_HAS_TEXTURE_EMISSIVE) && defined(FRAGMENT_SHADER)
uniform sampler2D occSamplerEmissive; //!< RGB emissive texture sampler
#define occTextureEmissive(theMatEmis, theTexCoord) (theMatEmis * occTexture2D(occSamplerEmissive, theTexCoord).rgb)
#define occMaterialEmission(theIsFront, theTexCoord) (occMaterial_Emission(theIsFront) * occTexture2D(occSamplerEmissive, theTexCoord).rgb)
#else
#define occTextureEmissive(theMatEmis, theTexCoord) theMatEmis
#define occMaterialEmission(theIsFront, theTexCoord) occMaterial_Emission(theIsFront)
#endif
#if defined(THE_HAS_TEXTURE_NORMAL) && defined(FRAGMENT_SHADER)
@@ -256,11 +249,11 @@ uniform sampler2D occSamplerNormal; //!< XYZ normal texture sampler with W=
#if defined(THE_HAS_TEXTURE_METALROUGHNESS) && defined(FRAGMENT_SHADER)
uniform sampler2D occSamplerMetallicRoughness; //!< BG metallic-roughness texture sampler
#define occTextureRoughness(theRoug, theTexCoord) (theRoug * occTexture2D(occSamplerMetallicRoughness, theTexCoord).g)
#define occTextureMetallic(theMet, theTexCoord) (theMet * occTexture2D(occSamplerMetallicRoughness, theTexCoord).b)
#define occMaterialRoughness(theIsFront, theTexCoord) (occPBRMaterial_NormalizedRoughness(theIsFront) * occTexture2D(occSamplerMetallicRoughness, theTexCoord).g)
#define occMaterialMetallic(theIsFront, theTexCoord) (occPBRMaterial_Metallic(theIsFront) * occTexture2D(occSamplerMetallicRoughness, theTexCoord).b)
#else
#define occTextureRoughness(theRoug, theTexCoord) theRoug
#define occTextureMetallic(theMet, theTexCoord) theMet
#define occMaterialRoughness(theIsFront, theTexCoord) occPBRMaterial_NormalizedRoughness(theIsFront)
#define occMaterialMetallic(theIsFront, theTexCoord) occPBRMaterial_Metallic(theIsFront)
#endif
uniform vec4 occColor; //!< color value (in case of disabled lighting)

View File

@@ -94,33 +94,23 @@ vec3 occDiffIBLMap (in vec3 theNormal)
// front and back material properties accessors
#if defined(THE_IS_PBR)
uniform vec4 occPbrFrontMaterial[3];
uniform vec4 occPbrBackMaterial[3];
uniform vec4 occPbrMaterial[3 * 2];
#define MIN_ROUGHNESS 0.01
float occRoughness (in float theNormalizedRoughness) { return theNormalizedRoughness * (1.0 - MIN_ROUGHNESS) + MIN_ROUGHNESS; }
vec4 occPBRMaterial_Color(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[0] : occPbrBackMaterial[0]; }
vec3 occPBRMaterial_Emission(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[1].rgb : occPbrBackMaterial[1].rgb; }
float occPBRMaterial_IOR(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[1].w : occPbrBackMaterial[1].w; }
float occPBRMaterial_Metallic(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[2].b : occPbrBackMaterial[2].b; }
float occPBRMaterial_NormalizedRoughness(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[2].g : occPbrBackMaterial[2].g; }
vec4 occPBRMaterial_Color(in bool theIsFront) { return theIsFront ? occPbrMaterial[0] : occPbrMaterial[3]; }
vec3 occPBRMaterial_Emission(in bool theIsFront) { return theIsFront ? occPbrMaterial[1].rgb : occPbrMaterial[4].rgb; }
float occPBRMaterial_IOR(in bool theIsFront) { return theIsFront ? occPbrMaterial[1].w : occPbrMaterial[4].w; }
float occPBRMaterial_Metallic(in bool theIsFront) { return theIsFront ? occPbrMaterial[2].b : occPbrMaterial[5].b; }
float occPBRMaterial_NormalizedRoughness(in bool theIsFront) { return theIsFront ? occPbrMaterial[2].g : occPbrMaterial[5].g; }
#else
uniform vec4 occFrontMaterial[5];
uniform vec4 occBackMaterial[5];
uniform vec4 occCommonMaterial[4 * 2];
vec4 occFrontMaterial_Ambient(void) { return occFrontMaterial[0]; }
vec4 occFrontMaterial_Diffuse(void) { return occFrontMaterial[1]; }
vec4 occFrontMaterial_Specular(void) { return occFrontMaterial[2]; }
vec4 occFrontMaterial_Emission(void) { return occFrontMaterial[3]; }
float occFrontMaterial_Shininess(void) { return occFrontMaterial[4].x; }
float occFrontMaterial_Transparency(void) { return occFrontMaterial[4].y; }
vec4 occBackMaterial_Ambient(void) { return occBackMaterial[0]; }
vec4 occBackMaterial_Diffuse(void) { return occBackMaterial[1]; }
vec4 occBackMaterial_Specular(void) { return occBackMaterial[2]; }
vec4 occBackMaterial_Emission(void) { return occBackMaterial[3]; }
float occBackMaterial_Shininess(void) { return occBackMaterial[4].x; }
float occBackMaterial_Transparency(void) { return occBackMaterial[4].y; }
vec4 occMaterial_Diffuse(in bool theIsFront) { return theIsFront ? occCommonMaterial[0] : occCommonMaterial[4]; }
vec3 occMaterial_Emission(in bool theIsFront) { return theIsFront ? occCommonMaterial[1].rgb : occCommonMaterial[5].rgb; }
vec3 occMaterial_Specular(in bool theIsFront) { return theIsFront ? occCommonMaterial[2].rgb : occCommonMaterial[6].rgb; }
float occMaterial_Shininess(in bool theIsFront) { return theIsFront ? occCommonMaterial[2].a : occCommonMaterial[6].a; }
vec3 occMaterial_Ambient(in bool theIsFront) { return theIsFront ? occCommonMaterial[3].rgb : occCommonMaterial[7].rgb; }
#endif
// 2D texture coordinates transformation

View File

@@ -21,7 +21,7 @@ void occDirectionalLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));
}
Diffuse += occLight_Diffuse (theId) * aNdotL * theShadow;

View File

@@ -28,7 +28,7 @@ void occPointLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));
}
Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;

View File

@@ -50,7 +50,7 @@ void pointLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, gl_FrontFacing ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (gl_FrontFacing));
}
Diffuse += occLight_Diffuse (theId).rgb * aNdotL * anAtten;
@@ -101,7 +101,7 @@ void spotLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, gl_FrontFacing ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (gl_FrontFacing));
}
Diffuse += occLight_Diffuse (theId).rgb * aNdotL * anAtten;
@@ -128,7 +128,7 @@ void directionalLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, gl_FrontFacing ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (gl_FrontFacing));
}
Diffuse += occLight_Diffuse (theId).rgb * aNdotL;
@@ -162,15 +162,15 @@ vec4 computeLighting (in vec3 theNormal,
}
}
vec4 aMaterialAmbient = gl_FrontFacing ? occFrontMaterial_Ambient() : occBackMaterial_Ambient();
vec4 aMaterialDiffuse = gl_FrontFacing ? occFrontMaterial_Diffuse() : occBackMaterial_Diffuse();
vec4 aMaterialSpecular = gl_FrontFacing ? occFrontMaterial_Specular() : occBackMaterial_Specular();
vec4 aMaterialEmission = gl_FrontFacing ? occFrontMaterial_Emission() : occBackMaterial_Emission();
vec3 aColor = Ambient * aMaterialAmbient.rgb
+ Diffuse * aMaterialDiffuse.rgb
+ Specular * aMaterialSpecular.rgb
+ aMaterialEmission.rgb;
return vec4 (aColor, aMaterialDiffuse.a);
vec3 aMatAmbient = occMaterial_Ambient (gl_FrontFacing);
vec4 aMatDiffuse = occMaterial_Diffuse (gl_FrontFacing);
vec3 aMatSpecular = occMaterial_Specular(gl_FrontFacing);
vec3 aMatEmission = occMaterial_Emission(gl_FrontFacing);
vec3 aColor = Ambient * aMatAmbient.rgb
+ Diffuse * aMatDiffuse.rgb
+ Specular * aMatSpecular.rgb
+ aMatEmission.rgb;
return vec4 (aColor, aMatDiffuse.a);
}
//! Entry point to the Fragment Shader

View File

@@ -43,7 +43,7 @@ void occSpotLight (in int theId,
float aSpecl = 0.0;
if (aNdotL > 0.0)
{
aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());
aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));
}
Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;

View File

@@ -97,33 +97,23 @@ static const char Shaders_DeclarationsImpl_glsl[] =
"\n"
"// front and back material properties accessors\n"
"#if defined(THE_IS_PBR)\n"
"uniform vec4 occPbrFrontMaterial[3];\n"
"uniform vec4 occPbrBackMaterial[3];\n"
"uniform vec4 occPbrMaterial[3 * 2];\n"
"\n"
"#define MIN_ROUGHNESS 0.01\n"
"float occRoughness (in float theNormalizedRoughness) { return theNormalizedRoughness * (1.0 - MIN_ROUGHNESS) + MIN_ROUGHNESS; }\n"
"vec4 occPBRMaterial_Color(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[0] : occPbrBackMaterial[0]; }\n"
"vec3 occPBRMaterial_Emission(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[1].rgb : occPbrBackMaterial[1].rgb; }\n"
"float occPBRMaterial_IOR(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[1].w : occPbrBackMaterial[1].w; }\n"
"float occPBRMaterial_Metallic(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[2].b : occPbrBackMaterial[2].b; }\n"
"float occPBRMaterial_NormalizedRoughness(in bool theIsFront) { return theIsFront ? occPbrFrontMaterial[2].g : occPbrBackMaterial[2].g; }\n"
"vec4 occPBRMaterial_Color(in bool theIsFront) { return theIsFront ? occPbrMaterial[0] : occPbrMaterial[3]; }\n"
"vec3 occPBRMaterial_Emission(in bool theIsFront) { return theIsFront ? occPbrMaterial[1].rgb : occPbrMaterial[4].rgb; }\n"
"float occPBRMaterial_IOR(in bool theIsFront) { return theIsFront ? occPbrMaterial[1].w : occPbrMaterial[4].w; }\n"
"float occPBRMaterial_Metallic(in bool theIsFront) { return theIsFront ? occPbrMaterial[2].b : occPbrMaterial[5].b; }\n"
"float occPBRMaterial_NormalizedRoughness(in bool theIsFront) { return theIsFront ? occPbrMaterial[2].g : occPbrMaterial[5].g; }\n"
"#else\n"
"uniform vec4 occFrontMaterial[5];\n"
"uniform vec4 occBackMaterial[5];\n"
"uniform vec4 occCommonMaterial[4 * 2];\n"
"\n"
"vec4 occFrontMaterial_Ambient(void) { return occFrontMaterial[0]; }\n"
"vec4 occFrontMaterial_Diffuse(void) { return occFrontMaterial[1]; }\n"
"vec4 occFrontMaterial_Specular(void) { return occFrontMaterial[2]; }\n"
"vec4 occFrontMaterial_Emission(void) { return occFrontMaterial[3]; }\n"
"float occFrontMaterial_Shininess(void) { return occFrontMaterial[4].x; }\n"
"float occFrontMaterial_Transparency(void) { return occFrontMaterial[4].y; }\n"
"\n"
"vec4 occBackMaterial_Ambient(void) { return occBackMaterial[0]; }\n"
"vec4 occBackMaterial_Diffuse(void) { return occBackMaterial[1]; }\n"
"vec4 occBackMaterial_Specular(void) { return occBackMaterial[2]; }\n"
"vec4 occBackMaterial_Emission(void) { return occBackMaterial[3]; }\n"
"float occBackMaterial_Shininess(void) { return occBackMaterial[4].x; }\n"
"float occBackMaterial_Transparency(void) { return occBackMaterial[4].y; }\n"
"vec4 occMaterial_Diffuse(in bool theIsFront) { return theIsFront ? occCommonMaterial[0] : occCommonMaterial[4]; }\n"
"vec3 occMaterial_Emission(in bool theIsFront) { return theIsFront ? occCommonMaterial[1].rgb : occCommonMaterial[5].rgb; }\n"
"vec3 occMaterial_Specular(in bool theIsFront) { return theIsFront ? occCommonMaterial[2].rgb : occCommonMaterial[6].rgb; }\n"
"float occMaterial_Shininess(in bool theIsFront) { return theIsFront ? occCommonMaterial[2].a : occCommonMaterial[6].a; }\n"
"vec3 occMaterial_Ambient(in bool theIsFront) { return theIsFront ? occCommonMaterial[3].rgb : occCommonMaterial[7].rgb; }\n"
"#endif\n"
"\n"
"// 2D texture coordinates transformation\n"

View File

@@ -206,22 +206,15 @@ static const char Shaders_Declarations_glsl[] =
"float occPBRMaterial_NormalizedRoughness(in bool theIsFront); //!< Normalized roughness coefficient\n"
"vec3 occPBRMaterial_Emission(in bool theIsFront); //!< Light intensity emitted by material\n"
"float occPBRMaterial_IOR(in bool theIsFront); //!< Index of refraction\n"
"#define occMaterial_Emission occPBRMaterial_Emission\n"
"#define occMaterial_Color occPBRMaterial_Color\n"
"#else\n"
"// Front material properties accessors\n"
"vec4 occFrontMaterial_Emission(void); //!< Emission color\n"
"vec4 occFrontMaterial_Ambient(void); //!< Ambient reflection\n"
"vec4 occFrontMaterial_Diffuse(void); //!< Diffuse reflection\n"
"vec4 occFrontMaterial_Specular(void); //!< Specular reflection\n"
"float occFrontMaterial_Shininess(void); //!< Specular exponent\n"
"float occFrontMaterial_Transparency(void); //!< Transparency coefficient\n"
"\n"
"// Back material properties accessors\n"
"vec4 occBackMaterial_Emission(void); //!< Emission color\n"
"vec4 occBackMaterial_Ambient(void); //!< Ambient reflection\n"
"vec4 occBackMaterial_Diffuse(void); //!< Diffuse reflection\n"
"vec4 occBackMaterial_Specular(void); //!< Specular reflection\n"
"float occBackMaterial_Shininess(void); //!< Specular exponent\n"
"float occBackMaterial_Transparency(void); //!< Transparency coefficient\n"
"vec4 occMaterial_Diffuse(in bool theIsFront); //!< Diffuse reflection\n"
"vec3 occMaterial_Specular(in bool theIsFront); //!< Specular reflection\n"
"float occMaterial_Shininess(in bool theIsFront); //!< Specular exponent\n"
"vec3 occMaterial_Ambient(in bool theIsFront); //!< Ambient reflection\n"
"vec3 occMaterial_Emission(in bool theIsFront); //!< Emission color\n"
"#define occMaterial_Color occMaterial_Diffuse\n"
"#endif\n"
"\n"
"#ifdef THE_HAS_DEFAULT_SAMPLER\n"
@@ -230,24 +223,24 @@ static const char Shaders_Declarations_glsl[] =
"uniform sampler2D occSampler0; //!< current active sampler;\n"
"#endif //! occSampler1, occSampler2,... should be defined in GLSL program body for multitexturing\n"
"\n"
"#if defined(THE_HAS_TEXTURE_COLOR)\n"
"#define occTextureColor(theMatColor, theTexCoord) (theMatColor * occTexture2D(occSamplerBaseColor, theTexCoord))\n"
"#if defined(THE_HAS_TEXTURE_COLOR) && defined(FRAGMENT_SHADER)\n"
"#define occMaterialBaseColor(theIsFront, theTexCoord) (occMaterial_Color(theIsFront) * occTexture2D(occSamplerBaseColor, theTexCoord))\n"
"#else\n"
"#define occTextureColor(theMatColor, theTexCoord) theMatColor\n"
"#define occMaterialBaseColor(theIsFront, theTexCoord) occMaterial_Color(theIsFront)\n"
"#endif\n"
"\n"
"#if defined(THE_HAS_TEXTURE_OCCLUSION) && defined(FRAGMENT_SHADER)\n"
"uniform sampler2D occSamplerOcclusion; //!< R occlusion texture sampler\n"
"#define occTextureOcclusion(theColor, theTexCoord) theColor *= occTexture2D(occSamplerOcclusion, theTexCoord).r;\n"
"#define occMaterialOcclusion(theColor, theTexCoord) theColor *= occTexture2D(occSamplerOcclusion, theTexCoord).r;\n"
"#else\n"
"#define occTextureOcclusion(theColor, theTexCoord)\n"
"#define occMaterialOcclusion(theColor, theTexCoord)\n"
"#endif\n"
"\n"
"#if defined(THE_HAS_TEXTURE_EMISSIVE) && defined(FRAGMENT_SHADER)\n"
"uniform sampler2D occSamplerEmissive; //!< RGB emissive texture sampler\n"
"#define occTextureEmissive(theMatEmis, theTexCoord) (theMatEmis * occTexture2D(occSamplerEmissive, theTexCoord).rgb)\n"
"#define occMaterialEmission(theIsFront, theTexCoord) (occMaterial_Emission(theIsFront) * occTexture2D(occSamplerEmissive, theTexCoord).rgb)\n"
"#else\n"
"#define occTextureEmissive(theMatEmis, theTexCoord) theMatEmis\n"
"#define occMaterialEmission(theIsFront, theTexCoord) occMaterial_Emission(theIsFront)\n"
"#endif\n"
"\n"
"#if defined(THE_HAS_TEXTURE_NORMAL) && defined(FRAGMENT_SHADER)\n"
@@ -259,11 +252,11 @@ static const char Shaders_Declarations_glsl[] =
"\n"
"#if defined(THE_HAS_TEXTURE_METALROUGHNESS) && defined(FRAGMENT_SHADER)\n"
"uniform sampler2D occSamplerMetallicRoughness; //!< BG metallic-roughness texture sampler\n"
"#define occTextureRoughness(theRoug, theTexCoord) (theRoug * occTexture2D(occSamplerMetallicRoughness, theTexCoord).g)\n"
"#define occTextureMetallic(theMet, theTexCoord) (theMet * occTexture2D(occSamplerMetallicRoughness, theTexCoord).b)\n"
"#define occMaterialRoughness(theIsFront, theTexCoord) (occPBRMaterial_NormalizedRoughness(theIsFront) * occTexture2D(occSamplerMetallicRoughness, theTexCoord).g)\n"
"#define occMaterialMetallic(theIsFront, theTexCoord) (occPBRMaterial_Metallic(theIsFront) * occTexture2D(occSamplerMetallicRoughness, theTexCoord).b)\n"
"#else\n"
"#define occTextureRoughness(theRoug, theTexCoord) theRoug\n"
"#define occTextureMetallic(theMet, theTexCoord) theMet\n"
"#define occMaterialRoughness(theIsFront, theTexCoord) occPBRMaterial_NormalizedRoughness(theIsFront)\n"
"#define occMaterialMetallic(theIsFront, theTexCoord) occPBRMaterial_Metallic(theIsFront)\n"
"#endif\n"
"\n"
"uniform vec4 occColor; //!< color value (in case of disabled lighting)\n"

View File

@@ -24,7 +24,7 @@ static const char Shaders_PhongDirectionalLight_glsl[] =
" float aSpecl = 0.0;\n"
" if (aNdotL > 0.0)\n"
" {\n"
" aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());\n"
" aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));\n"
" }\n"
"\n"
" Diffuse += occLight_Diffuse (theId) * aNdotL * theShadow;\n"

View File

@@ -31,7 +31,7 @@ static const char Shaders_PhongPointLight_glsl[] =
" float aSpecl = 0.0;\n"
" if (aNdotL > 0.0)\n"
" {\n"
" aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());\n"
" aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));\n"
" }\n"
"\n"
" Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;\n"

View File

@@ -46,7 +46,7 @@ static const char Shaders_PhongSpotLight_glsl[] =
" float aSpecl = 0.0;\n"
" if (aNdotL > 0.0)\n"
" {\n"
" aSpecl = pow (aNdotH, theIsFront ? occFrontMaterial_Shininess() : occBackMaterial_Shininess());\n"
" aSpecl = pow (aNdotH, occMaterial_Shininess (theIsFront));\n"
" }\n"
"\n"
" Diffuse += occLight_Diffuse (theId) * aNdotL * anAtten;\n"