From c01469dddabe404506ef3a64542e8423f9e11f2c Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 30 Jan 2022 17:44:05 +0100 Subject: Converted Opcode and Ice into unix newlines format --- Opcode/OPC_Common.h | 200 ++++++++++++++++++++++++++-------------------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'Opcode/OPC_Common.h') diff --git a/Opcode/OPC_Common.h b/Opcode/OPC_Common.h index cc14e96..84ccf8d 100644 --- a/Opcode/OPC_Common.h +++ b/Opcode/OPC_Common.h @@ -1,101 +1,101 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/* - * OPCODE - Optimized Collision Detection - * Copyright (C) 2001 Pierre Terdiman - * Homepage: http://www.codercorner.com/Opcode.htm - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Contains common classes & defs used in OPCODE. - * \file OPC_Common.h - * \author Pierre Terdiman - * \date March, 20, 2001 - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Include Guard -#ifndef __OPC_COMMON_H__ -#define __OPC_COMMON_H__ - -// [GOTTFRIED]: Just a small change for readability. -#ifdef OPC_CPU_COMPARE - #define GREATER(x, y) AIR(x) > IR(y) -#else - #define GREATER(x, y) fabsf(x) > (y) -#endif - - class OPCODE_API CollisionAABB - { - public: - //! Constructor - inline_ CollisionAABB() {} - //! Constructor - inline_ CollisionAABB(const AABB& b) { b.GetCenter(mCenter); b.GetExtents(mExtents); } - //! Destructor - inline_ ~CollisionAABB() {} - - //! Get min IcePoint of the box - inline_ void GetMin(IcePoint& min) const { min = mCenter - mExtents; } - //! Get max IcePoint of the box - inline_ void GetMax(IcePoint& max) const { max = mCenter + mExtents; } - - //! Get component of the box's min IcePoint along a given axis - inline_ float GetMin(udword axis) const { return mCenter[axis] - mExtents[axis]; } - //! Get component of the box's max IcePoint along a given axis - inline_ float GetMax(udword axis) const { return mCenter[axis] + mExtents[axis]; } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * Setups an AABB from min & max vectors. - * \param min [in] the min IcePoint - * \param max [in] the max IcePoint - */ - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - inline_ void SetMinMax(const IcePoint& min, const IcePoint& max) { mCenter = (max + min)*0.5f; mExtents = (max - min)*0.5f; } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - /** - * Checks a box is inside another box. - * \param box [in] the other box - * \return true if current box is inside input box - */ - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - inline_ BOOL IsInside(const CollisionAABB& box) const - { - if(box.GetMin(0)>GetMin(0)) return FALSE; - if(box.GetMin(1)>GetMin(1)) return FALSE; - if(box.GetMin(2)>GetMin(2)) return FALSE; - if(box.GetMax(0) IR(y) +#else + #define GREATER(x, y) fabsf(x) > (y) +#endif + + class OPCODE_API CollisionAABB + { + public: + //! Constructor + inline_ CollisionAABB() {} + //! Constructor + inline_ CollisionAABB(const AABB& b) { b.GetCenter(mCenter); b.GetExtents(mExtents); } + //! Destructor + inline_ ~CollisionAABB() {} + + //! Get min IcePoint of the box + inline_ void GetMin(IcePoint& min) const { min = mCenter - mExtents; } + //! Get max IcePoint of the box + inline_ void GetMax(IcePoint& max) const { max = mCenter + mExtents; } + + //! Get component of the box's min IcePoint along a given axis + inline_ float GetMin(udword axis) const { return mCenter[axis] - mExtents[axis]; } + //! Get component of the box's max IcePoint along a given axis + inline_ float GetMax(udword axis) const { return mCenter[axis] + mExtents[axis]; } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /** + * Setups an AABB from min & max vectors. + * \param min [in] the min IcePoint + * \param max [in] the max IcePoint + */ + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + inline_ void SetMinMax(const IcePoint& min, const IcePoint& max) { mCenter = (max + min)*0.5f; mExtents = (max - min)*0.5f; } + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /** + * Checks a box is inside another box. + * \param box [in] the other box + * \return true if current box is inside input box + */ + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + inline_ BOOL IsInside(const CollisionAABB& box) const + { + if(box.GetMin(0)>GetMin(0)) return FALSE; + if(box.GetMin(1)>GetMin(1)) return FALSE; + if(box.GetMin(2)>GetMin(2)) return FALSE; + if(box.GetMax(0)