Exemplo n.º 1
0
//////////////////////////////////////////////////////////////////////////
// onDetach
//virtual
void ScnModelComponent::onDetach( ScnEntityWeakRef Parent )
{
	// Wait for update + upload to complete.
	UpdateFence_.wait();
	UploadFence_.wait();

	// Detach material components from parent.
	for( BcU32 Idx = 0 ; Idx < PerComponentMeshDataList_.size(); ++Idx )
	{
		auto& PerComponentMeshData( PerComponentMeshDataList_[ Idx ] );
		Parent->detach( PerComponentMeshData.MaterialComponentRef_ );
		PerComponentMeshData.MaterialComponentRef_ = nullptr;
	}

	// Destroy resources.
	for( BcU32 Idx = 0; Idx < PerComponentMeshDataList_.size(); ++Idx )
	{
		RsCore::pImpl()->destroyResource( PerComponentMeshDataList_[ Idx ].UniformBuffer_ );
	}
	
	// Delete duplicated node data.
	delete [] pNodeTransformData_;
	pNodeTransformData_ = nullptr;

	//
	Super::onDetach( Parent );
}
//////////////////////////////////////////////////////////////////////////
// onDetach
//virtual
void ScnParticleSystemComponent::onDetach( ScnEntityWeakRef Parent )
{
	Parent->detach( MaterialComponent_ );

	MaterialComponent_ = NULL;

	Super::onDetach( Parent );
}
Exemplo n.º 3
0
//////////////////////////////////////////////////////////////////////////
// GaGameComponent
//virtual
void GaGameComponent::onDetach( ScnEntityWeakRef Parent )
{
	// Null canvas reference.
	CanvasComponent_ = NULL;

	// Detach materials.
	Parent->detach( DefaultMaterial_ );
	Parent->detach( BackgroundMaterial_ );
	Parent->detach( SpriteSheetMaterials_[ 0 ] );
	Parent->detach( SpriteSheetMaterials_[ 1 ] );
	Parent->detach( HUDMaterial_ );
	Parent->detach( Font_ );

	// Unsubscribe.
	OsCore::pImpl()->unsubscribeAll( this );

	// Don't forget to detach!
	Super::onDetach( Parent );
}
//////////////////////////////////////////////////////////////////////////
// onDetach
//virtual
void ScnParticleSystemComponent::onDetach( ScnEntityWeakRef Parent )
{
	Parent->detach( MaterialComponent_ );

	MaterialComponent_ = nullptr;

	for( BcU32 Idx = 0; Idx < 2; ++Idx )
	{
		TVertexBuffer& VertexBuffer = VertexBuffers_[ Idx ];
		RsCore::pImpl()->destroyResource( VertexBuffer.pVertexBuffer_ );
		RsCore::pImpl()->destroyResource( VertexBuffer.UniformBuffer_ );
	}

	RsCore::pImpl()->destroyResource( VertexDeclaration_ );
	
	delete [] pParticleBuffer_;

	Super::onDetach( Parent );
}
Exemplo n.º 5
0
////////////////////////////////////////////////////////////////////////////////
// onDetach
//virtual
void GaGameComponent::onDetach( ScnEntityWeakRef Parent )
{
	Super::onDetach( Parent );

	Parent->detach( EmoteMaterialComponent_ );
}