summaryrefslogtreecommitdiffhomepage
path: root/Opcode/Ice
diff options
context:
space:
mode:
Diffstat (limited to 'Opcode/Ice')
-rw-r--r--Opcode/Ice/IceAABB.cpp2
-rw-r--r--Opcode/Ice/IceAABB.h2
-rw-r--r--Opcode/Ice/IceContainer.cpp12
-rw-r--r--Opcode/Ice/IceContainer.h4
-rw-r--r--Opcode/Ice/IceFPU.h96
-rw-r--r--Opcode/Ice/IceIndexedTriangle.cpp4
-rw-r--r--Opcode/Ice/IceIndexedTriangle.h6
-rw-r--r--Opcode/Ice/IceLSS.h4
-rw-r--r--Opcode/Ice/IceMemoryMacros.h20
-rw-r--r--Opcode/Ice/IceOBB.cpp2
-rw-r--r--Opcode/Ice/IceOBB.h2
-rw-r--r--Opcode/Ice/IcePlane.cpp6
-rw-r--r--Opcode/Ice/IcePlane.h38
-rw-r--r--Opcode/Ice/IcePoint.cpp2
-rw-r--r--Opcode/Ice/IcePoint.h6
-rw-r--r--Opcode/Ice/IceSegment.cpp6
-rw-r--r--Opcode/Ice/IceSegment.h10
-rw-r--r--Opcode/Ice/IceTriangle.cpp4
-rw-r--r--Opcode/Ice/IceTriangle.h4
-rw-r--r--Opcode/Ice/IceUtils.h2
20 files changed, 72 insertions, 160 deletions
diff --git a/Opcode/Ice/IceAABB.cpp b/Opcode/Ice/IceAABB.cpp
index 149211c..2e3288b 100644
--- a/Opcode/Ice/IceAABB.cpp
+++ b/Opcode/Ice/IceAABB.cpp
@@ -100,7 +100,7 @@ bool AABB::IsInside(const AABB& box) const
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-bool AABB::ComputePlanes(Plane* planes) const
+bool AABB::ComputePlanes(IcePlane* planes) const
{
// Checkings
if(!planes) return false;
diff --git a/Opcode/Ice/IceAABB.h b/Opcode/Ice/IceAABB.h
index 2c2ce79..1ef671b 100644
--- a/Opcode/Ice/IceAABB.h
+++ b/Opcode/Ice/IceAABB.h
@@ -23,7 +23,7 @@
const sbyte* ComputeOutline(const IcePoint& local_eye, sdword& num) const; \
float ComputeBoxArea(const IcePoint& eye, const Matrix4x4& mat, float width, float height, sdword& num) const; \
bool IsInside(const AABB& box) const; \
- bool ComputePlanes(Plane* planes) const; \
+ bool ComputePlanes(IcePlane* planes) const; \
bool ComputePoints(IcePoint* pts) const; \
const IcePoint* GetVertexNormals() const; \
const udword* GetEdges() const; \
diff --git a/Opcode/Ice/IceContainer.cpp b/Opcode/Ice/IceContainer.cpp
index e2c42d1..552d051 100644
--- a/Opcode/Ice/IceContainer.cpp
+++ b/Opcode/Ice/IceContainer.cpp
@@ -28,9 +28,11 @@ using namespace IceCore;
// Static members
#ifdef CONTAINER_STATS
+#ifdef OPCODE_EXPORTS
udword Container::mNbContainers = 0;
udword Container::mUsedRam = 0;
#endif
+#endif
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -343,3 +345,13 @@ void Container::operator=(const Container& object)
CopyMemory(mEntries, object.GetEntries(), mMaxNbEntries*sizeof(udword));
mCurNbEntries = mMaxNbEntries;
}
+
+udword Container::GetNbContainers() const
+{
+ return mNbContainers;
+}
+
+udword Container::GetTotalBytes() const
+{
+ return mUsedRam;
+}
diff --git a/Opcode/Ice/IceContainer.h b/Opcode/Ice/IceContainer.h
index 9f06ada..2660cc8 100644
--- a/Opcode/Ice/IceContainer.h
+++ b/Opcode/Ice/IceContainer.h
@@ -192,8 +192,8 @@
void operator = (const Container& object);
#ifdef CONTAINER_STATS
- inline_ udword GetNbContainers() const { return mNbContainers; }
- inline_ udword GetTotalBytes() const { return mUsedRam; }
+ udword GetNbContainers() const;
+ udword GetTotalBytes() const;
private:
static udword mNbContainers; //!< Number of containers around
diff --git a/Opcode/Ice/IceFPU.h b/Opcode/Ice/IceFPU.h
index 9e57960..18ad7ae 100644
--- a/Opcode/Ice/IceFPU.h
+++ b/Opcode/Ice/IceFPU.h
@@ -12,6 +12,9 @@
#ifndef __ICEFPU_H__
#define __ICEFPU_H__
+ #include <algorithm>
+ #include <cmath>
+
#define SIGN_BITMASK 0x80000000
//! Integer representation of a floating-point value.
@@ -41,16 +44,7 @@
//! Fast square root for floating-point values.
inline_ float FastSqrt(float square)
{
- float retval;
-
- __asm {
- mov eax, square
- sub eax, 0x3F800000
- sar eax, 1
- add eax, 0x3F800000
- mov [retval], eax
- }
- return retval;
+ return std::sqrt(square);
}
//! Saturates positive to zero.
@@ -178,102 +172,28 @@
return x*x < epsilon;
}
- #define FCOMI_ST0 _asm _emit 0xdb _asm _emit 0xf0
- #define FCOMIP_ST0 _asm _emit 0xdf _asm _emit 0xf0
- #define FCMOVB_ST0 _asm _emit 0xda _asm _emit 0xc0
- #define FCMOVNB_ST0 _asm _emit 0xdb _asm _emit 0xc0
-
- #define FCOMI_ST1 _asm _emit 0xdb _asm _emit 0xf1
- #define FCOMIP_ST1 _asm _emit 0xdf _asm _emit 0xf1
- #define FCMOVB_ST1 _asm _emit 0xda _asm _emit 0xc1
- #define FCMOVNB_ST1 _asm _emit 0xdb _asm _emit 0xc1
-
- #define FCOMI_ST2 _asm _emit 0xdb _asm _emit 0xf2
- #define FCOMIP_ST2 _asm _emit 0xdf _asm _emit 0xf2
- #define FCMOVB_ST2 _asm _emit 0xda _asm _emit 0xc2
- #define FCMOVNB_ST2 _asm _emit 0xdb _asm _emit 0xc2
-
- #define FCOMI_ST3 _asm _emit 0xdb _asm _emit 0xf3
- #define FCOMIP_ST3 _asm _emit 0xdf _asm _emit 0xf3
- #define FCMOVB_ST3 _asm _emit 0xda _asm _emit 0xc3
- #define FCMOVNB_ST3 _asm _emit 0xdb _asm _emit 0xc3
-
- #define FCOMI_ST4 _asm _emit 0xdb _asm _emit 0xf4
- #define FCOMIP_ST4 _asm _emit 0xdf _asm _emit 0xf4
- #define FCMOVB_ST4 _asm _emit 0xda _asm _emit 0xc4
- #define FCMOVNB_ST4 _asm _emit 0xdb _asm _emit 0xc4
-
- #define FCOMI_ST5 _asm _emit 0xdb _asm _emit 0xf5
- #define FCOMIP_ST5 _asm _emit 0xdf _asm _emit 0xf5
- #define FCMOVB_ST5 _asm _emit 0xda _asm _emit 0xc5
- #define FCMOVNB_ST5 _asm _emit 0xdb _asm _emit 0xc5
-
- #define FCOMI_ST6 _asm _emit 0xdb _asm _emit 0xf6
- #define FCOMIP_ST6 _asm _emit 0xdf _asm _emit 0xf6
- #define FCMOVB_ST6 _asm _emit 0xda _asm _emit 0xc6
- #define FCMOVNB_ST6 _asm _emit 0xdb _asm _emit 0xc6
-
- #define FCOMI_ST7 _asm _emit 0xdb _asm _emit 0xf7
- #define FCOMIP_ST7 _asm _emit 0xdf _asm _emit 0xf7
- #define FCMOVB_ST7 _asm _emit 0xda _asm _emit 0xc7
- #define FCMOVNB_ST7 _asm _emit 0xdb _asm _emit 0xc7
-
//! A global function to find MAX(a,b) using FCOMI/FCMOV
inline_ float FCMax2(float a, float b)
{
- float Res;
- _asm fld [a]
- _asm fld [b]
- FCOMI_ST1
- FCMOVB_ST1
- _asm fstp [Res]
- _asm fcomp
- return Res;
+ return std::max(a, b);
}
//! A global function to find MIN(a,b) using FCOMI/FCMOV
inline_ float FCMin2(float a, float b)
{
- float Res;
- _asm fld [a]
- _asm fld [b]
- FCOMI_ST1
- FCMOVNB_ST1
- _asm fstp [Res]
- _asm fcomp
- return Res;
+ return std::min(a, b);
}
//! A global function to find MAX(a,b,c) using FCOMI/FCMOV
inline_ float FCMax3(float a, float b, float c)
{
- float Res;
- _asm fld [a]
- _asm fld [b]
- _asm fld [c]
- FCOMI_ST1
- FCMOVB_ST1
- FCOMI_ST2
- FCMOVB_ST2
- _asm fstp [Res]
- _asm fcompp
- return Res;
+ return std::max(std::max(a, b), c);
}
//! A global function to find MIN(a,b,c) using FCOMI/FCMOV
inline_ float FCMin3(float a, float b, float c)
{
- float Res;
- _asm fld [a]
- _asm fld [b]
- _asm fld [c]
- FCOMI_ST1
- FCMOVNB_ST1
- FCOMI_ST2
- FCMOVNB_ST2
- _asm fstp [Res]
- _asm fcompp
- return Res;
+ return std::min(std::min(a, b), c);
}
inline_ int ConvertToSortable(float f)
diff --git a/Opcode/Ice/IceIndexedTriangle.cpp b/Opcode/Ice/IceIndexedTriangle.cpp
index d680f24..ea32362 100644
--- a/Opcode/Ice/IceIndexedTriangle.cpp
+++ b/Opcode/Ice/IceIndexedTriangle.cpp
@@ -202,7 +202,7 @@ bool IndexedTriangle::IsVisible(const IcePoint* verts, const IcePoint& source) c
return (Normal | source) >= 0.0f;
// Same as:
-// Plane PL(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]);
+// IcePlane PL(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]);
// return PL.Distance(source) > PL.d;
}
@@ -234,7 +234,7 @@ bool IndexedTriangle::BackfaceCulling(const IcePoint* verts, const IcePoint& sou
return (Normal | (source - p0)) >= 0.0f;
// Same as: (but a bit faster)
-// Plane PL(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]);
+// IcePlane PL(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]);
// return PL.Distance(source)>0.0f;
}
diff --git a/Opcode/Ice/IceIndexedTriangle.h b/Opcode/Ice/IceIndexedTriangle.h
index 5dc39ea..842eea2 100644
--- a/Opcode/Ice/IceIndexedTriangle.h
+++ b/Opcode/Ice/IceIndexedTriangle.h
@@ -12,9 +12,6 @@
#ifndef __ICEINDEXEDTRIANGLE_H__
#define __ICEINDEXEDTRIANGLE_H__
- // Forward declarations
- enum CubeIndex;
-
// An indexed triangle class.
class ICEMATHS_API IndexedTriangle
{
@@ -60,9 +57,8 @@
float MaxEdgeLength(const IcePoint* verts) const;
void ComputePoint(const IcePoint* verts, float u, float v, IcePoint& pt, udword* nearvtx=null) const;
float Angle(const IndexedTriangle& tri, const IcePoint* verts) const;
- inline_ Plane PlaneEquation(const IcePoint* verts) const { return Plane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
+ inline_ IcePlane PlaneEquation(const IcePoint* verts) const { return IcePlane(verts[mVRef[0]], verts[mVRef[1]], verts[mVRef[2]]); }
bool Equal(const IndexedTriangle& tri) const;
- CubeIndex ComputeCubeIndex(const IcePoint* verts) const;
};
#endif // __ICEINDEXEDTRIANGLE_H__
diff --git a/Opcode/Ice/IceLSS.h b/Opcode/Ice/IceLSS.h
index 8c2c154..8a26823 100644
--- a/Opcode/Ice/IceLSS.h
+++ b/Opcode/Ice/IceLSS.h
@@ -12,13 +12,13 @@
#ifndef __ICELSS_H__
#define __ICELSS_H__
- class ICEMATHS_API LSS : public Segment
+ class ICEMATHS_API LSS : public IceSegment
{
public:
//! Constructor
inline_ LSS() {}
//! Constructor
- inline_ LSS(const Segment& seg, float radius) : Segment(seg), mRadius(radius) {}
+ inline_ LSS(const IceSegment& seg, float radius) : IceSegment(seg), mRadius(radius) {}
//! Destructor
inline_ ~LSS() {}
diff --git a/Opcode/Ice/IceMemoryMacros.h b/Opcode/Ice/IceMemoryMacros.h
index 490ecd1..346345b 100644
--- a/Opcode/Ice/IceMemoryMacros.h
+++ b/Opcode/Ice/IceMemoryMacros.h
@@ -47,23 +47,7 @@
//! \warning writes nb*4 bytes !
inline_ void StoreDwords(udword* dest, udword nb, udword value)
{
- // The asm code below **SHOULD** be equivalent to one of those C versions
- // or the other if your compiled is good: (checked on VC++ 6.0)
- //
- // 1) while(nb--) *dest++ = value;
- //
- // 2) for(udword i=0;i<nb;i++) dest[i] = value;
- //
- _asm push eax
- _asm push ecx
- _asm push edi
- _asm mov edi, dest
- _asm mov ecx, nb
- _asm mov eax, value
- _asm rep stosd
- _asm pop edi
- _asm pop ecx
- _asm pop eax
+ while (nb--) *dest++ = value;
}
//! Copies a buffer.
@@ -94,7 +78,7 @@
#define SAFE_DESTRUCT(x) if (x) { (x)->SelfDestruct(); (x) = null; } //!< Safe ICE-style release
#ifdef __ICEERROR_H__
- #define CHECKALLOC(x) if(!x) return SetIceError("Out of memory.", EC_OUT_OF_MEMORY); //!< Standard alloc checking. HANDLE WITH CARE.
+ #define CHECKALLOC(x) if(!x) return SetIceError;; // ("Out of memory.", EC_OUT_OF_MEMORY); //!< Standard alloc checking. HANDLE WITH CARE.
#else
#define CHECKALLOC(x) if(!x) return false;
#endif
diff --git a/Opcode/Ice/IceOBB.cpp b/Opcode/Ice/IceOBB.cpp
index 439c58c..5a986e8 100644
--- a/Opcode/Ice/IceOBB.cpp
+++ b/Opcode/Ice/IceOBB.cpp
@@ -79,7 +79,7 @@ void OBB::Create(const AABB& aabb, const Matrix4x4& mat)
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-bool OBB::ComputePlanes(Plane* planes) const
+bool OBB::ComputePlanes(IcePlane* planes) const
{
// Checkings
if(!planes) return false;
diff --git a/Opcode/Ice/IceOBB.h b/Opcode/Ice/IceOBB.h
index 2badb18..9c1711d 100644
--- a/Opcode/Ice/IceOBB.h
+++ b/Opcode/Ice/IceOBB.h
@@ -94,7 +94,7 @@
* \return true if success
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- bool ComputePlanes(Plane* planes) const;
+ bool ComputePlanes(IcePlane* planes) const;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
diff --git a/Opcode/Ice/IcePlane.cpp b/Opcode/Ice/IcePlane.cpp
index cd4758c..15e907c 100644
--- a/Opcode/Ice/IcePlane.cpp
+++ b/Opcode/Ice/IcePlane.cpp
@@ -9,8 +9,8 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Plane class.
- * \class Plane
+ * IcePlane class.
+ * \class IcePlane
* \author Pierre Terdiman
* \version 1.0
*/
@@ -31,7 +31,7 @@ using namespace IceMaths;
* \return Self-reference
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-Plane& Plane::Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2)
+IcePlane& IcePlane::Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2)
{
IcePoint Edge0 = p1 - p0;
IcePoint Edge1 = p2 - p0;
diff --git a/Opcode/Ice/IcePlane.h b/Opcode/Ice/IcePlane.h
index d514e68..1a447ce 100644
--- a/Opcode/Ice/IcePlane.h
+++ b/Opcode/Ice/IcePlane.h
@@ -14,28 +14,28 @@
#define PLANE_EPSILON (1.0e-7f)
- class ICEMATHS_API Plane
+ class ICEMATHS_API IcePlane
{
public:
//! Constructor
- inline_ Plane() { }
+ inline_ IcePlane() { }
//! Constructor from a normal and a distance
- inline_ Plane(float nx, float ny, float nz, float d) { Set(nx, ny, nz, d); }
+ inline_ IcePlane(float nx, float ny, float nz, float d) { Set(nx, ny, nz, d); }
//! Constructor from a point on the plane and a normal
- inline_ Plane(const IcePoint& p, const IcePoint& n) { Set(p, n); }
+ inline_ IcePlane(const IcePoint& p, const IcePoint& n) { Set(p, n); }
//! Constructor from three points
- inline_ Plane(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) { Set(p0, p1, p2); }
+ inline_ IcePlane(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) { Set(p0, p1, p2); }
//! Constructor from a normal and a distance
- inline_ Plane(const IcePoint& _n, float _d) { n = _n; d = _d; }
+ inline_ IcePlane(const IcePoint& _n, float _d) { n = _n; d = _d; }
//! Copy constructor
- inline_ Plane(const Plane& plane) : n(plane.n), d(plane.d) { }
+ inline_ IcePlane(const IcePlane& plane) : n(plane.n), d(plane.d) { }
//! Destructor
- inline_ ~Plane() { }
+ inline_ ~IcePlane() { }
- inline_ Plane& Zero() { n.Zero(); d = 0.0f; return *this; }
- inline_ Plane& Set(float nx, float ny, float nz, float _d) { n.Set(nx, ny, nz); d = _d; return *this; }
- inline_ Plane& Set(const IcePoint& p, const IcePoint& _n) { n = _n; d = - p | _n; return *this; }
- Plane& Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2);
+ inline_ IcePlane& Zero() { n.Zero(); d = 0.0f; return *this; }
+ inline_ IcePlane& Set(float nx, float ny, float nz, float _d) { n.Set(nx, ny, nz); d = _d; return *this; }
+ inline_ IcePlane& Set(const IcePoint& p, const IcePoint& _n) { n = _n; d = - p | _n; return *this; }
+ IcePlane& Set(const IcePoint& p0, const IcePoint& p1, const IcePoint& p2);
inline_ float Distance(const IcePoint& p) const { return (p | n) + d; }
inline_ bool Belongs(const IcePoint& p) const { return fabsf(Distance(p)) < PLANE_EPSILON; }
@@ -58,14 +58,14 @@
inline_ operator HPoint() const { return HPoint(n, d); }
// Arithmetic operators
- inline_ Plane operator*(const Matrix4x4& m) const
+ inline_ IcePlane operator*(const Matrix4x4& m) const
{
// Old code from Irion. Kept for reference.
- Plane Ret(*this);
+ IcePlane Ret(*this);
return Ret *= m;
}
- inline_ Plane& operator*=(const Matrix4x4& m)
+ inline_ IcePlane& operator*=(const Matrix4x4& m)
{
// Old code from Irion. Kept for reference.
IcePoint n2 = HPoint(n, 0.0f) * m;
@@ -77,14 +77,14 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Transforms a plane by a 4x4 matrix. Same as Plane * Matrix4x4 operator, but faster.
+ * Transforms a plane by a 4x4 matrix. Same as IcePlane * Matrix4x4 operator, but faster.
* \param transformed [out] transformed plane
* \param plane [in] source plane
* \param transform [in] transform matrix
* \warning the plane normal must be unit-length
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ void TransformPlane(Plane& transformed, const Plane& plane, const Matrix4x4& transform)
+ inline_ void TransformPlane(IcePlane& transformed, const IcePlane& plane, const Matrix4x4& transform)
{
// Rotate the normal using the rotation part of the 4x4 matrix
transformed.n = plane.n * Matrix3x3(transform);
@@ -95,13 +95,13 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Transforms a plane by a 4x4 matrix. Same as Plane * Matrix4x4 operator, but faster.
+ * Transforms a plane by a 4x4 matrix. Same as IcePlane * Matrix4x4 operator, but faster.
* \param plane [in/out] source plane (transformed on return)
* \param transform [in] transform matrix
* \warning the plane normal must be unit-length
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- inline_ void TransformPlane(Plane& plane, const Matrix4x4& transform)
+ inline_ void TransformPlane(IcePlane& plane, const Matrix4x4& transform)
{
// Rotate the normal using the rotation part of the 4x4 matrix
plane.n *= Matrix3x3(transform);
diff --git a/Opcode/Ice/IcePoint.cpp b/Opcode/Ice/IcePoint.cpp
index 717fc53..8bf2d40 100644
--- a/Opcode/Ice/IcePoint.cpp
+++ b/Opcode/Ice/IcePoint.cpp
@@ -106,7 +106,7 @@ IcePoint& IcePoint::Refract(const IcePoint& eye, const IcePoint& n, float refrac
return *this;
}
-IcePoint& IcePoint::ProjectToPlane(const Plane& p)
+IcePoint& IcePoint::ProjectToPlane(const IcePlane& p)
{
*this-= (p.d + (*this|p.n))*p.n;
return *this;
diff --git a/Opcode/Ice/IcePoint.h b/Opcode/Ice/IcePoint.h
index 7f55a27..bb06684 100644
--- a/Opcode/Ice/IcePoint.h
+++ b/Opcode/Ice/IcePoint.h
@@ -14,7 +14,7 @@
// Forward declarations
class HPoint;
- class Plane;
+ class IcePlane;
class Matrix3x3;
class Matrix4x4;
@@ -371,13 +371,13 @@
IcePoint& Refract(const IcePoint& eye, const IcePoint& n, float refractindex, IcePoint& refracted);
//! Projects the IcePoint onto a plane
- IcePoint& ProjectToPlane(const Plane& p);
+ IcePoint& ProjectToPlane(const IcePlane& p);
//! Projects the IcePoint onto the screen
void ProjectToScreen(float halfrenderwidth, float halfrenderheight, const Matrix4x4& mat, HPoint& projected) const;
//! Unfolds the IcePoint onto a plane according to edge(a,b)
- IcePoint& Unfold(Plane& p, IcePoint& a, IcePoint& b);
+ IcePoint& Unfold(IcePlane& p, IcePoint& a, IcePoint& b);
//! Hash function from Ville Miettinen
inline_ udword GetHashValue() const
diff --git a/Opcode/Ice/IceSegment.cpp b/Opcode/Ice/IceSegment.cpp
index f8d1553..0eede40 100644
--- a/Opcode/Ice/IceSegment.cpp
+++ b/Opcode/Ice/IceSegment.cpp
@@ -9,12 +9,12 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
- * Segment class.
+ * IceSegment class.
* A segment is defined by S(t) = mP0 * (1 - t) + mP1 * t, with 0 <= t <= 1
* Alternatively, a segment is S(t) = Origin + t * Direction for 0 <= t <= 1.
* Direction is not necessarily unit length. The end points are Origin = mP0 and Origin + Direction = mP1.
*
- * \class Segment
+ * \class IceSegment
* \author Pierre Terdiman
* \version 1.0
*/
@@ -26,7 +26,7 @@
using namespace IceMaths;
-float Segment::SquareDistance(const IcePoint& Point, float* t) const
+float IceSegment::SquareDistance(const IcePoint& Point, float* t) const
{
IcePoint Diff = Point - mP0;
IcePoint Dir = mP1 - mP0;
diff --git a/Opcode/Ice/IceSegment.h b/Opcode/Ice/IceSegment.h
index e3ce8ab..d2b7f07 100644
--- a/Opcode/Ice/IceSegment.h
+++ b/Opcode/Ice/IceSegment.h
@@ -12,17 +12,17 @@
#ifndef __ICESEGMENT_H__
#define __ICESEGMENT_H__
- class ICEMATHS_API Segment
+ class ICEMATHS_API IceSegment
{
public:
//! Constructor
- inline_ Segment() {}
+ inline_ IceSegment() {}
//! Constructor
- inline_ Segment(const IcePoint& p0, const IcePoint& p1) : mP0(p0), mP1(p1) {}
+ inline_ IceSegment(const IcePoint& p0, const IcePoint& p1) : mP0(p0), mP1(p1) {}
//! Copy constructor
- inline_ Segment(const Segment& seg) : mP0(seg.mP0), mP1(seg.mP1) {}
+ inline_ IceSegment(const IceSegment& seg) : mP0(seg.mP0), mP1(seg.mP1) {}
//! Destructor
- inline_ ~Segment() {}
+ inline_ ~IceSegment() {}
inline_ const IcePoint& GetOrigin() const { return mP0; }
inline_ IcePoint ComputeDirection() const { return mP1 - mP0; }
diff --git a/Opcode/Ice/IceTriangle.cpp b/Opcode/Ice/IceTriangle.cpp
index 69a858f..8a0a4b6 100644
--- a/Opcode/Ice/IceTriangle.cpp
+++ b/Opcode/Ice/IceTriangle.cpp
@@ -24,7 +24,7 @@ using namespace IceMaths;
*/
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static sdword VPlaneSideEps(const IcePoint& v, const Plane& plane, float epsilon)
+static sdword VPlaneSideEps(const IcePoint& v, const IcePlane& plane, float epsilon)
{
// Compute distance from current vertex to the plane
float Dist = plane.Distance(v);
@@ -132,7 +132,7 @@ void Triangle::Center(IcePoint& center) const
center = (p0 + p1 + p2)*INV3;
}
-PartVal Triangle::TestAgainstPlane(const Plane& plane, float epsilon) const
+PartVal Triangle::TestAgainstPlane(const IcePlane& plane, float epsilon) const
{
bool Pos = false, Neg = false;
diff --git a/Opcode/Ice/IceTriangle.h b/Opcode/Ice/IceTriangle.h
index 13eca37..c5c1fde 100644
--- a/Opcode/Ice/IceTriangle.h
+++ b/Opcode/Ice/IceTriangle.h
@@ -54,9 +54,9 @@
void Normal(IcePoint& normal) const;
void DenormalizedNormal(IcePoint& normal) const;
void Center(IcePoint& center) const;
- inline_ Plane PlaneEquation() const { return Plane(mVerts[0], mVerts[1], mVerts[2]); }
+ inline_ IcePlane PlaneEquation() const { return IcePlane(mVerts[0], mVerts[1], mVerts[2]); }
- PartVal TestAgainstPlane(const Plane& plane, float epsilon) const;
+ PartVal TestAgainstPlane(const IcePlane& plane, float epsilon) const;
// float Distance(Point& cp, Point& cq, Tri& tri);
void ComputeMoment(Moment& m);
float MinEdgeLength() const;
diff --git a/Opcode/Ice/IceUtils.h b/Opcode/Ice/IceUtils.h
index 0e6161e..9c1e045 100644
--- a/Opcode/Ice/IceUtils.h
+++ b/Opcode/Ice/IceUtils.h
@@ -204,7 +204,7 @@
//! TO BE DOCUMENTED
#define OFFSET_OF(Class, Member) (size_t)&(((Class*)0)->Member)
//! TO BE DOCUMENTED
- #define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
+ #define ICEARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**