From 5e6773397cc101c7c3d08482efc456daa91734e9 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 1 Oct 2021 22:52:04 +0200 Subject: Switched to use only one version of Opcode --- Opcode/CMakeLists.txt | 2 +- Opcode/Ice/IceAABB.cpp | 2 +- Opcode/Ice/IceAABB.h | 2 +- Opcode/Ice/IceContainer.cpp | 12 ++++++++++++ Opcode/Ice/IceContainer.h | 4 ++-- Opcode/Ice/IceIndexedTriangle.cpp | 4 ++-- Opcode/Ice/IceIndexedTriangle.h | 2 +- Opcode/Ice/IceLSS.h | 4 ++-- Opcode/Ice/IceOBB.cpp | 2 +- Opcode/Ice/IceOBB.h | 2 +- Opcode/Ice/IcePlane.cpp | 6 +++--- Opcode/Ice/IcePlane.h | 38 +++++++++++++++++++------------------- Opcode/Ice/IcePoint.cpp | 2 +- Opcode/Ice/IcePoint.h | 6 +++--- Opcode/Ice/IceSegment.cpp | 6 +++--- Opcode/Ice/IceSegment.h | 10 +++++----- Opcode/Ice/IceTriangle.cpp | 4 ++-- Opcode/Ice/IceTriangle.h | 4 ++-- Opcode/Ice/IceUtils.h | 2 +- Opcode/OPC_LSSAABBOverlap.h | 2 +- Opcode/OPC_LSSCollider.h | 2 +- Opcode/OPC_LSSTriOverlap.h | 8 ++++---- Opcode/OPC_PlanesAABBOverlap.h | 2 +- Opcode/OPC_PlanesCollider.cpp | 10 +++++----- Opcode/OPC_PlanesCollider.h | 10 +++++----- Opcode/OPC_PlanesTriOverlap.h | 2 +- Opcode/OPC_RayAABBOverlap.h | 2 +- Opcode/OPC_RayCollider.cpp | 12 ++++++------ Opcode/OPC_TriTriOverlap.h | 4 ++-- Opcode/Opcode.h | 27 +++------------------------ 30 files changed, 93 insertions(+), 102 deletions(-) (limited to 'Opcode') diff --git a/Opcode/CMakeLists.txt b/Opcode/CMakeLists.txt index e60d33c..d7b4ea5 100644 --- a/Opcode/CMakeLists.txt +++ b/Opcode/CMakeLists.txt @@ -50,5 +50,5 @@ target_precompile_headers( ) target_compile_definitions( Opcode - PUBLIC OPCODE_EXPORTS + PRIVATE OPCODE_EXPORTS ) 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])) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** diff --git a/Opcode/OPC_LSSAABBOverlap.h b/Opcode/OPC_LSSAABBOverlap.h index 0b03dbd..43a2da2 100644 --- a/Opcode/OPC_LSSAABBOverlap.h +++ b/Opcode/OPC_LSSAABBOverlap.h @@ -499,7 +499,7 @@ static float SqrDistance(const Ray& rkLine, const IcePoint& center, const IcePoi return fSqrDistance; } -inline_ float OPC_SegmentOBBSqrDist(const Segment& segment, const IcePoint& c0, const IcePoint& e0) +inline_ float OPC_SegmentOBBSqrDist(const IceSegment& segment, const IcePoint& c0, const IcePoint& e0) { float fLP; float fSqrDistance = SqrDistance(Ray(segment.GetOrigin(), segment.ComputeDirection()), c0, e0, &fLP); diff --git a/Opcode/OPC_LSSCollider.h b/Opcode/OPC_LSSCollider.h index b5f07dc..a533419 100644 --- a/Opcode/OPC_LSSCollider.h +++ b/Opcode/OPC_LSSCollider.h @@ -64,7 +64,7 @@ bool Collide(LSSCache& cache, const LSS& lss, const AABBTree* tree); protected: // LSS in model space - Segment mSeg; //!< Segment + IceSegment mSeg; //!< IceSegment float mRadius2; //!< LSS radius squared // Internal methods void _Collide(const AABBCollisionNode* node); diff --git a/Opcode/OPC_LSSTriOverlap.h b/Opcode/OPC_LSSTriOverlap.h index b60ab88..39c9df8 100644 --- a/Opcode/OPC_LSSTriOverlap.h +++ b/Opcode/OPC_LSSTriOverlap.h @@ -150,7 +150,7 @@ static float OPC_PointTriangleSqrDist(const IcePoint& Point, const IcePoint& p0, return fabsf(fSqrDist); } -static float OPC_SegmentSegmentSqrDist(const Segment& rkSeg0, const Segment& rkSeg1) +static float OPC_SegmentSegmentSqrDist(const IceSegment& rkSeg0, const IceSegment& rkSeg1) { // Hook IcePoint rkSeg0Direction = rkSeg0.ComputeDirection(); @@ -347,12 +347,12 @@ static float OPC_SegmentSegmentSqrDist(const Segment& rkSeg0, const Segment& rkS return fabsf(fSqrDist); } -inline_ float OPC_SegmentRaySqrDist(const Segment& rkSeg0, const Ray& rkSeg1) +inline_ float OPC_SegmentRaySqrDist(const IceSegment& rkSeg0, const Ray& rkSeg1) { - return OPC_SegmentSegmentSqrDist(rkSeg0, Segment(rkSeg1.mOrig, rkSeg1.mOrig + rkSeg1.mDir)); + return OPC_SegmentSegmentSqrDist(rkSeg0, IceSegment(rkSeg1.mOrig, rkSeg1.mOrig + rkSeg1.mDir)); } -static float OPC_SegmentTriangleSqrDist(const Segment& segment, const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) +static float OPC_SegmentTriangleSqrDist(const IceSegment& segment, const IcePoint& p0, const IcePoint& p1, const IcePoint& p2) { // Hook const IcePoint TriEdge0 = p1 - p0; diff --git a/Opcode/OPC_PlanesAABBOverlap.h b/Opcode/OPC_PlanesAABBOverlap.h index 80b8bce..27d0055 100644 --- a/Opcode/OPC_PlanesAABBOverlap.h +++ b/Opcode/OPC_PlanesAABBOverlap.h @@ -16,7 +16,7 @@ inline_ BOOL PlanesCollider::PlanesAABBOverlap(const IcePoint& center, const Ice // Stats mNbVolumeBVTests++; - const Plane* p = mPlanes; + const IcePlane* p = mPlanes; // Evaluate through all active frustum planes. We determine the relation // between the AABB and a plane by using the concept of "near" and "far" diff --git a/Opcode/OPC_PlanesCollider.cpp b/Opcode/OPC_PlanesCollider.cpp index b8ada6f..ef0088e 100644 --- a/Opcode/OPC_PlanesCollider.cpp +++ b/Opcode/OPC_PlanesCollider.cpp @@ -100,7 +100,7 @@ const char* PlanesCollider::ValidateSettings() * \warning SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only. */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool PlanesCollider::Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const Model& model, const Matrix4x4* worldm) +bool PlanesCollider::Collide(PlanesCache& cache, const IcePlane* planes, udword nb_planes, const Model& model, const Matrix4x4* worldm) { // Checkings if(!Setup(&model)) return false; @@ -174,7 +174,7 @@ bool PlanesCollider::Collide(PlanesCache& cache, const Plane* planes, udword nb_ * \warning SCALE NOT SUPPORTED. The matrix must contain rotation & translation parts only. */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -BOOL PlanesCollider::InitQuery(PlanesCache& cache, const Plane* planes, udword nb_planes, const Matrix4x4* worldm) +BOOL PlanesCollider::InitQuery(PlanesCache& cache, const IcePlane* planes, udword nb_planes, const Matrix4x4* worldm) { // 1) Call the base method VolumeCollider::InitQuery(); @@ -183,7 +183,7 @@ BOOL PlanesCollider::InitQuery(PlanesCache& cache, const Plane* planes, udword n if(nb_planes>mNbPlanes) { DELETEARRAY(mPlanes); - mPlanes = new Plane[nb_planes]; + mPlanes = new IcePlane[nb_planes]; } mNbPlanes = nb_planes; @@ -195,7 +195,7 @@ BOOL PlanesCollider::InitQuery(PlanesCache& cache, const Plane* planes, udword n // for(udword i=0;imAABB.mCenter, node->mAABB.mExtents)) return; if(node->IsLeaf()) @@ -522,7 +522,7 @@ void RayCollider::_SegmentStab(const AABBQuantizedNode* node) const IcePoint Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z); const IcePoint Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z); - // Perform Segment-AABB overlap test + // Perform IceSegment-AABB overlap test if(!SegmentAABBOverlap(Center, Extents)) return; if(node->IsLeaf()) @@ -547,7 +547,7 @@ void RayCollider::_SegmentStab(const AABBQuantizedNode* node) /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void RayCollider::_SegmentStab(const AABBNoLeafNode* node) { - // Perform Segment-AABB overlap test + // Perform IceSegment-AABB overlap test if(!SegmentAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents)) return; if(node->HasPosLeaf()) @@ -578,7 +578,7 @@ void RayCollider::_SegmentStab(const AABBQuantizedNoLeafNode* node) const IcePoint Center(float(Box.mCenter[0]) * mCenterCoeff.x, float(Box.mCenter[1]) * mCenterCoeff.y, float(Box.mCenter[2]) * mCenterCoeff.z); const IcePoint Extents(float(Box.mExtents[0]) * mExtentsCoeff.x, float(Box.mExtents[1]) * mExtentsCoeff.y, float(Box.mExtents[2]) * mExtentsCoeff.z); - // Perform Segment-AABB overlap test + // Perform IceSegment-AABB overlap test if(!SegmentAABBOverlap(Center, Extents)) return; if(node->HasPosLeaf()) diff --git a/Opcode/OPC_TriTriOverlap.h b/Opcode/OPC_TriTriOverlap.h index ccc8161..1789566 100644 --- a/Opcode/OPC_TriTriOverlap.h +++ b/Opcode/OPC_TriTriOverlap.h @@ -11,7 +11,7 @@ b=c; \ } -//! Edge to edge test based on Franlin Antonio's gem: "Faster Line Segment Intersection", in Graphics Gems III, pp. 199-202 +//! Edge to edge test based on Franlin Antonio's gem: "Faster Line IceSegment Intersection", in Graphics Gems III, pp. 199-202 #define EDGE_EDGE_TEST(V0, U0, U1) \ Bx = U0[i0] - U1[i0]; \ By = U0[i1] - U1[i1]; \ @@ -186,7 +186,7 @@ inline_ BOOL AABBTreeCollider::TriTriOverlap(const IcePoint& V0, const IcePoint& IcePoint E2 = V2 - V0; const IcePoint N1 = E1 ^ E2; const float d1 =-N1 | V0; - // Plane equation 1: N1.X+d1=0 + // IcePlane equation 1: N1.X+d1=0 // Put U0,U1,U2 into plane equation 1 to compute signed distances to the plane float du0 = (N1|U0) + d1; diff --git a/Opcode/Opcode.h b/Opcode/Opcode.h index ca29a91..33b0c5c 100644 --- a/Opcode/Opcode.h +++ b/Opcode/Opcode.h @@ -21,32 +21,11 @@ #define __OPCODE_H__ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Compilation messages -#if defined(OPCODE_EXPORTS) - #pragma message("Compiling OPCODE") -#elif !defined(OPCODE_EXPORTS) - #pragma message("Using OPCODE") - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Automatic linking - #ifndef BAN_OPCODE_AUTOLINK - #ifdef _DEBUG - #pragma comment(lib, "Opcode_D.lib") - #else - #pragma comment(lib, "Opcode.lib") - #endif - #endif -#endif - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Preprocessor -#ifndef ICE_NO_DLL - #ifdef OPCODE_EXPORTS - #define OPCODE_API __declspec(dllexport) - #else - #define OPCODE_API __declspec(dllimport) - #endif +#ifdef OPCODE_EXPORTS + #define OPCODE_API __declspec(dllexport) #else - #define OPCODE_API + #define OPCODE_API __declspec(dllimport) #endif #include "OPC_IceHook.h" -- cgit v1.1