diff options
author | Daniel Genrich <daniel.genrich@gmx.net> | 2009-09-13 16:35:35 +0400 |
---|---|---|
committer | Daniel Genrich <daniel.genrich@gmx.net> | 2009-09-13 16:35:35 +0400 |
commit | 06a2ee4afed4237398b69ddf253e29a730b2f9f0 (patch) | |
tree | b12872d1ded6fed06af36f15d4e6f788772652e4 /source/blender/editors/space_view3d/drawvolume.c | |
parent | ca986a6874412aacbe9ec31a0cf94285f3d9ad41 (diff) |
Smoke:
* Making edge and vertex arrays local to avoid problems
Diffstat (limited to 'source/blender/editors/space_view3d/drawvolume.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawvolume.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 2c2ab2cbdec..48f2145c03c 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -121,31 +121,7 @@ struct GPUTexture; -/* draw slices of smoke is adapted from c++ code authored by: Johannes Schmid and Ingemar Rask, 2006, johnny@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 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture 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@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 @@ void draw_volume(Scene *scene, ARegion *ar, View3D *v3d, Base *base, GPUTexture 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); |