[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11595] branches/soc-2007-maike/source/ blender/src/glsl_node_util.c: Added entry points for glsl texturing code concatenation

Miguel Torres Lima torreslima at gmail.com
Tue Aug 14 18:05:34 CEST 2007


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

Log Message:
-----------
Added entry points for glsl texturing code concatenation

Modified Paths:
--------------
    branches/soc-2007-maike/source/blender/src/glsl_node_util.c

Modified: branches/soc-2007-maike/source/blender/src/glsl_node_util.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_node_util.c	2007-08-14 15:48:59 UTC (rev 11594)
+++ branches/soc-2007-maike/source/blender/src/glsl_node_util.c	2007-08-14 16:05:33 UTC (rev 11595)
@@ -202,17 +202,22 @@
 
   char *light_funcs = NULL;
   char *cb_blend_funcs = NULL;
+  char *tex_funcs = NULL;
+  char *tex_blend_funcs = NULL;
+  char *tex_blendval_funcs = NULL;
 
   int diffuse = 0;
   int specular = 0;
   int visibility = 0;
   int ramp_blend = 0;
+  int tex_type = 0;
+  int tex_blend = 0;
+  int tex_blend_val = 0;
 
-
   if(tree->type == GLSL_MAT){
     GHashIterator *iter = BLI_ghashIterator_new(tree->hash);
     Material *mat = (Material *) BLI_ghashIterator_getKey(iter);
-    GLSL_NodeCode material_node = glsl_material_node(mat, &diffuse, &specular, &visibility, &ramp_blend, 0);
+    GLSL_NodeCode material_node = glsl_material_node(mat, &diffuse, &specular, &visibility, &ramp_blend, &tex_type, &tex_blend, &tex_blend_val, 0);
 
     program_node->uniform_code = glsl_string(2, 
 					     GFREE, program_node->uniform_code, 
@@ -227,14 +232,43 @@
     BLI_ghashIterator_free(iter);
   }
 
-  cb_blend_funcs = glsl_colorband_blend_funcs(ramp_blend);
 
-  if(!cb_blend_funcs){
+  if(!(tex_funcs = glsl_texture_funcs(tex_type))){
     MEM_freeN(program_node->uniform_code);
     MEM_freeN(program_node->node_code);
     MEM_freeN(program_node);
     return NULL;
   }
+  else if(strcmp(tex_funcs, "") != 0)
+    program_node->node_code = glsl_string(2, GFREE, tex_funcs, GFREE, program_node->node_code);
+
+  
+  if(!(tex_blend_funcs = glsl_texture_blend_funcs(tex_blend))){
+    MEM_freeN(program_node->uniform_code);
+    MEM_freeN(program_node->node_code);
+    MEM_freeN(program_node);
+    return NULL;
+  }
+  else if(strcmp(tex_blend_funcs, "") != 0)
+    program_node->node_code = glsl_string(2, GFREE, tex_blend_funcs, GFREE, program_node->node_code);
+
+  
+  if(!(tex_blendval_funcs = glsl_texture_blendval_funcs(tex_blend_val))){
+    MEM_freeN(program_node->uniform_code);
+    MEM_freeN(program_node->node_code);
+    MEM_freeN(program_node);
+    return NULL;
+  }
+  else if(strcmp(tex_blendval_funcs, "") != 0)
+    program_node->node_code = glsl_string(2, GFREE, tex_blendval_funcs, GFREE, program_node->node_code);
+
+
+  if(!(cb_blend_funcs = glsl_colorband_blend_funcs(ramp_blend))){
+    MEM_freeN(program_node->uniform_code);
+    MEM_freeN(program_node->node_code);
+    MEM_freeN(program_node);
+    return NULL;
+  }
   else if(strcmp(cb_blend_funcs, "") != 0) {
     program_node->node_code = glsl_string(2,
 					  GFREE, cb_blend_funcs,





More information about the Bf-blender-cvs mailing list