2023-01-30 18:43:28 -08:00
|
|
|
uniform float is_fixed_in_frame;
|
|
|
|
uniform mat4 view;
|
|
|
|
uniform float focal_distance;
|
2024-09-06 12:50:19 -05:00
|
|
|
uniform vec3 frame_rescale_factors;
|
2024-09-17 17:20:19 -05:00
|
|
|
uniform vec4 clip_plane;
|
2023-01-30 18:43:28 -08:00
|
|
|
|
|
|
|
void emit_gl_Position(vec3 point){
|
|
|
|
vec4 result = vec4(point, 1.0);
|
2024-01-19 17:42:12 -06:00
|
|
|
// This allow for smooth transitions between objects fixed and unfixed from frame
|
|
|
|
result = mix(view * result, result, is_fixed_in_frame);
|
2023-01-30 18:43:28 -08:00
|
|
|
// Essentially a projection matrix
|
2024-09-06 12:50:19 -05:00
|
|
|
result.xyz *= frame_rescale_factors;
|
2023-01-30 18:43:28 -08:00
|
|
|
result.w = 1.0 - result.z;
|
|
|
|
// Flip and scale to prevent premature clipping
|
|
|
|
result.z *= -0.1;
|
|
|
|
gl_Position = result;
|
2024-09-17 17:20:19 -05:00
|
|
|
|
|
|
|
if(clip_plane.xyz != vec3(0.0, 0.0, 0.0)){
|
|
|
|
gl_ClipDistance[0] = dot(vec4(point, 1.0), clip_plane);
|
|
|
|
}
|
2023-01-30 18:43:28 -08:00
|
|
|
}
|