aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/viewer.h
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/viewer.h')
-rw-r--r--linden/indra/newview/viewer.h324
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
48extern BOOL gHackGodmode;
49#endif
50// ************************************************************
51
52//
53// Forward Declarations
54//
55class LLVector3d;
56class LLViewerObject;
57class LLMessageSystem;
58class LLHost;
59class LLAudioEngine;
60class LLViewerRegion;
61class LLVFS;
62class LLGlobalEconomy;
63class LLPieMenu;
64
65//
66// Global Variables
67//
68
69extern LLString gSecondLife;
70
71extern S32 gNumSessions;
72extern BOOL gNoRender;
73extern LLMemoryInfo gSysMemory;
74extern BOOL gLogMessages;
75extern BOOL gLogUTC;
76extern BOOL gUseAudio;
77extern BOOL gConnectToSomething;
78extern BOOL gGodConnect;
79extern BOOL gRunLocal;
80extern LLString gCmdLineFirstName;
81extern LLString gCmdLineLastName;
82extern LLString gCmdLinePassword;
83extern BOOL gAutoLogin;
84extern LLUUID gTemplateToken;
85extern U32 gFrameCount;
86extern BOOL gRequestInventoryLibrary;
87extern BOOL gAcceptTOS;
88extern BOOL gAcceptCriticalMessage;
89extern LLUUID gInventoryLibraryOwner;
90extern LLUUID gInventoryLibraryRoot;
91extern BOOL gLastExecFroze;
92extern F32 gLogoutMaxTime;
93extern LLTimer gRenderStartTime;
94extern LLTimer gLogoutTimer;
95extern BOOL gInProductionGrid;
96extern S32 gCrashBehavior;
97extern bool gVerifySSLCert;
98
99
100// TODO: Eliminate most of these, move into a globals structure.
101extern const U32 PATCH_SIZE;
102extern const LLVector3 DEFAULT_OBJECT_SCALE;
103extern BOOL gDisconnected;
104extern BOOL gQuit; // We're done, quit after processing this message.
105extern BOOL gQuitRequested; // User wants to quit, may have modified documents open.
106extern BOOL gLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
107extern BOOL gInitializationComplete; // OK to call display() and idle()
108extern BOOL gUseWireframe;
109extern U32 gSecondsPerDay;
110extern U32 gSecondsPerYear;
111// Is the Pacific time zone (aka server time zone)
112// currently in daylight savings time?
113extern BOOL gPacificDaylightTime;
114
115extern U64 gFrameTime; // The timestamp of the most-recently-processed frame
116extern F32 gFrameTimeSeconds; // Loses msec precision after ~4.5 hours...
117extern F32 gFrameIntervalSeconds; // Elapsed time between current and previous gFrameTimeSeconds
118extern F32 gFPSClamped; // Frames per second, smoothed, weighted toward last frame
119extern F32 gFrameDTClamped;
120extern U64 gStartTime;
121
122extern LLFrameTimer gRestoreGLTimer;
123extern BOOL gRestoreGL;
124
125extern BOOL gDisplayCameraPos;
126extern BOOL gDisplayWindInfo;
127extern BOOL gDisplayNearestWater;
128extern BOOL gDisplayFOV;
129extern BOOL gForceRenderLandFence;
130
131extern BOOL gAllowAFK;
132extern BOOL gShowObjectUpdates;
133
134extern BOOL gTeleportDisplay;
135extern LLFrameTimer gTeleportDisplayTimer;
136
137extern 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
142extern LLVFS *gStaticVFS;
143
144extern LLUUID gViewerDigest; // MD5 digest of the viewer's executable file.
145
146class LLURLSimString
147{
148public:
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
157private:
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
168public:
169 static LLURLSimString sInstance;
170 static LLString sLocationStringHome;
171 static LLString sLocationStringLast;
172
173public:
174 LLString mSimString; // "name/x/y/z"
175 LLString mSimName;
176 S32 mX,mY,mZ;
177 S32 mParseState;
178};
179
180extern LLUUID gSunTextureID;
181extern LLUUID gMoonTextureID;
182
183extern BOOL gHandleKeysAsync;
184
185// Map scale in pixels per region
186extern F32 gMapScale;
187extern F32 gMiniMapScale;
188
189extern F32 gMouseSensitivity;
190extern BOOL gInvertMouse;
191
192//
193// Defines and constants
194//
195
196const S32 AGENT_UPDATES_PER_SECOND = 10;
197
198// Global because multiple functions need to identify the window
199// by its name.
200extern LLString gWindowTitle;
201extern LLString gWindowName;
202extern LLString gDisabledMessage;
203extern 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
216const 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};
227const 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
239const BOOL FOR_SELECTION = TRUE;
240const BOOL NOT_FOR_SELECTION = FALSE;
241
242const U8 YES_PHYSICS = 1;
243const U8 NO_PHYSICS = 0;
244
245//
246// Prototypes
247//
248void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0);
249void draw_axes();
250
251void fire_shot(const U8 shot_type, const U8 use_physics );
252void 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
260BOOL add_object(LLPCode pcode, S32 screen_x, S32 screen_y, U8 use_physics);
261
262void idle();
263void idle_network();
264void init_audio();
265void init_textures();
266void init_landscape();
267void keyboard(char key);
268void keyboard_windows(char key);
269void kill_all_trees();
270void move_sun();
271BOOL 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.
274void save_final_snapshot(void*);
275
276// Call when user is requesting application to quit.
277void app_request_quit();
278
279// Call when user aborts the quit, for example, canceling a required save of
280// dirty document.
281void app_abort_quit();
282
283// Call if you need to quit immediately. You can optionally
284// spawn a web page or open another application.
285void app_force_quit(const char* launch_file_on_quit = NULL);
286
287// Display an error dialog and forcibly quit.
288void app_early_exit(const LLString& message);
289
290// exit() immediately (after some cleanup)
291void app_force_exit(S32 arg);
292
293void do_disconnect(const LLString& message);
294void send_logout_request();
295void save_avatar(void*);
296
297void set_view(S32 which);
298
299void user_logout();
300
301F32 mouse_x_from_center(S32 x);
302F32 mouse_y_from_center(S32 x);
303
304void print_agent_nvpairs(void*);
305void reload_viewer(void);
306void reset_statistics();
307void output_statistics(void*);
308void write_debug(const char *str);
309void write_debug(const std::string& str);
310void login_alert_done(S32 option, void* user_data);
311void callback_cache_name(const LLUUID& id, const char* firstname, const char* lastname, BOOL is_group, void* data);
312void load_name_cache();
313void remove_marker_file();
314
315// Avoid including llagent.h everywhere. This returns gAgent.getID().
316const LLUUID& agent_get_id();
317const LLUUID& agent_get_session_id();
318void agent_send_reliable_message();
319
320// Helpers for URIs
321const std::string& getLoginURI();
322const std::string& getHelperURI();
323
324#endif