mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0026688: Visualization, TKOpenGl - apply transparency within GLSL programs
OpenGl_ShaderManager::PushAspectFace(), setup alpha to Diffuse() component as in FFP. OpenGl_ShaderManager::stdComputeLighting(), take alpha from material Diffuse component.
This commit is contained in:
parent
b6c4618c0e
commit
a86456de9a
@ -867,9 +867,11 @@ static void PushAspectFace (const Handle(OpenGl_Context)& theCtx,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
aParams.Init (anIndex == 0 || theAspect->DistinguishingMode() != TOn
|
const OPENGL_SURF_PROP& aProp = anIndex == 0 || theAspect->DistinguishingMode() != TOn
|
||||||
? theAspect->IntFront()
|
? theAspect->IntFront()
|
||||||
: theAspect->IntBack());
|
: theAspect->IntBack();
|
||||||
|
aParams.Init (aProp);
|
||||||
|
aParams.Diffuse.a() = aProp.trans;
|
||||||
theProgram->SetUniform (theCtx, aLoc, OpenGl_Material::NbOfVec4(),
|
theProgram->SetUniform (theCtx, aLoc, OpenGl_Material::NbOfVec4(),
|
||||||
aParams.Packed());
|
aParams.Packed());
|
||||||
}
|
}
|
||||||
@ -1342,14 +1344,15 @@ TCollection_AsciiString OpenGl_ShaderManager::stdComputeLighting (const Standard
|
|||||||
EOL" Specular = vec3 (0.0);"
|
EOL" Specular = vec3 (0.0);"
|
||||||
EOL" vec3 aPoint = thePoint.xyz / thePoint.w;"
|
EOL" vec3 aPoint = thePoint.xyz / thePoint.w;"
|
||||||
+ aLightsLoop
|
+ aLightsLoop
|
||||||
+ EOL" vec4 aMaterialAmbient = " + aGetMatAmbient
|
+ EOL" vec4 aMatAmbient = " + aGetMatAmbient
|
||||||
+ EOL" vec4 aMaterialDiffuse = " + aGetMatDiffuse
|
+ EOL" vec4 aMatDiffuse = " + aGetMatDiffuse
|
||||||
+ EOL" vec4 aMaterialSpecular = theIsFront ? occFrontMaterial_Specular() : occBackMaterial_Specular();"
|
+ EOL" vec4 aMatSpecular = theIsFront ? occFrontMaterial_Specular() : occBackMaterial_Specular();"
|
||||||
EOL" vec4 aMaterialEmission = theIsFront ? occFrontMaterial_Emission() : occBackMaterial_Emission();"
|
EOL" vec4 aMatEmission = theIsFront ? occFrontMaterial_Emission() : occBackMaterial_Emission();"
|
||||||
EOL" return vec4 (Ambient, 1.0) * aMaterialAmbient"
|
EOL" vec3 aColor = Ambient * aMatAmbient.rgb"
|
||||||
EOL" + vec4 (Diffuse, 1.0) * aMaterialDiffuse"
|
EOL" + Diffuse * aMatDiffuse.rgb"
|
||||||
EOL" + vec4 (Specular, 1.0) * aMaterialSpecular"
|
EOL" + Specular * aMatSpecular.rgb"
|
||||||
EOL" + aMaterialEmission;"
|
EOL" + aMatEmission.rgb;"
|
||||||
|
EOL" return vec4 (aColor, aMatDiffuse.a);"
|
||||||
EOL"}";
|
EOL"}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user