aboutsummaryrefslogtreecommitdiff
path: root/src/core.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-01-11 13:29:55 +0100
committerraysan5 <raysan5@gmail.com>2016-01-11 13:29:55 +0100
commit5e7686695fcfe32bbf956990ced0a02b7c881af1 (patch)
tree534c4b2f488e6cb0e650316fbee2b9d7a4d12664 /src/core.c
parente5a56fa98515337c805e5a641cd3787cb6898596 (diff)
downloadraylib-5e7686695fcfe32bbf956990ced0a02b7c881af1.tar.gz
raylib-5e7686695fcfe32bbf956990ced0a02b7c881af1.zip
Review Light/Material system
Simplified for the user (more intuitive and clear) Removed lighting module dependency
Diffstat (limited to 'src/core.c')
-rw-r--r--src/core.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index 708f2d22..f1445cce 100644
--- a/src/core.c
+++ b/src/core.c
@@ -519,7 +519,7 @@ void BeginDrawing(void)
rlLoadIdentity(); // Reset current matrix (MODELVIEW)
- rlMultMatrixf(GetMatrixVector(downscaleView)); // If downscale required, apply it here
+ rlMultMatrixf(MatrixToFloat(downscaleView)); // If downscale required, apply it here
//rlTranslatef(0.375, 0.375, 0); // HACK to have 2D pixel-perfect drawing on OpenGL 1.1
// NOTE: Not required with OpenGL 3.3+
@@ -533,7 +533,7 @@ void BeginDrawingEx(int blendMode, Shader shader, Matrix transform)
SetBlendMode(blendMode);
SetPostproShader(shader);
- rlMultMatrixf(GetMatrixVector(transform));
+ rlMultMatrixf(MatrixToFloat(transform));
}
// End canvas drawing and Swap Buffers (Double Buffering)
@@ -588,7 +588,7 @@ void Begin3dMode(Camera camera)
// Setup Camera view
Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up);
- rlMultMatrixf(GetMatrixVector(matView)); // Multiply MODELVIEW matrix by view matrix (camera)
+ rlMultMatrixf(MatrixToFloat(matView)); // Multiply MODELVIEW matrix by view matrix (camera)
}
// Ends 3D mode and returns to default 2D orthographic mode
@@ -630,6 +630,19 @@ float GetFrameTime(void)
return (float)roundedFrameTime; // Time in seconds to run a frame
}
+// Converts Color to float array and normalizes
+float *ColorToFloat(Color color)
+{
+ static float buffer[4];
+
+ buffer[0] = (float)color.r/255;
+ buffer[1] = (float)color.g/255;
+ buffer[2] = (float)color.b/255;
+ buffer[3] = (float)color.a/255;
+
+ return buffer;
+}
+
// Returns a Color struct from hexadecimal value
Color GetColor(int hexValue)
{