Undid changes to Point3F.

This commit is contained in:
Daniel Buckmaster 2015-01-26 00:16:38 +11:00
parent c1203c1cea
commit 540e68aadb
2 changed files with 9 additions and 31 deletions

View file

@ -515,24 +515,18 @@ void ForestWindEmitter::_renderEmitterInfo( ObjectRenderInst *ri, SceneRenderSta
drawer->drawArrow( desc, pos, pos + (windVec * mWindStrength), ColorI( 0, 0, 255, 255 ) );//Point3F( -235.214, 219.589, 34.0991 ), Point3F( -218.814, 244.731, 37.5587 ), ColorI( 255, 255, 0, 255 ) );// drawer->drawArrow( desc, pos, pos + (windVec * mWindStrength), ColorI( 0, 0, 255, 255 ) );//Point3F( -235.214, 219.589, 34.0991 ), Point3F( -218.814, 244.731, 37.5587 ), ColorI( 255, 255, 0, 255 ) );//
drawer->drawArrow( desc, pos, pos + (mWind->getTarget() * mWindStrength ), ColorI( 255, 0, 0, 85 ) ); drawer->drawArrow( desc, pos, pos + (mWind->getTarget() * mWindStrength ), ColorI( 255, 0, 0, 85 ) );
S32 useRadius = mWindRadius; S32 useRadius = mWindRadius;
// Draw a 2D circle for the wind radius. // Draw a 2D circle for the wind radius.
if ( isRadialEmitter() ) if ( isRadialEmitter() )
{ {
// If the camera is close to the sphere, shrink the sphere so it remains visible.
//So the problem is that when your inside the sphere it won't render so it might make someone GameConnection* gc = GameConnection::getConnectionToServer();
//think that it's not working right. So what I did was determine if the camera is inside the sphere. GameBase* gb;
//If the camera is inside the sphere, then I find the distance from the center of the sphere to the camera if ( gc && (gb = gc->getCameraObject()) )
//Round down and use that as the radius to draw the sphere.
//That way if someone zooms in or out, their screen is still showing the sphere.
GameConnection * gc = GameConnection::getConnectionToServer();
GameBase* gb = gc->getCameraObject();
if (gb)
{ {
Point3F camPos = gb->getPosition(); F32 camDist = (gb->getPosition() - getPosition()).len();
if ( getPosition().isInsideSphere( camPos, mWindRadius ) ) if ( camDist < mWindRadius )
useRadius = getPosition().distanceTo(camPos); useRadius = camDist;
} }
drawer->drawSphere( desc, useRadius, pos, ColorI( 255, 0, 0, 80 ) ); drawer->drawSphere( desc, useRadius, pos, ColorI( 255, 0, 0, 80 ) );
} }

View file

@ -123,22 +123,6 @@ class Point3F
void interpolate(const Point3F&, const Point3F&, F32); void interpolate(const Point3F&, const Point3F&, F32);
void zero(); void zero();
F32 distanceTo(Point3F loc)
{
F32 xSqr = (this->x - loc.x) * (this->x - loc.x);
F32 ySqr = (this->y - loc.y) * (this->y - loc.y);
F32 zSqr = (this->z - loc.z) * (this->z - loc.z);
F32 mySqr = xSqr + ySqr + zSqr;
return sqrt(mySqr);
}
bool isInsideSphere(Point3F pt, F32 Radius)
{
return ( (( this->x - pt.x) * ( this->x - pt.x) ) + (( this->y - pt.y) * ( this->y - pt.y) ) + (( this->z - pt.z) * ( this->z - pt.z) ) <= (Radius * Radius));
}
/// Returns the smallest absolute value. /// Returns the smallest absolute value.
F32 least() const; F32 least() const;