PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/llcommon/indra_constants.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 414 lines | 264 code | 65 blank | 85 comment | 0 complexity | 24d1178e3db0ee014514cd449ea4337a MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file indra_constants.h
  3. * @brief some useful short term constants for Indra
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_INDRA_CONSTANTS_H
  27. #define LL_INDRA_CONSTANTS_H
  28. #include "stdtypes.h"
  29. class LLUUID;
  30. // At 45 Hz collisions seem stable and objects seem
  31. // to settle down at a reasonable rate.
  32. // JC 3/18/2003
  33. // const F32 PHYSICS_TIMESTEP = 1.f / 45.f;
  34. // This must be a #define due to anal retentive restrictions on const expressions
  35. // CG 2008-06-05
  36. #define PHYSICS_TIMESTEP (1.f / 45.f)
  37. const F32 COLLISION_TOLERANCE = 0.1f;
  38. const F32 HALF_COLLISION_TOLERANCE = 0.05f;
  39. // Time constants
  40. const U32 HOURS_PER_LINDEN_DAY = 4;
  41. const U32 DAYS_PER_LINDEN_YEAR = 11;
  42. const U32 SEC_PER_LINDEN_DAY = HOURS_PER_LINDEN_DAY * 60 * 60;
  43. const U32 SEC_PER_LINDEN_YEAR = DAYS_PER_LINDEN_YEAR * SEC_PER_LINDEN_DAY;
  44. static const F32 REGION_WIDTH_METERS = 256.f;
  45. static const S32 REGION_WIDTH_UNITS = 256;
  46. static const U32 REGION_WIDTH_U32 = 256;
  47. const F32 REGION_HEIGHT_METERS = 4096.f;
  48. // Bits for simulator performance query flags
  49. enum LAND_STAT_FLAGS
  50. {
  51. STAT_FILTER_BY_PARCEL = 0x00000001,
  52. STAT_FILTER_BY_OWNER = 0x00000002,
  53. STAT_FILTER_BY_OBJECT = 0x00000004,
  54. STAT_REQUEST_LAST_ENTRY = 0x80000000,
  55. };
  56. enum LAND_STAT_REPORT_TYPE
  57. {
  58. STAT_REPORT_TOP_SCRIPTS = 0,
  59. STAT_REPORT_TOP_COLLIDERS
  60. };
  61. const U32 STAT_FILTER_MASK = 0x1FFFFFFF;
  62. // Region absolute limits
  63. static const S32 REGION_AGENT_COUNT_MIN = 1;
  64. static const S32 REGION_AGENT_COUNT_MAX = 200; // Must fit in U8 for the moment (RegionInfo msg)
  65. static const S32 REGION_PRIM_COUNT_MIN = 0;
  66. static const S32 REGION_PRIM_COUNT_MAX = 40000;
  67. static const F32 REGION_PRIM_BONUS_MIN = 1.0;
  68. static const F32 REGION_PRIM_BONUS_MAX = 10.0;
  69. // Default maximum number of tasks/prims per region.
  70. const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000;
  71. const F32 MIN_AGENT_DEPTH = 0.30f;
  72. const F32 DEFAULT_AGENT_DEPTH = 0.45f;
  73. const F32 MAX_AGENT_DEPTH = 0.60f;
  74. const F32 MIN_AGENT_WIDTH = 0.40f;
  75. const F32 DEFAULT_AGENT_WIDTH = 0.60f;
  76. const F32 MAX_AGENT_WIDTH = 0.80f;
  77. const F32 MIN_AGENT_HEIGHT = 1.1f;
  78. const F32 DEFAULT_AGENT_HEIGHT = 1.9f;
  79. const F32 MAX_AGENT_HEIGHT = 2.45f;
  80. // For linked sets
  81. const S32 MAX_CHILDREN_PER_TASK = 255;
  82. const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32;
  83. const S32 MAX_JOINTS_PER_OBJECT = 1; // limiting to 1 until Havok 2.x
  84. const char* const DEFAULT_DMZ_SPACE_SERVER = "192.168.0.140";
  85. const char* const DEFAULT_DMZ_USER_SERVER = "192.168.0.140";
  86. const char* const DEFAULT_DMZ_DATA_SERVER = "192.168.0.140";
  87. const char* const DEFAULT_DMZ_ASSET_SERVER = "http://asset.dmz.lindenlab.com:80";
  88. const char* const DEFAULT_AGNI_SPACE_SERVER = "63.211.139.100";
  89. const char* const DEFAULT_AGNI_USER_SERVER = "63.211.139.100";
  90. const char* const DEFAULT_AGNI_DATA_SERVER = "63.211.139.100";
  91. const char* const DEFAULT_AGNI_ASSET_SERVER = "http://asset.agni.lindenlab.com:80";
  92. // Information about what ports are for what services is in the wiki Name Space Ports page
  93. // https://wiki.lindenlab.com/wiki/Name_Space_Ports
  94. const char* const DEFAULT_LOCAL_ASSET_SERVER = "http://localhost:12041/asset/tmp";
  95. const char* const LOCAL_ASSET_URL_FORMAT = "http://%s:12041/asset";
  96. const U32 DEFAULT_LAUNCHER_PORT = 12029;
  97. //const U32 DEFAULT_BIGBOARD_PORT = 12030; // Deprecated
  98. //const U32 DEFAULT_QUERYSIM_PORT = 12031; // Deprecated
  99. const U32 DEFAULT_DATA_SERVER_PORT = 12032;
  100. const U32 DEFAULT_SPACE_SERVER_PORT = 12033;
  101. const U32 DEFAULT_VIEWER_PORT = 12034;
  102. const U32 DEFAULT_SIMULATOR_PORT = 12035;
  103. const U32 DEFAULT_USER_SERVER_PORT = 12036;
  104. const U32 DEFAULT_RPC_SERVER_PORT = 12037;
  105. const U32 DEFAULT_LOG_DATA_SERVER_PORT = 12039;
  106. const U32 DEFAULT_BACKBONE_PORT = 12040;
  107. const U32 DEFAULT_LOCAL_ASSET_PORT = 12041;
  108. //const U32 DEFAULT_BACKBONE_CAP_PORT = 12042; // Deprecated
  109. const U32 DEFAULT_CAP_PROXY_PORT = 12043;
  110. const U32 DEFAULT_INV_DATA_SERVER_PORT = 12044;
  111. const U32 DEFAULT_CGI_SERVICES_PORT = 12045;
  112. // Mapserver uses ports 12124 - 12139 to allow multiple mapservers to run
  113. // on a single host for map tile generation. JC
  114. const U32 DEFAULT_MAPSERVER_PORT = 12124;
  115. // For automatic port discovery when running multiple viewers on one host
  116. const U32 PORT_DISCOVERY_RANGE_MIN = 13000;
  117. const U32 PORT_DISCOVERY_RANGE_MAX = PORT_DISCOVERY_RANGE_MIN + 50;
  118. const char LAND_LAYER_CODE = 'L';
  119. const char WATER_LAYER_CODE = 'W';
  120. const char WIND_LAYER_CODE = '7';
  121. const char CLOUD_LAYER_CODE = '8';
  122. // keys
  123. // Bit masks for various keyboard modifier keys.
  124. const MASK MASK_NONE = 0x0000;
  125. const MASK MASK_CONTROL = 0x0001; // Mapped to cmd on Macs
  126. const MASK MASK_ALT = 0x0002;
  127. const MASK MASK_SHIFT = 0x0004;
  128. const MASK MASK_NORMALKEYS = 0x0007; // A real mask - only get the bits for normal modifier keys
  129. const MASK MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows
  130. const MASK MASK_MODIFIERS = MASK_CONTROL|MASK_ALT|MASK_SHIFT|MASK_MAC_CONTROL;
  131. // Special keys go into >128
  132. const KEY KEY_SPECIAL = 0x80; // special keys start here
  133. const KEY KEY_RETURN = 0x81;
  134. const KEY KEY_LEFT = 0x82;
  135. const KEY KEY_RIGHT = 0x83;
  136. const KEY KEY_UP = 0x84;
  137. const KEY KEY_DOWN = 0x85;
  138. const KEY KEY_ESCAPE = 0x86;
  139. const KEY KEY_BACKSPACE =0x87;
  140. const KEY KEY_DELETE = 0x88;
  141. const KEY KEY_SHIFT = 0x89;
  142. const KEY KEY_CONTROL = 0x8A;
  143. const KEY KEY_ALT = 0x8B;
  144. const KEY KEY_HOME = 0x8C;
  145. const KEY KEY_END = 0x8D;
  146. const KEY KEY_PAGE_UP = 0x8E;
  147. const KEY KEY_PAGE_DOWN = 0x8F;
  148. const KEY KEY_HYPHEN = 0x90;
  149. const KEY KEY_EQUALS = 0x91;
  150. const KEY KEY_INSERT = 0x92;
  151. const KEY KEY_CAPSLOCK = 0x93;
  152. const KEY KEY_TAB = 0x94;
  153. const KEY KEY_ADD = 0x95;
  154. const KEY KEY_SUBTRACT =0x96;
  155. const KEY KEY_MULTIPLY =0x97;
  156. const KEY KEY_DIVIDE = 0x98;
  157. const KEY KEY_F1 = 0xA1;
  158. const KEY KEY_F2 = 0xA2;
  159. const KEY KEY_F3 = 0xA3;
  160. const KEY KEY_F4 = 0xA4;
  161. const KEY KEY_F5 = 0xA5;
  162. const KEY KEY_F6 = 0xA6;
  163. const KEY KEY_F7 = 0xA7;
  164. const KEY KEY_F8 = 0xA8;
  165. const KEY KEY_F9 = 0xA9;
  166. const KEY KEY_F10 = 0xAA;
  167. const KEY KEY_F11 = 0xAB;
  168. const KEY KEY_F12 = 0xAC;
  169. const KEY KEY_PAD_UP = 0xC0;
  170. const KEY KEY_PAD_DOWN = 0xC1;
  171. const KEY KEY_PAD_LEFT = 0xC2;
  172. const KEY KEY_PAD_RIGHT = 0xC3;
  173. const KEY KEY_PAD_HOME = 0xC4;
  174. const KEY KEY_PAD_END = 0xC5;
  175. const KEY KEY_PAD_PGUP = 0xC6;
  176. const KEY KEY_PAD_PGDN = 0xC7;
  177. const KEY KEY_PAD_CENTER = 0xC8; // the 5 in the middle
  178. const KEY KEY_PAD_INS = 0xC9;
  179. const KEY KEY_PAD_DEL = 0xCA;
  180. const KEY KEY_PAD_RETURN = 0xCB;
  181. const KEY KEY_PAD_ADD = 0xCC; // not used
  182. const KEY KEY_PAD_SUBTRACT = 0xCD; // not used
  183. const KEY KEY_PAD_MULTIPLY = 0xCE; // not used
  184. const KEY KEY_PAD_DIVIDE = 0xCF; // not used
  185. const KEY KEY_BUTTON0 = 0xD0;
  186. const KEY KEY_BUTTON1 = 0xD1;
  187. const KEY KEY_BUTTON2 = 0xD2;
  188. const KEY KEY_BUTTON3 = 0xD3;
  189. const KEY KEY_BUTTON4 = 0xD4;
  190. const KEY KEY_BUTTON5 = 0xD5;
  191. const KEY KEY_BUTTON6 = 0xD6;
  192. const KEY KEY_BUTTON7 = 0xD7;
  193. const KEY KEY_BUTTON8 = 0xD8;
  194. const KEY KEY_BUTTON9 = 0xD9;
  195. const KEY KEY_BUTTON10 = 0xDA;
  196. const KEY KEY_BUTTON11 = 0xDB;
  197. const KEY KEY_BUTTON12 = 0xDC;
  198. const KEY KEY_BUTTON13 = 0xDD;
  199. const KEY KEY_BUTTON14 = 0xDE;
  200. const KEY KEY_BUTTON15 = 0xDF;
  201. const KEY KEY_NONE = 0xFF; // not sent from keyboard. For internal use only.
  202. const S32 KEY_COUNT = 256;
  203. const F32 DEFAULT_WATER_HEIGHT = 20.0f;
  204. // Maturity ratings for simulators
  205. const U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
  206. const U8 SIM_ACCESS_PG = 13;
  207. const U8 SIM_ACCESS_MATURE = 21;
  208. const U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
  209. const U8 SIM_ACCESS_DOWN = 254;
  210. const U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
  211. // attachment constants
  212. const S32 MAX_AGENT_ATTACHMENTS = 38;
  213. const U8 ATTACHMENT_ADD = 0x80;
  214. // god levels
  215. const U8 GOD_MAINTENANCE = 250;
  216. const U8 GOD_FULL = 200;
  217. const U8 GOD_LIAISON = 150;
  218. const U8 GOD_CUSTOMER_SERVICE = 100;
  219. const U8 GOD_LIKE = 1;
  220. const U8 GOD_NOT = 0;
  221. // "agent id" for things that should be done to ALL agents
  222. LL_COMMON_API extern const LLUUID LL_UUID_ALL_AGENTS;
  223. // inventory library owner
  224. LL_COMMON_API extern const LLUUID ALEXANDRIA_LINDEN_ID;
  225. LL_COMMON_API extern const LLUUID GOVERNOR_LINDEN_ID;
  226. LL_COMMON_API extern const LLUUID REALESTATE_LINDEN_ID;
  227. // Maintenance's group id.
  228. LL_COMMON_API extern const LLUUID MAINTENANCE_GROUP_ID;
  229. // Flags for kick message
  230. const U32 KICK_FLAGS_DEFAULT = 0x0;
  231. const U32 KICK_FLAGS_FREEZE = 1 << 0;
  232. const U32 KICK_FLAGS_UNFREEZE = 1 << 1;
  233. const U8 UPD_NONE = 0x00;
  234. const U8 UPD_POSITION = 0x01;
  235. const U8 UPD_ROTATION = 0x02;
  236. const U8 UPD_SCALE = 0x04;
  237. const U8 UPD_LINKED_SETS = 0x08;
  238. const U8 UPD_UNIFORM = 0x10; // used with UPD_SCALE
  239. // Agent Update Flags (U8)
  240. const U8 AU_FLAGS_NONE = 0x00;
  241. const U8 AU_FLAGS_HIDETITLE = 0x01;
  242. const U8 AU_FLAGS_CLIENT_AUTOPILOT = 0x02;
  243. // start location constants
  244. const U32 START_LOCATION_ID_LAST = 0;
  245. const U32 START_LOCATION_ID_HOME = 1;
  246. const U32 START_LOCATION_ID_DIRECT = 2; // for direct teleport
  247. const U32 START_LOCATION_ID_PARCEL = 3; // for teleports to a parcel
  248. const U32 START_LOCATION_ID_TELEHUB = 4; // for teleports to a spawnpoint
  249. const U32 START_LOCATION_ID_URL = 5;
  250. const U32 START_LOCATION_ID_COUNT = 6;
  251. // group constants
  252. const U32 GROUP_MIN_SIZE = 2;
  253. // gMaxAgentGroups is now sent by login.cgi, which
  254. // looks it up from globals.xml.
  255. //
  256. // For now we need an old default value however,
  257. // so the viewer can be deployed ahead of login.cgi.
  258. //
  259. const S32 DEFAULT_MAX_AGENT_GROUPS = 25;
  260. // radius within which a chat message is fully audible
  261. const F32 CHAT_WHISPER_RADIUS = 10.f;
  262. const F32 CHAT_NORMAL_RADIUS = 20.f;
  263. const F32 CHAT_SHOUT_RADIUS = 100.f;
  264. const F32 CHAT_MAX_RADIUS = CHAT_SHOUT_RADIUS;
  265. const F32 CHAT_MAX_RADIUS_BY_TWO = CHAT_MAX_RADIUS / 2.f;
  266. // squared editions of the above for distance checks
  267. const F32 CHAT_WHISPER_RADIUS_SQUARED = CHAT_WHISPER_RADIUS * CHAT_WHISPER_RADIUS;
  268. const F32 CHAT_NORMAL_RADIUS_SQUARED = CHAT_NORMAL_RADIUS * CHAT_NORMAL_RADIUS;
  269. const F32 CHAT_SHOUT_RADIUS_SQUARED = CHAT_SHOUT_RADIUS * CHAT_SHOUT_RADIUS;
  270. const F32 CHAT_MAX_RADIUS_SQUARED = CHAT_SHOUT_RADIUS_SQUARED;
  271. const F32 CHAT_MAX_RADIUS_BY_TWO_SQUARED = CHAT_MAX_RADIUS_BY_TWO * CHAT_MAX_RADIUS_BY_TWO;
  272. // this times above gives barely audible radius
  273. const F32 CHAT_BARELY_AUDIBLE_FACTOR = 2.0f;
  274. // distance in front of speaking agent the sphere is centered
  275. const F32 CHAT_WHISPER_OFFSET = 5.f;
  276. const F32 CHAT_NORMAL_OFFSET = 10.f;
  277. const F32 CHAT_SHOUT_OFFSET = 50.f;
  278. // first clean starts at 3 AM
  279. const S32 SANDBOX_FIRST_CLEAN_HOUR = 3;
  280. // clean every <n> hours
  281. const S32 SANDBOX_CLEAN_FREQ = 12;
  282. const F32 WIND_SCALE_HACK = 2.0f; // hack to make wind speeds more realistic
  283. enum ETerrainBrushType
  284. {
  285. // the valid brush numbers cannot be reordered, because they
  286. // are used in the binary LSL format as arguments to llModifyLand()
  287. E_LANDBRUSH_LEVEL = 0,
  288. E_LANDBRUSH_RAISE = 1,
  289. E_LANDBRUSH_LOWER = 2,
  290. E_LANDBRUSH_SMOOTH = 3,
  291. E_LANDBRUSH_NOISE = 4,
  292. E_LANDBRUSH_REVERT = 5,
  293. E_LANDBRUSH_INVALID = 6
  294. };
  295. // media commands
  296. const U32 PARCEL_MEDIA_COMMAND_STOP = 0;
  297. const U32 PARCEL_MEDIA_COMMAND_PAUSE = 1;
  298. const U32 PARCEL_MEDIA_COMMAND_PLAY = 2;
  299. const U32 PARCEL_MEDIA_COMMAND_LOOP = 3;
  300. const U32 PARCEL_MEDIA_COMMAND_TEXTURE = 4;
  301. const U32 PARCEL_MEDIA_COMMAND_URL = 5;
  302. const U32 PARCEL_MEDIA_COMMAND_TIME = 6;
  303. const U32 PARCEL_MEDIA_COMMAND_AGENT = 7;
  304. const U32 PARCEL_MEDIA_COMMAND_UNLOAD = 8;
  305. const U32 PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9;
  306. const U32 PARCEL_MEDIA_COMMAND_TYPE = 10;
  307. const U32 PARCEL_MEDIA_COMMAND_SIZE = 11;
  308. const U32 PARCEL_MEDIA_COMMAND_DESC = 12;
  309. const U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13;
  310. // map item types
  311. const U32 MAP_ITEM_TELEHUB = 0x01;
  312. const U32 MAP_ITEM_PG_EVENT = 0x02;
  313. const U32 MAP_ITEM_MATURE_EVENT = 0x03;
  314. //const U32 MAP_ITEM_POPULAR = 0x04; // No longer supported, 2009-03-02 KLW
  315. //const U32 MAP_ITEM_AGENT_COUNT = 0x05;
  316. const U32 MAP_ITEM_AGENT_LOCATIONS = 0x06;
  317. const U32 MAP_ITEM_LAND_FOR_SALE = 0x07;
  318. const U32 MAP_ITEM_CLASSIFIED = 0x08;
  319. const U32 MAP_ITEM_ADULT_EVENT = 0x09;
  320. const U32 MAP_ITEM_LAND_FOR_SALE_ADULT = 0x0a;
  321. // Region map layer numbers
  322. const S32 MAP_SIM_OBJECTS = 0;
  323. const S32 MAP_SIM_TERRAIN = 1;
  324. const S32 MAP_SIM_LAND_FOR_SALE = 2; // Transparent alpha overlay of land for sale
  325. const S32 MAP_SIM_IMAGE_TYPES = 3; // Number of map layers
  326. const S32 MAP_SIM_INFO_MASK = 0x00FFFFFF; // Agent access may be stuffed into upper byte
  327. const S32 MAP_SIM_LAYER_MASK = 0x0000FFFF; // Layer info is in lower 16 bits
  328. const S32 MAP_SIM_RETURN_NULL_SIMS = 0x00010000;
  329. const S32 MAP_SIM_PRELUDE = 0x00020000;
  330. // Crash reporter behavior
  331. const S32 CRASH_BEHAVIOR_ASK = 0;
  332. const S32 CRASH_BEHAVIOR_ALWAYS_SEND = 1;
  333. const S32 CRASH_BEHAVIOR_NEVER_SEND = 2;
  334. // Export/Import return values
  335. const S32 EXPORT_SUCCESS = 0;
  336. const S32 EXPORT_ERROR_PERMISSIONS = -1;
  337. const S32 EXPORT_ERROR_UNKNOWN = -2;
  338. // This is how long the sim will try to teleport you before giving up.
  339. const F32 TELEPORT_EXPIRY = 15.0f;
  340. // Additional time (in seconds) to wait per attachment
  341. const F32 TELEPORT_EXPIRY_PER_ATTACHMENT = 3.f;
  342. // The maximum size of an object extra parameters binary (packed) block
  343. #define MAX_OBJECT_PARAMS_SIZE 1024
  344. const S32 CHAT_CHANNEL_DEBUG = S32_MAX;
  345. // PLEASE don't add constants here. Every dev will have to do
  346. // a complete rebuild. Try to find another shared header file,
  347. // like llregionflags.h, lllslconstants.h, llagentconstants.h,
  348. // or create a new one. JC
  349. #endif