Merge branch 'blender-v2.91-release'

This commit is contained in:
Sebastián Barschkis 2020-11-09 12:54:26 +01:00
commit 0c4d12986a
2 changed files with 9 additions and 6 deletions

@ -360,7 +360,6 @@ def fluid_pre_step_$ID$():\n\
\n\ \n\
# Main vel grid is copied in adapt time step function\n\ # Main vel grid is copied in adapt time step function\n\
\n\ \n\
# translate obvels (world space) to grid space\n\
if using_obstacle_s$ID$:\n\ if using_obstacle_s$ID$:\n\
# Average out velocities from multiple obstacle objects at one cell\n\ # Average out velocities from multiple obstacle objects at one cell\n\
x_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\ x_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\
@ -368,7 +367,6 @@ def fluid_pre_step_$ID$():\n\
z_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\ z_obvel_s$ID$.safeDivide(numObs_s$ID$)\n\
copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n\ copyRealToVec3(sourceX=x_obvel_s$ID$, sourceY=y_obvel_s$ID$, sourceZ=z_obvel_s$ID$, target=obvelC_s$ID$)\n\
\n\ \n\
# translate invels (world space) to grid space\n\
if using_invel_s$ID$:\n\ if using_invel_s$ID$:\n\
copyRealToVec3(sourceX=x_invel_s$ID$, sourceY=y_invel_s$ID$, sourceZ=z_invel_s$ID$, target=invelC_s$ID$)\n\ copyRealToVec3(sourceX=x_invel_s$ID$, sourceY=y_invel_s$ID$, sourceZ=z_invel_s$ID$, target=invelC_s$ID$)\n\
\n\ \n\
@ -378,7 +376,6 @@ def fluid_pre_step_$ID$():\n\
interpolateMACGrid(source=guidevel_sg$ID$, target=velT_s$ID$)\n\ interpolateMACGrid(source=guidevel_sg$ID$, target=velT_s$ID$)\n\
velT_s$ID$.multConst(vec3(gamma_sg$ID$))\n\ velT_s$ID$.multConst(vec3(gamma_sg$ID$))\n\
\n\ \n\
# translate external forces (world space) to grid space\n\
copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n\ copyRealToVec3(sourceX=x_force_s$ID$, sourceY=y_force_s$ID$, sourceZ=z_force_s$ID$, target=forces_s$ID$)\n\
\n\ \n\
# If obstacle has velocity, i.e. is a moving obstacle, switch to dynamic preconditioner\n\ # If obstacle has velocity, i.e. is a moving obstacle, switch to dynamic preconditioner\n\

@ -3202,9 +3202,15 @@ static void update_effectors_task_cb(void *__restrict userdata,
mul_v3_fl(retvel, mag); mul_v3_fl(retvel, mag);
/* Constrain forces to interval -1 to 1. */ /* Constrain forces to interval -1 to 1. */
data->force_x[index] = min_ff(max_ff(-1.0f, retvel[0] * 0.2f), 1.0f); CLAMP3(retvel, -1.0f, 1.0f);
data->force_y[index] = min_ff(max_ff(-1.0f, retvel[1] * 0.2f), 1.0f); data->force_x[index] = retvel[0];
data->force_z[index] = min_ff(max_ff(-1.0f, retvel[2] * 0.2f), 1.0f); data->force_y[index] = retvel[1];
data->force_z[index] = retvel[2];
# if DEBUG_PRINT
/* Debugging: Print forces. */
printf("setting force: [%f, %f, %f]\n", data->force_x[index], data->force_y[index], data->force_z[index]);
# endif
} }
} }
} }