mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-23 04:30:15 -06:00
Added fade-in/out effect for min/max billboard size.
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
in vec4 gs_colorMap;
|
||||
in float vs_screenSpaceDepth;
|
||||
in vec2 texCoord;
|
||||
in float ta;
|
||||
|
||||
uniform float alphaValue;
|
||||
uniform vec3 color;
|
||||
@@ -51,7 +52,7 @@ Fragment getFragment() {
|
||||
fullColor = vec4(color.rgb * textureColor.rgb, textureColor.a * alphaValue);
|
||||
}
|
||||
|
||||
fullColor.a *= fadeInValue;
|
||||
fullColor.a *= fadeInValue * ta;
|
||||
|
||||
if (fullColor.a == 0.f) {
|
||||
discard;
|
||||
@@ -60,7 +61,7 @@ Fragment getFragment() {
|
||||
Fragment frag;
|
||||
frag.color = fullColor;
|
||||
frag.depth = vs_screenSpaceDepth;
|
||||
frag.gPosition = vec4(1e27, 1e27, 1e27, 1.0);
|
||||
frag.gPosition = vec4(1e32, 1e32, 1e32, 1.0);
|
||||
frag.gOtherData = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
frag.gNormal = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ in vec4 colorMap[];
|
||||
out vec4 gs_colorMap;
|
||||
out vec2 texCoord;
|
||||
out float vs_screenSpaceDepth;
|
||||
out float ta;
|
||||
|
||||
const double PARSEC = 0.308567756e17LF;
|
||||
|
||||
@@ -59,6 +60,7 @@ const vec2 corners[4] = vec2[4](
|
||||
|
||||
|
||||
void main() {
|
||||
ta = 1.0f;
|
||||
vec4 pos = gl_in[0].gl_Position;
|
||||
gs_colorMap = colorMap[0];
|
||||
|
||||
@@ -147,14 +149,32 @@ void main() {
|
||||
float height = abs(topRight.y - bottomLeft.y);
|
||||
float width = abs(topRight.x - bottomLeft.x);
|
||||
|
||||
// if ((height < (2.0 * maxBillboardSize)) ||
|
||||
// (width < (2.0 * maxBillboardSize))) {
|
||||
// ta = 1.0 - (height - maxBillboardSize)/(maxBillboardSize);
|
||||
// //ta = 0.5;
|
||||
// }
|
||||
|
||||
float var = (height+width);
|
||||
|
||||
if ((height > maxBillboardSize) ||
|
||||
(width > maxBillboardSize)) {
|
||||
return;
|
||||
//return;
|
||||
float maxVar = 3.0f * maxBillboardSize;
|
||||
float minVar = maxBillboardSize;
|
||||
ta = 1.0f - ( (var - minVar)/(maxVar - minVar) );
|
||||
if (ta == 0.0f)
|
||||
return;
|
||||
}
|
||||
else if (width < minBillboardSize) {
|
||||
return;
|
||||
else if (width < 2.0f * minBillboardSize) {
|
||||
//return;
|
||||
float maxVar = 2.0f * minBillboardSize;
|
||||
float minVar = minBillboardSize;
|
||||
ta = ( (var - minVar)/(maxVar - minVar) );
|
||||
if (ta == 0.0f)
|
||||
return;
|
||||
}
|
||||
else {
|
||||
{
|
||||
// Build primitive
|
||||
texCoord = corners[0];
|
||||
gl_Position = initialPosition;
|
||||
|
||||
Reference in New Issue
Block a user