2021-01-07 16:16:20 -08:00
|
|
|
// Assumes the following uniforms exist in the surrounding context:
|
2020-06-08 20:27:07 -07:00
|
|
|
// uniform float is_fixed_in_frame;
|
2021-01-18 16:39:29 -08:00
|
|
|
// uniform vec3 camera_center;
|
|
|
|
// uniform mat3 camera_rotation;
|
|
|
|
|
|
|
|
vec3 rotate_point_into_frame(vec3 point){
|
|
|
|
if(bool(is_fixed_in_frame)){
|
|
|
|
return point;
|
|
|
|
}
|
|
|
|
return camera_rotation * point;
|
|
|
|
}
|
|
|
|
|
2020-06-01 16:21:18 -07:00
|
|
|
|
|
|
|
vec3 position_point_into_frame(vec3 point){
|
2020-06-08 20:27:07 -07:00
|
|
|
if(bool(is_fixed_in_frame)){
|
|
|
|
return point;
|
|
|
|
}
|
2021-01-18 16:39:29 -08:00
|
|
|
return rotate_point_into_frame(point - camera_center);
|
2020-06-01 16:21:18 -07:00
|
|
|
}
|