[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29866] branches/soc-2010-moguri/source/ blender/gpu/intern/gpu_material.c: A few things:

Mitchell Stokes mogurijin at gmail.com
Fri Jul 2 11:15:00 CEST 2010


Revision: 29866
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29866
Author:   moguri
Date:     2010-07-02 11:15:00 +0200 (Fri, 02 Jul 2010)

Log Message:
-----------
A few things:
  * UV data can now be accessed through vertex shader attributes. The name of the attribute is the name of the UV layer you want to get the UV data from. (For example: attribute vec2 UVTex)
  * If a custom uniform isn't found in the shader, just skip it and go on to the next one
  * Fixed a bug preventing sampler data from properly being passed to the shader.

Modified Paths:
--------------
    branches/soc-2010-moguri/source/blender/gpu/intern/gpu_material.c

Modified: branches/soc-2010-moguri/source/blender/gpu/intern/gpu_material.c
===================================================================
--- branches/soc-2010-moguri/source/blender/gpu/intern/gpu_material.c	2010-07-02 04:16:28 UTC (rev 29865)
+++ branches/soc-2010-moguri/source/blender/gpu/intern/gpu_material.c	2010-07-02 09:15:00 UTC (rev 29866)
@@ -186,6 +186,10 @@
 		sprintf(name, "att%d", attribs->layer[a].glindex);
 		attribs->layer[a].glindex = GPU_shader_get_attribute(shader, name);
 
+		// If the attribute id wasn't found in the shader, check for the attribute name (for custom shaders)
+		if(attribs->layer[a].glindex < 0)
+			attribs->layer[a].glindex = GPU_shader_get_attribute(shader, attribs->layer[a].name);
+
 		if(attribs->layer[a].glindex >= 0) {
 			attribs->layer[b] = attribs->layer[a];
 			b++;
@@ -402,7 +406,12 @@
 		/* handle custom uniforms */
 		for(cu=material->ma->csi.uniforms.first; cu; cu=cu->next) {
 			loc = GPU_shader_get_uniform(shader, cu->name);
-			if(cu->type >= MA_UNF_FLOAT || cu->type <= MA_UNF_VEC4)
+
+			// If the uniform wasn't found, go on to the next one
+			if (loc < 0)
+				continue;
+
+			if(cu->type >= MA_UNF_FLOAT && cu->type <= MA_UNF_VEC4)
 			{
 				if (cu->size > 1)
 					GPU_shader_uniform_vector(shader, loc, cu->size, 1, (float*)(cu->data));





More information about the Bf-blender-cvs mailing list