[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11873] branches/soc-2007-maike/source/ blender: Removed variables not needed from GLSL_ColorBand structure

Miguel Torres Lima torreslima at gmail.com
Tue Aug 28 20:28:08 CEST 2007


Revision: 11873
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11873
Author:   maike
Date:     2007-08-28 20:28:08 +0200 (Tue, 28 Aug 2007)

Log Message:
-----------
Removed variables not needed from GLSL_ColorBand structure

Modified Paths:
--------------
    branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h
    branches/soc-2007-maike/source/blender/src/glsl_colorband.c
    branches/soc-2007-maike/source/blender/src/glsl_uniforms.c

Modified: branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h
===================================================================
--- branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h	2007-08-28 16:19:18 UTC (rev 11872)
+++ branches/soc-2007-maike/source/blender/include/BIF_glsl_colorband.h	2007-08-28 18:28:08 UTC (rev 11873)
@@ -13,16 +13,6 @@
 {
   struct ColorBand *colorband;
   short index;
-
-  float tex[COLORBAND_WIDTH][4];
-
-#ifdef __APPLE__
-  unsigned long texid;
-#else
-  unsigned int texid;
-#endif
-
-  short tex_set;
   
   void (*add_tex)(struct GLSL_ColorBand_ *colorband, int index);
   void (*free)(struct GLSL_ColorBand_ *colorband);

Modified: branches/soc-2007-maike/source/blender/src/glsl_colorband.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_colorband.c	2007-08-28 16:19:18 UTC (rev 11872)
+++ branches/soc-2007-maike/source/blender/src/glsl_colorband.c	2007-08-28 18:28:08 UTC (rev 11873)
@@ -52,19 +52,18 @@
   ColorBand *cb = colorband->colorband;
   int i;
 
+  glDeleteTextures(1, &colorband_tex);
+
   for(i = 0; i < 512; i++){
     do_colorband(cb, (float) (i + 1) / 512, texels);
-    colorband->tex[i][0] = texels[0];
-    colorband->tex[i][1] = texels[1];
-    colorband->tex[i][2] = texels[2];
-    colorband->tex[i][3] = texels[3];
-
+ 
     colorbands[index][i][0] = texels[0];
     colorbands[index][i][1] = texels[1];
     colorbands[index][i][2] = texels[2];
     colorbands[index][i][3] = texels[3];
   }
 
+  glGenTextures(1, &colorband_tex);
   glActiveTexture(GL_TEXTURE1);
   glBindTexture(GL_TEXTURE_2D, colorband_tex);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -103,7 +102,6 @@
     cb_index[i] = 1.0;
   }
 
-  glGenTextures(1, &colorband_tex);
   cb_count = 0;
 }
 
@@ -141,8 +139,6 @@
 
   colorband->index = glsl_find_free_cb_index();
   colorband->colorband = cb;
-  colorband->texid = 0;
-  colorband->tex_set = 0;
 
   colorband->add_tex = glsl_cb_add_tex;
   colorband->free = glsl_cb_free;

Modified: branches/soc-2007-maike/source/blender/src/glsl_uniforms.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_uniforms.c	2007-08-28 16:19:18 UTC (rev 11872)
+++ branches/soc-2007-maike/source/blender/src/glsl_uniforms.c	2007-08-28 18:28:08 UTC (rev 11873)
@@ -388,7 +388,7 @@
   
   GLSL_Material material = BLI_ghash_lookup(matHash, mat);
 
-  if(!material) return;
+  if(!material) { printf("\n mat not found\n"); return; }
 
   glUseProgram(program);
 
@@ -411,7 +411,7 @@
     spec_fac = glsl_string(5, 0, "u_mat_", GINT, index, 0, "_ramp_", GINT, 1, 0, "_fac");    
     spec_index = glsl_string(5, 0, "u_mat_", GINT, index, 0, "_ramp_", GINT, 1, 0, "_index");
     glUniform1f(glsl_uniform_location(program, spec_fac), mat->rampfac_spec);   
-    glUniform1f(glsl_uniform_location(program, spec_index), colorband->index);
+    glUniform1f(glsl_uniform_location(program, spec_index), (float) colorband->index);
 
     MEM_freeN(spec_fac);
     MEM_freeN(spec_index);
@@ -433,7 +433,7 @@
 
   if(mat->mode & MA_RAMP_COL || mat->mode & MA_RAMP_SPEC){
     glActiveTexture(GL_TEXTURE1);
-
+    glBindTexture(GL_TEXTURE_1D, glsl_get_colorband_tex_id());
     glUniform1i(glsl_uniform_location(program, colorband_tex), 1);
     glEnable(GL_TEXTURE_2D);
   }





More information about the Bf-blender-cvs mailing list