[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34878] trunk/blender/source/blender/gpu/ intern/gpu_buffers.c: removed some more magic constants

Lukas Steiblys imbusy at imbusy.org
Tue Feb 15 20:22:09 CET 2011


Revision: 34878
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=34878
Author:   imbusy
Date:     2011-02-15 19:22:08 +0000 (Tue, 15 Feb 2011)
Log Message:
-----------
removed some more magic constants
another fix: the patch for #25806 was submitted by Riakiotakis Antonis and not by Andrew Wall

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_buffers.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_buffers.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_buffers.c	2011-02-15 19:19:36 UTC (rev 34877)
+++ trunk/blender/source/blender/gpu/intern/gpu_buffers.c	2011-02-15 19:22:08 UTC (rev 34878)
@@ -780,7 +780,7 @@
 {
 	GPUBuffer *buffer;
 	float *varray;
-	int redir[32768];
+	int redir[MAX_MATERIALS];
 	int *index;
 	int i;
 	int success;
@@ -802,7 +802,7 @@
 	index = MEM_mallocN(sizeof(int)*object->nmaterials,"GPU_buffer_setup");
 	for( i = 0; i < object->nmaterials; i++ ) {
 		index[i] = object->materials[i].start*vector_size;
-		redir[object->materials[i].mat_nr+16383] = i;
+		redir[object->materials[i].mat_nr] = i;
 	}
 
 	if( useVBOs ) {
@@ -873,11 +873,11 @@
 
 	numfaces= dm->getNumFaces(dm);
 	for( i=0; i < numfaces; i++ ) {
-		start = index[redir[mface[i].mat_nr+16383]];
+		start = index[redir[mface[i].mat_nr]];
 		if( mface[i].v4 )
-			index[redir[mface[i].mat_nr+16383]] += 18;
+			index[redir[mface[i].mat_nr]] += 18;
 		else
-			index[redir[mface[i].mat_nr+16383]] += 9;
+			index[redir[mface[i].mat_nr]] += 9;
 
 		/* v1 v2 v3 */
 		VECCOPY(&varray[start],mvert[mface[i].v1].co);
@@ -923,11 +923,11 @@
 	for( i=0; i < numfaces; i++ ) {
 		const int smoothnormal = (mface[i].flag & ME_SMOOTH);
 
-		start = index[redir[mface[i].mat_nr+16383]];
+		start = index[redir[mface[i].mat_nr]];
 		if( mface[i].v4 )
-			index[redir[mface[i].mat_nr+16383]] += 18;
+			index[redir[mface[i].mat_nr]] += 18;
 		else
-			index[redir[mface[i].mat_nr+16383]] += 9;
+			index[redir[mface[i].mat_nr]] += 9;
 
 		/* v1 v2 v3 */
 		if(smoothnormal) {
@@ -993,11 +993,11 @@
 		
 	numfaces= dm->getNumFaces(dm);
 	for( i=0; i < numfaces; i++ ) {
-		start = index[redir[mface[i].mat_nr+16383]];
+		start = index[redir[mface[i].mat_nr]];
 		if( mface[i].v4 )
-			index[redir[mface[i].mat_nr+16383]] += 12;
+			index[redir[mface[i].mat_nr]] += 12;
 		else
-			index[redir[mface[i].mat_nr+16383]] += 6;
+			index[redir[mface[i].mat_nr]] += 6;
 
 		/* v1 v2 v3 */
 		VECCOPY2D(&varray[start],mtface[i].uv[0]);
@@ -1033,11 +1033,11 @@
 
 	numfaces= dm->getNumFaces(dm);
 	for( i=0; i < numfaces; i++ ) {
-		int start = index[redir[mface[i].mat_nr+16383]];
+		int start = index[redir[mface[i].mat_nr]];
 		if( mface[i].v4 )
-			index[redir[mface[i].mat_nr+16383]] += 18;
+			index[redir[mface[i].mat_nr]] += 18;
 		else
-			index[redir[mface[i].mat_nr+16383]] += 9;
+			index[redir[mface[i].mat_nr]] += 9;
 
 		/* v1 v2 v3 */
 		VECCOPY(&varray[start],&mcol[i*12]);
@@ -1063,11 +1063,11 @@
 
 	numfaces= dm->getNumFaces(dm);
 	for( i=0; i < numfaces; i++ ) {
-		int start = index[redir[mface[i].mat_nr+16383]];
+		int start = index[redir[mface[i].mat_nr]];
 		if( mface[i].v4 )
-			index[redir[mface[i].mat_nr+16383]] += 18;
+			index[redir[mface[i].mat_nr]] += 18;
 		else
-			index[redir[mface[i].mat_nr+16383]] += 9;
+			index[redir[mface[i].mat_nr]] += 9;
 
 		/* v1 v2 v3 */
 		VECCOPY(&varray[start],&mcol[i*16]);




More information about the Bf-blender-cvs mailing list