| 1055 | } |
| 1056 | |
| 1057 | static Collision lineCheckActiveSelected(SceneGraph* scenegraph, const vec3& start, const vec3& end, vec3* point, vec3* normal) { |
| 1058 | vec3 new_end = end; |
| 1059 | Collision tmp, ret; |
| 1060 | vec3 tmp_point; |
| 1061 | vec3* point_ptr; |
| 1062 | if (point) { |
| 1063 | point_ptr = point; |
| 1064 | } else { |
| 1065 | point_ptr = &tmp_point; |
| 1066 | } |
| 1067 | // lineCheck aginst the terrain |
| 1068 | if (scenegraph != NULL && scenegraph->terrain_object_ != NULL) { |
| 1069 | vec3 normal; |
| 1070 | if (scenegraph->terrain_object_->lineCheck(start, end, point_ptr, &normal) != -1) { |
| 1071 | new_end = *point_ptr; |
| 1072 | new_end += 0.01f * normalize(end - start); // so that decals on surface of terrain are hit (To do: Why is this necessary? Isn't it also done in DecalEditor::lineCheckDisplay2D?) |
| 1073 | } |
| 1074 | } |
| 1075 | tmp = lineCheckSelected(scenegraph->objects_, start, new_end, point_ptr); |
| 1076 | if (tmp.hit) { |
| 1077 | new_end = tmp.hit_where; |
| 1078 | ret = tmp; |
| 1079 | } |
| 1080 | return ret; |
| 1081 | } |
| 1082 | |
| 1083 | static EditorTypes::Tool OmniGetTool(const Collision& c, int permission_flags, const Object* object_, const Box& box_) { |
| 1084 | const Keyboard& keyboard = Input::Instance()->getKeyboard(); |
no test coverage detected