Esempio n. 1
0
//////////////////////////////////////////////////////////////////////////
// update
//virtual
void ScnModelComponent::postUpdate( BcF32 Tick )
{
	Super::postUpdate( Tick );

	UpdateFence_.increment();
	updateNodes( BaseTransform_ * getParentEntity()->getWorldMatrix() );

#if DEBUG_RENDER_NODES
	BcU32 NoofNodes = Model_->pHeader_->NoofNodes_;
	for( BcU32 NodeIdx = 0; NodeIdx < NoofNodes; ++NodeIdx )
	{
		ScnModelNodeTransformData* pNodeTransformData = &pNodeTransformData_[ NodeIdx ];
		ScnModelNodePropertyData* pNodePropertyData = &Model_->pNodePropertyData_[ NodeIdx ];

		MaMat4d ThisMatrix = pNodeTransformData->WorldTransform_;
		MaMat4d ParentMatrix = pNodePropertyData->ParentIndex_ != BcErrorCode ? 
			pNodeTransformData_[ pNodePropertyData->ParentIndex_ ].WorldTransform_ :
			getParentEntity()->getWorldMatrix();

		ScnDebugRenderComponent::pImpl()->drawMatrix( 
			ThisMatrix, RsColour::WHITE, 2000 );
		ScnDebugRenderComponent::pImpl()->drawLine( 
			ParentMatrix.translation(), 
			ThisMatrix.translation(), 
			RsColour::WHITE, 1000 );
	}

#endif // DEBUG_RENDER_NODES
}
Esempio n. 2
0
void GaGameComponent::drawMinimap()
{
	OsClient* Client = OsCore::pImpl()->getClient( 0 );
	MaVec2d ClientSize( Client->getWidth(), Client->getHeight() );
	MaVec2d Size( 100.0f, 100.0f );
	MaMat4d Transform;
	Transform.translation( ClientSize - MaVec2d( 100.0f, 100.0f ) );
	Canvas_->pushMatrix( Transform );
	Canvas_->drawBox( -Size, Size, RsColour( 0.05f, 0.05f, 0.05f, 1.0f ), 0 );
	
	for( auto* Unit : Units_ )
	{
		auto Position = Unit->getParentEntity()->getWorldPosition();

		// HACK: Rotate and flip appropriately later.
		Position.x( -Position.x() );
;
		if( Position.x() > -99.0f && Position.x() < 99.0f &&
			Position.z() > -99.0f && Position.z() < 99.0f )
		{
			Canvas_->drawBox( Position.xz() - MaVec2d( 1.0f, 1.0f ), Position.xz() + MaVec2d( 1.0f, 1.0f ), RsColour( 1.0f, 1.0f, 1.0f, 1.0f ), 0 );
		}
	}

	Canvas_->drawLineBox( -Size, Size, RsColour( 0.0f, 0.0f, 0.0f, 1.0f ), 0 );
	Canvas_->popMatrix();
}
Esempio n. 3
0
//////////////////////////////////////////////////////////////////////////
// bakeTransform
void MdlMesh::bakeTransform( const MaMat4d& Transform )
{
	MaMat4d NrmTransform = Transform;
	NrmTransform.translation( MaVec3d( 0.0f, 0.0f, 0.0f ) );
	for( BcU32 i = 0; i < aVertices_.size(); ++i )
	{
		aVertices_[ i ].Position_ = aVertices_[ i ].Position_ * Transform;
		aVertices_[ i ].Normal_ = aVertices_[ i ].Normal_ * NrmTransform;
		aVertices_[ i ].Normal_.normalise();
		aVertices_[ i ].Tangent_ = aVertices_[ i ].Tangent_ * NrmTransform;
		aVertices_[ i ].Tangent_.normalise();
	}
}