12#ifndef TT_INCLUDE_PHYSINTTEST_H
13#define TT_INCLUDE_PHYSINTTEST_H
16class PhysAABoxIntersectionTestClass :
public AABoxIntersectionTestClass
19 PhysAABoxIntersectionTestClass(
const AABoxClass & box,
int col_group,
int col_type,MultiListClass<PhysClass> * result_list = NULL) :
20 AABoxIntersectionTestClass(box,col_type),
21 CollisionGroup(col_group),
22 IntersectedObjects(result_list),
23 CheckStaticObjs(true),
24 CheckDynamicObjs(true)
27 void Add_Intersected_Object(PhysClass * obj) {
if (IntersectedObjects) IntersectedObjects->Add(obj); }
31 bool CheckDynamicObjs;
33 MultiListClass<PhysClass> * IntersectedObjects;
34 PhysAABoxIntersectionTestClass(
const PhysAABoxIntersectionTestClass & );
35 PhysAABoxIntersectionTestClass & operator = (
const PhysAABoxIntersectionTestClass & );
37class PhysOBBoxIntersectionTestClass :
public OBBoxIntersectionTestClass
40 PhysOBBoxIntersectionTestClass(
const OBBoxClass & box,
int col_group,
int col_type,MultiListClass<PhysClass> * result_list = NULL) :
41 OBBoxIntersectionTestClass(box,col_type),
42 CollisionGroup(col_group),
43 IntersectedObjects(result_list),
44 CheckStaticObjs(true),
45 CheckDynamicObjs(true)
48 void Add_Intersected_Object(PhysClass * obj) {
if (IntersectedObjects) IntersectedObjects->Add(obj); }
52 bool CheckDynamicObjs;
54 MultiListClass<PhysClass> * IntersectedObjects;
55 PhysOBBoxIntersectionTestClass(
const PhysOBBoxIntersectionTestClass & );
56 PhysOBBoxIntersectionTestClass & operator = (
const PhysOBBoxIntersectionTestClass & );
58class PhysMeshIntersectionTestClass :
public IntersectionTestClass
61 PhysMeshIntersectionTestClass::PhysMeshIntersectionTestClass(MeshClass * mesh,
int col_group,
int col_type,MultiListClass<PhysClass> * result_list) :
62 IntersectionTestClass(col_type),
64 CollisionGroup(col_group),
65 IntersectedObjects(result_list),
66 CheckStaticObjs(true),
67 CheckDynamicObjs(true)
69 REF_PTR_SET(Mesh,mesh);
72 BoundingBox = Mesh->Get_Bounding_Box();
75 ~PhysMeshIntersectionTestClass(
void)
77 REF_PTR_RELEASE(Mesh);
79 bool Cull(
const Vector3 & min,
const Vector3 & max);
80 bool Cull(
const AABoxClass & box);
81 void Add_Intersected_Object(PhysClass * obj) {
if (IntersectedObjects) IntersectedObjects->Add(obj); }
84 AABoxClass BoundingBox;
87 bool CheckDynamicObjs;
89 MultiListClass<PhysClass> * IntersectedObjects;
91 PhysMeshIntersectionTestClass(
const PhysMeshIntersectionTestClass & );
92 PhysMeshIntersectionTestClass & operator = (
const PhysMeshIntersectionTestClass & );
95inline bool PhysMeshIntersectionTestClass::Cull(
const Vector3 & cull_min,
const Vector3 & cull_max)
98 Vector3::Subtract(BoundingBox.Center,BoundingBox.Extent,&box_min);
100 Vector3::Add(BoundingBox.Center,BoundingBox.Extent,&box_max);
101 if ((box_min.X > cull_max.X) || (box_max.X < cull_min.X))
return true;
102 if ((box_min.Y > cull_max.Y) || (box_max.Y < cull_min.Y))
return true;
103 if ((box_min.Z > cull_max.Z) || (box_max.Z < cull_min.Z))
return true;
106inline bool PhysMeshIntersectionTestClass::Cull(
const AABoxClass & cull_box)
110 Vector3::Subtract(cull_box.Center,BoundingBox.Center,&dc);
111 Vector3::Add(cull_box.Extent,BoundingBox.Extent,&r);
112 if (WWMath::Fabs(dc.X) > r.X)
return true;
113 if (WWMath::Fabs(dc.Y) > r.Y)
return true;
114 if (WWMath::Fabs(dc.Z) > r.Z)
return true;