aboutsummaryrefslogtreecommitdiff
path: root/src/raylib.h
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2015-06-16 10:52:26 +0200
committerraysan5 <raysan5@gmail.com>2015-06-16 10:52:26 +0200
commitd9c5614342aa133218429d17dcc3267db5c0eef7 (patch)
tree7571a45f5d991b216efe05d0fc23d29e50ed2198 /src/raylib.h
parent4c6c18202331b53e6c94cecc52db9e55f7a81517 (diff)
downloadraylib-d9c5614342aa133218429d17dcc3267db5c0eef7.tar.gz
raylib-d9c5614342aa133218429d17dcc3267db5c0eef7.zip
Updated shader system
Diffstat (limited to 'src/raylib.h')
-rw-r--r--src/raylib.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/raylib.h b/src/raylib.h
index 851521e4..0d16a9af 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -282,26 +282,34 @@ typedef struct VertexData {
// Shader type
typedef struct Shader {
- unsigned int id; // Shader program id
+ unsigned int id; // Shader program id
+ unsigned int texDiffuseId; // Diffuse texture id
+ unsigned int texNormalId; // Normal texture id
+ unsigned int texSpecularId; // Specular texture id
+
// Variable attributes
- unsigned int vertexLoc; // Vertex attribute location point (vertex shader)
- unsigned int texcoordLoc; // Texcoord attribute location point (vertex shader)
- unsigned int normalLoc; // Normal attribute location point (vertex shader)
- unsigned int colorLoc; // Color attibute location point (vertex shader)
+ int vertexLoc; // Vertex attribute location point (vertex shader)
+ int texcoordLoc; // Texcoord attribute location point (vertex shader)
+ int normalLoc; // Normal attribute location point (vertex shader)
+ int colorLoc; // Color attibute location point (vertex shader)
// Uniforms
- unsigned int projectionLoc; // Projection matrix uniform location point (vertex shader)
- unsigned int modelviewLoc; // ModeView matrix uniform location point (vertex shader)
- unsigned int textureLoc; // Texture uniform location point (fragment shader)
- unsigned int tintColorLoc; // Color uniform location point (fragment shader)
+ int projectionLoc; // Projection matrix uniform location point (vertex shader)
+ int modelviewLoc; // ModeView matrix uniform location point (vertex shader)
+
+ int tintColorLoc; // Color uniform location point (fragment shader)
+
+ int mapDiffuseLoc; // Diffuse map texture uniform location point (fragment shader)
+ int mapNormalLoc; // Normal map texture uniform location point (fragment shader)
+ int mapSpecularLoc; // Specular map texture uniform location point (fragment shader)
} Shader;
// 3d Model type
typedef struct Model {
VertexData mesh;
Matrix transform;
- Texture2D texture;
+ Texture2D texture; // Only for OpenGL 1.1, on newer versions this should be in the shader
Shader shader;
} Model;
@@ -432,7 +440,10 @@ void SetSmoothZoomControl(int smoothZoomControlKey);
int GetShaderLocation(Shader shader, const char *uniformName);
void SetShaderValue(Shader shader, int uniformLoc, float *value, int size);
-void SetShaderTexture(Shader shader, int uniformLoc, Texture2D texture);
+
+void SetShaderMapDiffuse(Shader *shader, Texture2D texture);
+void SetShaderMapNormal(Shader *shader, const char *uniformName, Texture2D texture);
+void SetShaderMapSpecular(Shader *shader, const char *uniformName, Texture2D texture);
//------------------------------------------------------------------------------------
// Input Handling Functions (Module: core)