Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-10-11 03:44:07 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-11 03:44:07 +0400
commit57004cfb5a495adbb2aa890659b6540e3490a750 (patch)
treee3ab0c5daf30830593c3055f8fe27fd217a17379 /source/blender/editors
parentfe09b24e86e340e733f91c8ed9fcc7b8519157f4 (diff)
style cleanup:
also add helper makefile targets: * tbz - makes a tar.bz2 of an svn export * test_style_qtc - outputs style checks in qtc task format.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/meshlaplacian.c4
-rw-r--r--source/blender/editors/interface/interface_widgets.c12
-rw-r--r--source/blender/editors/object/object_iterators.c6
-rw-r--r--source/blender/editors/object/object_vgroup.c8
-rw-r--r--source/blender/editors/physics/dynamicpaint_ops.c38
-rw-r--r--source/blender/editors/space_image/image_ops.c3
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c113
7 files changed, 89 insertions, 95 deletions
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index e7efd7936c0..82fef00b1e6 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -1221,7 +1221,7 @@ static void harmonic_ray_callback(void *userdata, int index, const BVHTreeRay *r
else
normal_quad_v3(no, face[0], face[1], face[2], face[3]);
- dist = len_v3v3(ray->origin, co)/len_v3(isec->vec);
+ dist = len_v3v3(ray->origin, co) / len_v3(isec->vec);
if (dist < hit->dist) {
hit->index = index;
hit->dist = dist;
@@ -1257,7 +1257,7 @@ static MDefBoundIsect *meshdeform_ray_tree_intersect(MeshDeformBind *mdb, float
if (BLI_bvhtree_ray_cast(mdb->bvhtree, isect_mdef.start, isect_mdef.vec,
0.0, &hit, harmonic_ray_callback, data) != -1)
{
- len= isect_mdef.labda;
+ len = isect_mdef.labda;
isect_mdef.face = mface = mface1 + hit.index;
/* create MDefBoundIsect */
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 0e1fd87c985..3203237496f 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -3094,14 +3094,10 @@ static int widget_roundbox_set(uiBut *but, rcti *rect)
if (but->active) {
int direction = ui_button_open_menu_direction(but);
- if (direction == UI_TOP)
- roundbox &= ~(UI_CNR_TOP_RIGHT|UI_CNR_TOP_LEFT);
- else if (direction == UI_DOWN)
- roundbox &= ~(UI_CNR_BOTTOM_RIGHT|UI_CNR_BOTTOM_LEFT);
- else if (direction == UI_LEFT)
- roundbox &= ~(UI_CNR_TOP_LEFT|UI_CNR_BOTTOM_LEFT);
- else if (direction == UI_RIGHT)
- roundbox &= ~(UI_CNR_TOP_RIGHT|UI_CNR_BOTTOM_RIGHT);
+ if (direction == UI_TOP) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_TOP_LEFT);
+ else if (direction == UI_DOWN) roundbox &= ~(UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT);
+ else if (direction == UI_LEFT) roundbox &= ~(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
+ else if (direction == UI_RIGHT) roundbox &= ~(UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT);
}
return roundbox;
diff --git a/source/blender/editors/object/object_iterators.c b/source/blender/editors/object/object_iterators.c
index 1d38db9d59b..c1841711435 100644
--- a/source/blender/editors/object/object_iterators.c
+++ b/source/blender/editors/object/object_iterators.c
@@ -187,8 +187,7 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, const flo
if (efa && !BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
float screen_co[2];
- if (ED_view3d_project_float_object(data->vc.ar, cent, screen_co, data->clip_flag) == V3D_PROJ_RET_OK)
- {
+ if (ED_view3d_project_float_object(data->vc.ar, cent, screen_co, data->clip_flag) == V3D_PROJ_RET_OK) {
data->func(data->userData, efa, screen_co, index);
}
}
@@ -297,8 +296,7 @@ void mball_foreachScreenElem(
for (ml = mb->editelems->first; ml; ml = ml->next) {
float screen_co[2];
- if (ED_view3d_project_float_object(vc->ar, &ml->x, screen_co, clip_flag) == V3D_PROJ_RET_OK)
- {
+ if (ED_view3d_project_float_object(vc->ar, &ml->x, screen_co, clip_flag) == V3D_PROJ_RET_OK) {
func(userData, ml, screen_co);
}
}
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index b5643cdb9cb..a92cfa472aa 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -533,7 +533,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
}
/* loop through the vertices*/
- for(i = 0, dv_src = dv_array_src, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, dv_src++, mv_src++, mv_dst++) {
+ for (i = 0, dv_src = dv_array_src, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, dv_src++, mv_src++, mv_dst++) {
if (*dv_dst == NULL) {
continue;
@@ -553,7 +553,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
bvhtree_from_mesh_verts(&tree_mesh_vertices_src, dmesh_src, FLT_EPSILON, 2, 6);
/* loop trough vertices */
- for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++){
+ for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
if (*dv_dst == NULL) {
continue;
@@ -592,7 +592,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
bvhtree_from_mesh_faces(&tree_mesh_faces_src, dmesh_src, FLT_EPSILON, 2, 6);
/* loop through the vertices */
- for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
+ for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
if (*dv_dst == NULL) {
continue;
@@ -652,7 +652,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
bvhtree_from_mesh_faces(&tree_mesh_faces_src, dmesh_src, FLT_EPSILON, 2, 6);
/* loop through the vertices */
- for(i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++){
+ for (i = 0, dv_dst = dv_array_dst; i < me_dst->totvert; i++, dv_dst++, mv_dst++) {
if (*dv_dst == NULL) {
continue;
diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c
index 70fe87e5c01..5b69e6745c0 100644
--- a/source/blender/editors/physics/dynamicpaint_ops.c
+++ b/source/blender/editors/physics/dynamicpaint_ops.c
@@ -73,9 +73,9 @@ static int surface_slot_add_exec(bContext *C, wmOperator *UNUSED(op))
/* set preview for this surface only and set active */
canvas->active_sur = 0;
- for (surface=surface->prev; surface; surface=surface->prev) {
- surface->flags &= ~MOD_DPAINT_PREVIEW;
- canvas->active_sur++;
+ for (surface = surface->prev; surface; surface = surface->prev) {
+ surface->flags &= ~MOD_DPAINT_PREVIEW;
+ canvas->active_sur++;
}
return OPERATOR_FINISHED;
@@ -94,26 +94,26 @@ void DPAINT_OT_surface_slot_add(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
DynamicPaintModifierData *pmd = NULL;
- Object *cObject = ED_object_context(C);
+ Object *obj_ctx = ED_object_context(C);
DynamicPaintCanvasSettings *canvas;
DynamicPaintSurface *surface;
- int id=0;
+ int id = 0;
/* Make sure we're dealing with a canvas */
- pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
+ pmd = (DynamicPaintModifierData *)modifiers_findByType(obj_ctx, eModifierType_DynamicPaint);
if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
canvas = pmd->canvas;
surface = canvas->surfaces.first;
/* find active surface and remove it */
- for (; surface; surface=surface->next) {
+ for (; surface; surface = surface->next) {
if (id == canvas->active_sur) {
canvas->active_sur -= 1;
dynamicPaint_freeSurface(surface);
@@ -123,8 +123,8 @@ static int surface_slot_remove_exec(bContext *C, wmOperator *UNUSED(op))
}
dynamicPaint_resetPreview(canvas);
- DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
+ DAG_id_tag_update(&obj_ctx->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, obj_ctx);
return OPERATOR_FINISHED;
}
@@ -142,7 +142,7 @@ void DPAINT_OT_surface_slot_remove(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int type_toggle_exec(bContext *C, wmOperator *op)
@@ -151,7 +151,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
Object *cObject = ED_object_context(C);
Scene *scene = CTX_data_scene(C);
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(cObject, eModifierType_DynamicPaint);
- int type= RNA_enum_get(op->ptr, "type");
+ int type = RNA_enum_get(op->ptr, "type");
if (!pmd) return OPERATOR_CANCELLED;
@@ -170,7 +170,7 @@ static int type_toggle_exec(bContext *C, wmOperator *op)
/* update dependency */
DAG_id_tag_update(&cObject->id, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, cObject);
+ WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, cObject);
DAG_scene_sort(CTX_data_main(C), scene);
return OPERATOR_FINISHED;
@@ -190,10 +190,10 @@ void DPAINT_OT_type_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- prop= RNA_def_enum(ot->srna, "type", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
+ prop = RNA_def_enum(ot->srna, "type", prop_dynamicpaint_type_items, MOD_DYNAMICPAINT_TYPE_CANVAS, "Type", "");
ot->prop = prop;
}
@@ -203,7 +203,7 @@ static int output_toggle_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
DynamicPaintSurface *surface;
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
- int output= RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */
+ int output = RNA_enum_get(op->ptr, "output"); /* currently only 1/0 */
if (!pmd || !pmd->canvas) return OPERATOR_CANCELLED;
surface = get_activeSurface(pmd->canvas);
@@ -258,7 +258,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
ot->poll = ED_operator_object_active_editable;
/* flags */
- ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
ot->prop = RNA_def_enum(ot->srna, "output", prop_output_toggle_types, 0, "Output Toggle", "");
@@ -274,7 +274,7 @@ void DPAINT_OT_output_toggle(wmOperatorType *ot)
static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surface, Object *cObject)
{
DynamicPaintCanvasSettings *canvas = surface->canvas;
- Scene *scene= CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
wmWindow *win = CTX_wm_window(C);
int frame = 1;
int frames;
@@ -291,7 +291,7 @@ static int dynamicPaint_bakeImageSequence(bContext *C, DynamicPaintSurface *surf
if (!dynamicPaint_createUVSurface(surface)) return 0;
/* Loop through selected frames */
- for (frame=surface->start_frame; frame<=surface->end_frame; frame++) {
+ for (frame = surface->start_frame; frame <= surface->end_frame; frame++) {
float progress = (frame - surface->start_frame) / (float)frames * 100;
surface->current_frame = frame;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 4f57b2249d1..c7ad82dec85 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1259,8 +1259,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
BKE_image_release_renderresult(scene, ima);
}
else {
- if (BKE_imbuf_write_as(colormanaged_ibuf, simopts->filepath, &simopts->im_format, save_copy))
- {
+ if (BKE_imbuf_write_as(colormanaged_ibuf, simopts->filepath, &simopts->im_format, save_copy)) {
ok = TRUE;
}
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 8cc55363a5e..ebb48960b80 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -133,7 +133,7 @@ static int intersect_edges(float *points, float a, float b, float c, float d, fl
int i;
float t;
int numpoints = 0;
-
+
for (i = 0; i < 12; i++) {
t = -(a * edges[i][0][0] + b * edges[i][0][1] + c * edges[i][0][2] + d) /
(a * edges[i][1][0] + b * edges[i][1][1] + c * edges[i][1][2]);
@@ -280,21 +280,22 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
#define FIRE_THRESH 7
#define MAX_FIRE_ALPHA 0.06f
#define FULL_ON_FIRE 100
- spec_data = malloc(SPEC_WIDTH*4 * sizeof(unsigned char));
+ spec_data = malloc(SPEC_WIDTH * 4 * sizeof(unsigned char));
flame_get_spectrum(spec_data, SPEC_WIDTH, 1500, 3000);
- spec_pixels = malloc(SPEC_WIDTH*4*16*16 * sizeof(float));
- for (i=0;i<16;i++){
- for (j=0;j<16;j++) {
- for (k=0;k<SPEC_WIDTH;k++) {
- int index = (j*SPEC_WIDTH*16+i*SPEC_WIDTH+k)*4;
- if (k>=FIRE_THRESH) {
- spec_pixels[index] = ((float)spec_data[k*4])/255.0f;
- spec_pixels[index+1] = ((float)spec_data[k*4+1])/255.0f;
- spec_pixels[index+2] = ((float)spec_data[k*4+2])/255.0f;
- spec_pixels[index+3] = MAX_FIRE_ALPHA*(
- (k>FULL_ON_FIRE) ? 1.0f : (k-FIRE_THRESH)/((float)FULL_ON_FIRE-FIRE_THRESH));
- } else {
- spec_pixels[index] = spec_pixels[index+1] = spec_pixels[index+2] = spec_pixels[index+3] = 0.0f;
+ spec_pixels = malloc(SPEC_WIDTH * 4 * 16 * 16 * sizeof(float));
+ for (i = 0; i < 16; i++) {
+ for (j = 0; j < 16; j++) {
+ for (k = 0; k < SPEC_WIDTH; k++) {
+ int index = (j * SPEC_WIDTH * 16 + i * SPEC_WIDTH + k) * 4;
+ if (k >= FIRE_THRESH) {
+ spec_pixels[index] = ((float)spec_data[k * 4]) / 255.0f;
+ spec_pixels[index + 1] = ((float)spec_data[k * 4 + 1]) / 255.0f;
+ spec_pixels[index + 2] = ((float)spec_data[k * 4 + 2]) / 255.0f;
+ spec_pixels[index + 3] = MAX_FIRE_ALPHA * (
+ (k > FULL_ON_FIRE) ? 1.0f : (k - FIRE_THRESH) / ((float)FULL_ON_FIRE - FIRE_THRESH));
+ }
+ else {
+ spec_pixels[index] = spec_pixels[index + 1] = spec_pixels[index + 2] = spec_pixels[index + 3] = 0.0f;
}
}
}
@@ -372,7 +373,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
edges[11][1][0] = size[0];
glGetBooleanv(GL_BLEND, (GLboolean *)&gl_blend);
- glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
+ glGetBooleanv(GL_DEPTH_TEST, (GLboolean *)&gl_depth);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
@@ -382,9 +383,9 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
for (i = 0; i < 8; i++) {
float x, y, z;
- x = cv[i][0] - viewnormal[0]*size[0]*0.5f;
- y = cv[i][1] - viewnormal[1]*size[1]*0.5f;
- z = cv[i][2] - viewnormal[2]*size[2]*0.5f;
+ x = cv[i][0] - viewnormal[0] * size[0] * 0.5f;
+ y = cv[i][1] - viewnormal[1] * size[1] * 0.5f;
+ z = cv[i][2] - viewnormal[2] * size[2] * 0.5f;
if ((x >= min[0]) && (x <= max[0]) &&
(y >= min[1]) && (y <= max[1]) &&
@@ -448,7 +449,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
/* d0 = (viewnormal[0]*cv[i][0] + viewnormal[1]*cv[i][1] + viewnormal[2]*cv[i][2]); */ /* UNUSED */
ds = (ABS(viewnormal[0]) * size[0] + ABS(viewnormal[1]) * size[1] + ABS(viewnormal[2]) * size[2]);
- dd = MAX3(sds->global_size[0],sds->global_size[1],sds->global_size[2])/128.f;
+ dd = MAX3(sds->global_size[0], sds->global_size[1], sds->global_size[2]) / 128.f;
n = 0;
good_index = i;
@@ -500,7 +501,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
(points[i * 3 + 1] - min[1]) * cor[1] / size[1],
(points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
- glVertex3f(points[i * 3 + 0]/ob->size[0], points[i * 3 + 1]/ob->size[1], points[i * 3 + 2]/ob->size[2]);
+ glVertex3f(points[i * 3 + 0] / ob->size[0], points[i * 3 + 1] / ob->size[1], points[i * 3 + 2] / ob->size[2]);
}
glEnd();
@@ -513,7 +514,7 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
glTexCoord3d((points[i * 3 + 0] - min[0]) * cor[0] / size[0],
(points[i * 3 + 1] - min[1]) * cor[1] / size[1],
(points[i * 3 + 2] - min[2]) * cor[2] / size[2]);
- glVertex3f(points[i * 3 + 0]/ob->size[0], points[i * 3 + 1]/ob->size[1], points[i * 3 + 2]/ob->size[2]);
+ glVertex3f(points[i * 3 + 0] / ob->size[0], points[i * 3 + 1] / ob->size[1], points[i * 3 + 2] / ob->size[2]);
}
glEnd();
}
@@ -549,15 +550,15 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
if (gl_depth) {
glEnable(GL_DEPTH_TEST);
- glDepthMask(GL_TRUE);
+ glDepthMask(GL_TRUE);
}
}
#ifdef SMOKE_DEBUG_VELOCITY
void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob)
{
- float x,y,z;
- float x0,y0,z0;
+ float x, y, z;
+ float x0, y0, z0;
int *base_res = domain->base_res;
int *res = domain->res;
int *res_min = domain->res_min;
@@ -568,27 +569,27 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob)
float min[3];
float *cell_size = domain->cell_size;
- float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2]))/16.f;
+ float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f;
float vf = domain->scale / 16.f * 2.f; /* velocity factor */
glLineWidth(1.0f);
/* set first position so that it doesn't jump when domain moves */
- x0 = res_min[0] + fmod(-(float)domain->shift[0]+res_min[0],step_size);
- y0 = res_min[1] + fmod(-(float)domain->shift[1]+res_min[1],step_size);
- z0 = res_min[2] + fmod(-(float)domain->shift[2]+res_min[2],step_size);
- if (x0<res_min[0]) x0+=step_size;
- if (y0<res_min[1]) y0+=step_size;
- if (z0<res_min[2]) z0+=step_size;
+ x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
+ y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
+ z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
+ if (x0 < res_min[0]) x0 += step_size;
+ if (y0 < res_min[1]) y0 += step_size;
+ if (z0 < res_min[2]) z0 += step_size;
add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
- for (x=floor(x0); x<res_max[0]; x+=step_size)
- for (y=floor(y0); y<res_max[1]; y+=step_size)
- for (z=floor(z0); z<res_max[2]; z+=step_size) {
- int index = (floor(x)-res_min[0]) + (floor(y)-res_min[1])*res[0] + (floor(z)-res_min[2])*res[0]*res[1];
+ for (x = floor(x0); x < res_max[0]; x += step_size)
+ for (y = floor(y0); y < res_max[1]; y += step_size)
+ for (z = floor(z0); z < res_max[2]; z += step_size) {
+ int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
- 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]};
- float vel = sqrtf(vel_x[index]*vel_x[index] + vel_y[index]*vel_y[index] + vel_z[index]*vel_z[index]);
+ 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]};
+ float vel = sqrtf(vel_x[index] * vel_x[index] + vel_y[index] * vel_y[index] + vel_z[index] * vel_z[index]);
/* draw heat as scaled "arrows" */
if (vel >= 0.01f) {
@@ -599,21 +600,21 @@ void draw_smoke_velocity(SmokeDomainSettings *domain, Object *ob)
glBegin(GL_LINES);
glVertex3f(pos[0], pos[1], pos[2]);
- glVertex3f(pos[0]+vel_x[index]*vf, pos[1]+vel_y[index]*vf, pos[2]+vel_z[index]*vf);
+ glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
glEnd();
glBegin(GL_POINTS);
- glVertex3f(pos[0]+vel_x[index]*vf, pos[1]+vel_y[index]*vf, pos[2]+vel_z[index]*vf);
+ glVertex3f(pos[0] + vel_x[index] * vf, pos[1] + vel_y[index] * vf, pos[2] + vel_z[index] * vf);
glEnd();
}
- }
+ }
}
#endif
#ifdef SMOKE_DEBUG_HEAT
void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob)
{
- float x,y,z;
- float x0,y0,z0;
+ float x, y, z;
+ float x0, y0, z0;
int *base_res = domain->base_res;
int *res = domain->res;
int *res_min = domain->res_min;
@@ -622,24 +623,24 @@ void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob)
float min[3];
float *cell_size = domain->cell_size;
- float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2]))/16.f;
+ float step_size = ((float)MAX3(base_res[0], base_res[1], base_res[2])) / 16.f;
float vf = domain->scale / 16.f * 2.f; /* velocity factor */
/* set first position so that it doesn't jump when domain moves */
- x0 = res_min[0] + fmod(-(float)domain->shift[0]+res_min[0],step_size);
- y0 = res_min[1] + fmod(-(float)domain->shift[1]+res_min[1],step_size);
- z0 = res_min[2] + fmod(-(float)domain->shift[2]+res_min[2],step_size);
- if (x0<res_min[0]) x0+=step_size;
- if (y0<res_min[1]) y0+=step_size;
- if (z0<res_min[2]) z0+=step_size;
+ x0 = res_min[0] + fmod(-(float)domain->shift[0] + res_min[0], step_size);
+ y0 = res_min[1] + fmod(-(float)domain->shift[1] + res_min[1], step_size);
+ z0 = res_min[2] + fmod(-(float)domain->shift[2] + res_min[2], step_size);
+ if (x0 < res_min[0]) x0 += step_size;
+ if (y0 < res_min[1]) y0 += step_size;
+ if (z0 < res_min[2]) z0 += step_size;
add_v3_v3v3(min, domain->p0, domain->obj_shift_f);
- for (x=floor(x0); x<res_max[0]; x+=step_size)
- for (y=floor(y0); y<res_max[1]; y+=step_size)
- for (z=floor(z0); z<res_max[2]; z+=step_size) {
- int index = (floor(x)-res_min[0]) + (floor(y)-res_min[1])*res[0] + (floor(z)-res_min[2])*res[0]*res[1];
+ for (x = floor(x0); x < res_max[0]; x += step_size)
+ for (y = floor(y0); y < res_max[1]; y += step_size)
+ for (z = floor(z0); z < res_max[2]; z += step_size) {
+ int index = (floor(x) - res_min[0]) + (floor(y) - res_min[1]) * res[0] + (floor(z) - res_min[2]) * res[0] * res[1];
- 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]};
+ 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]};
/* draw heat as different sized points */
if (heat[index] >= 0.01f) {
@@ -652,6 +653,6 @@ void draw_smoke_heat(SmokeDomainSettings *domain, Object *ob)
glVertex3f(pos[0], pos[1], pos[2]);
glEnd();
}
- }
+ }
}
#endif