Returns false if no basis selected
| 3033 | |
| 3034 | // Returns false if no basis selected |
| 3035 | static bool GetScaleBasis(vec3 clicked_point, vec3 clicked_normal, |
| 3036 | Basis* basis, vec3* p, const Object* object_, const Box& box_, ToolMode tool_mode) { |
| 3037 | const mat4& obj_transform = object_->GetTransform(); |
| 3038 | const quaternion& obj_rot = object_->GetRotation(); |
| 3039 | |
| 3040 | int i = box_.GetHitFaceIndex(invert(obj_rot) * clicked_normal, invert(obj_transform) * clicked_point); |
| 3041 | if (i == -1) { |
| 3042 | return false; |
| 3043 | } |
| 3044 | basis->up = obj_rot * Box::GetPlaneTangent(i); |
| 3045 | basis->facing = obj_rot * Box::GetPlaneNormal(i); |
| 3046 | basis->right = obj_rot * Box::GetPlaneBitangent(i); |
| 3047 | if (tool_mode == SCALE_NORMAL) { |
| 3048 | *p = clicked_point; |
| 3049 | } else { |
| 3050 | *p = obj_transform * box_.GetPlanePoint(i); |
| 3051 | } |
| 3052 | return true; |
| 3053 | } |
| 3054 | |
| 3055 | static bool GetRotationBasis(vec3 clicked_point, vec3 clicked_normal, |
| 3056 | Basis* basis, vec3* p, vec3* around, |
no test coverage detected