mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Expose EYE_OFFSET to gdshader code
This commit is contained in:
parent
0810ecaafd
commit
8c77aea9ab
9 changed files with 24 additions and 3 deletions
|
|
@ -268,9 +268,11 @@ void main() {
|
|||
#ifdef USE_MULTIVIEW
|
||||
mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
|
||||
mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
|
||||
vec3 eye_offset = multiview_data.eye_offset[ViewIndex].xyz;
|
||||
#else
|
||||
mat4 projection_matrix = scene_data.projection_matrix;
|
||||
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
|
||||
vec3 eye_offset = vec3(0.0, 0.0, 0.0);
|
||||
#endif //USE_MULTIVIEW
|
||||
|
||||
#ifdef USE_INSTANCING
|
||||
|
|
@ -930,10 +932,12 @@ void main() {
|
|||
//lay out everything, whatever is unused is optimized away anyway
|
||||
vec3 vertex = vertex_interp;
|
||||
#ifdef USE_MULTIVIEW
|
||||
vec3 view = -normalize(vertex_interp - multiview_data.eye_offset[ViewIndex].xyz);
|
||||
vec3 eye_offset = multiview_data.eye_offset[ViewIndex].xyz;
|
||||
vec3 view = -normalize(vertex_interp - eye_offset);
|
||||
mat4 projection_matrix = multiview_data.projection_matrix_view[ViewIndex];
|
||||
mat4 inv_projection_matrix = multiview_data.inv_projection_matrix_view[ViewIndex];
|
||||
#else
|
||||
vec3 eye_offset = vec3(0.0, 0.0, 0.0);
|
||||
vec3 view = -normalize(vertex_interp);
|
||||
mat4 projection_matrix = scene_data.projection_matrix;
|
||||
mat4 inv_projection_matrix = scene_data.inv_projection_matrix;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue