| 1259 | //------------------------------------------------------------------------------ |
| 1260 | |
| 1261 | bool 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 |
nothing calls this directly
no test coverage detected