diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llbbox.h | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llbbox.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/linden/indra/newview/llbbox.h b/linden/indra/newview/llbbox.h new file mode 100644 index 0000000..b8d1d4e --- /dev/null +++ b/linden/indra/newview/llbbox.h | |||
@@ -0,0 +1,100 @@ | |||
1 | /** | ||
2 | * @file llbbox.h | ||
3 | * @brief General purpose bounding box class | ||
4 | * | ||
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | #ifndef LL_BBOX_H | ||
29 | #define LL_BBOX_H | ||
30 | |||
31 | #include "v3math.h" | ||
32 | #include "llquaternion.h" | ||
33 | |||
34 | // Note: "local space" for an LLBBox is defined relative to agent space in terms of | ||
35 | // a translation followed by a rotation. There is no scale term since the LLBBox's min and | ||
36 | // max are not necessarily symetrical and define their own extents. | ||
37 | |||
38 | class LLBBox | ||
39 | { | ||
40 | public: | ||
41 | LLBBox() {mEmpty = TRUE;} | ||
42 | LLBBox( const LLVector3& pos_agent, | ||
43 | const LLQuaternion& rot, | ||
44 | const LLVector3& min_local, | ||
45 | const LLVector3& max_local ) | ||
46 | : | ||
47 | mMinLocal( min_local ), mMaxLocal( max_local ), mPosAgent(pos_agent), mRotation( rot), mEmpty( TRUE ) | ||
48 | {} | ||
49 | |||
50 | // Default copy constructor is OK. | ||
51 | |||
52 | const LLVector3& getPositionAgent() const { return mPosAgent; } | ||
53 | const LLQuaternion& getRotation() const { return mRotation; } | ||
54 | |||
55 | const LLVector3& getMinLocal() const { return mMinLocal; } | ||
56 | void setMinLocal( const LLVector3& min ) { mMinLocal = min; } | ||
57 | |||
58 | const LLVector3& getMaxLocal() const { return mMaxLocal; } | ||
59 | void setMaxLocal( const LLVector3& max ) { mMaxLocal = max; } | ||
60 | |||
61 | LLVector3 getCenterLocal() const { return (mMaxLocal - mMinLocal) * 0.5f + mMinLocal; } | ||
62 | LLVector3 getCenterAgent() const { return localToAgent( getCenterLocal() ); } | ||
63 | |||
64 | LLVector3 getExtentLocal() const { return mMaxLocal - mMinLocal; } | ||
65 | |||
66 | BOOL containsPointLocal(const LLVector3& p) const; | ||
67 | BOOL containsPointAgent(const LLVector3& p) const; | ||
68 | |||
69 | BOOL intersects(const LLBBox& b) const; | ||
70 | |||
71 | void addPointAgent(LLVector3 p); | ||
72 | void addBBoxAgent(const LLBBox& b); | ||
73 | |||
74 | void addPointLocal(const LLVector3& p); | ||
75 | void addBBoxLocal(const LLBBox& b) { addPointLocal( b.mMinLocal ); addPointLocal( b.mMaxLocal ); } | ||
76 | |||
77 | void expand( F32 delta ); | ||
78 | |||
79 | LLVector3 localToAgent( const LLVector3& v ) const; | ||
80 | LLVector3 agentToLocal( const LLVector3& v ) const; | ||
81 | |||
82 | // Changes rotation but not position | ||
83 | LLVector3 localToAgentBasis(const LLVector3& v) const; | ||
84 | LLVector3 agentToLocalBasis(const LLVector3& v) const; | ||
85 | |||
86 | |||
87 | // friend LLBBox operator*(const LLBBox& a, const LLMatrix4& b); | ||
88 | |||
89 | private: | ||
90 | LLVector3 mMinLocal; | ||
91 | LLVector3 mMaxLocal; | ||
92 | LLVector3 mPosAgent; // Position relative to Agent's Region | ||
93 | LLQuaternion mRotation; | ||
94 | BOOL mEmpty; // Nothing has been added to this bbox yet | ||
95 | }; | ||
96 | |||
97 | //LLBBox operator*(const LLBBox &a, const LLMatrix4 &b); | ||
98 | |||
99 | |||
100 | #endif // LL_BBOX_H | ||