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

Method onAdd

Engine/source/postFx/postEffect.cpp:593–647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

591}
592
593bool PostEffect::onAdd()
594{
595 if( !Parent::onAdd() )
596 return false;
597
598 LightManager::smActivateSignal.notify( this, &PostEffect::_onLMActivate );
599 mUpdateShader = true;
600
601 // Grab the script path.
602 Torque::Path scriptPath( Con::getVariable( "$Con::File" ) );
603 scriptPath.setFileName( String::EmptyString );
604 scriptPath.setExtension( String::EmptyString );
605
606 // Find additional textures
607 for (S32 i = 0; i < NumTextures; i++)
608 {
609 mTextureType[i] = NormalTextureType;
610 String texFilename = getTexture(i);
611
612 // Skip empty stages or ones with variable or target names.
613 if (texFilename.isEmpty() ||
614 texFilename[0] == '$' ||
615 texFilename[0] == '#')
616 continue;
617
618 mTextureProfile[i] = (mTexSRGB[i]) ? &PostFxTextureSRGBProfile : &PostFxTextureProfile;
619 _setTexture(texFilename, i);
620 }
621
622 // Is the target a named target?
623 if ( mTargetName.isNotEmpty() && mTargetName[0] == '#' )
624 {
625 mNamedTarget.registerWithName( mTargetName.substr( 1 ) );
626 mNamedTarget.getTextureDelegate().bind( this, &PostEffect::_getTargetTexture );
627 }
628 if ( mTargetDepthStencilName.isNotEmpty() && mTargetDepthStencilName[0] == '#' )
629 mNamedTargetDepthStencil.registerWithName( mTargetDepthStencilName.substr( 1 ) );
630
631 if (mNamedTarget.isRegistered() || mNamedTargetDepthStencil.isRegistered())
632 GFXTextureManager::addEventDelegate( this, &PostEffect::_onTextureEvent );
633
634 // Call onAdd in script
635 onAdd_callback();
636
637 // Should we start enabled?
638 if ( mEnabled )
639 {
640 mEnabled = false;
641 enable();
642 }
643
644 getSet()->addObject( this );
645
646 return true;
647}
648
649void PostEffect::onRemove()
650{

Callers

nothing calls this directly

Calls 10

getVariableFunction · 0.85
registerWithNameMethod · 0.80
substrMethod · 0.80
notifyMethod · 0.45
setExtensionMethod · 0.45
isEmptyMethod · 0.45
isNotEmptyMethod · 0.45
bindMethod · 0.45
isRegisteredMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected