summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorraysan5 <[email protected]>2017-07-20 14:27:59 +0200
committerraysan5 <[email protected]>2017-07-20 14:27:59 +0200
commit63fd96354e7ceffcdf292a1aac6d564dc694377c (patch)
tree44a164ec42deb1dcb9be7cf5cd953f07d39b6cba /src/rlgl.c
parent4c06725461227d90feb169b30208e5bc3cec9c4d (diff)
downloadraylib-63fd96354e7ceffcdf292a1aac6d564dc694377c.tar.gz
raylib-63fd96354e7ceffcdf292a1aac6d564dc694377c.zip
Simplify a bit GenTexture*() functions
Still shader dependant, locations set should be moved out
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index 0700c926..44b20b61 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -2519,10 +2519,9 @@ Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size)
{
Texture2D cubemap = { 0 };
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- // Get cubemap shader locations
- //int projectionLoc = GetShaderLocation(shader, "projection"); // Already set at SetShaderDefaultLocations()
- //int viewLoc = GetShaderLocation(shader, "view"); // Already set at SetShaderDefaultLocations()
- int texmapLoc = GetShaderLocation(shader, "equirectangularMap");
+ // NOTE: SetShaderDefaultLocations() already setups locations for projection and view Matrix in shader
+ // TODO: Locations should be taken out of this function... too shader dependant...
+ SetShaderValuei(shader, GetShaderLocation(shader, "environmentMap"), (int[1]){ 0 }, 1);
SetShaderValuei(shader, texmapLoc, (int[1]){ 0 }, 1); // Set default active texture to 0
@@ -2598,14 +2597,11 @@ Texture2D GenTextureCubemap(Shader shader, Texture2D skyHDR, int size)
Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size)
{
Texture2D irradiance = { 0 };
-#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- // Get irradiance shader locations
- //int projectionLoc = GetShaderLocation(shader, "projection"); // Already set at SetShaderDefaultLocations()
- //int viewLoc = GetShaderLocation(shader, "view"); // Already set at SetShaderDefaultLocations()
- int texmapLoc = GetShaderLocation(shader, "environmentMap");
- // Set up shaders constant values
- SetShaderValuei(shader, texmapLoc, (int[1]){ 0 }, 1);
+#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
+ // NOTE: SetShaderDefaultLocations() already setups locations for projection and view Matrix in shader
+ // TODO: Locations should be taken out of this function... too shader dependant...
+ SetShaderValuei(shader, GetShaderLocation(shader, "environmentMap"), (int[1]){ 0 }, 1);
// Setup framebuffer
unsigned int fbo, rbo;
@@ -2673,14 +2669,12 @@ Texture2D GenTextureIrradiance(Shader shader, Texture2D cubemap, int size)
Texture2D GenTexturePrefilter(Shader shader, Texture2D cubemap, int size)
{
Texture2D prefilter = { 0 };
-#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
- // Get prefilter shader locations
- //int projectionLoc = GetShaderLocation(shader, "projection"); // Already set at SetShaderDefaultLocations()
- //int viewLoc = GetShaderLocation(shader, "view"); // Already set at SetShaderDefaultLocations()
- int roughnessLoc = GetShaderLocation(shader, "roughness");
- int texmapLoc = GetShaderLocation(shader, "environmentMap");
- SetShaderValuei(shader, texmapLoc, (int[1]){ 0 }, 1);
+#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
+ // NOTE: SetShaderDefaultLocations() already setups locations for projection and view Matrix in shader
+ // TODO: Locations should be taken out of this function... too shader dependant...
+ int roughnessLoc = GetShaderLocation(shader, "roughness");
+ SetShaderValuei(shader, GetShaderLocation(shader, "environmentMap"), (int[1]){ 0 }, 1);
// Setup framebuffer
unsigned int fbo, rbo;