MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / recurseSubshape

Method recurseSubshape

Engine/source/ts/loader/tsShapeLoader.cpp:261–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recurseChildren)
262{
263 // Ignore local bounds nodes
264 if (appNode->isBounds())
265 return;
266
267 S32 subShapeNum = shape->subShapeFirstNode.size()-1;
268 Subshape* subshape = subshapes[subShapeNum];
269
270 // Check if we should collapse this node
271 S32 myIndex;
272 if (ignoreNode(appNode->getName()))
273 {
274 myIndex = parentIndex;
275 }
276 else
277 {
278 // Check that adding this node will not exceed the maximum node count
279 if (shape->nodes.size() >= MAX_TS_SET_SIZE)
280 return;
281
282 myIndex = shape->nodes.size();
283 String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names);
284
285 // Create the 3space node
286 shape->nodes.increment();
287 TSShape::Node& lastNode = shape->nodes.last();
288 lastNode.nameIndex = shape->addName(nodeName);
289 lastNode.parentIndex = parentIndex;
290 lastNode.firstObject = -1;
291 lastNode.firstChild = -1;
292 lastNode.nextSibling = -1;
293
294 // Add the AppNode to a matching list (so AppNodes can be accessed using 3space
295 // node indices)
296 appNodes.push_back(appNode);
297 appNodes.last()->mParentIndex = parentIndex;
298
299 // Check for NULL detail or AutoBillboard nodes (no children or geometry)
300 if ((appNode->getNumChildNodes() == 0) &&
301 (appNode->getNumMesh() == 0))
302 {
303 S32 size = 0x7FFFFFFF;
304 String dname(String::GetTrailingNumber(appNode->getName(), size));
305
306 if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF))
307 {
308 shape->addDetail("detail", size, subShapeNum);
309 }
310 else if (appNode->isBillboard() && (size != 0x7FFFFFFF))
311 {
312 // AutoBillboard detail
313 S32 numEquatorSteps = 4;
314 S32 numPolarSteps = 0;
315 F32 polarAngle = 0.0f;
316 S32 dl = 0;
317 S32 dim = 64;
318 bool includePoles = true;

Callers

nothing calls this directly

Calls 15

dStrEqualFunction · 0.85
isBoundsMethod · 0.80
incrementMethod · 0.80
addNameMethod · 0.80
getNumChildNodesMethod · 0.80
getNumMeshMethod · 0.80
addDetailMethod · 0.80
getChildNodeMethod · 0.80
getUniqueNameFunction · 0.70
sizeMethod · 0.45
getNameMethod · 0.45
lastMethod · 0.45

Tested by

no test coverage detected