diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-12-17 00:52:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-12-17 00:54:03 +0300 |
commit | 3da429aa87bab5f4121065df000862b5ae1c411c (patch) | |
tree | fd0bc17f195a10c7350da03ec8aadfb5eb6f5dc9 /source/blender/blenkernel/intern/fluid.c | |
parent | 79c3e8db26da63f5c2a88b2523f5ff5a24e3ae48 (diff) |
Cleanup: replace 'if 0' with 'DEBUG_PRINT' define
Allows enabling debug prints in this file easily,
differentiates it from code which has been disabled for other reasons.
Also remove unused DEBUG_TIME.
Diffstat (limited to 'source/blender/blenkernel/intern/fluid.c')
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 45461133dfe..1b4b81c6f5f 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -75,20 +75,16 @@ #include "GPU_glew.h" -//#define DEBUG_TIME - #include "manta_fluid_API.h" -#ifdef DEBUG_TIME -# include "PIL_time.h" -#endif - #include "BLI_task.h" #include "BLI_kdtree.h" #include "BLI_voxel.h" #ifdef WITH_FLUID +// #define DEBUG_PRINT + static ThreadMutex object_update_lock = BLI_MUTEX_INITIALIZER; struct Mesh; @@ -1302,9 +1298,13 @@ static void obstacles_from_mesh_task_cb(void *__restrict userdata, data->velocityZ[index] += (data->mes->type == FLUID_EFFECTOR_TYPE_GUIDE) ? hit_vel[2] * data->mes->vel_multi : hit_vel[2]; -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print object velocities. */ - printf("adding effector object vel: [%f, %f, %f], dx is: %f\n", hit_vel[0], hit_vel[1], hit_vel[2], mds->dx); + printf("adding effector object vel: [%f, %f, %f], dx is: %f\n", + hit_vel[0], + hit_vel[1], + hit_vel[2], + mds->dx); # endif } } @@ -1578,9 +1578,12 @@ static void update_obstacles(Depsgraph *depsgraph, scene->r.subframe = 0.0f; scene->r.cfra = frame; } -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print subframe information. */ - printf("effector: frame: %d // scene current frame: %d // scene current subframe: %f\n", frame, scene->r.cfra, scene->r.subframe); + printf("effector: frame: %d // scene current frame: %d // scene current subframe: %f\n", + frame, + scene->r.cfra, + scene->r.subframe); # endif /* TODO (sebbas): Using BKE_scene_frame_get(scene) instead of new DEG_get_ctime(depsgraph) as * subframes dont work with the latter yet. */ @@ -2405,7 +2408,7 @@ static void sample_mesh(FluidFlowSettings *mfs, velocity_map[index * 3] += hit_vel[0] * mfs->vel_multi; velocity_map[index * 3 + 1] += hit_vel[1] * mfs->vel_multi; velocity_map[index * 3 + 2] += hit_vel[2] * mfs->vel_multi; -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print flow object velocities. */ printf("adding flow object vel: [%f, %f, %f]\n", hit_vel[0], hit_vel[1], hit_vel[2]); # endif @@ -3305,9 +3308,15 @@ static void update_flowsfluids(struct Depsgraph *depsgraph, } /* Sanity check: subframe portion must be between 0 and 1 */ CLAMP(scene->r.subframe, 0.0f, 1.0f); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print subframe information. */ - printf("flow: frame (is first: %d): %d // scene current frame: %d // scene current subframe: %f\n", is_first_frame, frame, scene->r.cfra, scene->r.subframe); + printf( + "flow: frame (is first: %d): %d // scene current frame: %d // scene current subframe: " + "%f\n", + is_first_frame, + frame, + scene->r.cfra, + scene->r.subframe); # endif /* Update frame time, this is considering current subframe fraction * BLI_mutex_lock() called in manta_step(), so safe to update subframe here @@ -3353,9 +3362,13 @@ static void update_flowsfluids(struct Depsgraph *depsgraph, } } } -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print time information. */ - printf("flow: frame: %d // time per frame: %f // frame length: %f // dt: %f\n", frame, time_per_frame, frame_length, dt); + printf("flow: frame: %d // time per frame: %f // frame length: %f // dt: %f\n", + frame, + time_per_frame, + frame_length, + dt); # endif /* Adjust domain size if needed. Only do this once for every frame */ @@ -3685,7 +3698,7 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec num_normals = manta_liquid_get_num_normals(mds->fluid); num_faces = manta_liquid_get_num_triangles(mds->fluid); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print number of vertices, normals, and faces. */ printf("num_verts: %d, num_normals: %d, num_faces: %d\n", num_verts, num_normals, num_faces); # endif @@ -3734,9 +3747,12 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec mverts->co[0] *= max_size / fabsf(ob->scale[0]); mverts->co[1] *= max_size / fabsf(ob->scale[1]); mverts->co[2] *= max_size / fabsf(ob->scale[2]); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print coordinates of vertices. */ - printf("mverts->co[0]: %f, mverts->co[1]: %f, mverts->co[2]: %f\n", mverts->co[0], mverts->co[1], mverts->co[2]); + printf("mverts->co[0]: %f, mverts->co[1]: %f, mverts->co[2]: %f\n", + mverts->co[0], + mverts->co[1], + mverts->co[2]); # endif } @@ -3749,7 +3765,7 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec no[2] = manta_liquid_get_normal_z_at(mds->fluid, i); normal_float_to_short_v3(no_s, no); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print coordinates of normals. */ printf("no_s[0]: %d, no_s[1]: %d, no_s[2]: %d\n", no_s[0], no_s[1], no_s[2]); # endif @@ -3767,9 +3783,12 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec mloops[0].v = manta_liquid_get_triangle_x_at(mds->fluid, i); mloops[1].v = manta_liquid_get_triangle_y_at(mds->fluid, i); mloops[2].v = manta_liquid_get_triangle_z_at(mds->fluid, i); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print mesh faces. */ - printf("mloops[0].v: %d, mloops[1].v: %d, mloops[2].v: %d\n", mloops[0].v, mloops[1].v, mloops[2].v); + printf("mloops[0].v: %d, mloops[1].v: %d, mloops[2].v: %d\n", + mloops[0].v, + mloops[1].v, + mloops[2].v); # endif } @@ -3801,9 +3820,15 @@ static Mesh *createLiquidGeometry(FluidDomainSettings *mds, Mesh *orgmesh, Objec velarray[i].vel[0] = manta_liquid_get_vertvel_x_at(mds->fluid, i) * (mds->dx / time_mult); velarray[i].vel[1] = manta_liquid_get_vertvel_y_at(mds->fluid, i) * (mds->dx / time_mult); velarray[i].vel[2] = manta_liquid_get_vertvel_z_at(mds->fluid, i) * (mds->dx / time_mult); -# if 0 +# ifdef DEBUG_PRINT /* Debugging: Print velocities of vertices. */ - printf("velarray[%d].vel[0]: %f, velarray[%d].vel[1]: %f, velarray[%d].vel[2]: %f\n", i, velarray[i].vel[0], i, velarray[i].vel[1], i, velarray[i].vel[2]); + printf("velarray[%d].vel[0]: %f, velarray[%d].vel[1]: %f, velarray[%d].vel[2]: %f\n", + i, + velarray[i].vel[0], + i, + velarray[i].vel[1], + i, + velarray[i].vel[2]); # endif } |