1
1
forked from 0ad/0ad

Add some missing consts to arguments.

This was SVN commit r7805.
This commit is contained in:
Ykkrosh 2010-07-25 14:10:46 +00:00
parent 8d7011998e
commit 1faf83f916
4 changed files with 10 additions and 11 deletions

View File

@ -42,8 +42,8 @@ CHFTracer::CHFTracer(CTerrain *pTerrain):
// RayTriIntersect: intersect a ray with triangle defined by vertices
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
// or false otherwise
bool CHFTracer::RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
const CVector3D& origin,const CVector3D& dir,float& dist) const
bool CHFTracer::RayTriIntersect(const CVector3D& v0, const CVector3D& v1, const CVector3D& v2,
const CVector3D& origin, const CVector3D& dir, float& dist) const
{
const float EPSILON=0.00001f;
@ -90,7 +90,7 @@ bool CHFTracer::RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CV
///////////////////////////////////////////////////////////////////////////////
// CellIntersect: test if ray intersects either of the triangles in the given
// cell - return hit result, and distance to hit, if hit occurred
bool CHFTracer::CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const
bool CHFTracer::CellIntersect(int cx, int cz, const CVector3D& origin, const CVector3D& dir, float& dist) const
{
bool res=false;
@ -117,7 +117,7 @@ bool CHFTracer::CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,flo
// RayIntersect: intersect ray with this heightfield; return true if
// intersection occurs (and fill in grid coordinates of intersection), or false
// otherwise
bool CHFTracer::RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const
bool CHFTracer::RayIntersect(const CVector3D& origin, const CVector3D& dir, int& x, int& z, CVector3D& ipt) const
{
// intersect first against bounding box
CBound bound;

View File

@ -35,17 +35,17 @@ public:
// intersect ray with this heightfield; return true if intersection
// occurs (and fill in grid coordinates and point of intersection), or false otherwise
bool RayIntersect(CVector3D& origin,CVector3D& dir,int& x,int& z,CVector3D& ipt) const;
bool RayIntersect(const CVector3D& origin, const CVector3D& dir, int& x, int& z, CVector3D& ipt) const;
private:
// intersect a ray with triangle defined by vertices
// v0,v1,v2; return true if ray hits triangle at distance less than dist,
// or false otherwise
bool RayTriIntersect(const CVector3D& v0,const CVector3D& v1,const CVector3D& v2,
const CVector3D& origin,const CVector3D& dir,float& dist) const;
bool RayTriIntersect(const CVector3D& v0, const CVector3D& v1, const CVector3D& v2,
const CVector3D& origin, const CVector3D& dir, float& dist) const;
// test if ray intersects either of the triangles in the given
bool CellIntersect(int cx,int cz,CVector3D& origin,CVector3D& dir,float& dist) const;
bool CellIntersect(int cx, int cz, const CVector3D& origin, const CVector3D& dir, float& dist) const;
// The terrain we're operating on
CTerrain *m_pTerrain;

View File

@ -125,13 +125,12 @@ bool CPlane::FindLineSegIntersection (const CVector3D &start, const CVector3D &e
return true;
}
bool CPlane::FindRayIntersection (CVector3D &start, CVector3D &direction, CVector3D *intsect)
bool CPlane::FindRayIntersection (const CVector3D &start, const CVector3D &direction, CVector3D *intsect)
{
float dot = m_Norm.Dot (direction);
if (dot == 0.0f)
return false;
//CVector3D a; // EDIT: John M. Mena - Not sure why this is here
*intsect = start - (direction * (DistanceToPlane (start)/dot));
return true;
}

View File

@ -59,7 +59,7 @@ class CPlane
//calculates the intersection point of a line with this
//plane. Returns false if there is no intersection
bool FindLineSegIntersection (const CVector3D &start, const CVector3D &end, CVector3D *intsect);
bool FindRayIntersection (CVector3D &start, CVector3D &direction, CVector3D *intsect);
bool FindRayIntersection (const CVector3D &start, const CVector3D &direction, CVector3D *intsect);
public:
CVector3D m_Norm; //normal vector of the plane