Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IceAABB.h File Reference

Go to the source code of this file.

Classes

class  AABB
 

Macros

#define AABB_COMMON_METHODS
 Declarations of type-independent methods (most of them implemented in the .cpp) More...
 
#define __ICEAABB_H__
 
#define AABB_COMMON_METHODS
 

Enumerations

enum  AABBType { AABB_RENDER = 0, AABB_UPDATE = 1, AABB_FORCE_DWORD = 0x7fffffff }
 

Functions

inline_ void ComputeMinMax (const Point &p, Point &min, Point &max)
 
inline_ void ComputeAABB (AABB &aabb, const Point *list, udword nb_pts)
 

Detailed Description

Contains AABB-related code. (axis-aligned bounding box)

Author
Pierre Terdiman
Date
January, 13, 2000

Definition in file IceAABB.h.

Macro Definition Documentation

#define __ICEAABB_H__

Definition at line 14 of file Opcode.h.

#define AABB_COMMON_METHODS
Value:
AABB& Add(const AABB& aabb); \
float MakeCube(AABB& cube) const; \
void MakeSphere(Sphere& sphere) const; \
const sbyte* ComputeOutline(const Point& local_eye, sdword& num) const; \
float ComputeBoxArea(const Point& eye, const Matrix4x4& mat, float width, float height, sdword& num) const; \
bool IsInside(const AABB& box) const; \
bool ComputePlanes(Plane* planes) const; \
bool ComputePoints(Point* pts) const; \
const Point* GetVertexNormals() const; \
const udword* GetEdges() const; \
const Point* GetEdgeNormals() const; \
inline_ BOOL ContainsPoint(const Point& p) const \
{ \
if(p.x > GetMax(0) || p.x < GetMin(0)) return FALSE; \
if(p.y > GetMax(1) || p.y < GetMin(1)) return FALSE; \
if(p.z > GetMax(2) || p.z < GetMin(2)) return FALSE; \
return TRUE; \
}
#define AABB_COMMON_METHODS
Value:
AABB& Add(const AABB& aabb); \
float MakeCube(AABB& cube) const; \
void MakeSphere(Sphere& sphere) const; \
const sbyte* ComputeOutline(const Point& local_eye, sdword& num) const; \
float ComputeBoxArea(const Point& eye, const Matrix4x4& mat, float width, float height, sdword& num) const; \
bool IsInside(const AABB& box) const; \
bool ComputePlanes(Plane* planes) const; \
bool ComputePoints(Point* pts) const; \
const Point* GetVertexNormals() const; \
const udword* GetEdges() const; \
const Point* GetEdgeNormals() const; \
inline_ BOOL ContainsPoint(const Point& p) const \
{ \
if(p.x > GetMax(0) || p.x < GetMin(0)) return FALSE; \
if(p.y > GetMax(1) || p.y < GetMin(1)) return FALSE; \
if(p.z > GetMax(2) || p.z < GetMin(2)) return FALSE; \
return TRUE; \
}

Declarations of type-independent methods (most of them implemented in the .cpp)

Definition at line 20 of file Opcode.h.

Enumeration Type Documentation

enum AABBType
Enumerator
AABB_RENDER 

AABB used for rendering. Not visible == not rendered.

AABB_UPDATE 

AABB used for dynamic updates. Not visible == not updated.

AABB_FORCE_DWORD 

Definition at line 39 of file IceAABB.h.

40  {
41  AABB_RENDER = 0,
42  AABB_UPDATE = 1,
43 
44  AABB_FORCE_DWORD = 0x7fffffff
45  };

Function Documentation

inline_ void ComputeAABB ( AABB aabb,
const Point list,
udword  nb_pts 
)

Definition at line 490 of file IceAABB.h.

References ComputeMinMax(), MAX_FLOAT, MIN_FLOAT, and AABB::SetMinMax().

491  {
492  if(list)
493  {
496  while(nb_pts--)
497  {
498 // _prefetch(list+1); // off by one ?
499  ComputeMinMax(*list++, Mini, Maxi);
500  }
501  aabb.SetMinMax(Mini, Maxi);
502  }
503  }
inline_ void ComputeMinMax ( const Point p,
Point min,
Point max 
)

Definition at line 478 of file IceAABB.h.

References Point::x, Point::y, and Point::z.

Referenced by ComputeAABB().

479  {
480  if(p.x > max.x) max.x = p.x;
481  if(p.x < min.x) min.x = p.x;
482 
483  if(p.y > max.y) max.y = p.y;
484  if(p.y < min.y) min.y = p.y;
485 
486  if(p.z > max.z) max.z = p.z;
487  if(p.z < min.z) min.z = p.z;
488  }