MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Combine

Function Combine

Source/Engine/CSG/CSGBuilder.cpp:154–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152 }
153
154 Mesh* Combine(Actor* actor, MeshesLookup& cache, Mesh* combineParent)
155 {
156 ASSERT(actor);
157 Mesh* result = nullptr;
158 Mesh* myBrush = nullptr;
159 cache.TryGet(actor, myBrush);
160
161 // Get first child mesh with valid data (has additive brush)
162 int32 childIndex = 0;
163 while (childIndex < actor->Children.Count())
164 {
165 auto child = Combine(actor->Children[childIndex], cache, combineParent);
166
167 childIndex++;
168 if (child)
169 {
170 // If brush was based on additive brush or current actor is a brush we can stop searching
171 if (child->HasMode(Mode::Additive) || myBrush)
172 {
173 // End searching
174 result = child;
175 break;
176 }
177
178 if (combineParent)
179 {
180 // Combine
181 combineParent->PerformOperation(child);
182 }
183 }
184 }
185
186 // Check if has any child with CSG brush
187 if (result)
188 {
189 // Check if has own brush
190 if (myBrush)
191 {
192 // Combine with first child
193 myBrush->PerformOperation(result);
194
195 // Set this actor brush as a result
196 result = myBrush;
197 }
198
199 // Merge with the other children
200 while (childIndex < actor->Children.Count())
201 {
202 auto child = Combine(actor->Children[childIndex], cache, result);
203 if (child)
204 {
205 // Combine
206 result->PerformOperation(child);
207 }
208
209 childIndex++;
210 }
211 }

Callers 1

buildInnerMethod · 0.85

Calls 7

HasModeMethod · 0.80
PerformOperationMethod · 0.80
LockMethod · 0.80
UnlockMethod · 0.80
InstanceClass · 0.50
TryGetMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected