We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 80adf9b commit 0ffd50cCopy full SHA for 0ffd50c
source/OpenGL/GLSL/grid.vert
@@ -14,6 +14,14 @@ out vec4 FragmentColour;
14
15
void main()
16
{
17
- gl_Position = viewProperties.projection * viewProperties.view * vec4(VertexPosition, 1.0);
+ // Snap camera position to grid units to create bone grid effect
18
+ // This makes the grid follow the camera while maintaining grid alignment
19
+ vec3 camera_pos = viewProperties.camera_position.xyz;
20
+ vec3 snapped_camera_pos = floor(camera_pos);
21
+
22
+ // Offset the grid position by the snapped camera position
23
+ vec3 world_position = VertexPosition + snapped_camera_pos;
24
25
+ gl_Position = viewProperties.projection * viewProperties.view * vec4(world_position, 1.0);
26
FragmentColour = VertexColour;
27
}
0 commit comments