mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 01:24:03 +02:00
Fix star point smoothing... sort of
This commit is contained in:
parent
59b69be251
commit
2221c839c3
2 changed files with 24 additions and 5 deletions
|
@ -11,8 +11,24 @@
|
|||
//
|
||||
|
||||
in vec4 varColor;
|
||||
in float varSize;
|
||||
|
||||
out vec4 outFragColor;
|
||||
|
||||
const float EDGE_SIZE = 0.25;
|
||||
const float ALPHA_BOUNDARY = 1.0 - EDGE_SIZE;
|
||||
|
||||
void main(void) {
|
||||
outFragColor = varColor; //vec4(varColor, 1.0);
|
||||
vec2 coord = gl_PointCoord * vec2(2.0) - vec2(1.0);
|
||||
coord = coord * coord;
|
||||
|
||||
float l = coord.x + coord.y;
|
||||
if (l > 1.0) {
|
||||
discard;
|
||||
}
|
||||
|
||||
outFragColor = varColor;
|
||||
if (l >= ALPHA_BOUNDARY) {
|
||||
outFragColor.a = smoothstep(1.0, ALPHA_BOUNDARY, l);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,12 @@
|
|||
|
||||
<$declareStandardTransform()$>
|
||||
|
||||
out vec3 varPosition;
|
||||
out vec4 varColor;
|
||||
// TODO we need to get the viewport resolution and FOV passed to us so we can modify the point size
|
||||
// and effectively producing a points that take up a constant angular size regardless of the display resolution
|
||||
// or projection matrix
|
||||
|
||||
out vec4 varColor;
|
||||
out float varSize;
|
||||
|
||||
void main(void) {
|
||||
varColor = inColor.rgba;
|
||||
|
@ -29,6 +32,6 @@ void main(void) {
|
|||
TransformCamera cam = getTransformCamera();
|
||||
TransformObject obj = getTransformObject();
|
||||
<$transformModelToClipPos(cam, obj, inPosition, gl_Position)$>
|
||||
varPosition = inPosition.xyz;
|
||||
gl_PointSize = inColor.a;
|
||||
varSize = inColor.a;
|
||||
gl_PointSize = varSize;
|
||||
}
|
Loading…
Reference in a new issue