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

Method _updateGeometry

Engine/source/T3D/convexShape.cpp:1261–1522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259}
1260
1261void ConvexShape::_updateGeometry( bool updateCollision )
1262{
1263 mPlanes.clear();
1264
1265 for ( S32 i = 0; i < mSurfaces.size(); i++ )
1266 mPlanes.push_back( PlaneF( mSurfaces[i].getPosition(), mSurfaces[i].getUpVector() ) );
1267
1268 Vector< Point3F > tangents;
1269 for (S32 i = 0; i < mSurfaces.size(); i++)
1270 tangents.push_back(mSurfaces[i].getRightVector());
1271
1272 //prepping the texture info
1273 Vector<Point2F> texOffset;
1274 Vector<Point2F> texScale;
1275 Vector<bool> horzFlip;
1276 Vector<bool> vertFlip;
1277 //step in here, and add new surfaceTextures if we don't match the count of surfaces, we use
1278 //msurfaces as the counter, because we need to match it.
1279 if (mSurfaceUVs.size() > mSurfaces.size())
1280 {
1281 for (U32 x = mSurfaceUVs.size(); x > mSurfaces.size(); x--)
1282 mSurfaceUVs.pop_front();
1283 }
1284 else if (mSurfaceUVs.size() < mSurfaces.size())
1285 {
1286 for (U32 x = mSurfaceUVs.size(); x <= mSurfaces.size(); x++)
1287 {
1288 mSurfaceUVs.increment();
1289 mSurfaceUVs[x].offset = Point2F(0, 0);
1290 mSurfaceUVs[x].scale = Point2F(1, 1);
1291 mSurfaceUVs[x].zRot = 0;
1292 mSurfaceUVs[x].horzFlip = false;
1293 mSurfaceUVs[x].vertFlip = false;
1294 mSurfaceUVs[x].matID = 0;
1295 }
1296 }
1297
1298 for (S32 i = 0; i < mSurfaceUVs.size(); i++)
1299 {
1300 //add our offsets/scales for passing to the geometry now
1301 texOffset.push_back(mSurfaceUVs[i].offset);
1302 texScale.push_back(mSurfaceUVs[i].scale);
1303 horzFlip.push_back(mSurfaceUVs[i].horzFlip);
1304 vertFlip.push_back(mSurfaceUVs[i].vertFlip);
1305 }
1306
1307 mGeometry.generate(mPlanes, tangents, mSurfaceTextures, texOffset, texScale, horzFlip, vertFlip);
1308
1309 AssertFatal(mGeometry.faces.size() <= mSurfaces.size(), "Got more faces than planes?");
1310
1311 const Vector< ConvexShape::Face > &faceList = mGeometry.faces;
1312 const Vector< Point3F > &pointList = mGeometry.points;
1313
1314 // Reset our surface center points.
1315
1316 for (S32 i = 0; i < faceList.size(); i++)
1317 mSurfaces[faceList[i].id].setPosition(faceList[i].centroid);
1318

Callers

nothing calls this directly

Calls 15

getUpVectorMethod · 0.80
getRightVectorMethod · 0.80
incrementMethod · 0.80
PlaneFClass · 0.50
Point2FClass · 0.50
mCrossFunction · 0.50
clearMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45
getPositionMethod · 0.45
pop_frontMethod · 0.45
generateMethod · 0.45

Tested by

no test coverage detected