aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvlmanager.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llvlmanager.cpp
parentREADME.txt (diff)
downloadmeta-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 'linden/indra/newview/llvlmanager.cpp')
-rw-r--r--linden/indra/newview/llvlmanager.cpp166
1 files changed, 166 insertions, 0 deletions
diff --git a/linden/indra/newview/llvlmanager.cpp b/linden/indra/newview/llvlmanager.cpp
new file mode 100644
index 0000000..4ac22e2
--- /dev/null
+++ b/linden/indra/newview/llvlmanager.cpp
@@ -0,0 +1,166 @@
1/**
2 * @file llvlmanager.cpp
3 * @brief LLVLManager class implementation
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#include "llviewerprecompiledheaders.h"
29
30#include "llvlmanager.h"
31
32#include "indra_constants.h"
33#include "bitpack.h"
34#include "patch_code.h"
35#include "patch_dct.h"
36#include "llviewerregion.h"
37#include "llframetimer.h"
38#include "llagent.h"
39#include "llsurface.h"
40
41LLVLManager gVLManager;
42
43LLVLManager::~LLVLManager()
44{
45 S32 i;
46 for (i = 0; i < mPacketData.count(); i++)
47 {
48 delete mPacketData[i];
49 }
50 mPacketData.reset();
51}
52
53void LLVLManager::addLayerData(LLVLData *vl_datap, const S32 mesg_size)
54{
55 if (LAND_LAYER_CODE == vl_datap->mType)
56 {
57 mLandBits += mesg_size * 8;
58 }
59 else if (WIND_LAYER_CODE == vl_datap->mType)
60 {
61 mWindBits += mesg_size * 8;
62 }
63 else if (CLOUD_LAYER_CODE == vl_datap->mType)
64 {
65 mCloudBits += mesg_size * 8;
66 }
67 else
68 {
69 llerrs << "Unknown layer type!" << (S32)vl_datap->mType << llendl;
70 }
71
72 mPacketData.put(vl_datap);
73}
74
75void LLVLManager::unpackData(const S32 num_packets)
76{
77 static LLFrameTimer decode_timer;
78
79 S32 i;
80 for (i = 0; i < mPacketData.count(); i++)
81 {
82 LLVLData *datap = mPacketData[i];
83
84 LLBitPack bit_pack(datap->mData, datap->mSize);
85 LLGroupHeader goph;
86
87 decode_patch_group_header(bit_pack, &goph);
88 if (LAND_LAYER_CODE == datap->mType)
89 {
90 datap->mRegionp->getLand().decompressDCTPatch(bit_pack, &goph, FALSE);
91 }
92 else if (WIND_LAYER_CODE == datap->mType)
93 {
94 datap->mRegionp->mWind.decompress(bit_pack, &goph);
95
96 }
97 else if (CLOUD_LAYER_CODE == datap->mType)
98 {
99 datap->mRegionp->mCloudLayer.decompress(bit_pack, &goph);
100 }
101 }
102
103 for (i = 0; i < mPacketData.count(); i++)
104 {
105 delete mPacketData[i];
106 }
107 mPacketData.reset();
108
109}
110
111void LLVLManager::resetBitCounts()
112{
113 mLandBits = mWindBits = mCloudBits = 0;
114}
115
116S32 LLVLManager::getLandBits() const
117{
118 return mLandBits;
119}
120
121S32 LLVLManager::getWindBits() const
122{
123 return mWindBits;
124}
125
126S32 LLVLManager::getCloudBits() const
127{
128 return mCloudBits;
129}
130
131S32 LLVLManager::getTotalBytes() const
132{
133 return mLandBits + mWindBits + mCloudBits;
134}
135
136void LLVLManager::cleanupData(LLViewerRegion *regionp)
137{
138 S32 cur = 0;
139 while (cur < mPacketData.count())
140 {
141 if (mPacketData[cur]->mRegionp == regionp)
142 {
143 delete mPacketData[cur];
144 mPacketData.remove(cur);
145 }
146 else
147 {
148 cur++;
149 }
150 }
151}
152
153LLVLData::LLVLData(LLViewerRegion *regionp, const S8 type, U8 *data, const S32 size)
154{
155 mType = type;
156 mData = data;
157 mRegionp = regionp;
158 mSize = size;
159}
160
161LLVLData::~LLVLData()
162{
163 delete [] mData;
164 mData = NULL;
165 mRegionp = NULL;
166}