Files
manim/manimlib/shaders/inserts/emit_gl_Position.glsl
2024-09-17 17:20:19 -05:00

22 lines
696 B
GLSL

uniform float is_fixed_in_frame;
uniform mat4 view;
uniform float focal_distance;
uniform vec3 frame_rescale_factors;
uniform vec4 clip_plane;
void emit_gl_Position(vec3 point){
vec4 result = vec4(point, 1.0);
// This allow for smooth transitions between objects fixed and unfixed from frame
result = mix(view * result, result, is_fixed_in_frame);
// Essentially a projection matrix
result.xyz *= frame_rescale_factors;
result.w = 1.0 - result.z;
// Flip and scale to prevent premature clipping
result.z *= -0.1;
gl_Position = result;
if(clip_plane.xyz != vec3(0.0, 0.0, 0.0)){
gl_ClipDistance[0] = dot(vec4(point, 1.0), clip_plane);
}
}