[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23180] trunk/blender/source/blender/ editors/space_view3d/drawvolume.c: Smoke:

Daniel Genrich daniel.genrich at gmx.net
Sun Sep 13 14:35:35 CEST 2009


Revision: 23180
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23180
Author:   genscher
Date:     2009-09-13 14:35:35 +0200 (Sun, 13 Sep 2009)

Log Message:
-----------
Smoke:
* Making edge and vertex arrays local to avoid problems

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/drawvolume.c

Modified: trunk/blender/source/blender/editors/space_view3d/drawvolume.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawvolume.c	2009-09-13 12:34:00 UTC (rev 23179)
+++ trunk/blender/source/blender/editors/space_view3d/drawvolume.c	2009-09-13 12:35:35 UTC (rev 23180)
@@ -121,31 +121,7 @@
 
 struct GPUTexture;
 
-/* draw slices of smoke is adapted from c++ code authored by: Johannes Schmid and Ingemar Rask, 2006, johnny at grob.org */
-static float cv[][3] = {
-	{1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f},
-	{1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}
-};
-
-// edges have the form edges[n][0][xyz] + t*edges[n][1][xyz]
-static float edges[12][2][3] = {
-	{{1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
-	{{-1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
-	{{-1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
-	{{1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
-
-	{{1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
-	{{-1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
-	{{-1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
-	{{1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
-
-	{{-1.0f, 1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
-	{{-1.0f, -1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
-	{{-1.0f, -1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}},
-	{{-1.0f, 1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}}
-};
-
-int intersect_edges(float *points, float a, float b, float c, float d)
+int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
 {
 	int i;
 	float t;
@@ -204,6 +180,30 @@
 	float cor[3] = {1.,1.,1.};
 	int gl_depth = 0, gl_blend = 0;
 
+	/* draw slices of smoke is adapted from c++ code authored by: Johannes Schmid and Ingemar Rask, 2006, johnny at grob.org */
+	float cv[][3] = {
+		{1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f},
+		{1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}
+	};
+
+	// edges have the form edges[n][0][xyz] + t*edges[n][1][xyz]
+	float edges[12][2][3] = {
+		{{1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
+		{{-1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
+		{{-1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
+		{{1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
+
+		{{1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
+		{{-1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
+		{{-1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
+		{{1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
+
+		{{-1.0f, 1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
+		{{-1.0f, -1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
+		{{-1.0f, -1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}},
+		{{-1.0f, 1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}}
+	};
+
 	/* Fragment program to calculate the 3dview of smoke */
 	/* using 2 textures, density and shadow */
 	const char *text = "!!ARBfp1.0\n"
@@ -368,7 +368,7 @@
 		float p0[3];
 		// intersect_edges returns the intersection points of all cube edges with
 		// the given plane that lie within the cube
-		numpoints = intersect_edges(points, viewnormal[0], viewnormal[1], viewnormal[2], d);
+		numpoints = intersect_edges(points, viewnormal[0], viewnormal[1], viewnormal[2], d, edges);
 
 		if (numpoints > 2) {
 			VECCOPY(p0, points);





More information about the Bf-blender-cvs mailing list