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

Method InitRelMats

Source/Objects/group.cpp:142–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142void Group::InitRelMats() {
143 for (auto& i : children) {
144 Object* obj = i.direct_ptr;
145 if (obj && (obj->GetType() == _group || obj->GetType() == _prefab) && !obj->Selected()) {
146 Group* child_group = (Group*)obj;
147 child_group->InitRelMats();
148 }
149 }
150
151 // Get child transforms relative to group transform
152 for (auto& i : children) {
153 Child& child = i;
154 Object* obj = i.direct_ptr;
155 if (obj) {
156 child.rel_rotation = invert(GetRotation()) * obj->GetRotation();
157 child.rel_translation = (invert(GetRotation()) * ((obj->GetTranslation() - translation_)) / scale_);
158 child.rel_scale = child.rel_rotation * (obj->GetScale() / scale_);
159 }
160 }
161}
162
163void Group::InitShape() {
164 if (children.empty()) {

Callers 4

GroupSelectedMethod · 0.80
PrefabSelectedMethod · 0.80

Calls 6

GetRotationFunction · 0.85
SelectedMethod · 0.80
GetRotationMethod · 0.80
GetTranslationMethod · 0.80
invertFunction · 0.50
GetTypeMethod · 0.45

Tested by

no test coverage detected