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

Method onAdd

Engine/source/T3D/fx/fxFoliageReplicator.cpp:1261–1298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1259//------------------------------------------------------------------------------
1260
1261bool fxFoliageReplicator::onAdd()
1262{
1263 if(!Parent::onAdd()) return(false);
1264
1265 // Add the Replicator to the Replicator Set.
1266 dynamic_cast<SimSet*>(Sim::findObject("fxFoliageSet"))->addObject(this);
1267
1268 // Set Default Object Box.
1269 mObjBox.minExtents.set( -0.5, -0.5, -0.5 );
1270 mObjBox.maxExtents.set( 0.5, 0.5, 0.5 );
1271 resetWorldBox();
1272 setRenderTransform(mObjToWorld);
1273
1274 // Add to Scene.
1275 addToScene();
1276
1277 // Are we on the client?
1278 if ( isClientObject() )
1279 {
1280 // Yes, so load foliage texture.
1281 if( mFieldData.mFoliageFile != NULL && dStrlen(mFieldData.mFoliageFile) > 0 )
1282 mFieldData.mFoliageTexture = GFXTexHandle( mFieldData.mFoliageFile, &GFXStaticTextureSRGBProfile, avar("%s() - mFieldData.mFoliageTexture (line %d)", __FUNCTION__, __LINE__) );
1283
1284 if ((GFXTextureObject*) mFieldData.mFoliageTexture == NULL)
1285 Con::printf("fxFoliageReplicator: %s is an invalid or missing foliage texture file.", mFieldData.mFoliageFile);
1286
1287 mAlphaLookup = new GBitmap(AlphaTexLen, 1);
1288 computeAlphaTex();
1289
1290 // Register for notification when GhostAlways objects are done loading
1291 NetConnection::smGhostAlwaysDone.notify( this, &fxFoliageReplicator::onGhostAlwaysDone );
1292
1293 SetupShader();
1294 }
1295
1296 // Return OK.
1297 return(true);
1298}
1299
1300//------------------------------------------------------------------------------
1301

Callers

nothing calls this directly

Calls 8

avarFunction · 0.85
printfFunction · 0.85
findObjectFunction · 0.50
dStrlenFunction · 0.50
GFXTexHandleClass · 0.50
addObjectMethod · 0.45
setMethod · 0.45
notifyMethod · 0.45

Tested by

no test coverage detected