Skip to content

Commit

Permalink
fix(points): Correct orthographic vertex projection
Browse files Browse the repository at this point in the history
  • Loading branch information
Desplandis committed Dec 20, 2023
1 parent cae9463 commit e6e1d80
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Renderer/Shader/PointsVS.glsl
Expand Up @@ -103,12 +103,15 @@ void main() {
#include <begin_vertex>
#include <project_vertex>

if (sizeMode == PNTS_SIZE_MODE_VALUE) {
gl_PointSize = size;
} else if (sizeMode == PNTS_SIZE_MODE_ATTENUATED) {
gl_PointSize = size;
gl_PointSize *= (preSSE / -mvPosition.z);
gl_PointSize = clamp(gl_PointSize, minAttenuatedSize, maxAttenuatedSize);
gl_PointSize = size;

if (sizeMode == PNTS_SIZE_MODE_ATTENUATED) {
bool isPerspective = isPerspectiveMatrix(projectionMatrix);

if (isPerspective) {
gl_PointSize *= preSSE / -mvPosition.z;
gl_PointSize = clamp(gl_PointSize, minAttenuatedSize, maxAttenuatedSize);
}
}

#if defined(USE_TEXTURES_PROJECTIVE)
Expand Down

0 comments on commit e6e1d80

Please sign in to comment.