aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvictorfisac <victorfisac@gmail.com>2015-12-21 16:42:13 +0100
committervictorfisac <victorfisac@gmail.com>2015-12-21 16:42:13 +0100
commit4db2da91850fcc55ec08df253e533e236eb91451 (patch)
tree83042caf6816073f29e69c0b6d46de88fb3c3c19 /src
parent1b39b2e2612dfd7613e3bfb6948e8d27472ab8c1 (diff)
downloadraylib-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')
-rw-r--r--src/audio.c2
-rw-r--r--src/libraylib.abin0 -> 394980 bytes
-rw-r--r--src/models.c185
-rw-r--r--src/raylib.h5
-rw-r--r--src/rlgl.c10
-rw-r--r--src/rlgl.h4
6 files changed, 114 insertions, 92 deletions
diff --git a/src/audio.c b/src/audio.c
index 8ef71116..6313c9dc 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -92,7 +92,7 @@ typedef enum { INFO = 0, ERROR, WARNING, DEBUG, OTHER } TraceLogType;
//----------------------------------------------------------------------------------
// Global Variables Definition
//----------------------------------------------------------------------------------
-bool musicEnabled = false;
+static bool musicEnabled = false;
static Music currentMusic; // Current music loaded
// NOTE: Only one music file playing at a time
diff --git a/src/libraylib.a b/src/libraylib.a
new file mode 100644
index 00000000..1da3aae4
--- /dev/null
+++ b/src/libraylib.a
Binary files differ
diff --git a/src/models.c b/src/models.c
index f7e39863..090c4d86 100644
--- a/src/models.c
+++ b/src/models.c
@@ -64,7 +64,7 @@ static VertexData LoadOBJ(const char *fileName);
// Draw cube
// NOTE: Cube position is the center position
-void DrawCube(Vector3 position, float width, float height, float lenght, Color color)
+void DrawCube(Vector3 position, float width, float height, float length, Color color)
{
float x = 0.0f;
float y = 0.0f;
@@ -81,58 +81,58 @@ void DrawCube(Vector3 position, float width, float height, float lenght, Color c
rlColor4ub(color.r, color.g, color.b, color.a);
// Front Face -----------------------------------------------------
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Right
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
// Back Face ------------------------------------------------------
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Left
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Left
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
// Top Face -------------------------------------------------------
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Bottom Left
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Bottom Right
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Bottom Left
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Bottom Right
// Bottom Face ----------------------------------------------------
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Top Left
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Top Right
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Top Right
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Left
// Right face -----------------------------------------------------
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Left
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Left
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Left
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Left
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Left
// Left Face ------------------------------------------------------
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Right
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Right
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Right
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Right
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Right
rlEnd();
rlPopMatrix();
}
@@ -144,7 +144,7 @@ void DrawCubeV(Vector3 position, Vector3 size, Color color)
}
// Draw cube wires
-void DrawCubeWires(Vector3 position, float width, float height, float lenght, Color color)
+void DrawCubeWires(Vector3 position, float width, float height, float length, Color color)
{
float x = 0.0f;
float y = 0.0f;
@@ -160,62 +160,62 @@ void DrawCubeWires(Vector3 position, float width, float height, float lenght, Co
// Front Face -----------------------------------------------------
// Bottom Line
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
// Left Line
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Right
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right
// Top Line
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Right
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
// Right Line
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left
// Back Face ------------------------------------------------------
// Bottom Line
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Left
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Left
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
// Left Line
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right
// Top Line
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
// Right Line
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Left
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Left
// Top Face -------------------------------------------------------
// Left Line
- rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left Front
- rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left Back
+ rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left Front
+ rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left Back
// Right Line
- rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Right Front
- rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right Back
+ rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right Front
+ rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Back
// Bottom Face ---------------------------------------------------
// Left Line
- rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Top Left Front
- rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Top Left Back
+ rlVertex3f(x-width/2, y-height/2, z+length/2); // Top Left Front
+ rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Left Back
// Right Line
- rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Top Right Front
- rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Top Right Back
+ rlVertex3f(x+width/2, y-height/2, z+length/2); // Top Right Front
+ rlVertex3f(x+width/2, y-height/2, z-length/2); // Top Right Back
rlEnd();
rlPopMatrix();
}
// Draw cube
// NOTE: Cube position is the center position
-void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float lenght, Color color)
+void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float height, float length, Color color)
{
float x = position.x;
float y = position.y;
@@ -233,40 +233,40 @@ void DrawCubeTexture(Texture2D texture, Vector3 position, float width, float hei
rlColor4ub(color.r, color.g, color.b, color.a);
// Front Face
rlNormal3f(0.0f, 0.0f, 1.0f); // Normal Pointing Towards Viewer
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Left Of The Texture and Quad
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Right Of The Texture and Quad
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Right Of The Texture and Quad
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
// Back Face
rlNormal3f( 0.0f, 0.0f,-1.0f); // Normal Pointing Away From Viewer
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Right Of The Texture and Quad
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Right Of The Texture and Quad
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Left Of The Texture and Quad
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Left Of The Texture and Quad
// Top Face
rlNormal3f( 0.0f, 1.0f, 0.0f); // Normal Pointing Up
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left Of The Texture and Quad
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Bottom Left Of The Texture and Quad
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Bottom Right Of The Texture and Quad
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
// Bottom Face
rlNormal3f( 0.0f,-1.0f, 0.0f); // Normal Pointing Down
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Top Right Of The Texture and Quad
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Top Left Of The Texture and Quad
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Left Of The Texture and Quad
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Right Of The Texture and Quad
// Right face
rlNormal3f( 1.0f, 0.0f, 0.0f); // Normal Pointing Right
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-lenght/2); // Bottom Right Of The Texture and Quad
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-lenght/2); // Top Right Of The Texture and Quad
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+lenght/2); // Top Left Of The Texture and Quad
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+lenght/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z-length/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z-length/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x+width/2, y+height/2, z+length/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x+width/2, y-height/2, z+length/2); // Bottom Left Of The Texture and Quad
// Left Face
rlNormal3f(-1.0f, 0.0f, 0.0f); // Normal Pointing Left
- rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-lenght/2); // Bottom Left Of The Texture and Quad
- rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+lenght/2); // Bottom Right Of The Texture and Quad
- rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+lenght/2); // Top Right Of The Texture and Quad
- rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-lenght/2); // Top Left Of The Texture and Quad
+ rlTexCoord2f(0.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z-length/2); // Bottom Left Of The Texture and Quad
+ rlTexCoord2f(1.0f, 0.0f); rlVertex3f(x-width/2, y-height/2, z+length/2); // Bottom Right Of The Texture and Quad
+ rlTexCoord2f(1.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z+length/2); // Top Right Of The Texture and Quad
+ rlTexCoord2f(0.0f, 1.0f); rlVertex3f(x-width/2, y+height/2, z-length/2); // Top Left Of The Texture and Quad
rlEnd();
//rlPopMatrix();
@@ -534,12 +534,12 @@ void DrawGrid(int slices, float spacing)
void DrawGizmo(Vector3 position)
{
// NOTE: RGB = XYZ
- float lenght = 1.0f;
+ float length = 1.0f;
rlPushMatrix();
rlTranslatef(position.x, position.y, position.z);
//rlRotatef(rotation, 0, 1, 0);
- rlScalef(lenght, lenght, lenght);
+ rlScalef(length, length, length);
rlBegin(RL_LINES);
rlColor3f(1.0f, 0.0f, 0.0f); rlVertex3f(0.0f, 0.0f, 0.0f);
@@ -1164,6 +1164,13 @@ void DrawModelWires(Model model, Vector3 position, float scale, Color color)
rlglDrawModel(model, position, 0.0f, rotationAxis, vScale, color, true);
}
+// Draw a model wires (with texture if set) with extended parameters
+void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint)
+{
+ // NOTE: Rotation must be provided in degrees, it's converted to radians inside rlglDrawModel()
+ rlglDrawModel(model, position, rotationAngle, rotationAxis, scale, tint, true);
+}
+
// Draw a billboard
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint)
{
diff --git a/src/raylib.h b/src/raylib.h
index daf8133c..cf401cca 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -329,7 +329,9 @@ typedef struct Shader {
// Uniforms
int projectionLoc; // Projection matrix uniform location point (vertex shader)
- int modelviewLoc; // ModeView matrix uniform location point (vertex shader)
+ int modelviewLoc; // ModelView matrix uniform location point (vertex shader)
+ int modelLoc; // Model transformation matrix uniform location point (vertex shader)
+ int viewLoc; // View transformation matrix uniform location point (vertex shader)
int tintColorLoc; // Color uniform location point (fragment shader)
int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)
@@ -666,6 +668,7 @@ void SetModelTexture(Model *model, Texture2D texture);
void DrawModel(Model model, Vector3 position, float scale, Color tint); // Draw a model (with texture if set)
void DrawModelEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model with extended parameters
void DrawModelWires(Model model, Vector3 position, float scale, Color color); // Draw a model wires (with texture if set)
+void DrawModelWiresEx(Model model, Vector3 position, float rotationAngle, Vector3 rotationAxis, Vector3 scale, Color tint); // Draw a model wires (with texture if set) with extended parameters
void DrawBillboard(Camera camera, Texture2D texture, Vector3 center, float size, Color tint); // Draw a billboard texture
void DrawBillboardRec(Camera camera, Texture2D texture, Rectangle sourceRec, Vector3 center, float size, Color tint); // Draw a billboard texture defined by sourceRec
diff --git a/src/rlgl.c b/src/rlgl.c
index 3862ac74..f9108342 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -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)
diff --git a/src/rlgl.h b/src/rlgl.h
index 0960fa83..a7df043e 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -160,7 +160,9 @@ typedef enum { OPENGL_11 = 1, OPENGL_33, OPENGL_ES_20 } GlVersion;
// Uniforms
int projectionLoc; // Projection matrix uniform location point (vertex shader)
- int modelviewLoc; // ModeView matrix uniform location point (vertex shader)
+ int modelviewLoc; // ModelView matrix uniform location point (vertex shader)
+ int modelLoc; // Model transformation matrix uniform location point (vertex shader)
+ int viewLoc; // View transformation matrix uniform location point (vertex shader)
int tintColorLoc; // Color uniform location point (fragment shader)
int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)