diff options
| author | victorfisac <victorfisac@gmail.com> | 2015-12-21 16:42:13 +0100 |
|---|---|---|
| committer | victorfisac <victorfisac@gmail.com> | 2015-12-21 16:42:13 +0100 |
| commit | 4db2da91850fcc55ec08df253e533e236eb91451 (patch) | |
| tree | 83042caf6816073f29e69c0b6d46de88fb3c3c19 /src/rlgl.c | |
| parent | 1b39b2e2612dfd7613e3bfb6948e8d27472ab8c1 (diff) | |
| download | raylib-4db2da91850fcc55ec08df253e533e236eb91451.tar.gz raylib-4db2da91850fcc55ec08df253e533e236eb91451.zip | |
Added new matrix location points and extra functions
- New model and view transformation matrix added, useful for shaders.
Modelview matrix not deleted to keep opengl 1.1 pipeline compatibility.
- New extra function added DrawModelWiresEx() to set a rotation and
scale transformations to a wire model drawing.
- Other writing and little audio.c bug fixed.
Diffstat (limited to 'src/rlgl.c')
| -rw-r--r-- | src/rlgl.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1498,6 +1498,8 @@ void rlglDrawModel(Model model, Vector3 position, float rotationAngle, Vector3 r glUseProgram(model.shader.id); // Apply transformation provided in model.transform matrix + // TODO: review if at this point the modelview matrix just contains view matrix values + Matrix viewworld = modelview; // Store view matrix before applying model transformations Matrix modelviewworld = MatrixMultiply(model.transform, modelview); // World-space transformation // Apply transformations provided in function @@ -1513,6 +1515,8 @@ void rlglDrawModel(Model model, Vector3 position, float rotationAngle, Vector3 r // NOTE: Drawing in OpenGL 3.3+, transform is passed to shader glUniformMatrix4fv(model.shader.projectionLoc, 1, false, GetMatrixVector(projection)); + glUniformMatrix4fv(model.shader.modelLoc, 1, false, GetMatrixVector(transform)); + glUniformMatrix4fv(model.shader.viewLoc, 1, false, GetMatrixVector(viewworld)); glUniformMatrix4fv(model.shader.modelviewLoc, 1, false, GetMatrixVector(modelviewworld)); // Apply color tinting to model @@ -2242,6 +2246,8 @@ Shader LoadShader(char *vsFileName, char *fsFileName) // Get handles to GLSL uniform locations (vertex shader) shader.modelviewLoc = glGetUniformLocation(shader.id, "modelviewMatrix"); + shader.modelLoc = glGetUniformLocation(shader.id, "modelMatrix"); + shader.viewLoc = glGetUniformLocation(shader.id, "viewMatrix"); shader.projectionLoc = glGetUniformLocation(shader.id, "projectionMatrix"); // Get handles to GLSL uniform locations (fragment shader) @@ -2781,6 +2787,8 @@ static Shader LoadDefaultShader(void) // Get handles to GLSL uniform locations (vertex shader) shader.modelviewLoc = glGetUniformLocation(shader.id, "modelviewMatrix"); + shader.modelLoc = glGetUniformLocation(shader.id, "modelMatrix"); + shader.viewLoc = glGetUniformLocation(shader.id, "viewMatrix"); shader.projectionLoc = glGetUniformLocation(shader.id, "projectionMatrix"); // Get handles to GLSL uniform locations (fragment shader) @@ -2861,6 +2869,8 @@ static Shader LoadSimpleShader(void) // Get handles to GLSL uniform locations (vertex shader) shader.modelviewLoc = glGetUniformLocation(shader.id, "modelviewMatrix"); + shader.modelLoc = glGetUniformLocation(shader.id, "modelMatrix"); + shader.viewLoc = glGetUniformLocation(shader.id, "viewMatrix"); shader.projectionLoc = glGetUniformLocation(shader.id, "projectionMatrix"); // Get handles to GLSL uniform locations (fragment shader) |
