2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * Contributor(s): Daniel Genrich
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file blender/editors/space_view3d/drawvolume.c
35 #include "MEM_guardedalloc.h"
37 #include "DNA_scene_types.h"
38 #include "DNA_screen_types.h"
39 #include "DNA_smoke_types.h"
40 #include "DNA_view3d_types.h"
41 #include "DNA_property_types.h"
43 #include "BLI_utildefines.h"
44 #include "BLI_blenlib.h"
46 #include "BLI_edgehash.h"
48 #include "BKE_curve.h"
49 #include "BKE_constraint.h" /* for the get_constraint_target function */
50 #include "BKE_DerivedMesh.h"
51 #include "BKE_displist.h"
52 #include "BKE_effect.h"
54 #include "BKE_global.h"
55 #include "BKE_image.h"
57 #include "BKE_lattice.h"
59 #include "BKE_material.h"
60 #include "BKE_mball.h"
61 #include "BKE_modifier.h"
62 #include "BKE_object.h"
63 #include "BKE_paint.h"
64 #include "BKE_particle.h"
65 #include "BKE_property.h"
66 #include "BKE_smoke.h"
68 #include "smoke_API.h"
72 #include "GPU_extensions.h"
78 #include "view3d_intern.h" // own include
82 // #define DEBUG_DRAW_TIME
84 #ifdef DEBUG_DRAW_TIME
85 # include "PIL_time.h"
88 static int intersect_edges(float *points, float a, float b, float c, float d, float edges[12][2][3])
94 for (i = 0; i < 12; i++) {
95 t = -(a * edges[i][0][0] + b * edges[i][0][1] + c * edges[i][0][2] + d) /
96 (a * edges[i][1][0] + b * edges[i][1][1] + c * edges[i][1][2]);
97 if ((t > 0) && (t < 1)) {
98 points[numpoints * 3 + 0] = edges[i][0][0] + edges[i][1][0] * t;
99 points[numpoints * 3 + 1] = edges[i][0][1] + edges[i][1][1] * t;
100 points[numpoints * 3 + 2] = edges[i][0][2] + edges[i][1][2] * t;
107 static bool convex(const float p0[3], const float up[3], const float a[3], const float b[3])
109 /* Vec3 va = a-p0, vb = b-p0; */
110 float va[3], vb[3], tmp[3];
111 sub_v3_v3v3(va, a, p0);
112 sub_v3_v3v3(vb, b, p0);
113 cross_v3_v3v3(tmp, va, vb);
114 return dot_v3v3(up, tmp) >= 0;
117 void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
118 GPUTexture *tex, float min[3], float max[3],
119 int res[3], float dx, float UNUSED(base_scale), float viewnormal[3],
120 GPUTexture *tex_shadow, GPUTexture *tex_flame)
122 int i, j, k, n, good_index;
123 float d /*, d0 */ /* UNUSED */, dd, ds;
124 float *points = NULL;
126 float cor[3] = {1.0f, 1.0f, 1.0f};
127 int gl_depth = 0, gl_blend = 0;
129 /* draw slices of smoke is adapted from c++ code authored
130 * by: Johannes Schmid and Ingemar Rask, 2006, johnny@grob.org */
132 {1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f},
133 {1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}
136 /* edges have the form edges[n][0][xyz] + t*edges[n][1][xyz] */
137 float edges[12][2][3] = {
138 {{1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
139 {{-1.0f, 1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
140 {{-1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
141 {{1.0f, -1.0f, -1.0f}, {0.0f, 0.0f, 2.0f}},
143 {{1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
144 {{-1.0f, -1.0f, 1.0f}, {0.0f, 2.0f, 0.0f}},
145 {{-1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
146 {{1.0f, -1.0f, -1.0f}, {0.0f, 2.0f, 0.0f}},
148 {{-1.0f, 1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
149 {{-1.0f, -1.0f, 1.0f}, {2.0f, 0.0f, 0.0f}},
150 {{-1.0f, -1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}},
151 {{-1.0f, 1.0f, -1.0f}, {2.0f, 0.0f, 0.0f}}
154 unsigned char *spec_data;
156 GPUTexture *tex_spec;
158 /* Fragment program to calculate the view3d of smoke */
159 /* using 4 textures, density, shadow, flame and flame spectrum */
160 const char *shader_basic =
162 "PARAM dx = program.local[0];\n"
163 "PARAM darkness = program.local[1];\n"
164 "PARAM render = program.local[2];\n"
165 "PARAM f = {1.442695041, 1.442695041, 1.442695041, 0.01};\n"
166 "TEMP temp, shadow, flame, spec, value;\n"
167 "TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
168 "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
169 "TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
170 "TEX spec, flame.r, texture[3], 1D;\n"
171 /* calculate shading factor from density */
172 "MUL value.r, temp.a, darkness.a;\n"
173 "MUL value.r, value.r, dx.r;\n"
174 "MUL value.r, value.r, f.r;\n"
175 "EX2 temp, -value.r;\n"
177 "SUB temp.a, 1.0, temp.r;\n"
179 "MUL temp.r, temp.r, shadow.r;\n"
180 "MUL temp.g, temp.g, shadow.r;\n"
181 "MUL temp.b, temp.b, shadow.r;\n"
182 "MUL temp.r, temp.r, darkness.r;\n"
183 "MUL temp.g, temp.g, darkness.g;\n"
184 "MUL temp.b, temp.b, darkness.b;\n"
185 /* for now this just replace smoke shading if rendering fire */
186 "CMP result.color, render.r, temp, spec;\n"
190 const char *shader_color =
192 "PARAM dx = program.local[0];\n"
193 "PARAM darkness = program.local[1];\n"
194 "PARAM render = program.local[2];\n"
195 "PARAM f = {1.442695041, 1.442695041, 1.442695041, 1.442695041};\n"
196 "TEMP temp, shadow, flame, spec, value;\n"
197 "TEX temp, fragment.texcoord[0], texture[0], 3D;\n"
198 "TEX shadow, fragment.texcoord[0], texture[1], 3D;\n"
199 "TEX flame, fragment.texcoord[0], texture[2], 3D;\n"
200 "TEX spec, flame.r, texture[3], 1D;\n"
201 /* unpremultiply volume texture */
202 "RCP value.r, temp.a;\n"
203 "MUL temp.r, temp.r, value.r;\n"
204 "MUL temp.g, temp.g, value.r;\n"
205 "MUL temp.b, temp.b, value.r;\n"
206 /* calculate shading factor from density */
207 "MUL value.r, temp.a, darkness.a;\n"
208 "MUL value.r, value.r, dx.r;\n"
209 "MUL value.r, value.r, f.r;\n"
210 "EX2 value.r, -value.r;\n"
212 "SUB temp.a, 1.0, value.r;\n"
214 "MUL temp.r, temp.r, shadow.r;\n"
215 "MUL temp.g, temp.g, shadow.r;\n"
216 "MUL temp.b, temp.b, shadow.r;\n"
217 "MUL temp.r, temp.r, value.r;\n"
218 "MUL temp.g, temp.g, value.r;\n"
219 "MUL temp.b, temp.b, value.r;\n"
220 /* for now this just replace smoke shading if rendering fire */
221 "CMP result.color, render.r, temp, spec;\n"
230 printf("Could not allocate 3D texture for 3D View smoke drawing.\n");
234 #ifdef DEBUG_DRAW_TIME
238 /* generate flame spectrum texture */
239 #define SPEC_WIDTH 256
240 #define FIRE_THRESH 7
241 #define MAX_FIRE_ALPHA 0.06f
242 #define FULL_ON_FIRE 100
243 spec_data = malloc(SPEC_WIDTH * 4 * sizeof(unsigned char));
244 flame_get_spectrum(spec_data, SPEC_WIDTH, 1500, 3000);
245 spec_pixels = malloc(SPEC_WIDTH * 4 * 16 * 16 * sizeof(float));
246 for (i = 0; i < 16; i++) {
247 for (j = 0; j < 16; j++) {
248 for (k = 0; k < SPEC_WIDTH; k++) {
249 int index = (j * SPEC_WIDTH * 16 + i * SPEC_WIDTH + k) * 4;
250 if (k >= FIRE_THRESH) {
251 spec_pixels[index] = ((float)spec_data[k * 4]) / 255.0f;
252 spec_pixels[index + 1] = ((float)spec_data[k * 4 + 1]) / 255.0f;
253 spec_pixels[index + 2] = ((float)spec_data[k * 4 + 2]) / 255.0f;
254 spec_pixels[index + 3] = MAX_FIRE_ALPHA * (
255 (k > FULL_ON_FIRE) ? 1.0f : (k - FIRE_THRESH) / ((float)FULL_ON_FIRE - FIRE_THRESH));
258 spec_pixels[index] = spec_pixels[index + 1] = spec_pixels[index + 2] = spec_pixels[index + 3] = 0.0f;
264 tex_spec = GPU_texture_create_1D(SPEC_WIDTH, spec_pixels, NULL);
266 sub_v3_v3v3(size, max, min);
268 /* maxx, maxy, maxz */
272 /* minx, maxy, maxz */
276 /* minx, miny, maxz */
280 /* maxx, miny, maxz */
285 /* maxx, maxy, minz */
289 /* minx, maxy, minz */
293 /* minx, miny, minz */
297 /* maxx, miny, minz */
302 copy_v3_v3(edges[0][0], cv[4]); /* maxx, maxy, minz */
303 copy_v3_v3(edges[1][0], cv[5]); /* minx, maxy, minz */
304 copy_v3_v3(edges[2][0], cv[6]); /* minx, miny, minz */
305 copy_v3_v3(edges[3][0], cv[7]); /* maxx, miny, minz */
307 copy_v3_v3(edges[4][0], cv[3]); /* maxx, miny, maxz */
308 copy_v3_v3(edges[5][0], cv[2]); /* minx, miny, maxz */
309 copy_v3_v3(edges[6][0], cv[6]); /* minx, miny, minz */
310 copy_v3_v3(edges[7][0], cv[7]); /* maxx, miny, minz */
312 copy_v3_v3(edges[8][0], cv[1]); /* minx, maxy, maxz */
313 copy_v3_v3(edges[9][0], cv[2]); /* minx, miny, maxz */
314 copy_v3_v3(edges[10][0], cv[6]); /* minx, miny, minz */
315 copy_v3_v3(edges[11][0], cv[5]); /* minx, maxy, minz */
317 // printf("size x: %f, y: %f, z: %f\n", size[0], size[1], size[2]);
318 // printf("min[2]: %f, max[2]: %f\n", min[2], max[2]);
320 edges[0][1][2] = size[2];
321 edges[1][1][2] = size[2];
322 edges[2][1][2] = size[2];
323 edges[3][1][2] = size[2];
325 edges[4][1][1] = size[1];
326 edges[5][1][1] = size[1];
327 edges[6][1][1] = size[1];
328 edges[7][1][1] = size[1];
330 edges[8][1][0] = size[0];
331 edges[9][1][0] = size[0];
332 edges[10][1][0] = size[0];
333 edges[11][1][0] = size[0];
335 glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend);
336 glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
338 glDepthMask(GL_FALSE);
339 glDisable(GL_DEPTH_TEST);
342 /* find cube vertex that is closest to the viewer */
343 for (i = 0; i < 8; i++) {
346 x = cv[i][0] - viewnormal[0] * size[0] * 0.5f;
347 y = cv[i][1] - viewnormal[1] * size[1] * 0.5f;
348 z = cv[i][2] - viewnormal[2] * size[2] * 0.5f;
350 if ((x >= min[0]) && (x <= max[0]) &&
351 (y >= min[1]) && (y <= max[1]) &&
352 (z >= min[2]) && (z <= max[2]))
359 /* fallback, avoid using buffer over-run */
363 // printf("i: %d\n", i);
364 // printf("point %f, %f, %f\n", cv[i][0], cv[i][1], cv[i][2]);
366 if (GL_TRUE == glewIsSupported("GL_ARB_fragment_program")) {
367 glEnable(GL_FRAGMENT_PROGRAM_ARB);
368 glGenProgramsARB(1, &prog);
370 glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, prog);
372 if (sds->active_fields & SM_ACTIVE_COLORS)
373 glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(shader_color), shader_color);
375 glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, (GLsizei)strlen(shader_basic), shader_basic);
378 glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 0, dx, dx, dx, 1.0);
379 /* custom parameter for smoke style (higher = thicker) */
380 if (sds->active_fields & SM_ACTIVE_COLORS)
381 glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, 1.0, 1.0, 1.0, 10.0);
383 glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 1, sds->active_color[0], sds->active_color[1], sds->active_color[2], 10.0);
386 printf("Your gfx card does not support 3D View smoke drawing.\n");
388 GPU_texture_bind(tex, 0);
390 GPU_texture_bind(tex_shadow, 1);
392 printf("No volume shadow\n");
395 GPU_texture_bind(tex_flame, 2);
396 GPU_texture_bind(tex_spec, 3);
399 if (!GPU_non_power_of_two_support()) {
400 cor[0] = (float)res[0] / (float)power_of_2_max_i(res[0]);
401 cor[1] = (float)res[1] / (float)power_of_2_max_i(res[1]);
402 cor[2] = (float)res[2] / (float)power_of_2_max_i(res[2]);
405 /* our slices are defined by the plane equation a*x + b*y +c*z + d = 0
406 * (a,b,c), the plane normal, are given by viewdir
407 * d is the parameter along the view direction. the first d is given by
408 * inserting previously found vertex into the plane equation */
410 /* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */
411 ds = (fabsf(viewnormal[0]) * size[0] + fabsf(viewnormal[1]) * size[1] + fabsf(viewnormal[2]) * size[2]);
412 dd = max_fff(sds->global_size[0], sds->global_size[1], sds->global_size[2]) / 128.f;
416 // printf("d0: %f, dd: %f, ds: %f\n\n", d0, dd, ds);
418 points = MEM_callocN(sizeof(float) * 12 * 3, "smoke_points_preview");
422 float tmp_point[3], tmp_point2[3];
424 if (dd * (float)n > ds)
427 copy_v3_v3(tmp_point, viewnormal);
428 mul_v3_fl(tmp_point, -dd * ((ds / dd) - (float)n));
429 add_v3_v3v3(tmp_point2, cv[good_index], tmp_point);
430 d = dot_v3v3(tmp_point2, viewnormal);
432 // printf("my d: %f\n", d);
434 /* intersect_edges returns the intersection points of all cube edges with
435 * the given plane that lie within the cube */
436 numpoints = intersect_edges(points, viewnormal[0], viewnormal[1], viewnormal[2], -d, edges);
438 // printf("points: %d\n", numpoints);
441 copy_v3_v3(p0, points);
443 /* sort points to get a convex polygon */
444 for (i = 1; i < numpoints - 1; i++) {
445 for (j = i + 1; j < numpoints; j++) {
446 if (!convex(p0, viewnormal, &points[j * 3], &points[i * 3])) {
448 copy_v3_v3(tmp2, &points[j * 3]);
449 copy_v3_v3(&points[j * 3], &points[i * 3]);
450 copy_v3_v3(&points[i * 3], tmp2);
455 /* render fire slice */
456 glBlendFunc(GL_SRC_ALPHA, GL_ONE);
457 glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0);
459 glColor3f(1.0, 1.0, 1.0);
460 for (i = 0; i < numpoints; i++) {
461 glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
462 (points[i * 3 + 1] - min[1]) * cor[1] / size[1],
463 (points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
464 glVertex3f(points[i * 3 + 0] / fabsf(ob->size[0]),
465 points[i * 3 + 1] / fabsf(ob->size[1]),
466 points[i * 3 + 2] / fabsf(ob->size[2]));
470 /* render smoke slice */
471 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
472 glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, -1.0, 0.0, 0.0, 0.0);
474 glColor3f(1.0, 1.0, 1.0);
475 for (i = 0; i < numpoints; i++) {
476 glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
477 (points[i * 3 + 1] - min[1]) * cor[1] / size[1],
478 (points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
479 glVertex3f(points[i * 3 + 0] / fabsf(ob->size[0]),
480 points[i * 3 + 1] / fabsf(ob->size[1]),
481 points[i * 3 + 2] / fabsf(ob->size[2]));
488 #ifdef DEBUG_DRAW_TIME
489 printf("Draw Time: %f\n", (float)TIMEIT_VALUE(draw));
494 GPU_texture_unbind(tex_shadow);
495 GPU_texture_unbind(tex);
497 GPU_texture_unbind(tex_flame);
498 GPU_texture_unbind(tex_spec);
500 GPU_texture_free(tex_spec);
505 if (GLEW_ARB_fragment_program) {
506 glDisable(GL_FRAGMENT_PROGRAM_ARB);
507 glDeleteProgramsARB(1, &prog);
518 glEnable(GL_DEPTH_TEST);
519 glDepthMask(GL_TRUE);
523 #ifdef SMOKE_DEBUG_VELOCITY
524 void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob)
528 int *base_res = domain->base_res;
529 int *res = domain->res;
530 int *res_min = domain->res_min;
531 int *res_max = domain->res_max;
532 float *vel_x = smoke_get_velocity_x(domain->fluid);
533 float *vel_y = smoke_get_velocity_y(domain->fluid);
534 float *vel_z = smoke_get_velocity_z(domain->fluid);
537 float *cell_size = domain->cell_size;
538 float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.f;
539 float vf = domain->scale / 16.f * 2.f; /* velocity factor */
543 /* set first position so that it doesn't jump when domain moves */
544 x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
545 y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
546 z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
547 if (x0 < res_min[0]) x0 += step_size;
548 if (y0 < res_min[1]) y0 += step_size;
549 if (z0 < res_min[2]) z0 += step_size;
550 add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
552 for (x = floor(x0); x < res_max[0]; x += step_size)
553 for (y = floor(y0); y < res_max[1]; y += step_size)
554 for (z = floor(z0); z < res_max[2]; z += step_size) {
555 int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
557 float pos[3] = {min[0] + ((float)x + 0.5f) * cell_size[0], min[1] + ((float)y + 0.5f) * cell_size[1], min[2] + ((float)z + 0.5f) * cell_size[2]};
558 float vel = sqrtf(vel_x[index] * vel_x[index] + vel_y[index] * vel_y[index] + vel_z[index] * vel_z[index]);
560 /* draw heat as scaled "arrows" */
562 float col_g = 1.0f - vel;
563 CLAMP(col_g, 0.0f, 1.0f);
564 glColor3f(1.0f, col_g, 0.0f);
565 glPointSize(10.0f * vel);
568 glVertex3f(pos[0], pos[1], pos[2]);
569 glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
572 glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
579 #ifdef SMOKE_DEBUG_HEAT
580 void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob)
584 int *base_res = domain->base_res;
585 int *res = domain->res;
586 int *res_min = domain->res_min;
587 int *res_max = domain->res_max;
588 float *heat = smoke_get_heat(domain->fluid);
591 float *cell_size = domain->cell_size;
592 float step_size = ((float)max_iii(base_res[0], base_res[1], base_res[2])) / 16.f;
593 float vf = domain->scale / 16.f * 2.f; /* velocity factor */
595 /* set first position so that it doesn't jump when domain moves */
596 x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
597 y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
598 z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
599 if (x0 < res_min[0]) x0 += step_size;
600 if (y0 < res_min[1]) y0 += step_size;
601 if (z0 < res_min[2]) z0 += step_size;
602 add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
604 for (x = floor(x0); x < res_max[0]; x += step_size)
605 for (y = floor(y0); y < res_max[1]; y += step_size)
606 for (z = floor(z0); z < res_max[2]; z += step_size) {
607 int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
609 float pos[3] = {min[0] + ((float)x + 0.5f) * cell_size[0], min[1] + ((float)y + 0.5f) * cell_size[1], min[2] + ((float)z + 0.5f) * cell_size[2]};
611 /* draw heat as different sized points */
612 if (heat[index] >= 0.01f) {
613 float col_gb = 1.0f - heat[index];
614 CLAMP(col_gb, 0.0f, 1.0f);
615 glColor3f(1.0f, col_gb, col_gb);
616 glPointSize(24.0f * heat[index]);
619 glVertex3f(pos[0], pos[1], pos[2]);