ScummVM API documentation
BoundingVolume.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_BOUNDING_VOLUME_H
29#define HPL_BOUNDING_VOLUME_H
30
31#include "hpl1/engine/graphics/GraphicsTypes.h"
32#include "hpl1/engine/math/MathTypes.h"
33#include "hpl1/engine/system/SerializeClass.h"
34#include "hpl1/engine/system/SystemTypes.h"
35
36namespace hpl {
37
38class iLowLevelGraphics;
39class cBoundingVolume;
40
42public:
43 const float *mpArray;
44 int mlSize;
45};
46
47enum eBVCollision {
48 eBVCollision_Inside,
49 eBVCollision_Outside,
50 eBVCollision_Intersect,
51 eBVCollision_LastEnum
52};
53
54typedef Common::List<cBVTempArray> tBVTempArrayList;
55typedef tBVTempArrayList::iterator tBVTempArrayListIt;
56
58public:
59 cPlanef mvPlanes[12];
60 int mlPlaneCount;
61 tVector3fVec mvPoints;
62 int mlCapPlanes;
63
64 bool CollideBoundingVolume(cBoundingVolume *aBV);
65
66private:
67 bool CollideBVSphere(cBoundingVolume *aBV);
68 bool CollideBVAABB(cBoundingVolume *aBV);
69};
70
72 friend class cMath;
73 kSerializableClassInit(cBoundingVolume) public : cBoundingVolume();
74
75 cVector3f GetMax();
76 cVector3f GetMin();
77
78 cVector3f GetLocalMax();
79 cVector3f GetLocalMin();
80
81 void SetLocalMinMax(const cVector3f &mvMin, const cVector3f &mvMax);
82
83 void SetPosition(const cVector3f &avPos);
84 cVector3f GetPosition();
85
86 void SetSize(const cVector3f &avSize);
87 cVector3f GetSize();
88
89 void SetTransform(const cMatrixf &a_mtxTransform);
90 const cMatrixf &GetTransform();
91
92 cVector3f GetLocalCenter();
93 cVector3f GetWorldCenter();
94
95 float GetRadius();
96
97 void AddArrayPoints(const float *apArray, int alNumOfVectors);
98 void CreateFromPoints(int alStride);
99
100 cShadowVolumeBV *GetShadowVolume(const cVector3f &avLightPos, float afLightRange, bool abForceUpdate);
101
102 // Debug:
103 void DrawEdges(const cVector3f &avLightPos, float afLightRange, iLowLevelGraphics *apLowLevelGraphics);
104 void UpdateSize();
105
106 cMatrixf m_mtxTransform;
107
108 cVector3f mvLocalMax;
109 cVector3f mvLocalMin;
110
111 cVector3f mvMax;
112 cVector3f mvMin;
113
114 cVector3f mvPivot;
115
116 cVector3f mvWorldMax;
117 cVector3f mvWorldMin;
118
119 cVector3f mvPosition;
120 cVector3f mvSize;
121 float mfRadius;
122
123private:
124 bool mbPositionUpdated;
125 bool mbSizeUpdated;
126
127 tBVTempArrayList mlstArrays;
128
129 cShadowVolumeBV mShadowVolume;
130 bool mbShadowPlanesNeedUpdate;
131};
132
133} // namespace hpl
134
135#endif // HPL_BOUNDING_VOLUME_H
ListInternal::Iterator< cBVTempArray > iterator
Definition: list.h:52
Definition: BoundingVolume.h:41
Definition: BoundingVolume.h:71
Definition: Math.h:39
Definition: BoundingVolume.h:57
Definition: LowLevelGraphics.h:200
Definition: SerializeClass.h:230