Changed rotation order to YZX
This commit is contained in:
@ -126,15 +126,15 @@ void shaderUsePosition(shader_t *shader,
|
||||
|
||||
//Position
|
||||
axis[0] = x, axis[1] = y, axis[2] = z;
|
||||
glm_translate(MATRIX_POSITION, axis);
|
||||
glm_translate_make(MATRIX_POSITION, axis);
|
||||
|
||||
//Rotation, we do each axis individually
|
||||
axis[0] = 1, axis[1] = 0, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
axis[0] = 0, axis[1] = 1;
|
||||
// Rotation (YZX order)
|
||||
axis[0] = 0, axis[1] = 1, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, yaw, axis);
|
||||
axis[1] = 0, axis[2] = 1;
|
||||
glm_rotate(MATRIX_POSITION, roll, axis);
|
||||
axis[0] = 1, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
|
||||
//Send to the shader.
|
||||
glUniformMatrix4fv(shader->uniModl, 1, GL_FALSE, MATRIX_POSITION[0]);
|
||||
@ -151,17 +151,17 @@ void shaderUsePositionAndScale(shader_t *shader,
|
||||
// Identify mat.
|
||||
glm_mat4_identity(MATRIX_POSITION);
|
||||
|
||||
// Position
|
||||
//Position
|
||||
axis[0] = x, axis[1] = y, axis[2] = z;
|
||||
glm_translate(MATRIX_POSITION, axis);
|
||||
glm_translate_make(MATRIX_POSITION, axis);
|
||||
|
||||
// Rotation
|
||||
axis[0] = 1, axis[1] = 0, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
axis[0] = 0, axis[1] = 1;
|
||||
// Rotation (YZX order)
|
||||
axis[0] = 0, axis[1] = 1, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, yaw, axis);
|
||||
axis[1] = 0, axis[2] = 1;
|
||||
glm_rotate(MATRIX_POSITION, roll, axis);
|
||||
axis[0] = 1, axis[2] = 0;
|
||||
glm_rotate(MATRIX_POSITION, pitch, axis);
|
||||
|
||||
// Scale
|
||||
axis[0] = scaleX, axis[1] = scaleY, axis[2] = scaleZ;
|
||||
|
@ -48,7 +48,7 @@ void shaderUseTexture(shader_t *shader, texture_t *texture);
|
||||
|
||||
/**
|
||||
* Set's the current translation matrix onto the shader for the next
|
||||
* render to use.
|
||||
* render to use. Rotation order is set to YZX.
|
||||
*
|
||||
* @param shader Shader to attach to.
|
||||
* @param x X coordinate (world space).
|
||||
|
Reference in New Issue
Block a user