diff options
Diffstat (limited to 'indra/llcommon')
-rw-r--r-- | indra/llcommon/indra_constants.h | 7 | ||||
-rw-r--r-- | indra/llcommon/llagentconstants.h | 74 | ||||
-rw-r--r-- | indra/llcommon/llapr.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/lldefs.h | 11 | ||||
-rw-r--r-- | indra/llcommon/llframetimer.cpp | 15 | ||||
-rw-r--r-- | indra/llcommon/llframetimer.h | 6 | ||||
-rw-r--r-- | indra/llcommon/llpreprocessor.h | 9 | ||||
-rw-r--r-- | indra/llcommon/llptrskiplist.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llskiplist.h | 1 | ||||
-rw-r--r-- | indra/llcommon/llstatenums.h | 8 | ||||
-rw-r--r-- | indra/llcommon/llstl.h | 3 | ||||
-rw-r--r-- | indra/llcommon/llstring.cpp | 21 | ||||
-rw-r--r-- | indra/llcommon/llversionserver.h | 6 |
13 files changed, 110 insertions, 54 deletions
diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 89b276e3b3..a0b1293639 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -38,9 +38,10 @@ // At 45 Hz collisions seem stable and objects seem // to settle down at a reasonable rate. // JC 3/18/2003 -const F32 HAVOK_TIMESTEP = 1.f / 45.f; +const F32 PHYSICS_TIMESTEP = 1.f / 45.f; const F32 COLLISION_TOLERANCE = 0.1f; +const F32 HALF_COLLISION_TOLERANCE = COLLISION_TOLERANCE * 0.5f; // Time constants const U32 HOURS_PER_LINDEN_DAY = 4; @@ -53,6 +54,8 @@ const F32 REGION_WIDTH_METERS = 256.f; const S32 REGION_WIDTH_UNITS = 256; const U32 REGION_WIDTH_U32 = 256; +const F32 REGION_HEIGHT_METERS = 4096.f; + // Bits for simulator performance query flags enum LAND_STAT_FLAGS { @@ -87,7 +90,7 @@ const F32 MAX_AGENT_HEIGHT = 2.65f - 2.0f * COLLISION_TOLERANCE; // For linked sets const S32 MAX_CHILDREN_PER_TASK = 255; -const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 31; +const S32 MAX_CHILDREN_PER_PHYSICAL_TASK = 32; const S32 MAX_JOINTS_PER_OBJECT = 1; // limiting to 1 until Havok 2.x diff --git a/indra/llcommon/llagentconstants.h b/indra/llcommon/llagentconstants.h index 2989d6d7d4..f630af6530 100644 --- a/indra/llcommon/llagentconstants.h +++ b/indra/llcommon/llagentconstants.h @@ -67,43 +67,43 @@ const U32 CONTROL_ML_LBUTTON_DOWN_INDEX = 30; const U32 CONTROL_ML_LBUTTON_UP_INDEX = 31; const U32 TOTAL_CONTROLS = 32; -const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; -const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; -const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; -const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; -const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; -const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; -const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; -const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; -const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; -const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; - -const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; -const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; -const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; - -const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; -const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; -const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; -const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; -const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; -const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; - -const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; -const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; -const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; -const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; -const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; -const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; -const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; -const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; - -const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; - -const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; -const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; -const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; -const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; +const U32 AGENT_CONTROL_AT_POS = 0x1 << CONTROL_AT_POS_INDEX; // 0x00000001 +const U32 AGENT_CONTROL_AT_NEG = 0x1 << CONTROL_AT_NEG_INDEX; // 0x00000002 +const U32 AGENT_CONTROL_LEFT_POS = 0x1 << CONTROL_LEFT_POS_INDEX; // 0x00000004 +const U32 AGENT_CONTROL_LEFT_NEG = 0x1 << CONTROL_LEFT_NEG_INDEX; // 0x00000008 +const U32 AGENT_CONTROL_UP_POS = 0x1 << CONTROL_UP_POS_INDEX; // 0x00000010 +const U32 AGENT_CONTROL_UP_NEG = 0x1 << CONTROL_UP_NEG_INDEX; // 0x00000020 +const U32 AGENT_CONTROL_PITCH_POS = 0x1 << CONTROL_PITCH_POS_INDEX; // 0x00000040 +const U32 AGENT_CONTROL_PITCH_NEG = 0x1 << CONTROL_PITCH_NEG_INDEX; // 0x00000080 +const U32 AGENT_CONTROL_YAW_POS = 0x1 << CONTROL_YAW_POS_INDEX; // 0x00000100 +const U32 AGENT_CONTROL_YAW_NEG = 0x1 << CONTROL_YAW_NEG_INDEX; // 0x00000200 + +const U32 AGENT_CONTROL_FAST_AT = 0x1 << CONTROL_FAST_AT_INDEX; // 0x00000400 +const U32 AGENT_CONTROL_FAST_LEFT = 0x1 << CONTROL_FAST_LEFT_INDEX; // 0x00000800 +const U32 AGENT_CONTROL_FAST_UP = 0x1 << CONTROL_FAST_UP_INDEX; // 0x00001000 + +const U32 AGENT_CONTROL_FLY = 0x1 << CONTROL_FLY_INDEX; // 0x00002000 +const U32 AGENT_CONTROL_STOP = 0x1 << CONTROL_STOP_INDEX; // 0x00004000 +const U32 AGENT_CONTROL_FINISH_ANIM = 0x1 << CONTROL_FINISH_ANIM_INDEX; // 0x00008000 +const U32 AGENT_CONTROL_STAND_UP = 0x1 << CONTROL_STAND_UP_INDEX; // 0x00010000 +const U32 AGENT_CONTROL_SIT_ON_GROUND = 0x1 << CONTROL_SIT_ON_GROUND_INDEX; // 0x00020000 +const U32 AGENT_CONTROL_MOUSELOOK = 0x1 << CONTROL_MOUSELOOK_INDEX; // 0x00040000 + +const U32 AGENT_CONTROL_NUDGE_AT_POS = 0x1 << CONTROL_NUDGE_AT_POS_INDEX; // 0x00080000 +const U32 AGENT_CONTROL_NUDGE_AT_NEG = 0x1 << CONTROL_NUDGE_AT_NEG_INDEX; // 0x00100000 +const U32 AGENT_CONTROL_NUDGE_LEFT_POS = 0x1 << CONTROL_NUDGE_LEFT_POS_INDEX; // 0x00200000 +const U32 AGENT_CONTROL_NUDGE_LEFT_NEG = 0x1 << CONTROL_NUDGE_LEFT_NEG_INDEX; // 0x00400000 +const U32 AGENT_CONTROL_NUDGE_UP_POS = 0x1 << CONTROL_NUDGE_UP_POS_INDEX; // 0x00800000 +const U32 AGENT_CONTROL_NUDGE_UP_NEG = 0x1 << CONTROL_NUDGE_UP_NEG_INDEX; // 0x01000000 +const U32 AGENT_CONTROL_TURN_LEFT = 0x1 << CONTROL_TURN_LEFT_INDEX; // 0x02000000 +const U32 AGENT_CONTROL_TURN_RIGHT = 0x1 << CONTROL_TURN_RIGHT_INDEX; // 0x04000000 + +const U32 AGENT_CONTROL_AWAY = 0x1 << CONTROL_AWAY_INDEX; // 0x08000000 + +const U32 AGENT_CONTROL_LBUTTON_DOWN = 0x1 << CONTROL_LBUTTON_DOWN_INDEX; // 0x10000000 +const U32 AGENT_CONTROL_LBUTTON_UP = 0x1 << CONTROL_LBUTTON_UP_INDEX; // 0x20000000 +const U32 AGENT_CONTROL_ML_LBUTTON_DOWN = 0x1 << CONTROL_ML_LBUTTON_DOWN_INDEX; // 0x40000000 +const U32 AGENT_CONTROL_ML_LBUTTON_UP = ((U32)0x1) << CONTROL_ML_LBUTTON_UP_INDEX; // 0x80000000 const U32 AGENT_CONTROL_AT = AGENT_CONTROL_AT_POS | AGENT_CONTROL_AT_NEG diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 3512f2fb17..5e6dfd975e 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -116,8 +116,10 @@ void LLScopedLock::unlock() bool ll_apr_warn_status(apr_status_t status) { if(APR_SUCCESS == status) return false; +#ifndef LL_WINDOWS char buf[MAX_STRING]; /* Flawfinder: ignore */ llwarns << "APR: " << apr_strerror(status, buf, MAX_STRING) << llendl; +#endif return true; } diff --git a/indra/llcommon/lldefs.h b/indra/llcommon/lldefs.h index 96b2ab169b..34bde66678 100644 --- a/indra/llcommon/lldefs.h +++ b/indra/llcommon/lldefs.h @@ -218,7 +218,15 @@ inline LLDATATYPE llmin(const LLDATATYPE& d1, const LLDATATYPE& d2, const LLDATA template <class LLDATATYPE> inline LLDATATYPE llclamp(const LLDATATYPE& a, const LLDATATYPE& minval, const LLDATATYPE& maxval) { - return llmin(llmax(a, minval), maxval); + if ( a < minval ) + { + return minval; + } + else if ( a > maxval ) + { + return maxval; + } + return a; } template <class LLDATATYPE> @@ -234,3 +242,4 @@ inline LLDATATYPE llclampb(const LLDATATYPE& a) } #endif // LL_LLDEFS_H + diff --git a/indra/llcommon/llframetimer.cpp b/indra/llcommon/llframetimer.cpp index 23d8775824..b74151bc2a 100644 --- a/indra/llcommon/llframetimer.cpp +++ b/indra/llcommon/llframetimer.cpp @@ -140,3 +140,18 @@ F32 LLFrameTimer::getFrameDeltaTimeF32() { return (F32)(U64_to_F64(sFrameDeltaTime) * USEC_TO_SEC_F64); } + + +// static +// Return seconds since the current frame started +F32 LLFrameTimer::getCurrentFrameTime() +{ + U64 frame_time = totalTime() - sTotalTime; + return (F32)(U64_to_F64(frame_time) * USEC_TO_SEC_F64); +} + +// Glue code to avoid full class .h file #includes +F32 getCurrentFrameTime() +{ + return (F32)(LLFrameTimer::getCurrentFrameTime()); +} diff --git a/indra/llcommon/llframetimer.h b/indra/llcommon/llframetimer.h index 9d55fd1a0b..2998560ab9 100644 --- a/indra/llcommon/llframetimer.h +++ b/indra/llcommon/llframetimer.h @@ -74,6 +74,9 @@ public: static F32 getFrameDeltaTimeF32(); + // Return seconds since the current frame started + static F32 getCurrentFrameTime(); + // MANIPULATORS void start(); void stop(); @@ -144,4 +147,7 @@ protected: BOOL mStarted; }; +// Glue code for Havok (or anything else that doesn't want the full .h files) +extern F32 getCurrentFrameTime(); + #endif // LL_LLFRAMETIMER_H diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h index ac06b431c1..454a820ce5 100644 --- a/indra/llcommon/llpreprocessor.h +++ b/indra/llcommon/llpreprocessor.h @@ -79,9 +79,16 @@ #endif + // Deal with the differeneces on Windows #if LL_MSVC -#define snprintf safe_snprintf /* Flawfinder: ignore */ +namespace snprintf_hack +{ + int snprintf(char *str, size_t size, const char *format, ...); +} + +// #define snprintf safe_snprintf /* Flawfinder: ignore */ +using snprintf_hack::snprintf; #endif // LL_MSVC // Static linking with apr on windows needs to be declared. diff --git a/indra/llcommon/llptrskiplist.h b/indra/llcommon/llptrskiplist.h index 81c8ca3ef3..b03faf57f1 100644 --- a/indra/llcommon/llptrskiplist.h +++ b/indra/llcommon/llptrskiplist.h @@ -34,6 +34,7 @@ #include "llerror.h" //#include "vmath.h" +#include "llrand.h" ///////////////////////////////////////////// // diff --git a/indra/llcommon/llskiplist.h b/indra/llcommon/llskiplist.h index 314043ebac..17e0baddb7 100644 --- a/indra/llcommon/llskiplist.h +++ b/indra/llcommon/llskiplist.h @@ -32,6 +32,7 @@ #define LL_LLSKIPLIST_H #include "llrand.h" +#include "llrand.h" // NOTA BENE: Insert first needs to be < NOT <= // Binary depth must be >= 2 diff --git a/indra/llcommon/llstatenums.h b/indra/llcommon/llstatenums.h index e9876f8061..a82996b852 100644 --- a/indra/llcommon/llstatenums.h +++ b/indra/llcommon/llstatenums.h @@ -57,7 +57,13 @@ enum LL_SIM_STAT_VIRTUAL_SIZE_KB, LL_SIM_STAT_RESIDENT_SIZE_KB, LL_SIM_STAT_PENDING_LOCAL_UPLOADS, - LL_SIM_STAT_TOTAL_UNACKED_BYTES + LL_SIM_STAT_TOTAL_UNACKED_BYTES, + LL_SIM_STAT_PHYSICS_PINNED_TASKS, + LL_SIM_STAT_PHYSICS_LOD_TASKS, + LL_SIM_STAT_SIMPHYSICSSTEPMS, + LL_SIM_STAT_SIMPHYSICSSHAPEMS, + LL_SIM_STAT_SIMPHYSICSOTHERMS, + LL_SIM_STAT_SIMPHYSICSMEMORY }; #endif diff --git a/indra/llcommon/llstl.h b/indra/llcommon/llstl.h index b692daefd8..988e706091 100644 --- a/indra/llcommon/llstl.h +++ b/indra/llcommon/llstl.h @@ -33,6 +33,9 @@ #define LL_LLSTL_H #include <functional> +#include <algorithm> +#include <map> +#include <vector> #include <set> #include <deque> diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index a688bc1c6f..59d71a8e8e 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -804,16 +804,19 @@ std::string utf8str_removeCRLF(const std::string& utf8str) #if LL_WINDOWS // documentation moved to header. Phoenix 2007-11-27 -int safe_snprintf(char *str, size_t size, const char *format, ...) +namespace snprintf_hack { - va_list args; - va_start(args, format); - - int num_written = _vsnprintf(str, size, format, args); /* Flawfinder: ignore */ - va_end(args); - - str[size-1] = '\0'; // always null terminate - return num_written; + int snprintf(char *str, size_t size, const char *format, ...) + { + va_list args; + va_start(args, format); + + int num_written = _vsnprintf(str, size, format, args); /* Flawfinder: ignore */ + va_end(args); + + str[size-1] = '\0'; // always null terminate + return num_written; + } } std::string ll_convert_wide_to_string(const wchar_t* in) diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h index b87d054b3b..5da3c01096 100644 --- a/indra/llcommon/llversionserver.h +++ b/indra/llcommon/llversionserver.h @@ -33,9 +33,9 @@ #define LL_LLVERSIONSERVER_H const S32 LL_VERSION_MAJOR = 1; -const S32 LL_VERSION_MINOR = 19; -const S32 LL_VERSION_PATCH = 2; -const S32 LL_VERSION_BUILD = 83236; +const S32 LL_VERSION_MINOR = 20; +const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_BUILD = 83892; const char * const LL_CHANNEL = "Second Life Server"; |