diff options
Diffstat (limited to 'linden/indra/newview/viewer.h')
-rw-r--r-- | linden/indra/newview/viewer.h | 324 |
1 files changed, 324 insertions, 0 deletions
diff --git a/linden/indra/newview/viewer.h b/linden/indra/newview/viewer.h new file mode 100644 index 0000000..ed302ce --- /dev/null +++ b/linden/indra/newview/viewer.h | |||
@@ -0,0 +1,324 @@ | |||
1 | /** | ||
2 | * @file viewer.h | ||
3 | * @brief Main file for viewer. | ||
4 | * | ||
5 | * Copyright (c) 2000-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_VIEWER_H | ||
29 | #define LL_VIEWER_H | ||
30 | |||
31 | #include "stdtypes.h" | ||
32 | #include "v3math.h" | ||
33 | #include "llcoord.h" | ||
34 | |||
35 | #include "lltimer.h" | ||
36 | #include "llframetimer.h" | ||
37 | #include "lluuid.h" | ||
38 | #include "llsys.h" | ||
39 | #include "lltransactiontypes.h" | ||
40 | #include "llviewercontrol.h" | ||
41 | |||
42 | // ************************************************************ | ||
43 | // Enabled this definition to compile a 'hacked' viewer that | ||
44 | // allows a hacked godmode to be toggled on and off. | ||
45 | #define TOGGLE_HACKED_GODLIKE_VIEWER | ||
46 | |||
47 | #ifdef TOGGLE_HACKED_GODLIKE_VIEWER | ||
48 | extern BOOL gHackGodmode; | ||
49 | #endif | ||
50 | // ************************************************************ | ||
51 | |||
52 | // | ||
53 | // Forward Declarations | ||
54 | // | ||
55 | class LLVector3d; | ||
56 | class LLViewerObject; | ||
57 | class LLMessageSystem; | ||
58 | class LLHost; | ||
59 | class LLAudioEngine; | ||
60 | class LLViewerRegion; | ||
61 | class LLVFS; | ||
62 | class LLGlobalEconomy; | ||
63 | class LLPieMenu; | ||
64 | |||
65 | // | ||
66 | // Global Variables | ||
67 | // | ||
68 | |||
69 | extern LLString gSecondLife; | ||
70 | |||
71 | extern S32 gNumSessions; | ||
72 | extern BOOL gNoRender; | ||
73 | extern LLMemoryInfo gSysMemory; | ||
74 | extern BOOL gLogMessages; | ||
75 | extern BOOL gLogUTC; | ||
76 | extern BOOL gUseAudio; | ||
77 | extern BOOL gConnectToSomething; | ||
78 | extern BOOL gGodConnect; | ||
79 | extern BOOL gRunLocal; | ||
80 | extern LLString gCmdLineFirstName; | ||
81 | extern LLString gCmdLineLastName; | ||
82 | extern LLString gCmdLinePassword; | ||
83 | extern BOOL gAutoLogin; | ||
84 | extern LLUUID gTemplateToken; | ||
85 | extern U32 gFrameCount; | ||
86 | extern BOOL gRequestInventoryLibrary; | ||
87 | extern BOOL gAcceptTOS; | ||
88 | extern BOOL gAcceptCriticalMessage; | ||
89 | extern LLUUID gInventoryLibraryOwner; | ||
90 | extern LLUUID gInventoryLibraryRoot; | ||
91 | extern BOOL gLastExecFroze; | ||
92 | extern F32 gLogoutMaxTime; | ||
93 | extern LLTimer gRenderStartTime; | ||
94 | extern LLTimer gLogoutTimer; | ||
95 | extern BOOL gInProductionGrid; | ||
96 | extern S32 gCrashBehavior; | ||
97 | extern bool gVerifySSLCert; | ||
98 | |||
99 | |||
100 | // TODO: Eliminate most of these, move into a globals structure. | ||
101 | extern const U32 PATCH_SIZE; | ||
102 | extern const LLVector3 DEFAULT_OBJECT_SCALE; | ||
103 | extern BOOL gDisconnected; | ||
104 | extern BOOL gQuit; // We're done, quit after processing this message. | ||
105 | extern BOOL gQuitRequested; // User wants to quit, may have modified documents open. | ||
106 | extern BOOL gLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim. | ||
107 | extern BOOL gInitializationComplete; // OK to call display() and idle() | ||
108 | extern BOOL gUseWireframe; | ||
109 | extern U32 gSecondsPerDay; | ||
110 | extern U32 gSecondsPerYear; | ||
111 | // Is the Pacific time zone (aka server time zone) | ||
112 | // currently in daylight savings time? | ||
113 | extern BOOL gPacificDaylightTime; | ||
114 | |||
115 | extern U64 gFrameTime; // The timestamp of the most-recently-processed frame | ||
116 | extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours... | ||
117 | extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds | ||
118 | extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame | ||
119 | extern F32 gFrameDTClamped; | ||
120 | extern U64 gStartTime; | ||
121 | |||
122 | extern LLFrameTimer gRestoreGLTimer; | ||
123 | extern BOOL gRestoreGL; | ||
124 | |||
125 | extern BOOL gDisplayCameraPos; | ||
126 | extern BOOL gDisplayWindInfo; | ||
127 | extern BOOL gDisplayNearestWater; | ||
128 | extern BOOL gDisplayFOV; | ||
129 | extern BOOL gForceRenderLandFence; | ||
130 | |||
131 | extern BOOL gAllowAFK; | ||
132 | extern BOOL gShowObjectUpdates; | ||
133 | |||
134 | extern BOOL gTeleportDisplay; | ||
135 | extern LLFrameTimer gTeleportDisplayTimer; | ||
136 | |||
137 | extern LLGlobalEconomy *gGlobalEconomy; | ||
138 | |||
139 | // VFS globals - gVFS is for general use | ||
140 | // gStaticVFS is read-only and is shipped w/ the viewer | ||
141 | // it has pre-cache data like the UI .TGAs | ||
142 | extern LLVFS *gStaticVFS; | ||
143 | |||
144 | extern LLUUID gViewerDigest; // MD5 digest of the viewer's executable file. | ||
145 | |||
146 | class LLURLSimString | ||
147 | { | ||
148 | public: | ||
149 | enum { NOT_SET=0, NOT_PARSED=1, PARSE_OK=2, PARSE_FAIL=-1 }; | ||
150 | static void setString(const LLString& url); | ||
151 | static bool parse(); | ||
152 | static bool unpack_data(void* data); | ||
153 | static bool send_to_other_instance(); | ||
154 | |||
155 | LLURLSimString() : mX(128), mY(128), mZ(0), mParseState(NOT_PARSED) {} | ||
156 | |||
157 | private: | ||
158 | static S32 parseGridIdx(const LLString& in_string, S32 idx0, S32* res, S32 max); | ||
159 | struct llurl_data | ||
160 | { | ||
161 | char mSimName[DB_SIM_NAME_BUF_SIZE]; | ||
162 | S32 mSimX; | ||
163 | S32 mSimY; | ||
164 | S32 mSimZ; | ||
165 | }; | ||
166 | |||
167 | |||
168 | public: | ||
169 | static LLURLSimString sInstance; | ||
170 | static LLString sLocationStringHome; | ||
171 | static LLString sLocationStringLast; | ||
172 | |||
173 | public: | ||
174 | LLString mSimString; // "name/x/y/z" | ||
175 | LLString mSimName; | ||
176 | S32 mX,mY,mZ; | ||
177 | S32 mParseState; | ||
178 | }; | ||
179 | |||
180 | extern LLUUID gSunTextureID; | ||
181 | extern LLUUID gMoonTextureID; | ||
182 | |||
183 | extern BOOL gHandleKeysAsync; | ||
184 | |||
185 | // Map scale in pixels per region | ||
186 | extern F32 gMapScale; | ||
187 | extern F32 gMiniMapScale; | ||
188 | |||
189 | extern F32 gMouseSensitivity; | ||
190 | extern BOOL gInvertMouse; | ||
191 | |||
192 | // | ||
193 | // Defines and constants | ||
194 | // | ||
195 | |||
196 | const S32 AGENT_UPDATES_PER_SECOND = 10; | ||
197 | |||
198 | // Global because multiple functions need to identify the window | ||
199 | // by its name. | ||
200 | extern LLString gWindowTitle; | ||
201 | extern LLString gWindowName; | ||
202 | extern LLString gDisabledMessage; | ||
203 | extern BOOL gHideLinks; | ||
204 | |||
205 | #define REGIONS_PER_LANDSCAPE_EDGE 3 | ||
206 | #define NUMBER_OF_REGIONS (REGIONS_PER_LANDSCAPE_EDGE \ | ||
207 | * REGIONS_PER_LANDSCAPE_EDGE) | ||
208 | #define CENTER_REGION ((REGIONS_PER_LANDSCAPE_EDGE / 2) \ | ||
209 | * REGIONS_PER_LANDSCAPE_EDGE \ | ||
210 | + REGIONS_PER_LANDSCAPE_EDGE / 2) | ||
211 | |||
212 | |||
213 | // translates constant EAST, NORTH, WEST, etc. to x,y offsets | ||
214 | // eg, EAST = +1, 0 | ||
215 | // eg, SOUTHWEST = -1, -1 | ||
216 | const S32 MAP_REGION_TO_X[NUMBER_OF_REGIONS - 1] = | ||
217 | { | ||
218 | 1, // east | ||
219 | 0, // north | ||
220 | -1, // west | ||
221 | 0, // south | ||
222 | 1, // northeast | ||
223 | -1, // northwest | ||
224 | -1, // southwest | ||
225 | 1 // southeast | ||
226 | }; | ||
227 | const S32 MAP_REGION_TO_Y[NUMBER_OF_REGIONS - 1] = | ||
228 | { | ||
229 | 0, // east | ||
230 | 1, // north | ||
231 | 0, // west | ||
232 | -1, // south | ||
233 | 1, // northeast | ||
234 | 1, // northwest | ||
235 | -1, // southwest | ||
236 | -1 // southeast | ||
237 | }; | ||
238 | |||
239 | const BOOL FOR_SELECTION = TRUE; | ||
240 | const BOOL NOT_FOR_SELECTION = FALSE; | ||
241 | |||
242 | const U8 YES_PHYSICS = 1; | ||
243 | const U8 NO_PHYSICS = 0; | ||
244 | |||
245 | // | ||
246 | // Prototypes | ||
247 | // | ||
248 | void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0); | ||
249 | void draw_axes(); | ||
250 | |||
251 | void fire_shot(const U8 shot_type, const U8 use_physics ); | ||
252 | void add_object(LLPCode pcode, | ||
253 | U8 use_physics, | ||
254 | const LLVector3d &object_pos_global, | ||
255 | const LLQuaternion &rotation, | ||
256 | const LLVector3 &scale, | ||
257 | const LLVector3 &velocity, | ||
258 | const LLVector3 &angular_velocity); | ||
259 | |||
260 | BOOL add_object(LLPCode pcode, S32 screen_x, S32 screen_y, U8 use_physics); | ||
261 | |||
262 | void idle(); | ||
263 | void idle_network(); | ||
264 | void init_audio(); | ||
265 | void init_textures(); | ||
266 | void init_landscape(); | ||
267 | void keyboard(char key); | ||
268 | void keyboard_windows(char key); | ||
269 | void kill_all_trees(); | ||
270 | void move_sun(); | ||
271 | BOOL raycast_for_new_obj_pos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region ); | ||
272 | |||
273 | // Saves the final snapshot, but only once. | ||
274 | void save_final_snapshot(void*); | ||
275 | |||
276 | // Call when user is requesting application to quit. | ||
277 | void app_request_quit(); | ||
278 | |||
279 | // Call when user aborts the quit, for example, canceling a required save of | ||
280 | // dirty document. | ||
281 | void app_abort_quit(); | ||
282 | |||
283 | // Call if you need to quit immediately. You can optionally | ||
284 | // spawn a web page or open another application. | ||
285 | void app_force_quit(const char* launch_file_on_quit = NULL); | ||
286 | |||
287 | // Display an error dialog and forcibly quit. | ||
288 | void app_early_exit(const LLString& message); | ||
289 | |||
290 | // exit() immediately (after some cleanup) | ||
291 | void app_force_exit(S32 arg); | ||
292 | |||
293 | void do_disconnect(const LLString& message); | ||
294 | void send_logout_request(); | ||
295 | void save_avatar(void*); | ||
296 | |||
297 | void set_view(S32 which); | ||
298 | |||
299 | void user_logout(); | ||
300 | |||
301 | F32 mouse_x_from_center(S32 x); | ||
302 | F32 mouse_y_from_center(S32 x); | ||
303 | |||
304 | void print_agent_nvpairs(void*); | ||
305 | void reload_viewer(void); | ||
306 | void reset_statistics(); | ||
307 | void output_statistics(void*); | ||
308 | void write_debug(const char *str); | ||
309 | void write_debug(const std::string& str); | ||
310 | void login_alert_done(S32 option, void* user_data); | ||
311 | void callback_cache_name(const LLUUID& id, const char* firstname, const char* lastname, BOOL is_group, void* data); | ||
312 | void load_name_cache(); | ||
313 | void remove_marker_file(); | ||
314 | |||
315 | // Avoid including llagent.h everywhere. This returns gAgent.getID(). | ||
316 | const LLUUID& agent_get_id(); | ||
317 | const LLUUID& agent_get_session_id(); | ||
318 | void agent_send_reliable_message(); | ||
319 | |||
320 | // Helpers for URIs | ||
321 | const std::string& getLoginURI(); | ||
322 | const std::string& getHelperURI(); | ||
323 | |||
324 | #endif | ||