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

Method buildPolyList

Engine/source/T3D/tsStatic.cpp:1230–1283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1228}
1229
1230bool TSStatic::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F& box, const SphereF&)
1231{
1232 if (!mShapeInstance)
1233 return false;
1234
1235 // This is safe to set even if we're not outputing
1236 polyList->setTransform(&mObjToWorld, mObjScale);
1237 polyList->setObject(this);
1238
1239 if (context == PLC_Export)
1240 {
1241 // Use highest detail level
1242 S32 dl = 0;
1243
1244 // Try to call on the client so we can export materials
1245 if (isServerObject() && getClientObject())
1246 dynamic_cast<TSStatic*>(getClientObject())->mShapeInstance->buildPolyList(polyList, dl);
1247 else
1248 mShapeInstance->buildPolyList(polyList, dl);
1249 }
1250 else if (context == PLC_Selection)
1251 {
1252 // Use the last rendered detail level
1253 S32 dl = mShapeInstance->getCurrentDetail();
1254 mShapeInstance->buildPolyListOpcode(dl, polyList, box);
1255 }
1256 else
1257 {
1258 // Figure out the mesh type we're looking for.
1259 MeshType meshType = (context == PLC_Decal) ? mDecalType : mCollisionType;
1260
1261 if (meshType == None)
1262 return false;
1263 else if (meshType == Bounds)
1264 polyList->addBox(mObjBox);
1265 else if (meshType == VisibleMesh)
1266 mShapeInstance->buildPolyList(polyList, 0);
1267 else if (context == PLC_Decal && mDecalDetailsPtr != 0)
1268 {
1269 for (U32 i = 0; i < mDecalDetailsPtr->size(); i++)
1270 mShapeInstance->buildPolyListOpcode((*mDecalDetailsPtr)[i], polyList, box);
1271 }
1272 else
1273 {
1274 // Everything else is done from the collision meshes
1275 // which may be built from either the visual mesh or
1276 // special collision geometry.
1277 for (U32 i = 0; i < mCollisionDetails.size(); i++)
1278 mShapeInstance->buildPolyListOpcode(mCollisionDetails[i], polyList, box);
1279 }
1280 }
1281
1282 return true;
1283}
1284
1285bool TSStatic::buildExportPolyList(ColladaUtils::ExportData* exportData, const Box3F& box, const SphereF&)
1286{

Callers 1

buildExportPolyListMethod · 0.45

Calls 7

getCurrentDetailMethod · 0.80
buildPolyListOpcodeMethod · 0.80
getClientObjectFunction · 0.50
setTransformMethod · 0.45
setObjectMethod · 0.45
addBoxMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected