From 6546474fa45234ed0a84f62be705d9a9aee43079 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 17 Jul 2017 00:33:40 +0200 Subject: Manual integration of material-pbr into develop --- examples/shaders/shaders_model_shader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'examples/shaders') diff --git a/examples/shaders/shaders_model_shader.c b/examples/shaders/shaders_model_shader.c index 51e9c1b3..ef5665d2 100644 --- a/examples/shaders/shaders_model_shader.c +++ b/examples/shaders/shaders_model_shader.c @@ -38,7 +38,7 @@ int main() "resources/shaders/glsl330/grayscale.fs"); // Load model shader dwarf.material.shader = shader; // Set shader effect to 3d model - dwarf.material.texDiffuse = texture; // Bind texture to model + dwarf.material.maps[TEXMAP_DIFFUSE].tex = texture; // Bind texture to model Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position -- cgit v1.2.3 From 9040526f175ac6e19551fa72e2dc25790be9f818 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 21 Jul 2017 17:17:37 +0200 Subject: Adapt to new materials system --- examples/models/models_mesh_picking.c | 2 +- examples/models/models_obj_loading.c | 2 +- examples/models/models_skybox.c | 2 +- examples/shaders/shaders_custom_uniform.c | 2 +- examples/shaders/shaders_model_shader.c | 4 ++-- examples/shaders/shaders_postprocessing.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) (limited to 'examples/shaders') diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c index ec151599..2f54468a 100644 --- a/examples/models/models_mesh_picking.c +++ b/examples/models/models_mesh_picking.c @@ -35,7 +35,7 @@ int main() Model tower = LoadModel("resources/tower.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/tower.png"); // Load model texture - tower.material.texDiffuse = texture; // Set model diffuse texture + tower.material.maps[MAP_DIFFUSE].texture = texture; // Set model diffuse texture Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position BoundingBox towerBBox = CalculateBoundingBox(tower.mesh); diff --git a/examples/models/models_obj_loading.c b/examples/models/models_obj_loading.c index 50d42d2e..70f92168 100644 --- a/examples/models/models_obj_loading.c +++ b/examples/models/models_obj_loading.c @@ -25,7 +25,7 @@ int main() Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture - dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture + dwarf.material.maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position SetTargetFPS(60); // Set our game to run at 60 frames-per-second diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c index 500cb19b..25b01e9c 100644 --- a/examples/models/models_skybox.c +++ b/examples/models/models_skybox.c @@ -35,7 +35,7 @@ int main() // Load cubemap shader and setup required shader locations Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs"); - SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "environmentMap"), (int[1]){ 0 }, 1); + SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, 1); Texture2D texHDR = LoadTexture("resources/pinetree.hdr"); skybox.material.maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512); diff --git a/examples/shaders/shaders_custom_uniform.c b/examples/shaders/shaders_custom_uniform.c index 89f87df9..a0f6fd22 100644 --- a/examples/shaders/shaders_custom_uniform.c +++ b/examples/shaders/shaders_custom_uniform.c @@ -34,7 +34,7 @@ int main() Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture (diffuse map) - dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture + dwarf.material.maps[MAP_DIFFUSE].texture = texture; // Set dwarf model diffuse texture Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position diff --git a/examples/shaders/shaders_model_shader.c b/examples/shaders/shaders_model_shader.c index ef5665d2..f1a349c6 100644 --- a/examples/shaders/shaders_model_shader.c +++ b/examples/shaders/shaders_model_shader.c @@ -37,8 +37,8 @@ int main() Shader shader = LoadShader("resources/shaders/glsl330/base.vs", "resources/shaders/glsl330/grayscale.fs"); // Load model shader - dwarf.material.shader = shader; // Set shader effect to 3d model - dwarf.material.maps[TEXMAP_DIFFUSE].tex = texture; // Bind texture to model + dwarf.material.shader = shader; // Set shader effect to 3d model + dwarf.material.maps[MAP_DIFFUSE].texture = texture; // Bind texture to model Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position diff --git a/examples/shaders/shaders_postprocessing.c b/examples/shaders/shaders_postprocessing.c index bb239efa..ae77a723 100644 --- a/examples/shaders/shaders_postprocessing.c +++ b/examples/shaders/shaders_postprocessing.c @@ -76,7 +76,7 @@ int main() Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture (diffuse map) - dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture + dwarf.material.maps[MAP_DIFFUSE].texture = texture; // Set dwarf model diffuse texture Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position -- cgit v1.2.3 From 0fc1323c80c2501c36741c05fd771ac1d001d049 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Fri, 25 Aug 2017 01:43:55 +0200 Subject: Renamed modelviewprojection matrix --- examples/models/resources/shaders/pbr.vs | 4 ++-- examples/shaders/resources/shaders/glsl100/base.vs | 4 ++-- examples/shaders/resources/shaders/glsl330/base.vs | 4 ++-- src/rlgl.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'examples/shaders') diff --git a/examples/models/resources/shaders/pbr.vs b/examples/models/resources/shaders/pbr.vs index 6a0fb238..e852ac1a 100644 --- a/examples/models/resources/shaders/pbr.vs +++ b/examples/models/resources/shaders/pbr.vs @@ -15,7 +15,7 @@ in vec3 vertexNormal; in vec3 vertexTangent; // Input uniform values -uniform mat4 mvpMatrix; +uniform mat4 mvp; uniform mat4 mMatrix; // Output vertex attributes (to fragment shader) @@ -45,5 +45,5 @@ void main() fragBinormal = cross(fragNormal, fragTangent); // Calculate final vertex position - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); + gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/base.vs b/examples/shaders/resources/shaders/glsl100/base.vs index e9386939..4be76b9e 100644 --- a/examples/shaders/resources/shaders/glsl100/base.vs +++ b/examples/shaders/resources/shaders/glsl100/base.vs @@ -7,7 +7,7 @@ attribute vec3 vertexNormal; attribute vec4 vertexColor; // Input uniform values -uniform mat4 mvpMatrix; +uniform mat4 mvp; // Output vertex attributes (to fragment shader) varying vec2 fragTexCoord; @@ -22,5 +22,5 @@ void main() fragColor = vertexColor; // Calculate final vertex position - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); + gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/base.vs b/examples/shaders/resources/shaders/glsl330/base.vs index 638cb8ae..f3099e82 100644 --- a/examples/shaders/resources/shaders/glsl330/base.vs +++ b/examples/shaders/resources/shaders/glsl330/base.vs @@ -7,7 +7,7 @@ in vec3 vertexNormal; in vec4 vertexColor; // Input uniform values -uniform mat4 mvpMatrix; +uniform mat4 mvp; // Output vertex attributes (to fragment shader) out vec2 fragTexCoord; @@ -22,5 +22,5 @@ void main() fragColor = vertexColor; // Calculate final vertex position - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); + gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/src/rlgl.c b/src/rlgl.c index 184277d0..373dada9 100644 --- a/src/rlgl.c +++ b/src/rlgl.c @@ -3251,12 +3251,12 @@ static Shader LoadShaderDefault(void) "out vec2 fragTexCoord; \n" "out vec4 fragColor; \n" #endif - "uniform mat4 mvpMatrix; \n" + "uniform mat4 mvp; \n" "void main() \n" "{ \n" " fragTexCoord = vertexTexCoord; \n" " fragColor = vertexColor; \n" - " gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); \n" + " gl_Position = mvp*vec4(vertexPosition, 1.0); \n" "} \n"; // Fragment shader directly defined, no external file required @@ -3302,7 +3302,7 @@ static Shader LoadShaderDefault(void) shader.locs[LOC_VERTEX_COLOR] = glGetAttribLocation(shader.id, "vertexColor"); // Get handles to GLSL uniform locations - shader.locs[LOC_MATRIX_MVP] = glGetUniformLocation(shader.id, "mvpMatrix"); + shader.locs[LOC_MATRIX_MVP] = glGetUniformLocation(shader.id, "mvp"); shader.locs[LOC_COLOR_DIFFUSE] = glGetUniformLocation(shader.id, "colDiffuse"); shader.locs[LOC_MAP_DIFFUSE] = glGetUniformLocation(shader.id, "texture0"); } @@ -3332,7 +3332,7 @@ static void SetShaderDefaultLocations(Shader *shader) shader->locs[LOC_VERTEX_COLOR] = glGetAttribLocation(shader->id, DEFAULT_ATTRIB_COLOR_NAME); // Get handles to GLSL uniform locations (vertex shader) - shader->locs[LOC_MATRIX_MVP] = glGetUniformLocation(shader->id, "mvpMatrix"); + shader->locs[LOC_MATRIX_MVP] = glGetUniformLocation(shader->id, "mvp"); shader->locs[LOC_MATRIX_PROJECTION] = glGetUniformLocation(shader->id, "projection"); shader->locs[LOC_MATRIX_VIEW] = glGetUniformLocation(shader->id, "view"); -- cgit v1.2.3