| 3053 | } |
| 3054 | |
| 3055 | static bool GetRotationBasis(vec3 clicked_point, vec3 clicked_normal, |
| 3056 | Basis* basis, vec3* p, vec3* around, |
| 3057 | const Object* object_, const Box& box_) { |
| 3058 | const mat4& obj_transform = object_->GetTransform(); |
| 3059 | const quaternion& obj_rot = object_->GetRotation(); |
| 3060 | int i = box_.GetHitFaceIndex(invert(obj_rot) * clicked_normal, invert(obj_transform) * clicked_point); |
| 3061 | if (i == -1) { |
| 3062 | return false; |
| 3063 | } |
| 3064 | basis->up = obj_rot * Box::GetPlaneTangent(i); |
| 3065 | basis->facing = obj_rot * Box::GetPlaneNormal(i); |
| 3066 | basis->right = obj_rot * Box::GetPlaneBitangent(i); |
| 3067 | *around = Box::GetPlaneNormal(i); |
| 3068 | *p = obj_transform * box_.GetPlanePoint(i); |
| 3069 | return true; |
| 3070 | } |
| 3071 | |
| 3072 | static vec3 GetTranslation(const LineSegment& mouseray, bool snapping_enabled, const vec3& cam_moved, const ControlEditorInfo* control_editor_info, Tool* tool_, Object* object_) { |
| 3073 | static const float TRANSLATION_SNAP_INCR = 0.50f; // percent of dimension in direction of movement |
no test coverage detected