MCPcopy Create free account
hub / github.com/WolfireGames/overgrowth / lineCheckActiveSelected

Function lineCheckActiveSelected

Source/Editors/map_editor.cpp:1057–1081  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1055}
1056
1057static 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
1083static EditorTypes::Tool OmniGetTool(const Collision& c, int permission_flags, const Object* object_, const Box& box_) {
1084 const Keyboard& keyboard = Input::Instance()->getKeyboard();

Callers 4

UpdateMethod · 0.85
UpdateCursorMethod · 0.85
HandleShortcutsMethod · 0.85
UpdateToolsMethod · 0.85

Calls 3

lineCheckSelectedFunction · 0.85
normalizeFunction · 0.50
lineCheckMethod · 0.45

Tested by

no test coverage detected