summaryrefslogtreecommitdiffhomepage
path: root/Opcode/Ice
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-10-01 22:52:04 +0200
committerAki <please@ignore.pl>2021-10-01 23:45:09 +0200
commit5e6773397cc101c7c3d08482efc456daa91734e9 (patch)
treed6a116bb2c12dab6ff5e0f212676a9ac6bd19346 /Opcode/Ice
parentc2d2c3551501110fddd78674d5435bfaa70382a3 (diff)
downloadstarshatter-5e6773397cc101c7c3d08482efc456daa91734e9.zip
starshatter-5e6773397cc101c7c3d08482efc456daa91734e9.tar.gz
starshatter-5e6773397cc101c7c3d08482efc456daa91734e9.tar.bz2
Switched to use only one version of Opcode
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/IceIndexedTriangle.cpp4
-rw-r--r--Opcode/Ice/IceIndexedTriangle.h2
-rw-r--r--Opcode/Ice/IceLSS.h4
-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
18 files changed, 62 insertions, 50 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/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..2cffa92 100644
--- a/Opcode/Ice/IceIndexedTriangle.h
+++ b/Opcode/Ice/IceIndexedTriangle.h
@@ -60,7 +60,7 @@
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;
};
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/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]))
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**