indra_constants.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /**
  2. * @file indra_constants.h
  3. * @brief some useful short term constants for Indra
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_INDRA_CONSTANTS_H
  33. #define LL_INDRA_CONSTANTS_H
  34. #include "stdtypes.h"
  35. class LLUUID;
  36. constexpr F32 REGION_WIDTH_METERS = 256.f;
  37. constexpr S32 REGION_WIDTH_UNITS = (S32)REGION_WIDTH_METERS;
  38. constexpr U32 REGION_WIDTH_U32 = (U32)REGION_WIDTH_METERS;
  39. constexpr F32 REGION_HEIGHT_METERS = 4096.f;
  40. constexpr F32 DEFAULT_AGENT_DEPTH = 0.45f;
  41. constexpr F32 DEFAULT_AGENT_WIDTH = 0.60f;
  42. enum ETerrainBrushType
  43. {
  44. // The valid brush numbers cannot be reordered, because they are used in
  45. // the binary LSL format as arguments to llModifyLand()
  46. E_LANDBRUSH_LEVEL = 0,
  47. E_LANDBRUSH_RAISE = 1,
  48. E_LANDBRUSH_LOWER = 2,
  49. E_LANDBRUSH_SMOOTH = 3,
  50. E_LANDBRUSH_NOISE = 4,
  51. E_LANDBRUSH_REVERT = 5,
  52. E_LANDBRUSH_INVALID = 6
  53. };
  54. // Bit masks for various keyboard modifier keys.
  55. constexpr MASK MASK_NONE = 0x0000;
  56. constexpr MASK MASK_CONTROL = 0x0001; // Mapped to cmd on Macs
  57. constexpr MASK MASK_ALT = 0x0002;
  58. constexpr MASK MASK_SHIFT = 0x0004;
  59. constexpr MASK MASK_NORMALKEYS = 0x0007; // A real mask - only get the bits for normal modifier keys
  60. constexpr MASK MASK_MAC_CONTROL = 0x0008; // Un-mapped Ctrl key on Macs, not used on Windows
  61. constexpr MASK MASK_MODIFIERS = MASK_CONTROL|MASK_ALT|MASK_SHIFT|MASK_MAC_CONTROL;
  62. // Special keys go into >128
  63. constexpr KEY KEY_SPECIAL = 0x80; // special keys start here
  64. constexpr KEY KEY_RETURN = 0x81;
  65. constexpr KEY KEY_LEFT = 0x82;
  66. constexpr KEY KEY_RIGHT = 0x83;
  67. constexpr KEY KEY_UP = 0x84;
  68. constexpr KEY KEY_DOWN = 0x85;
  69. constexpr KEY KEY_ESCAPE = 0x86;
  70. constexpr KEY KEY_BACKSPACE = 0x87;
  71. constexpr KEY KEY_DELETE = 0x88;
  72. constexpr KEY KEY_SHIFT = 0x89;
  73. constexpr KEY KEY_CONTROL = 0x8A;
  74. constexpr KEY KEY_ALT = 0x8B;
  75. constexpr KEY KEY_HOME = 0x8C;
  76. constexpr KEY KEY_END = 0x8D;
  77. constexpr KEY KEY_PAGE_UP = 0x8E;
  78. constexpr KEY KEY_PAGE_DOWN = 0x8F;
  79. constexpr KEY KEY_HYPHEN = 0x90;
  80. constexpr KEY KEY_EQUALS = 0x91;
  81. constexpr KEY KEY_INSERT = 0x92;
  82. constexpr KEY KEY_CAPSLOCK = 0x93;
  83. constexpr KEY KEY_TAB = 0x94;
  84. constexpr KEY KEY_ADD = 0x95;
  85. constexpr KEY KEY_SUBTRACT = 0x96;
  86. constexpr KEY KEY_MULTIPLY = 0x97;
  87. constexpr KEY KEY_DIVIDE = 0x98;
  88. constexpr KEY KEY_F1 = 0xA1;
  89. constexpr KEY KEY_F2 = 0xA2;
  90. constexpr KEY KEY_F3 = 0xA3;
  91. constexpr KEY KEY_F4 = 0xA4;
  92. constexpr KEY KEY_F5 = 0xA5;
  93. constexpr KEY KEY_F6 = 0xA6;
  94. constexpr KEY KEY_F7 = 0xA7;
  95. constexpr KEY KEY_F8 = 0xA8;
  96. constexpr KEY KEY_F9 = 0xA9;
  97. constexpr KEY KEY_F10 = 0xAA;
  98. constexpr KEY KEY_F11 = 0xAB;
  99. constexpr KEY KEY_F12 = 0xAC;
  100. constexpr KEY KEY_PAD_UP = 0xC0;
  101. constexpr KEY KEY_PAD_DOWN = 0xC1;
  102. constexpr KEY KEY_PAD_LEFT = 0xC2;
  103. constexpr KEY KEY_PAD_RIGHT = 0xC3;
  104. constexpr KEY KEY_PAD_HOME = 0xC4;
  105. constexpr KEY KEY_PAD_END = 0xC5;
  106. constexpr KEY KEY_PAD_PGUP = 0xC6;
  107. constexpr KEY KEY_PAD_PGDN = 0xC7;
  108. constexpr KEY KEY_PAD_CENTER = 0xC8; // the 5 in the middle
  109. constexpr KEY KEY_PAD_INS = 0xC9;
  110. constexpr KEY KEY_PAD_DEL = 0xCA;
  111. constexpr KEY KEY_PAD_RETURN = 0xCB;
  112. constexpr KEY KEY_PAD_ADD = 0xCC; // not used
  113. constexpr KEY KEY_PAD_SUBTRACT = 0xCD; // not used
  114. constexpr KEY KEY_PAD_MULTIPLY = 0xCE; // not used
  115. constexpr KEY KEY_PAD_DIVIDE = 0xCF; // not used
  116. constexpr KEY KEY_BUTTON0 = 0xD0;
  117. constexpr KEY KEY_BUTTON1 = 0xD1;
  118. constexpr KEY KEY_BUTTON2 = 0xD2;
  119. constexpr KEY KEY_BUTTON3 = 0xD3;
  120. constexpr KEY KEY_BUTTON4 = 0xD4;
  121. constexpr KEY KEY_BUTTON5 = 0xD5;
  122. constexpr KEY KEY_BUTTON6 = 0xD6;
  123. constexpr KEY KEY_BUTTON7 = 0xD7;
  124. constexpr KEY KEY_BUTTON8 = 0xD8;
  125. constexpr KEY KEY_BUTTON9 = 0xD9;
  126. constexpr KEY KEY_BUTTON10 = 0xDA;
  127. constexpr KEY KEY_BUTTON11 = 0xDB;
  128. constexpr KEY KEY_BUTTON12 = 0xDC;
  129. constexpr KEY KEY_BUTTON13 = 0xDD;
  130. constexpr KEY KEY_BUTTON14 = 0xDE;
  131. constexpr KEY KEY_BUTTON15 = 0xDF;
  132. constexpr KEY KEY_NONE = 0xFF; // not sent from keyboard. For internal use only.
  133. constexpr S32 KEY_COUNT = 256;
  134. constexpr F32 DEFAULT_WATER_HEIGHT = 20.0f;
  135. // Maturity ratings for simulators
  136. constexpr U8 SIM_ACCESS_MIN = 0; // Treated as 'unknown', usually ends up being SIM_ACCESS_PG
  137. constexpr U8 SIM_ACCESS_PG = 13;
  138. constexpr U8 SIM_ACCESS_MATURE = 21;
  139. constexpr U8 SIM_ACCESS_ADULT = 42; // Seriously Adult Only
  140. constexpr U8 SIM_ACCESS_DOWN = 254;
  141. constexpr U8 SIM_ACCESS_MAX = SIM_ACCESS_ADULT;
  142. // Attachment constants
  143. constexpr S32 MAX_AGENT_ATTACHMENTS = 38;
  144. constexpr U8 ATTACHMENT_ADD = 0x80;
  145. // God levels
  146. constexpr U8 GOD_MAINTENANCE = 250;
  147. constexpr U8 GOD_FULL = 200;
  148. constexpr U8 GOD_LIAISON = 150;
  149. constexpr U8 GOD_CUSTOMER_SERVICE = 100;
  150. constexpr U8 GOD_LIKE = 1;
  151. constexpr U8 GOD_NOT = 0;
  152. // "agent id" for things that should be done to ALL agents
  153. extern const LLUUID LL_UUID_ALL_AGENTS;
  154. // Inventory library owner
  155. extern const LLUUID ALEXANDRIA_LINDEN_ID;
  156. extern const LLUUID GOVERNOR_LINDEN_ID;
  157. // Maintenance's group id.
  158. extern const LLUUID MAINTENANCE_GROUP_ID;
  159. // Attachments baking pseudo-textures
  160. extern const LLUUID IMG_USE_BAKED_HEAD;
  161. extern const LLUUID IMG_USE_BAKED_UPPER;
  162. extern const LLUUID IMG_USE_BAKED_LOWER;
  163. extern const LLUUID IMG_USE_BAKED_HAIR;
  164. extern const LLUUID IMG_USE_BAKED_EYES;
  165. extern const LLUUID IMG_USE_BAKED_SKIRT;
  166. extern const LLUUID IMG_USE_BAKED_LEFTARM;
  167. extern const LLUUID IMG_USE_BAKED_LEFTLEG;
  168. extern const LLUUID IMG_USE_BAKED_AUX1;
  169. extern const LLUUID IMG_USE_BAKED_AUX2;
  170. extern const LLUUID IMG_USE_BAKED_AUX3;
  171. // Blank GLTF material asset Id
  172. extern const LLUUID BLANK_MATERIAL_ASSET_ID;
  173. // Flags for kick message
  174. constexpr U32 KICK_FLAGS_DEFAULT = 0x0;
  175. constexpr U32 KICK_FLAGS_FREEZE = 1 << 0;
  176. constexpr U32 KICK_FLAGS_UNFREEZE = 1 << 1;
  177. // Radius within which a chat message is fully audible
  178. constexpr F32 CHAT_WHISPER_RADIUS = 10.f;
  179. constexpr F32 CHAT_NORMAL_RADIUS = 20.f;
  180. constexpr F32 CHAT_SHOUT_RADIUS = 100.f;
  181. // Media commands
  182. constexpr U32 PARCEL_MEDIA_COMMAND_STOP = 0;
  183. constexpr U32 PARCEL_MEDIA_COMMAND_PAUSE = 1;
  184. constexpr U32 PARCEL_MEDIA_COMMAND_PLAY = 2;
  185. constexpr U32 PARCEL_MEDIA_COMMAND_LOOP = 3;
  186. constexpr U32 PARCEL_MEDIA_COMMAND_TEXTURE = 4;
  187. constexpr U32 PARCEL_MEDIA_COMMAND_URL = 5;
  188. constexpr U32 PARCEL_MEDIA_COMMAND_TIME = 6;
  189. constexpr U32 PARCEL_MEDIA_COMMAND_AGENT = 7;
  190. constexpr U32 PARCEL_MEDIA_COMMAND_UNLOAD = 8;
  191. constexpr U32 PARCEL_MEDIA_COMMAND_AUTO_ALIGN = 9;
  192. constexpr U32 PARCEL_MEDIA_COMMAND_TYPE = 10;
  193. constexpr U32 PARCEL_MEDIA_COMMAND_SIZE = 11;
  194. constexpr U32 PARCEL_MEDIA_COMMAND_DESC = 12;
  195. constexpr U32 PARCEL_MEDIA_COMMAND_LOOP_SET = 13;
  196. constexpr S32 CHAT_CHANNEL_DEBUG = S32_MAX;
  197. // DO NOT CHANGE THE SEQUENCE OF THIS LIST !
  198. constexpr U8 CLICK_ACTION_NONE = 0;
  199. constexpr U8 CLICK_ACTION_TOUCH = 0;
  200. constexpr U8 CLICK_ACTION_SIT = 1;
  201. constexpr U8 CLICK_ACTION_BUY = 2;
  202. constexpr U8 CLICK_ACTION_PAY = 3;
  203. constexpr U8 CLICK_ACTION_OPEN = 4;
  204. constexpr U8 CLICK_ACTION_PLAY = 5;
  205. constexpr U8 CLICK_ACTION_OPEN_MEDIA = 6;
  206. constexpr U8 CLICK_ACTION_ZOOM = 7;
  207. constexpr U8 CLICK_ACTION_DISABLED = 8;
  208. constexpr U8 CLICK_ACTION_IGNORE = 9;
  209. // Primitve-related "constants" (a couple are not since they differ in SL and
  210. // in OpenSim grids). Used to be exported from llprimitive.cpp (the couple non-
  211. // constant ones still are). Added here, since quite a few of these constants
  212. // are needed by llmath, and I did not want to make the latter depend on
  213. // llprimitive; this also allows to use constexpr, with avoids the allocation
  214. // of a storage for each constant by the compiler... HB
  215. constexpr F32 OBJECT_CUT_MIN = 0.f;
  216. constexpr F32 OBJECT_CUT_MAX = 1.f;
  217. constexpr F32 OBJECT_CUT_INC = 0.05f;
  218. constexpr F32 OBJECT_MIN_CUT_INC = 0.02f;
  219. constexpr F32 OBJECT_ROTATION_PRECISION = 0.05f;
  220. constexpr F32 OBJECT_TWIST_MIN = -360.f;
  221. constexpr F32 OBJECT_TWIST_MAX = 360.f;
  222. constexpr F32 OBJECT_TWIST_INC = 18.f;
  223. // This is used for linear paths, since twist is used in a slightly different
  224. // manner.
  225. constexpr F32 OBJECT_TWIST_LINEAR_MIN = -180.f;
  226. constexpr F32 OBJECT_TWIST_LINEAR_MAX = 180.f;
  227. constexpr F32 OBJECT_TWIST_LINEAR_INC = 9.f;
  228. extern F32 OBJECT_MIN_HOLE_SIZE; // Differs in SL and OpenSim
  229. constexpr F32 OBJECT_MAX_HOLE_SIZE_X = 1.f;
  230. constexpr F32 OBJECT_MAX_HOLE_SIZE_Y = 0.5f;
  231. // Hollow
  232. constexpr F32 OBJECT_HOLLOW_MIN = 0.f;
  233. extern F32 OBJECT_HOLLOW_MAX; // Differs in SL and OpenSim
  234. constexpr F32 OBJECT_HOLLOW_MAX_SQUARE = 0.7f;
  235. // Revolutions parameters.
  236. constexpr F32 OBJECT_REV_MIN = 1.f;
  237. constexpr F32 OBJECT_REV_MAX = 4.f;
  238. constexpr F32 OBJECT_REV_INC = 0.1f;
  239. // Lights
  240. constexpr F32 LIGHT_MIN_RADIUS = 0.f;
  241. constexpr F32 LIGHT_DEFAULT_RADIUS = 5.f;
  242. constexpr F32 LIGHT_MAX_RADIUS = 20.f;
  243. constexpr F32 LIGHT_MIN_FALLOFF = 0.f;
  244. constexpr F32 LIGHT_DEFAULT_FALLOFF = 1.f;
  245. constexpr F32 LIGHT_MAX_FALLOFF = 2.f;
  246. constexpr F32 LIGHT_MIN_CUTOFF = 0.f;
  247. constexpr F32 LIGHT_DEFAULT_CUTOFF = 0.f;
  248. constexpr F32 LIGHT_MAX_CUTOFF = 180.f;
  249. // "Tension" => [0,10], increments of 0.1
  250. constexpr F32 FLEXIBLE_OBJECT_MIN_TENSION = 0.f;
  251. constexpr F32 FLEXIBLE_OBJECT_DEFAULT_TENSION = 1.f;
  252. constexpr F32 FLEXIBLE_OBJECT_MAX_TENSION = 10.f;
  253. // "Drag" => [0,10], increments of 0.1
  254. constexpr F32 FLEXIBLE_OBJECT_MIN_AIR_FRICTION = 0.f;
  255. constexpr F32 FLEXIBLE_OBJECT_DEFAULT_AIR_FRICTION = 2.f;
  256. constexpr F32 FLEXIBLE_OBJECT_MAX_AIR_FRICTION = 10.f;
  257. // "Gravity" = [-10,10], increments of 0.1
  258. constexpr F32 FLEXIBLE_OBJECT_MIN_GRAVITY = -10.f;
  259. constexpr F32 FLEXIBLE_OBJECT_DEFAULT_GRAVITY = 0.3f;
  260. constexpr F32 FLEXIBLE_OBJECT_MAX_GRAVITY = 10.f;
  261. // "Wind" = [0,10], increments of 0.1
  262. constexpr F32 FLEXIBLE_OBJECT_MIN_WIND_SENSITIVITY = 0.f;
  263. constexpr F32 FLEXIBLE_OBJECT_DEFAULT_WIND_SENSITIVITY = 0.f;
  264. constexpr F32 FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY = 10.f;
  265. constexpr F32 FLEXIBLE_OBJECT_MAX_INTERNAL_TENSION_FORCE = 0.99f;
  266. constexpr F32 FLEXIBLE_OBJECT_DEFAULT_LENGTH = 1.f;
  267. constexpr bool FLEXIBLE_OBJECT_DEFAULT_USING_COLLISION_SPHERE = false;
  268. constexpr bool FLEXIBLE_OBJECT_DEFAULT_RENDERING_COLLISION_SPHERE = false;
  269. // The following constants were defined in llvomulme.cpp, with a "to do"
  270. // commment "move to llprimitive.cpp". They are best placed here. HB
  271. constexpr F32 RATIO_MIN = 0.f;
  272. // Inverted sense here: 0 = top taper, 2 = bottom taper
  273. constexpr F32 RATIO_MAX = 2.f;
  274. constexpr F32 SHEAR_MIN = -0.5f;
  275. constexpr F32 SHEAR_MAX = 0.5f;
  276. constexpr F32 TAPER_MIN = -1.f;
  277. constexpr F32 TAPER_MAX = 1.f;
  278. constexpr F32 SKEW_MIN = -0.95f;
  279. constexpr F32 SKEW_MAX = 0.95f;
  280. constexpr F32 SCULPT_MIN_AREA = 0.002f;
  281. constexpr S32 SCULPT_MIN_AREA_DETAIL = 1;
  282. #endif