//-----------------------------------------------------------------------------
	// draw this pedestrian into scene
	void Pedestrian::draw( const float currentTime, const float elapsedTime )
	{
		SLBaseClass::draw( currentTime, elapsedTime );
#if 0
		Color kColor;
		Vec3 kPosition = position();
		bool bGotParentColor = false;
		AbstractPlugin* parentPlugin = dynamic_cast<AbstractPlugin*>(getParentEntity());
		ZonePlugin* zonePlugin = NULL;
		if( NULL != parentPlugin )
		{
			zonePlugin = dynamic_cast<ZonePlugin*>(parentPlugin->getParentPlugin());
			bGotParentColor = parentPlugin->queryVehicleColor( *this, kColor ) ;
			if( true == bGotParentColor )
			{

			}
			else
			{
				if( true == isRemoteObject() )
				{
					kColor = gGreen;
					Vec3 kTempPosition = kPosition;
					kTempPosition.y += 0.05f;
					setPosition( kTempPosition );
				}
				else
				{
					kColor = gRed;
				}
				kColor.setA( 0.5f );
			}
		}

		drawBasic2dCircularVehicle (*this, kColor);
		setPosition( kPosition );
		kColor.setA( 1.0f );
		EAnnotationMode eMode = getAnnotationMode();
		setAnnotationMode( EAnnotationMode_local );
		drawTrail( kColor, gWhite );
		setAnnotationMode( eMode );


		if( NULL != zonePlugin )
		{
			// check for zone memberships
			// textual annotation
			std::ostringstream annote;
			annote << std::setprecision (2) << std::setiosflags (std::ios::fixed);
			annote << "z[";
			for( size_t i = 0; i < 4; ++i )
			{
				if( true == getIsZoneMember(i) )
				{
					annote << i;
				}
				else
				{
					annote << " ";
				}
				if( i < 3 )
				{
					annote << "-";
				}
			}
			annote << "]\n";	

			//draw borders		
			annote << "b[";
			for( size_t i = 0; i < 4; ++i )
			{
				if( true == getIsZoneBorderMember(i) )
				{
					annote << i;
				}
				else
				{
					annote << " ";
				}
				if( i < 3 )
				{
					annote << "-";
				}
			}
			annote << "]";

			draw2dTextAt3dLocation (annote, position(), gWhite, drawGetWindowWidth(), drawGetWindowHeight());
		}
#endif
	}
Exemplo n.º 2
0
//-----------------------------------------------------------------------------
// draw this pedestrian into scene
void NetPedestrian::draw( OpenSteer::AbstractRenderer* pRenderer, 
	const float currentTime, const float elapsedTime )
{
	BaseClass::draw( pRenderer, currentTime, elapsedTime );
	Color kColor;
	Vec3 kPosition = this->position();
	bool bGotParentColor = false;
	AbstractPlugin* parentPlugin = dynamic_cast<AbstractPlugin*>(this->getParentEntity());
	ZonePlugin* zonePlugin = NULL;
	if( NULL != parentPlugin )
	{
		zonePlugin = dynamic_cast<ZonePlugin*>(parentPlugin->getParentPlugin());
		bGotParentColor = parentPlugin->queryVehicleColor( *this, kColor ) ;
		if( true == bGotParentColor )
		{

		}
		else
		{
			if( true == this->isRemoteObject() )
			{
				kColor = gGreen;
				Vec3 kTempPosition = kPosition;
				kTempPosition.y += 0.05f;
				this->setPosition( kTempPosition );
			}
			else
			{
				kColor = gRed;
			}
			kColor.setA( 0.5f );
		}
	}

	pRenderer->drawBasic2dCircularVehicle (*this, kColor);
	this->setPosition( kPosition );
	kColor.setA( 1.0f );
	OpenSteer::EAnnotationMode eMode = this->getAnnotationMode();
	this->setAnnotationMode( OpenSteer::EAnnotationMode_local );
	this->drawTrail( pRenderer, kColor, gWhite );
	this->setAnnotationMode( eMode );


	if( NULL != zonePlugin )
	{
		// check for zone memberships
		// textual annotation
		std::ostringstream annote;
		annote << std::setprecision (2) << std::setiosflags (std::ios::fixed);
		annote << "[";
		for( size_t i = 0; i < 4; ++i )
		{
			if( true == this->getIsZoneMember(i) )
			{
				annote << i;
			}
			else
			{
				annote << " ";
			}
			if( i < 3 )
			{
				annote << "-";
			}
		}
		annote << "]";
		pRenderer->draw2dTextAt3dLocation (annote, this->position(), gWhite, 
			pRenderer->drawGetWindowWidth(), pRenderer->drawGetWindowHeight());
	}
}