Example #1
0
bool CBuzzControllerSpiri::Land() {
   CVector3 cPos = m_pcPosition->GetReading().Position;
   if(Abs(cPos.GetZ()) < 0.01f) return false;
   cPos.SetZ(0.0f);
   m_pcPropellers->SetAbsolutePosition(cPos);
   return true;
}
Example #2
0
QString MyLineEdit::GetDefault()
{
	if (parameterContainer && !gotDefault)
	{
		QString type = GetType(objectName());
		if (type == QString("vect3"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect);
			QString valS = QString::number(val.itemByName(lastChar), 'g', 16);
			defaultText = valS;
			gotDefault = true;
		}
		else
		{
			QString val = parameterContainer->GetDefault<QString>(parameterName);
			defaultText = val;
			gotDefault = true;
		}

		QString toolTipText;
		toolTipText += "Name: " + parameterName + "\n";
		toolTipText += "Default: " + defaultText;
		setToolTip(toolTipText);
	}
	return defaultText;
}
Example #3
0
QString MyLineEdit::GetDefault()
{
	if (parameterContainer && !gotDefault)
	{
		QString type = GetType(objectName());
		if (type == QString("vect3") || type == QString("logvect3"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect);
			QString valS = QString("%L1").arg(val.itemByName(lastChar), 0, 'g', 16);
			defaultText = valS;
			gotDefault = true;
		}
		else if (type == QString("vect4") || type == QString("logvect3"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector4 val = parameterContainer->GetDefault<CVector4>(nameVect);
			QString valS = QString("%L1").arg(val.itemByName(lastChar), 0, 'g', 16);
			defaultText = valS;
			gotDefault = true;
		}
		else
		{
			QString val = parameterContainer->GetDefault<QString>(parameterName);
			defaultText = val;
			gotDefault = true;
		}

		setToolTipText();
	}
	return defaultText;
}
Example #4
0
double MyDoubleSpinBox::GetDefault()
{
	if (parameterContainer && !gotDefault)
	{
		QString type = GetType(objectName());
		if (type == QString("spinbox3") || type == QString("spinboxd3"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect);
			defaultValue = val.itemByName(lastChar);
			gotDefault = true;
		}
		else if (type == QString("spinbox4") || type == QString("spinboxd4"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector4 val = parameterContainer->GetDefault<CVector4>(nameVect);
			defaultValue = val.itemByName(lastChar);
			gotDefault = true;
		}
		else
		{
			defaultValue = parameterContainer->GetDefault<double>(parameterName);
			gotDefault = true;
		}

		QString toolTipText = toolTip();
		toolTipText += "\nParameter name: " + parameterName + "<br>";
		toolTipText += "Default: " + QString("%L1").arg(defaultValue, 0, 'g', 16);
		setToolTip(toolTipText);
	}
	return defaultValue;
}
Example #5
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CMatrix
//
//  - prototype : void SetPosition(const CVector3& position)
//
//  - Purpose   : Sets matrix's position values.
//
// -----------------------------------------------------------------------------
void CMatrix::SetPosition(const CVector3& position)
{
	m_fM[0][3] = position.X();
	m_fM[1][3] = position.Y();
	m_fM[2][3] = position.Z();

}
double MyDoubleSpinBox::GetDefault()
{
	if (parameterContainer && !gotDefault)
	{
		QString type = GetType(objectName());
		if (type == QString("spinbox3") || type == QString("spinboxd3"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector3 val = parameterContainer->GetDefault<CVector3>(nameVect);
			defaultValue = val.itemByName(lastChar);
			gotDefault = true;
			setToolTipText();
		}
		else if (type == QString("spinbox4") || type == QString("spinboxd4"))
		{
			char lastChar = (parameterName.at(parameterName.length() - 1)).toLatin1();
			QString nameVect = parameterName.left(parameterName.length() - 2);
			CVector4 val = parameterContainer->GetDefault<CVector4>(nameVect);
			defaultValue = val.itemByName(lastChar);
			gotDefault = true;
			setToolTipText();
		}
		else
		{
			defaultValue = parameterContainer->GetDefault<double>(parameterName);
			gotDefault = true;
			setToolTipText();
		}
	}
	return defaultValue;
}
Example #7
0
 void CRABEquippedEntity::Update() {
    CVector3 cPos = m_cPosOffset;
    cPos.Rotate(m_psAnchor->Orientation);
    cPos += m_psAnchor->Position;
    SetPosition(cPos);
    SetOrientation(m_psAnchor->Orientation * m_cRotOffset);
 }
VoronoiDiagram::Point VoronoiDiagram::ToPoint(const CVector3& vec) const {
    VoronoiDiagram::Point point;
    /* Assuming that Vector have meter values */
    point.set(HORIZONTAL, vec.GetX()*scaleVectorToMilimeters);
    point.set(VERTICAL, vec.GetY()*scaleVectorToMilimeters);
    return point;
}
Example #9
0
CVector3 CVector3::RotateAroundVectorByAngle(CVector3 axis, double angle)
{
	CVector3 vector = *this * cos(angle);
	vector += (axis.Cross(*this)) * sin(angle);
	vector += axis * axis.Dot(*this) * (1 - cos(angle));
	return vector;
}
Example #10
0
sRGBAfloat cRenderWorker::EnvMapping(const sShaderInputData &input)
{
	sRGBAfloat envReflect;
	CVector3 reflect;
	double dot = -input.viewVector.Dot(input.normal);
	reflect = input.normal * 2.0 * dot + input.viewVector;

	double alphaTexture = reflect.GetAlpha() + M_PI;
	double betaTexture = reflect.GetBeta();
	double texWidth = data->textures.envmapTexture.Width();
	double texHeight = data->textures.envmapTexture.Height();

	if (betaTexture > 0.5 * M_PI) betaTexture = 0.5 * M_PI - betaTexture;

	if (betaTexture < -0.5 * M_PI) betaTexture = -0.5 * M_PI + betaTexture;

	double dtx = (alphaTexture / (2.0 * M_PI)) * texWidth + texWidth * 8.25;
	double dty = (betaTexture / (M_PI) + 0.5) * texHeight + texHeight * 8.0;
	dtx = fmod(dtx, texWidth);
	dty = fmod(dty, texHeight);
	if (dtx < 0) dtx = 0;
	if (dty < 0) dty = 0;
	envReflect.R = data->textures.envmapTexture.Pixel(dtx, dty).R / 256.0;
	envReflect.G = data->textures.envmapTexture.Pixel(dtx, dty).G / 256.0;
	envReflect.B = data->textures.envmapTexture.Pixel(dtx, dty).B / 256.0;
	return envReflect;
}
Example #11
0
 bool CDynamics3DEntity::MoveTo(const CVector3& c_position,
                                const CQuaternion& c_orientation,
                                bool b_check_only) {
    /* Move the body to the new position */
    dBodySetPosition(m_tBody, c_position.GetX(), c_position.GetY(), c_position.GetZ());
    /* Rotate the body to the new orientation */
    dQuaternion tQuat = { c_orientation.GetW(),
                          c_orientation.GetX(),
                          c_orientation.GetY(),
                          c_orientation.GetZ() };
    dBodySetQuaternion(m_tBody, tQuat);
    /* Check for collisions */
    bool bCollisions = m_cEngine.IsEntityColliding(m_tEntitySpace);
    if(bCollisions || b_check_only) {
       /*
        * Undo the changes if there is a collision or
        * if the move was just a check
        */
       const CVector3& cPosition = GetEmbodiedEntity().GetPosition();
       dBodySetPosition(m_tBody, cPosition.GetX(), cPosition.GetY(), cPosition.GetZ());
       const CQuaternion& cOrientation = GetEmbodiedEntity().GetOrientation();
       dQuaternion tQuat2 = { cOrientation.GetW(),
                              cOrientation.GetX(),
                              cOrientation.GetY(),
                              cOrientation.GetZ() };
       dBodySetQuaternion(m_tBody, tQuat2);
       return !bCollisions;
    }
    else {
       /* Set the new position and orientation */
       GetEmbodiedEntity().SetPosition(c_position);
       GetEmbodiedEntity().SetOrientation(c_orientation);
       return true;
    }
 }
Example #12
0
 bool CDynamics3DEntity::CheckIntersectionWithRay(Real& f_t_on_ray,
                                                  const CRay& c_ray) const {
    /* Create an ODE ray from ARGoS ray */
    Real fRayLength = c_ray.GetLength();
    dGeomID tRay = dCreateRay(m_cEngine.GetSpaceID(), fRayLength);
    CVector3 cDirection;
    c_ray.GetDirection(cDirection);
    dGeomRaySet(tRay,
                c_ray.GetStart().GetX(),
                c_ray.GetStart().GetY(),
                c_ray.GetStart().GetZ(),
                cDirection.GetX(),
                cDirection.GetY(),
                cDirection.GetZ());
    /* Create the structure to contain info about the possible
       ray/geom intersection */
    dContactGeom tIntersection;
    /* Check for intersection between the ray and the object local space */
    if(dCollide(tRay, reinterpret_cast<dGeomID>(m_tEntitySpace), 1, &tIntersection, sizeof(dContactGeom)) > 0) {
       /* There is an intersecton */
       f_t_on_ray = tIntersection.depth / fRayLength;
       return true;
    }
    else {
       /* No intersection detected */
       return false;
    }
 }
Example #13
0
 void CDynamics2DEngine::PositionPhysicsToSpace(CVector3& c_new_pos,
                                                const CVector3& c_original_pos,
                                                const cpBody* pt_body) {
    c_new_pos.SetX(pt_body->p.x);
    c_new_pos.SetY(pt_body->p.y);
    c_new_pos.SetZ(c_original_pos.GetZ());
 }
Example #14
0
 bool CPlane::Intersects(Real& f_t_on_ray,
                         const CRay3& c_ray) {
    /* Ray direction */
    CVector3 cRayDir;
    c_ray.GetDirection(cRayDir);
    /* Calculate f_t_on_ray */
    Real fNumerator = (m_cPosition-c_ray.GetStart()).DotProduct(m_cNormal);
    Real fDenominator = cRayDir.DotProduct(m_cNormal);
    /* Is ray parallel to plane? */
    if(Abs(fDenominator) > 1e-6) {
       /* No, it's not */
       f_t_on_ray = fNumerator / fDenominator / c_ray.GetLength();
       return (f_t_on_ray < 1.0f);
    }
    else {
       /* Yes, it is */
       /* Is ray coincident with the plane? */
       if(Abs(fNumerator) > 1e-6) {
          /* No, the ray is parallel to and far from the plane */
          /* No intersection possible */
          return false;
       }
       else {
          /* Yes, the ray coincides with the plane */
          f_t_on_ray = 0.0f;
          return true;
       }
    }
 }
Example #15
0
unsigned int CBspMapMeshProvider::FindLeaf(const CVector3& searchPosition) const
{
	int32 index = 0;
	const Bsp::NodeArray& nodes(m_bspFile->GetNodes());
	const Bsp::PlaneArray& planes(m_bspFile->GetPlanes());

	while(index >= 0)
	{
		const Bsp::NODE& node = nodes[index];
		const Bsp::PLANE& plane = planes[node.plane];

		CVector3 planeNormal = Bsp::ConvertToAthenaCoord(plane.normal);
		float distance = planeNormal.Dot(searchPosition) - plane.distance;

		if(distance >= 0)
		{
			index = node.children[0];
		}
		else
		{
			index = node.children[1];
		}
	}
	return -index - 1;
}
Example #16
0
void CGround::Update()
{
	CVector3 pos;
	pos.Set(0.0f, -0.5f, 0.0f);
	m_box.SetPosition(pos);
	m_box.UpdateWorldMatrix();
}
Example #17
0
bool CPalet::detectionCollision(CVector3 *_poPosBoule, int *i)
{
    CVector3 positionObjet;
    this->getPosition(&positionObjet);

    float ys=_poPosBoule->fGetY();
    float yc=positionObjet.fGetY();
    float zs=_poPosBoule->fGetZ();
    float zc=positionObjet.fGetZ();
    float L=2*scale->fGetY()*0.4;
    float l=2*scale->fGetZ()*1.2;

    Rectangle rect(yc,zc,L+0.3,l+0.3);
    if (rect.contains(ys,zs))
    {
        if (fabs(ys-yc)<((l/2))) {
            *i=0;
        }
        else {
            *i=1;
        }
        return true;
    }
    return false;
}
Example #18
0
 CRABEquippedEntity::CRABEquippedEntity(CComposableEntity* pc_parent,
                                        const std::string& str_id,
                                        size_t un_msg_size,
                                        Real f_range,
                                        const SAnchor& s_anchor,
                                        CEmbodiedEntity& c_entity_body,
                                        const CVector3& c_pos_offset,
                                        const CQuaternion& c_rot_offset) :
    CPositionalEntity(pc_parent,
                      str_id),
    m_psAnchor(&s_anchor),
    m_cPosOffset(c_pos_offset),
    m_cRotOffset(c_rot_offset),
    m_cData(un_msg_size),
    m_fRange(f_range),
    m_pcEntityBody(&c_entity_body) {
    Disable();
    SetCanBeEnabledIfDisabled(false);
    CVector3 cPos = c_pos_offset;
    cPos.Rotate(s_anchor.Orientation);
    cPos += s_anchor.Position;
    SetInitPosition(cPos);
    SetPosition(cPos);
    SetInitOrientation(s_anchor.Orientation * c_rot_offset);
    SetOrientation(GetInitOrientation());
 }
Example #19
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CMatrix
//
//  - prototype : void Transform(CPlane* plane)
//
//  - Purpose   : Transforms a plane.
//
// -----------------------------------------------------------------------------
void CMatrix::Transform(CPlane* plane) const
{
	CVector3 planePoint;

	// Get a point of the plane:

	if(IS_ZERO(plane->A()) == false)
	{
		planePoint.Set(-plane->D() / plane->A(), 0.0f, 0.0f);
	}
	else if(IS_ZERO(plane->B()) == false)
	{
		planePoint.Set(0.0f, -plane->D() / plane->B(), 0.0f);
	}
	else if(IS_ZERO(plane->C()) == false)
	{
		planePoint.Set(0.0f, 0.0f, -plane->D() / plane->C());
	}

	// Transform both point of the plane and plane's normal.

	CVector3 normal = plane->Normal();

	Transform(&planePoint);
	Transform(&normal, true);

	plane->Build(planePoint, normal);
}
Example #20
0
   void CQTOpenGLUserFunctions::DrawPolygon(const CVector3& c_position,
                                            const CQuaternion& c_orientation,
                                            const std::vector<CVector2>& vec_points,
                                            const CColor& c_color,
                                            const bool b_fill) {
      if(vec_points.size() < 2) {
         LOGERR << "CQTOpenGLUserFunctions::DrawPolygon() needs at least 3 points." << std::endl;
         return;
      }
      /* Save attributes and current matrix */
      glPushAttrib(GL_POLYGON_BIT);
      /* Set color */
      SetColor(c_color);
      /* Disable face culling, to make the triangle visible from any angle */
	    glDisable(GL_CULL_FACE);
      /* Set polygon attributes */
	    glEnable(GL_POLYGON_SMOOTH);
      glPolygonMode(GL_FRONT_AND_BACK, b_fill ? GL_FILL : GL_LINE);
      /* Set position/orientation */
      Rototranslate(c_position, c_orientation);
      /*  Draw */
      glBegin(GL_POLYGON);
      glNormal3f(0.0f, 0.0f, 1.0f);
      for(size_t i = 0; i < vec_points.size(); ++i) {
         glVertex3f(vec_points[i].GetX(), vec_points[i].GetY(), 0.0f);
      }
      glEnd();
      /* Reset translation */
      glTranslatef(-c_position.GetX(), -c_position.GetY(), -c_position.GetZ());
      /* Restore saved stuff */
      glPopAttrib();
   }
 void CDynamics2DMultiBodyObjectModel::MoveTo(const CVector3& c_position,
                                              const CQuaternion& c_orientation) {
    /* Set target position and orientation */
    cpVect tBodyPos = cpv(c_position.GetX(), c_position.GetY());
    CRadians cXAngle, cYAngle, cZAngle;
    c_orientation.ToEulerAngles(cZAngle, cYAngle, cXAngle);
    cpFloat tBodyOrient = cZAngle.GetValue();
    /* For each body: */
    for(size_t i = 0; i < m_vecBodies.size(); ++i) {
       /* Set body orientation at anchor */
       cpBodySetAngle(m_vecBodies[i].Body,
                      tBodyOrient + m_vecBodies[i].OffsetOrient);
       /* Set body position at anchor */
       cpBodySetPos(m_vecBodies[i].Body,
                    cpvadd(tBodyPos,
                           cpvrotate(m_vecBodies[i].OffsetPos,
                                     m_vecBodies[i].Body->rot)));
       
       /* Update shape index */
       cpSpaceReindexShapesForBody(GetDynamics2DEngine().GetPhysicsSpace(),
                                   m_vecBodies[i].Body);
    }
    /* Update ARGoS entity state */
    UpdateEntityStatus();
 }
Example #22
0
// --[  Method  ]---------------------------------------------------------------
//
//  - Class     : CMatrix
//
//  - prototype : CMatrix Quaternion()
//
//  - Purpose   : Returns the equivalent quaternion.
//
// -----------------------------------------------------------------------------
CQuaternion CMatrix::Quaternion() const
{
	CQuaternion result;
	float fTrace, fS;

	fTrace = 1.0f + m_fM[0][0] + m_fM[1][1] + m_fM[2][2];

	// Check trace value

	if(fTrace > 0.000001f)
	{
		fS = 0.5f / sqrtf(fTrace);
		result.SetW(0.25f / fS);

		CVector3 v;

		v.SetX((m_fM[2][1] - m_fM[1][2]) * fS);
		v.SetY((m_fM[0][2] - m_fM[2][0]) * fS);
		v.SetZ((m_fM[1][0] - m_fM[0][1]) * fS);

		result.SetV(v);

		return result;
	}
	else
	{
		float qx, qy, qz, qw;

		if(m_fM[0][0] > m_fM[1][1] && m_fM[0][0] > m_fM[2][2])
		{
			fS = sqrtf(1.0f + m_fM[0][0] - m_fM[1][1] - m_fM[2][2]) * 2.0f;
			qx = 0.25f * fS;
			qy = (m_fM[0][1] + m_fM[1][0] ) / fS;
			qz = (m_fM[0][2] + m_fM[2][0] ) / fS;
			qw = (m_fM[1][2] - m_fM[2][1] ) / fS;
		}
		else if(m_fM[1][1] > m_fM[2][2])
		{ 
			fS = sqrt( 1.0 + m_fM[1][1] - m_fM[0][0] - m_fM[2][2] ) * 2;
			qx = (m_fM[0][1] + m_fM[1][0] ) / fS;
			qy = 0.25f * fS;
			qz = (m_fM[1][2] + m_fM[2][1] ) / fS;
			qw = (m_fM[0][2] - m_fM[2][0] ) / fS;
		}
		else
		{
			fS = sqrt( 1.0 + m_fM[2][2] - m_fM[0][0] - m_fM[1][1] ) * 2;
			qx = (m_fM[0][2] + m_fM[2][0] ) / fS;
			qy = (m_fM[1][2] + m_fM[2][1] ) / fS;
			qz = 0.25f * fS;
			qw = (m_fM[0][1] - m_fM[1][0] ) / fS;
		}

		result.SetW(qw);
		result.SetV(CVector3(qx, qy, qz));
	}

	return result;
}
Example #23
0
CVector3 AABox::Corner( int idx ) const
{
    CVector3 rval;
    rval.SetX( ((idx & 1) == 1) ? mMax.GetX() : mMin.GetX() );
    rval.SetY( ((idx & 2) == 1) ? mMax.GetY() : mMin.GetY() );
    rval.SetZ( ((idx & 4) == 1) ? mMax.GetZ() : mMin.GetZ() );
    return rval;
}
Example #24
0
double cPrimitives::PrimitiveSphere(CVector3 _point, const sPrimitiveSphere &sphere) const
{
	CVector3 point = _point - sphere.position;
	point = sphere.rotationMatrix.RotateVector(point);
	point = point.mod(sphere.repeat);
	double dist = point.Length() - sphere.radius;
	return sphere.empty ? fabs(dist) : dist;
}
Example #25
0
// --[ Method ]---------------------------------------------------------------
//
//  - Class     : CVector3
//  - Prototype : bool operator != (const CVector3& vector) const
//
//  - Purpose   : Comparison operator
//
// ---------------------------------------------------------------------------
bool CVector3::operator != (const CVector3& vector) const
{
	if(!ARE_EQUAL(vector.X(), m_fX)) return true;
	if(!ARE_EQUAL(vector.Y(), m_fY)) return true;
	if(!ARE_EQUAL(vector.Z(), m_fZ)) return true;

	return false;
}
bool	CEntityPhysics::BoundingCircleCollide(const CEntityPhysics& that, const CEntityTransform& thistransform, const CEntityTransform& thattransform) const
{
	
	CVector3 thatPos = thattransform.GetPosition();
	CVector3 thisPos = thistransform.GetPosition();
	CVector3 centerToCenter = thatPos - thisPos;
	return centerToCenter.LengthSq() <= (this->GetBoundingCircleRadiusSq() + that.GetBoundingCircleRadiusSq());
}
Example #27
0
void CBuzzControllerSpiri::SetDirection(const CVector3& c_heading) {
   CVector3 cDir = c_heading;
   if(cDir.SquareLength() > 0.01f) {
      cDir.Normalize();
      cDir *= 0.01;
   }
   m_pcPropellers->SetRelativePosition(cDir);
}
Example #28
0
double sPrimitiveSphere::PrimitiveDistance(CVector3 _point) const
{
	CVector3 point = _point - position;
	point = rotationMatrix.RotateVector(point);
	point = point.mod(repeat);
	double dist = point.Length() - radius;
	return empty ? fabs(dist) : dist;
}
Example #29
0
void CTargetingComputer::render() 
{
   // Display surround
   renderQuad();

   char strFont[256];

   if (m_pTarget) {
      // Calculate position of targeting reticle
      CVector3 pos = m_pTarget->m_ppMasses[0]->m_vecPos;
      // Get viewport
      int viewport[4];
      double modelview[16];
      double projection[16];
      glGetIntegerv(GL_VIEWPORT,viewport);
      glGetDoublev(GL_MODELVIEW_MATRIX,modelview);
      glGetDoublev(GL_PROJECTION_MATRIX,projection);
      // Project to 2d screen coords
      double dX, dY, dZ;
      gluProject(pos.X(),pos.Y(),pos.Z(),
                 modelview, projection,
                 viewport, &dX, &dY, &dZ);
      // If behind, invert and scale everything up lots to force it to the edge
      // This could perhaps work better... not too happy, but it's late
      if (dZ > 1.0f) {
         dX = -(dX - (viewport[2]/2)) * viewport[2] + viewport[2]/2;
         dY = -(dY - (viewport[3]/2)) * viewport[3] + viewport[3]/2;
      }
      // Clip
      if (dX < 0) dX = 0;
      else if (dX > viewport[2]) dX = viewport[2];
      if (dY < 0) dY = 0;
      else if (dY > viewport[3]) dY = viewport[3];         
      // Rescale to 0..1
      dX /= viewport[2];
      dY /= viewport[3];
		double dW = 32.0f / viewport[2];
		double dH = 32.0f / viewport[3];
      // Render reticle
      m_poTargetingReticle->setPosition(dX-dW, (1-dY)-dH, dW*2, dH*2);
		m_poTargetingReticle->setTexturePercentage(100.0f);
		m_poTargetingReticle->renderQuad();
		// Radar imagexs
		m_poHoloTarget->renderQuad();
         // Calculate range
		NSDMath::CVector3 vecTarget = m_pTarget->m_ppMasses[0]->m_vecPos - m_pPlayerShip->m_ppMasses[0]->m_vecPos;
      int iRange = static_cast<int>(vecTarget.length());           
      // Range
      sprintf(strFont,"%5d m", iRange);
      m_poFont->print("Range:", CVector2(0.03f, 0.25f), 0.0075f, CVector3(0,1,0));
      m_poFont->print(strFont, CVector2(0.03f, 0.28f), 0.0075f, CVector3(0,1,0));
      // Velocity
      sprintf(strFont,"%5d m/s", static_cast<int>(m_pTarget->m_fVel));
      g_oTextureManager.render(m_auiOffScreenTexture);
      m_poFont->print("Velocity:", CVector2(0.03f, 0.32f), 0.0075f, CVector3(0,1,0));
      m_poFont->print(strFont, CVector2(0.03f, 0.35f), 0.0075f, CVector3(0,1,0));
    }
}
void game_physics_engine::CParticalDrag::UpdateForce( CPartical* pPartical, const real duration )
{
	CVector3 force = pPartical->GetVelocity();
	real dragCoeff = force.Magnitude();
	dragCoeff = m_k1 * dragCoeff + m_k2 * dragCoeff * dragCoeff;
	force.Normalize();
	force *= -dragCoeff;
	pPartical->AddForce(force);
}