Feature/orion changes (#1359)

* Changed RenderableModel to allow user-control depth and blending.
* Updated RenderableModel to correctly handle the Orion Nebula model.
Co-authored-by: Alexander Bock <mail@alexanderbock.eu>
This commit is contained in:
Jonathas Costa
2020-11-04 07:11:25 -05:00
committed by GitHub
parent db4f16f75f
commit 3fbefa5324
6 changed files with 152 additions and 16 deletions
+17 -2
View File
@@ -34,6 +34,7 @@ uniform float diffuseIntensity = 1.0;
uniform float specularIntensity = 1.0;
uniform bool performShading = true;
uniform bool opacityBlending = false;
uniform sampler2D texture1;
@@ -46,6 +47,10 @@ uniform float opacity = 1.0;
const vec3 SpecularAlbedo = vec3(1.0);
Fragment getFragment() {
if (opacity == 0.0) {
discard;
}
vec3 diffuseAlbedo = texture(texture1, vs_st).rgb;
Fragment frag;
@@ -84,12 +89,22 @@ Fragment getFragment() {
frag.color.rgb = diffuseAlbedo;
}
frag.color.a = opacity;
if (opacityBlending) {
// frag.color.a = opacity * (frag.color.r + frag.color.g + frag.color.b)/3.0;
frag.color.a = opacity * max(max(frag.color.r, frag.color.g), frag.color.b);
}
else {
frag.color.a = opacity;
}
if (frag.color.a < 0.1) {
discard;
}
frag.depth = vs_screenSpaceDepth;
frag.gPosition = vs_positionCameraSpace;
frag.gNormal = vec4(vs_normalViewSpace, 0.0);
frag.disableLDR2HDR = true;
return frag;
}