Skip to content

Commit

Permalink
Merge pull request #27798 from clayjohn/gles2-proj-mat-bug
Browse files Browse the repository at this point in the history
Fixes bug when setting projection matrix in shader GLES2
  • Loading branch information
akien-mga authored May 13, 2019
2 parents e0517a1 + e37d723 commit 86a74e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions drivers/gles2/shaders/scene.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,12 @@ void main() {

#endif

mat4 local_projection_matrix = projection_matrix;

mat4 modelview = camera_inverse_matrix * world_matrix;
float roughness = 1.0;

#define projection_matrix local_projection_matrix
#define world_transform world_matrix

{
Expand Down
2 changes: 1 addition & 1 deletion servers/visual/shader_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ShaderTypes::ShaderTypes() {
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["CAMERA_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["MODELVIEW_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = ShaderLanguage::TYPE_MAT4;
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["INV_PROJECTION_MATRIX"] = constt(ShaderLanguage::TYPE_MAT4);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["TIME"] = constt(ShaderLanguage::TYPE_FLOAT);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["VIEWPORT_SIZE"] = constt(ShaderLanguage::TYPE_VEC2);
shader_modes[VS::SHADER_SPATIAL].functions["vertex"].built_ins["OUTPUT_IS_SRGB"] = constt(ShaderLanguage::TYPE_BOOL);
Expand Down

0 comments on commit 86a74e2

Please sign in to comment.