diff options
Diffstat (limited to 'linden/indra/llmath/llvolumemgr.h')
-rw-r--r-- | linden/indra/llmath/llvolumemgr.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/linden/indra/llmath/llvolumemgr.h b/linden/indra/llmath/llvolumemgr.h new file mode 100644 index 0000000..9cb1f63 --- /dev/null +++ b/linden/indra/llmath/llvolumemgr.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /** | ||
2 | * @file llvolumemgr.h | ||
3 | * @brief LLVolumeMgr class. | ||
4 | * | ||
5 | * Copyright (c) 2002-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_LLVOLUMEMGR_H | ||
29 | #define LL_LLVOLUMEMGR_H | ||
30 | |||
31 | #include <map> | ||
32 | |||
33 | #include "llvolume.h" | ||
34 | #include "llmemory.h" | ||
35 | #include "llthread.h" | ||
36 | |||
37 | class LLVolumeParams; | ||
38 | class LLVolumeLODGroup; | ||
39 | |||
40 | class LLVolumeLODGroup : public LLThreadSafeRefCount | ||
41 | { | ||
42 | protected: | ||
43 | ~LLVolumeLODGroup(); | ||
44 | |||
45 | public: | ||
46 | enum | ||
47 | { | ||
48 | NUM_LODS = 4 | ||
49 | }; | ||
50 | |||
51 | LLVolumeLODGroup(const LLVolumeParams ¶ms); | ||
52 | |||
53 | BOOL derefLOD(LLVolume *volumep); | ||
54 | static S32 getDetailFromTan(const F32 tan_angle); | ||
55 | static F32 getVolumeScaleFromDetail(const S32 detail); | ||
56 | |||
57 | LLVolume *getLOD(const S32 detail); | ||
58 | const LLVolumeParams &getParams() const { return mParams; }; | ||
59 | |||
60 | F32 dump(); | ||
61 | friend std::ostream& operator<<(std::ostream& s, const LLVolumeLODGroup& volgroup); | ||
62 | |||
63 | protected: | ||
64 | LLVolumeParams mParams; | ||
65 | |||
66 | S32 mLODRefs[NUM_LODS]; | ||
67 | LLVolume *mVolumeLODs[NUM_LODS]; | ||
68 | static F32 mDetailThresholds[NUM_LODS]; | ||
69 | static F32 mDetailScales[NUM_LODS]; | ||
70 | S32 mAccessCount[NUM_LODS]; | ||
71 | }; | ||
72 | |||
73 | class LLVolumeMgr | ||
74 | { | ||
75 | public: | ||
76 | static void initClass(); | ||
77 | static BOOL cleanupClass(); | ||
78 | |||
79 | public: | ||
80 | LLVolumeMgr(); | ||
81 | ~LLVolumeMgr(); | ||
82 | BOOL cleanup(); // Cleanup all volumes being managed, returns TRUE if no dangling references | ||
83 | LLVolume *getVolume(const LLVolumeParams &volume_params, const S32 detail); | ||
84 | void cleanupVolume(LLVolume *volumep); | ||
85 | |||
86 | void dump(); | ||
87 | friend std::ostream& operator<<(std::ostream& s, const LLVolumeMgr& volume_mgr); | ||
88 | |||
89 | protected: | ||
90 | typedef std::map<const LLVolumeParams*, LLVolumeLODGroup*, LLVolumeParams::compare> volume_lod_group_map_t; | ||
91 | typedef volume_lod_group_map_t::const_iterator volume_lod_group_map_iter; | ||
92 | volume_lod_group_map_t mVolumeLODGroups; | ||
93 | |||
94 | LLMutex* mDataMutex; | ||
95 | |||
96 | // S32 mNumVolumes; | ||
97 | }; | ||
98 | |||
99 | extern LLVolumeMgr* gVolumeMgr; | ||
100 | |||
101 | #endif // LL_LLVOLUMEMGR_H | ||