aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerregion.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:34 -0500
committerJacek Antonelli2008-08-15 23:45:34 -0500
commitcd17687f01420952712a500107e0f93e7ab8d5f8 (patch)
treece48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/newview/llviewerregion.cpp
parentSecond Life viewer sources 1.19.0.5 (diff)
downloadmeta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2
meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz
Second Life viewer sources 1.19.1.0
Diffstat (limited to 'linden/indra/newview/llviewerregion.cpp')
-rw-r--r--linden/indra/newview/llviewerregion.cpp51
1 files changed, 42 insertions, 9 deletions
diff --git a/linden/indra/newview/llviewerregion.cpp b/linden/indra/newview/llviewerregion.cpp
index f8b8f76..1cc6d42 100644
--- a/linden/indra/newview/llviewerregion.cpp
+++ b/linden/indra/newview/llviewerregion.cpp
@@ -64,6 +64,7 @@
64#include "llvocache.h" 64#include "llvocache.h"
65#include "llvoclouds.h" 65#include "llvoclouds.h"
66#include "llworld.h" 66#include "llworld.h"
67#include "llspatialpartition.h"
67 68
68// Viewer object cache version, change if object update 69// Viewer object cache version, change if object update
69// format changes. JC 70// format changes. JC
@@ -97,7 +98,6 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
97 mBillableFactor(1.0), 98 mBillableFactor(1.0),
98 mMaxTasks(MAX_TASKS_PER_REGION), 99 mMaxTasks(MAX_TASKS_PER_REGION),
99 mCacheLoaded(FALSE), 100 mCacheLoaded(FALSE),
100 mCacheMap(),
101 mCacheEntriesCount(0), 101 mCacheEntriesCount(0),
102 mCacheID(), 102 mCacheID(),
103 mEventPoll(NULL) 103 mEventPoll(NULL)
@@ -105,6 +105,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
105 mWidth = region_width_meters; 105 mWidth = region_width_meters;
106 106
107 mOriginGlobal = from_region_handle(handle); 107 mOriginGlobal = from_region_handle(handle);
108 updateRenderMatrix();
108 109
109 mLandp = new LLSurface('l', NULL); 110 mLandp = new LLSurface('l', NULL);
110 if (!gNoRender) 111 if (!gNoRender)
@@ -138,6 +139,19 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
138 139
139 mCacheStart.append(mCacheEnd); 140 mCacheStart.append(mCacheEnd);
140 141
142 //create object partitions
143 //MUST MATCH declaration of eObjectPartitions
144 mObjectPartition.push_back(new LLHUDPartition()); //PARTITION_HUD
145 mObjectPartition.push_back(new LLTerrainPartition()); //PARTITION_TERRAIN
146 mObjectPartition.push_back(new LLWaterPartition()); //PARTITION_WATER
147 mObjectPartition.push_back(new LLTreePartition()); //PARTITION_TREE
148 mObjectPartition.push_back(new LLParticlePartition()); //PARTITION_PARTICLE
149 mObjectPartition.push_back(new LLCloudPartition()); //PARTITION_CLOUD
150 mObjectPartition.push_back(new LLGrassPartition()); //PARTITION_GRASS
151 mObjectPartition.push_back(new LLVolumePartition()); //PARTITION_VOLUME
152 mObjectPartition.push_back(new LLBridgePartition()); //PARTITION_BRIDGE
153 mObjectPartition.push_back(NULL); //PARTITION_NONE
154
141} 155}
142 156
143 157
@@ -176,6 +190,8 @@ LLViewerRegion::~LLViewerRegion()
176 LLHTTPSender::clearSender(mHost); 190 LLHTTPSender::clearSender(mHost);
177 191
178 saveCache(); 192 saveCache();
193
194 std::for_each(mObjectPartition.begin(), mObjectPartition.end(), DeletePointer());
179} 195}
180 196
181 197
@@ -326,7 +342,7 @@ void LLViewerRegion::saveCache()
326 entry->writeToFile(fp); 342 entry->writeToFile(fp);
327 } 343 }
328 344
329 mCacheMap.removeAllData(); 345 mCacheMap.clear();
330 mCacheEnd.unlink(); 346 mCacheEnd.unlink();
331 mCacheEnd.init(); 347 mCacheEnd.init();
332 mCacheStart.deleteAll(); 348 mCacheStart.deleteAll();
@@ -381,12 +397,17 @@ void LLViewerRegion::setRegionFlags(U32 flags)
381void LLViewerRegion::setOriginGlobal(const LLVector3d &origin_global) 397void LLViewerRegion::setOriginGlobal(const LLVector3d &origin_global)
382{ 398{
383 mOriginGlobal = origin_global; 399 mOriginGlobal = origin_global;
400 updateRenderMatrix();
384 mLandp->setOriginGlobal(origin_global); 401 mLandp->setOriginGlobal(origin_global);
385 mWind.setOriginGlobal(origin_global); 402 mWind.setOriginGlobal(origin_global);
386 mCloudLayer.setOriginGlobal(origin_global); 403 mCloudLayer.setOriginGlobal(origin_global);
387 calculateCenterGlobal(); 404 calculateCenterGlobal();
388} 405}
389 406
407void LLViewerRegion::updateRenderMatrix()
408{
409 mRenderMatrix.setTranslation(getOriginAgent());
410}
390 411
391void LLViewerRegion::setTimeDilation(F32 time_dilation) 412void LLViewerRegion::setTimeDilation(F32 time_dilation)
392{ 413{
@@ -952,8 +973,7 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
952 // << " Z: " << (S32)(z_pos * 4) 973 // << " Z: " << (S32)(z_pos * 4)
953 // << llendl; 974 // << llendl;
954 975
955 // treat the target specially for the map, and don't add you 976 // treat the target specially for the map
956 // or the target
957 if(i == target_index) 977 if(i == target_index)
958 { 978 {
959 LLVector3d global_pos(mOriginGlobal); 979 LLVector3d global_pos(mOriginGlobal);
@@ -962,7 +982,9 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg)
962 global_pos.mdV[VZ] += (F64)(z_pos) * 4.0; 982 global_pos.mdV[VZ] += (F64)(z_pos) * 4.0;
963 LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos); 983 LLAvatarTracker::instance().setTrackedCoarseLocation(global_pos);
964 } 984 }
965 else if( i != agent_index) 985
986 //don't add you
987 if( i != agent_index)
966 { 988 {
967 pos = 0x0; 989 pos = 0x0;
968 pos |= x_pos; 990 pos |= x_pos;
@@ -990,7 +1012,7 @@ void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinary
990 U32 local_id = objectp->getLocalID(); 1012 U32 local_id = objectp->getLocalID();
991 U32 crc = objectp->getCRC(); 1013 U32 crc = objectp->getCRC();
992 1014
993 LLVOCacheEntry *entry = mCacheMap.getIfThere(local_id); 1015 LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL);
994 1016
995 if (entry) 1017 if (entry)
996 { 1018 {
@@ -1003,7 +1025,7 @@ void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinary
1003 else 1025 else
1004 { 1026 {
1005 // Update the cache entry 1027 // Update the cache entry
1006 mCacheMap.removeData(local_id); 1028 mCacheMap.erase(local_id);
1007 delete entry; 1029 delete entry;
1008 entry = new LLVOCacheEntry(local_id, crc, dp); 1030 entry = new LLVOCacheEntry(local_id, crc, dp);
1009 mCacheEnd.insert(*entry); 1031 mCacheEnd.insert(*entry);
@@ -1018,7 +1040,7 @@ void LLViewerRegion::cacheFullUpdate(LLViewerObject* objectp, LLDataPackerBinary
1018 if (mCacheEntriesCount > MAX_OBJECT_CACHE_ENTRIES) 1040 if (mCacheEntriesCount > MAX_OBJECT_CACHE_ENTRIES)
1019 { 1041 {
1020 entry = mCacheStart.getNext(); 1042 entry = mCacheStart.getNext();
1021 mCacheMap.removeData(entry->getLocalID()); 1043 mCacheMap.erase(entry->getLocalID());
1022 delete entry; 1044 delete entry;
1023 mCacheEntriesCount--; 1045 mCacheEntriesCount--;
1024 } 1046 }
@@ -1037,7 +1059,7 @@ LLDataPacker *LLViewerRegion::getDP(U32 local_id, U32 crc)
1037{ 1059{
1038 llassert(mCacheLoaded); 1060 llassert(mCacheLoaded);
1039 1061
1040 LLVOCacheEntry *entry = mCacheMap.getIfThere(local_id); 1062 LLVOCacheEntry* entry = get_if_there(mCacheMap, local_id, (LLVOCacheEntry*)NULL);
1041 1063
1042 if (entry) 1064 if (entry)
1043 { 1065 {
@@ -1353,12 +1375,15 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
1353 capabilityNames.append("ChatSessionRequest"); 1375 capabilityNames.append("ChatSessionRequest");
1354 capabilityNames.append("CopyInventoryFromNotecard"); 1376 capabilityNames.append("CopyInventoryFromNotecard");
1355 capabilityNames.append("DispatchRegionInfo"); 1377 capabilityNames.append("DispatchRegionInfo");
1378 capabilityNames.append("EstateChangeInfo");
1356 capabilityNames.append("EventQueueGet"); 1379 capabilityNames.append("EventQueueGet");
1380 capabilityNames.append("FetchInventoryDescendents");
1357 capabilityNames.append("GroupProposalBallot"); 1381 capabilityNames.append("GroupProposalBallot");
1358 capabilityNames.append("MapLayer"); 1382 capabilityNames.append("MapLayer");
1359 capabilityNames.append("MapLayerGod"); 1383 capabilityNames.append("MapLayerGod");
1360 capabilityNames.append("NewFileAgentInventory"); 1384 capabilityNames.append("NewFileAgentInventory");
1361 capabilityNames.append("ParcelGodReserveForNewbie"); 1385 capabilityNames.append("ParcelGodReserveForNewbie");
1386 capabilityNames.append("ParcelPropertiesUpdate");
1362 capabilityNames.append("ParcelVoiceInfoRequest"); 1387 capabilityNames.append("ParcelVoiceInfoRequest");
1363 capabilityNames.append("ProvisionVoiceAccountRequest"); 1388 capabilityNames.append("ProvisionVoiceAccountRequest");
1364 capabilityNames.append("RemoteParcelRequest"); 1389 capabilityNames.append("RemoteParcelRequest");
@@ -1429,4 +1454,12 @@ void LLViewerRegion::logActiveCapabilities() const
1429 llinfos << "Dumped " << count << " entries." << llendl; 1454 llinfos << "Dumped " << count << " entries." << llendl;
1430} 1455}
1431 1456
1457LLSpatialPartition* LLViewerRegion::getSpatialPartition(U32 type)
1458{
1459 if (type < mObjectPartition.size())
1460 {
1461 return mObjectPartition[type];
1462 }
1463 return NULL;
1464}
1432 1465