| 3044 | } |
| 3045 | |
| 3046 | void CDrawEarImpl( |
| 3047 | MovementObject* mo, |
| 3048 | float& time, |
| 3049 | float& time_step, |
| 3050 | int& species, |
| 3051 | int& skip_ear_physics_counter, |
| 3052 | bool& flip_info_flipping, |
| 3053 | bool& on_ground, |
| 3054 | CScriptArrayWrapper<int>& ik_chain_start_index, |
| 3055 | CScriptArrayWrapper<int>& ik_chain_elements, |
| 3056 | CScriptArrayWrapper<float>& ear_rotation, |
| 3057 | CScriptArrayWrapper<float>& ear_rotation_time, |
| 3058 | CScriptArrayWrapper<float>& target_ear_rotation, |
| 3059 | CScriptArrayWrapper<BoneTransform>& inv_skeleton_bind_transforms, |
| 3060 | CScriptArrayWrapper<vec3>& ear_points, |
| 3061 | CScriptArrayWrapper<vec3>& old_ear_points, |
| 3062 | CScriptArrayWrapper<vec3>& temp_old_ear_points, |
| 3063 | bool right, const BoneTransform& head_transform, int num_frames) { |
| 3064 | MovementObject& this_mo = *mo; |
| 3065 | RiggedObject& rigged_object = *this_mo.rigged_object(); |
| 3066 | |
| 3067 | int chain_start = ik_chain_start_index[kLeftEarIK + (right ? 1 : 0)]; |
| 3068 | |
| 3069 | vec3 tip, middle, base; |
| 3070 | tip = rigged_object_GetTransformedBonePoint(ik_chain_elements[chain_start + 0], 1); |
| 3071 | middle = rigged_object_GetTransformedBonePoint(ik_chain_elements[chain_start + 0], 0); |
| 3072 | base = rigged_object_GetTransformedBonePoint(ik_chain_elements[chain_start + 1], 0); |
| 3073 | |
| 3074 | if (ear_rotation.size() == 0) { |
| 3075 | ear_rotation.resize(2); |
| 3076 | ear_rotation_time.resize(2); |
| 3077 | target_ear_rotation.resize(2); |
| 3078 | for (int i = 0; i < 2; ++i) { |
| 3079 | target_ear_rotation[i] = 0.0f; |
| 3080 | ear_rotation[i] = 0.0f; |
| 3081 | ear_rotation_time[i] = 0.0f; |
| 3082 | } |
| 3083 | } else { |
| 3084 | int which = right ? 1 : 0; |
| 3085 | if (ear_rotation_time[which] < time) { |
| 3086 | target_ear_rotation[which] = RangedRandomFloat(-0.4f, 0.8f); |
| 3087 | ear_rotation_time[which] = time + RangedRandomFloat(0.7f, 4.0f); |
| 3088 | } |
| 3089 | ear_rotation[which] = mix(target_ear_rotation[which], ear_rotation[which], pow(0.9f, num_frames)); |
| 3090 | } |
| 3091 | |
| 3092 | bool ear_rotate_test = true; |
| 3093 | if (ear_rotate_test) { |
| 3094 | // vec3 head_up = head_transform.rotation * inv_skeleton_bind_transforms[ik_chain_elements[ik_chain_start_index[kHeadIK]]].rotation * vec3(0,0,1); |
| 3095 | vec3 head_dir = head_transform.rotation * inv_skeleton_bind_transforms[ik_chain_elements[ik_chain_start_index[kHeadIK]]].rotation * vec3(0, 1, 0); |
| 3096 | // vec3 head_right = cross(head_dir, head_up); |
| 3097 | // float ear_back_amount = 2.5f; |
| 3098 | // float ear_twist_amount = 3.0f * (right?-1.0f:1.0f); |
| 3099 | float ear_back_amount = 0.0f; |
| 3100 | float ear_twist_amount = ear_rotation[right ? 1 : 0]; |
| 3101 | if (right) { |
| 3102 | ear_twist_amount *= -1.0f; |
| 3103 | } |
no test coverage detected