From 373dc625f82b47096893add42c4472e4a57ab7eb Mon Sep 17 00:00:00 2001 From: Aki Date: Wed, 9 Feb 2022 22:23:03 +0100 Subject: Moved third-party libraries to a separate subdirectory --- Opcode/Ice/IceAABB.cpp | 405 ------------------------------------------------- 1 file changed, 405 deletions(-) delete mode 100644 Opcode/Ice/IceAABB.cpp (limited to 'Opcode/Ice/IceAABB.cpp') diff --git a/Opcode/Ice/IceAABB.cpp b/Opcode/Ice/IceAABB.cpp deleted file mode 100644 index 03bca6c..0000000 --- a/Opcode/Ice/IceAABB.cpp +++ /dev/null @@ -1,405 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Contains AABB-related code. - * \file IceAABB.cpp - * \author Pierre Terdiman - * \date January, 29, 2000 - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * AABB class. - * \class AABB - * \author Pierre Terdiman - * \version 1.0 - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Precompiled Header -#include "StdAfx.h" - -using namespace IceMaths; - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Computes the sum of two AABBs. - * \param aabb [in] the other AABB - * \return Self-Reference - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -AABB& AABB::Add(const AABB& aabb) -{ - // Compute new min & max values - IcePoint Min; GetMin(Min); - IcePoint Tmp; aabb.GetMin(Tmp); - Min.Min(Tmp); - - IcePoint Max; GetMax(Max); - aabb.GetMax(Tmp); - Max.Max(Tmp); - - // Update this - SetMinMax(Min, Max); - return *this; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Makes a cube from the AABB. - * \param cube [out] the cube AABB - * \return cube edge length - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -float AABB::MakeCube(AABB& cube) const -{ - IcePoint Ext; GetExtents(Ext); - float Max = Ext.Max(); - - IcePoint Cnt; GetCenter(Cnt); - cube.SetCenterExtents(Cnt, IcePoint(Max, Max, Max)); - return Max; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Makes a sphere from the AABB. - * \param sphere [out] sphere containing the AABB - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void AABB::MakeSphere(Sphere& sphere) const -{ - GetExtents(sphere.mCenter); - sphere.mRadius = sphere.mCenter.Magnitude() * 1.00001f; // To make sure sphere::Contains(*this) succeeds - GetCenter(sphere.mCenter); -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * Checks a box is inside another box. - * \param box [in] the other AABB - * \return true if current box is inside input box - */ -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool AABB::IsInside(const AABB& 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) max.x) ? 2 : 0) // 2 = right - + ((local_eye.y < min.y) ? 4 : 0) // 4 = bottom - + ((local_eye.y > max.y) ? 8 : 0) // 8 = top - + ((local_eye.z < min.z) ? 16 : 0) // 16 = front - + ((local_eye.z > max.z) ? 32 : 0); // 32 = back - - // Look up number of vertices in outline - num = (sdword)gIndexList[pos][7]; - // Zero indicates invalid case - if(!num) return null; - - return &gIndexList[pos][0]; -} - -// calculateBoxArea: computes the screen-projected 2D area of an oriented 3D bounding box - -//const IcePoint& eye, //eye point (in bbox object coordinates) -//const AABB& box, //3d bbox -//const Matrix4x4& mat, //free transformation for bbox -//float width, float height, int& num) -float AABB::ComputeBoxArea(const IcePoint& eye, const Matrix4x4& mat, float width, float height, sdword& num) const -{ - const sbyte* Outline = ComputeOutline(eye, num); - if(!Outline) return -1.0f; - - // Compute box vertices - IcePoint vertexBox[8], dst[8]; - ComputePoints(vertexBox); - - // Transform all outline corners into 2D screen space - for(sdword i=0;i