aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llworld.h
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/llworld.h
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/llworld.h')
-rw-r--r--linden/indra/newview/llworld.h197
1 files changed, 197 insertions, 0 deletions
diff --git a/linden/indra/newview/llworld.h b/linden/indra/newview/llworld.h
new file mode 100644
index 0000000..6645b94
--- /dev/null
+++ b/linden/indra/newview/llworld.h
@@ -0,0 +1,197 @@
1/**
2 * @file llworld.h
3 * @brief Initial test structure to organize viewer regions
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_LLWORLD_H
29#define LL_LLWORLD_H
30
31#include "llpatchvertexarray.h"
32#include "doublelinkedlist.h"
33#include "linked_lists.h"
34
35#include "llmath.h"
36//#include "vmath.h"
37#include "v3math.h"
38#include "llmemory.h"
39#include "llstring.h"
40#include "llviewerpartsim.h"
41#include "llviewerimage.h"
42
43class LLViewerRegion;
44class LLVector3d;
45class LLMessageSystem;
46class LLNetMap;
47class LLHost;
48
49class LLViewerObject;
50class LLVOWater;
51class LLSurfacePatch;
52
53class LLCloudPuff;
54class LLCloudGroup;
55class LLVOAvatar;
56
57// LLWorld maintains a stack of unused viewer_regions and an array of pointers to viewer regions
58// as simulators are connected to, viewer_regions are popped off the stack and connected as required
59// as simulators are removed, they are pushed back onto the stack
60
61class LLWorld
62{
63public:
64 LLWorld(const U32 grids_per_region, const F32 meters_per_grid);
65 ~LLWorld();
66
67 LLViewerRegion* addRegion(const U64 &region_handle, const LLHost &host);
68 // safe to call if already present, does the "right thing" if
69 // hosts are same, or if hosts are different, etc...
70 void removeRegion(const LLHost &host);
71
72 void disconnectRegions(); // Send quit messages to all child regions
73
74 LLViewerRegion* getRegion(const LLHost &host);
75 LLViewerRegion* getRegionFromPosGlobal(const LLVector3d &pos);
76 LLViewerRegion* getRegionFromPosAgent(const LLVector3 &pos);
77 LLViewerRegion* getRegionFromHandle(const U64 &handle);
78 BOOL positionRegionValidGlobal(const LLVector3d& pos); // true if position is in valid region
79 LLVector3d clipToVisibleRegions(const LLVector3d &start_pos, const LLVector3d &end_pos);
80
81 void updateAgentOffset(const LLVector3d &offset);
82
83 // All of these should be in the agent coordinate frame
84 LLViewerRegion* resolveRegionGlobal(LLVector3 &localpos, const LLVector3d &position);
85 LLViewerRegion* resolveRegionAgent(LLVector3 &localpos, const LLVector3 &position);
86 F32 resolveLandHeightGlobal(const LLVector3d &position);
87 F32 resolveLandHeightAgent(const LLVector3 &position);
88
89 // Return the lowest allowed Z point to prevent objects from being moved
90 // underground.
91 F32 getMinAllowedZ(LLViewerObject* object);
92
93 // takes a line segment defined by point_a and point_b, then
94 // determines the closest (to point_a) point of intersection that is
95 // on the land surface or on an object of the world.
96 // Stores results in "intersection" and "intersection_normal" and
97 // returns a scalar value that is the normalized (by length of line segment)
98 // distance along the line from "point_a" to "intersection".
99 //
100 // Currently assumes point_a and point_b only differ in z-direction,
101 // but it may eventually become more general.
102 F32 resolveStepHeightGlobal(const LLVOAvatar* avatarp, const LLVector3d &point_a, const LLVector3d &point_b,
103 LLVector3d &intersection, LLVector3 &intersection_normal,
104 LLViewerObject** viewerObjectPtr=NULL);
105
106 LLSurfacePatch * resolveLandPatchGlobal(const LLVector3d &position);
107 LLVector3 resolveLandNormalGlobal(const LLVector3d &position); // absolute frame
108
109 U32 getRegionWidthInPoints() const { return mWidth; }
110 F32 getRegionScale() const { return mScale; }
111
112 // region X and Y size in meters
113 F32 getRegionWidthInMeters() const { return mWidthInMeters; }
114 F32 getRegionMinHeight() const { return -mWidthInMeters; }
115 F32 getRegionMaxHeight() const { return 3.f*mWidthInMeters; }
116
117 void updateRegions();
118 void updateVisibilities();
119 void updateParticles();
120 void updateClouds(const F32 dt);
121 LLCloudGroup * findCloudGroup(const LLCloudPuff &puff);
122
123 void renderPropertyLines();
124
125 void resetStats();
126 void updateNetStats(); // Update network statistics for all the regions...
127
128 void printPacketsLost();
129 void requestCacheMisses();
130
131 // deal with map object updates in the world.
132 static void processCoarseUpdate(LLMessageSystem* msg, void** user_data);
133
134 F32 getLandFarClip() const;
135 void setLandFarClip(const F32 far_clip);
136
137 LLViewerImage *getDefaultWaterTexture();
138 void updateWaterObjects();
139
140 void setSpaceTimeUSec(const U64 space_time_usec);
141 U64 getSpaceTimeUSec() const;
142
143 LLString getInfoString();
144public:
145 LLDoubleLinkedList<LLViewerRegion> mActiveRegionList;
146 LLViewerPartSim mPartSim;
147
148private:
149 LLLinkedList<LLViewerRegion> mRegionList;
150 LLDoubleLinkedList<LLViewerRegion> mVisibleRegionList;
151 LLDoubleLinkedList<LLViewerRegion> mCulledRegionList;
152
153 // Number of points on edge
154 const U32 mWidth;
155
156 // meters/point, therefore mWidth * mScale = meters per edge
157 const F32 mScale;
158
159 const F32 mWidthInMeters;
160
161 F32 mLandFarClip; // Far clip distance for land.
162 F32 mIdleUpdateTime;
163 LLPatchVertexArray mLandPatch;
164 S32 mLastPacketsIn;
165 S32 mLastPacketsOut;
166 S32 mLastPacketsLost;
167
168 ////////////////////////////
169 //
170 // Data for "Fake" objects
171 //
172
173 // Used to define the "Square" which we need to fill in
174 U32 mMinRegionX;
175 U32 mMaxRegionX;
176 U32 mMinRegionY;
177 U32 mMaxRegionY;
178
179 LLLinkedList<LLVOWater> mHoleWaterObjects;
180 LLPointer<LLVOWater> mEdgeWaterObjects[8];
181
182 LLPointer<LLViewerImage> mDefaultWaterTexturep;
183 U64 mSpaceTimeUSec;
184};
185
186extern LLWorld *gWorldp;
187#define gWorldPointer gWorldp
188
189void process_enable_simulator(LLMessageSystem *mesgsys, void **user_data);
190void process_disable_simulator(LLMessageSystem *mesgsys, void **user_data);
191
192void process_region_handshake(LLMessageSystem* msg, void** user_data);
193
194void send_agent_pause();
195void send_agent_resume();
196
197#endif