mirror of
https://github.com/godotengine/godot.git
synced 2024-11-14 08:03:05 +00:00
[GLES2] Fix binding 3D Transforms to mat4 uniforms
This commit is contained in:
parent
cdb5ac52f5
commit
335498df6d
@ -827,27 +827,49 @@ void ShaderGLES2::use_material(void *p_material) {
|
||||
|
||||
case ShaderLanguage::TYPE_MAT4: {
|
||||
|
||||
Transform2D tr = V->get();
|
||||
GLfloat matrix[16] = { /* build a 16x16 matrix */
|
||||
tr.elements[0][0],
|
||||
tr.elements[0][1],
|
||||
0,
|
||||
0,
|
||||
tr.elements[1][0],
|
||||
tr.elements[1][1],
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
tr.elements[2][0],
|
||||
tr.elements[2][1],
|
||||
0,
|
||||
1
|
||||
};
|
||||
|
||||
glUniformMatrix4fv(location, 1, GL_FALSE, matrix);
|
||||
if (V->get().get_type() == Variant::TRANSFORM) {
|
||||
Transform tr = V->get();
|
||||
GLfloat matrix[16] = { /* build a 16x16 matrix */
|
||||
tr.basis.elements[0][0],
|
||||
tr.basis.elements[1][0],
|
||||
tr.basis.elements[2][0],
|
||||
0,
|
||||
tr.basis.elements[0][1],
|
||||
tr.basis.elements[1][1],
|
||||
tr.basis.elements[2][1],
|
||||
0,
|
||||
tr.basis.elements[0][2],
|
||||
tr.basis.elements[1][2],
|
||||
tr.basis.elements[2][2],
|
||||
0,
|
||||
tr.origin.x,
|
||||
tr.origin.y,
|
||||
tr.origin.z,
|
||||
1
|
||||
};
|
||||
glUniformMatrix4fv(location, 1, GL_FALSE, matrix);
|
||||
} else {
|
||||
Transform2D tr = V->get();
|
||||
GLfloat matrix[16] = { /* build a 16x16 matrix */
|
||||
tr.elements[0][0],
|
||||
tr.elements[0][1],
|
||||
0,
|
||||
0,
|
||||
tr.elements[1][0],
|
||||
tr.elements[1][1],
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
tr.elements[2][0],
|
||||
tr.elements[2][1],
|
||||
0,
|
||||
1
|
||||
};
|
||||
glUniformMatrix4fv(location, 1, GL_FALSE, matrix);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user