Permalink
Browse files

Sync with alchemy

Moves some constants out of llavatarconstants.h
8ebf8f4608bd: Change various const constants to constexpr
e07d5d43ba30: CID-143595
30b6935fc66d: CID-143595
acc96f9051cb: Fix a memory leak in viewer side baking initial wearable setup
Sync llmodel.*

Changesets assimilated:
f8f7706c2902: CID-143554 - fix out of bounds access
223eb65adce4: CID-143554 - Chase
2ceb49aaa133: CID-42838, CID-42930, CID-42933, CID-42938, CID-42940, CID-42945, CID-42948, CID-56111, CID-83907
d220005d9f23: Missing null check before deref
31dbb0f3b6ee: CID-42571 CID-42576 CID-42578
49caf082e65c: change unordered_map to flat_map
Doesn't cause as many problems as a hashmap when it comes to assumptions in the
LLUI system.
f93f5e881484: "update" linux cef
downgrade to fix javascript problems
cba818dd9269: Various null checks and etc.
1b4c6bc483bb: CID-42847, CID-42854, CID-42886, CID-42921, CID-42922, CID-42923, CID-42924, CID-42925,
CID-42927, CID-42928, CID-83871, CID-83876, CID-83878, CID-83880, CID-83900, CID-143573
0fe90cd9ec24: Various file size related things
a79f6f653dca: CID-42918 - Initialize member pointers in LLFloaterGodTools
0b70d600d978: Tweak LLFloaterBuyLand initializations
e8b173ffe813: CID-42854 - Additional fix to LLDrawInfo
b5d745cf3fde: Fix signage
4f2e2f384781: Initialize and cleanup various class member variables.
CID-42899, CID-42900, CID-42902, CID-42903, CID-42904, CID-42905, CID-42909, CID-42910,
CID-42911, CID-42912, CID-42913, CID-42967, CID-83853, CID-83898, CID-83890, CID-143584
9851a3e39b4c: Fix platform specific include directories
5c074e84f1be: Initialize and clenaup various more class member variables.
CID-42885, CID-42853, CID-42894, CID-42895, CID-42896, CID-83908, CID-143574, CID-143575,
CID-143576, CID-143576, CID-143578
ac262854ac92: Brace sub-object in initialization to make our intentions clear to clang
358da477d4c1: More double brace init
c3850119314a: Initialize various member pointers in panels
CID-83902, CID-83903, CID-83905, CID-83909, CID-83911, CID-83912, CID-143572
  • Loading branch information...
Lirusaito committed Mar 31, 2016
1 parent 7a48138 commit 2653567d82502364cfc96234fc76d6faebcf1dce
Showing with 366 additions and 233 deletions.
  1. +3 −3 autobuild.xml
  2. +2 −0 indra/cmake/00-Common.cmake
  3. +5 −1 indra/cmake/NDOF.cmake
  4. +0 −2 indra/cmake/UI.cmake
  5. +0 −8 indra/llcommon/llavatarconstants.h
  6. +1 −1 indra/llimage/llimagetga.cpp
  7. +31 −31 indra/llmath/llmath.h
  8. +31 −31 indra/llprimitive/llmodel.cpp
  9. +7 −1 indra/llprimitive/llmodel.h
  10. +2 −2 indra/llui/llview.cpp
  11. +2 −2 indra/llui/llview.h
  12. +2 −2 indra/llui/llxuiparser.cpp
  13. +1 −1 indra/llxml/llxmlnode.cpp
  14. +1 −1 indra/llxml/llxmlparser.cpp
  15. +2 −1 indra/newview/llagent.cpp
  16. +5 −10 indra/newview/llagentwearablesfetch.cpp
  17. +8 −8 indra/newview/llappviewer.cpp
  18. +8 −0 indra/newview/llavatarpropertiesprocessor.h
  19. +5 −2 indra/newview/llcompilequeue.cpp
  20. +1 −1 indra/newview/lldrawable.h
  21. +1 −1 indra/newview/lldrawpoolavatar.h
  22. +4 −0 indra/newview/llfloateravatartextures.cpp
  23. +28 −6 indra/newview/llfloaterbuyland.cpp
  24. +6 −7 indra/newview/llfloaterbvhpreview.cpp
  25. +3 −0 indra/newview/llfloatercamera.cpp
  26. +13 −0 indra/newview/llfloatercolorpicker.cpp
  27. +2 −0 indra/newview/llfloatergodtools.cpp
  28. +1 −0 indra/newview/llfloaterinspect.cpp
  29. +3 −0 indra/newview/llfloaterjoystick.cpp
  30. +1 −1 indra/newview/llfloaterjoystick.h
  31. +45 −9 indra/newview/llfloaterland.cpp
  32. +0 −7 indra/newview/llfloaterland.h
  33. +7 −4 indra/newview/llfloatermediasettings.cpp
  34. +9 −4 indra/newview/llfloatermodelpreview.cpp
  35. +1 −0 indra/newview/llfloaterpathfindinglinksets.cpp
  36. +10 −2 indra/newview/llfloaterregioninfo.cpp
  37. +3 −3 indra/newview/llfloaterreporter.h
  38. +2 −1 indra/newview/llfloaterscriptdebug.cpp
  39. +2 −0 indra/newview/llfloaterscriptlimits.cpp
  40. +1 −0 indra/newview/llfloatersettingsdebug.cpp
  41. +1 −0 indra/newview/llfloaterurlentry.cpp
  42. +1 −0 indra/newview/llfloatervoiceeffect.cpp
  43. +0 −1 indra/newview/llfloatervoiceeffect.h
  44. +3 −2 indra/newview/llfloaterwhitelistentry.cpp
  45. +3 −6 indra/newview/llgivemoney.cpp
  46. +2 −4 indra/newview/llgivemoney.h
  47. +1 −1 indra/newview/llhudeffecttrail.h
  48. +2 −0 indra/newview/llimpanel.cpp
  49. +2 −2 indra/newview/llmaniprotate.cpp
  50. +2 −2 indra/newview/llmaniptranslate.cpp
  51. +2 −1 indra/newview/llmeshrepository.cpp
  52. +2 −2 indra/newview/llnetmap.cpp
  53. +1 −1 indra/newview/llpanelcontents.cpp
  54. +4 −4 indra/newview/llpanelgrouplandmoney.cpp
  55. +12 −2 indra/newview/llpanelmaininventory.cpp
  56. +1 −1 indra/newview/llpanelmediasettingsgeneral.cpp
  57. +17 −7 indra/newview/llpanelnearbymedia.cpp
  58. +0 −1 indra/newview/llpanelnearbymedia.h
  59. +3 −2 indra/newview/llpanelprimmediacontrols.cpp
  60. +18 −10 indra/newview/llpreviewscript.cpp
  61. +1 −0 indra/newview/llspatialpartition.cpp
  62. +0 −2 indra/newview/llspatialpartition.h
  63. +5 −5 indra/newview/lltexturecache.cpp
  64. +1 −1 indra/newview/lltexturecache.h
  65. +1 −1 indra/newview/lltooldraganddrop.cpp
  66. +5 −5 indra/newview/llviewerobjectlist.h
  67. +17 −17 indra/newview/llvosky.h
View
@@ -1866,11 +1866,11 @@
<key>archive</key>
<map>
<key>hash</key>
- <string>6d832d5ed191e61c7aec6d8a10bb3062</string>
+ <string>0e7613b2e038e18488452c2a9882144d</string>
<key>hash_algorithm</key>
<string>md5</string>
<key>url</key>
- <string>http://depot.alchemyviewer.org/pub/linux64/lib-trusty/llceflib-3.2623.1395.g3034273-linux64-201603262117.tar.bz2</string>
+ <string>http://depot.alchemyviewer.org/pub/linux64/lib-trusty/llceflib-3.2526.1373.gb660893-linux64-201603281900.tar.bz2</string>
</map>
<key>name</key>
<string>linux64</string>
@@ -1905,7 +1905,7 @@
</map>
</map>
<key>version</key>
- <string>3.2623.1395.g3034273</string>
+ <string>3.2526.1373.gb660893</string>
</map>
<key>llphysicsextensions_stub</key>
<map>
@@ -308,11 +308,13 @@ if (STANDALONE)
else (STANDALONE)
set(${ARCH}_linux_INCLUDES
atk-1.0
+ cairo
glib-2.0
gdk-pixbuf-2.0
gstreamer-0.10
gtk-2.0
pango-1.0
+ pixman-1
)
endif (STANDALONE)
View
@@ -19,7 +19,11 @@ else (STANDALONE)
set(NDOF_LIBRARY ndofdev)
endif (WINDOWS)
- set(NDOF_INCLUDE_DIR ${ARCH_PREBUILT_DIRS}/include/ndofdev)
+ if (WINDOWS)
+ set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include)
+ else (WINDOWS)
+ set(NDOF_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/ndofdev)
+ endif (WINDOWS)
set(NDOF_FOUND 1)
endif (STANDALONE)
View
@@ -58,8 +58,6 @@ else (STANDALONE)
include_directories (
${LIBS_PREBUILT_DIR}/include
- ${LIBS_PREBUILT_DIR}/include/cairo
- ${LIBS_PREBUILT_DIR}/include/pixman-1
)
foreach(include ${${LL_ARCH}_INCLUDES})
include_directories(${LIBS_PREBUILT_DIR}/include/${include})
@@ -44,14 +44,6 @@ const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisa
// Maximum number of avatar picks
const S32 MAX_AVATAR_PICKS = 10;
-// For Flags in AvatarPropertiesReply
-const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
-const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
-const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
-const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
-const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
-const U32 AVATAR_AGEVERIFIED = 0x1 << 5; // whether avatar has been age-verified
-
char const* const VISIBILITY_DEFAULT = "default";
char const* const VISIBILITY_HIDDEN = "hidden";
char const* const VISIBILITY_VISIBLE = "visible";
@@ -1155,7 +1155,7 @@ bool LLImageTGA::loadFile( const std::string& path )
return false;
}
- S32 file_size = 0;
+ size_t file_size = 0;
if (!fseek(file, 0, SEEK_END))
{
file_size = ftell(file);
View
@@ -48,34 +48,34 @@
#define tanf(x) ((F32)tan((F64)(x)))
#endif*/
-const F32 GRAVITY = -9.8f;
+constexpr F32 GRAVITY = -9.8f;
// mathematical constants
-const F32 F_PI = 3.1415926535897932384626433832795f;
-const F32 F_TWO_PI = 6.283185307179586476925286766559f;
-const F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f;
-const F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f;
-const F32 F_E = 2.71828182845904523536f;
-const F32 F_SQRT2 = 1.4142135623730950488016887242097f;
-const F32 F_SQRT3 = 1.73205080756888288657986402541f;
-const F32 OO_SQRT2 = 0.7071067811865475244008443621049f;
-const F32 OO_SQRT3 = 0.577350269189625764509f;
-const F32 DEG_TO_RAD = 0.017453292519943295769236907684886f;
-const F32 RAD_TO_DEG = 57.295779513082320876798154814105f;
-const F32 F_APPROXIMATELY_ZERO = 0.00001f;
-const F32 F_LN10 = 2.3025850929940456840179914546844f;
-const F32 OO_LN10 = 0.43429448190325182765112891891661f;
-const F32 F_LN2 = 0.69314718056f;
-const F32 OO_LN2 = 1.4426950408889634073599246810019f;
-
-const F32 F_ALMOST_ZERO = 0.0001f;
-const F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO;
-
-const F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees
+constexpr F32 F_PI = 3.1415926535897932384626433832795f;
+constexpr F32 F_TWO_PI = 6.283185307179586476925286766559f;
+constexpr F32 F_PI_BY_TWO = 1.5707963267948966192313216916398f;
+constexpr F32 F_SQRT_TWO_PI = 2.506628274631000502415765284811f;
+constexpr F32 F_E = 2.71828182845904523536f;
+constexpr F32 F_SQRT2 = 1.4142135623730950488016887242097f;
+constexpr F32 F_SQRT3 = 1.73205080756888288657986402541f;
+constexpr F32 OO_SQRT2 = 0.7071067811865475244008443621049f;
+constexpr F32 OO_SQRT3 = 0.577350269189625764509f;
+constexpr F32 DEG_TO_RAD = 0.017453292519943295769236907684886f;
+constexpr F32 RAD_TO_DEG = 57.295779513082320876798154814105f;
+constexpr F32 F_APPROXIMATELY_ZERO = 0.00001f;
+constexpr F32 F_LN10 = 2.3025850929940456840179914546844f;
+constexpr F32 OO_LN10 = 0.43429448190325182765112891891661f;
+constexpr F32 F_LN2 = 0.69314718056f;
+constexpr F32 OO_LN2 = 1.4426950408889634073599246810019f;
+
+constexpr F32 F_ALMOST_ZERO = 0.0001f;
+constexpr F32 F_ALMOST_ONE = 1.0f - F_ALMOST_ZERO;
+
+constexpr F32 GIMBAL_THRESHOLD = 0.000436f; // sets the gimballock threshold 0.025 away from +/-90 degrees
// formula: GIMBAL_THRESHOLD = sin(DEG_TO_RAD * gimbal_threshold_angle);
// BUG: Eliminate in favor of F_APPROXIMATELY_ZERO above?
-const F32 FP_MAG_THRESHOLD = 0.0000001f;
+constexpr F32 FP_MAG_THRESHOLD = 0.0000001f;
// TODO: Replace with logic like is_approx_equal
inline bool is_approx_zero( F32 f ) { return (-F_APPROXIMATELY_ZERO < f) && (f < F_APPROXIMATELY_ZERO); }
@@ -112,13 +112,13 @@ inline bool is_zero(F32 x)
inline bool is_approx_equal(F32 x, F32 y)
{
- const S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
+ constexpr S32 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
return (std::abs((S32) ((U32&)x - (U32&)y) ) < COMPARE_MANTISSA_UP_TO_BIT);
}
inline bool is_approx_equal(F64 x, F64 y)
{
- const S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
+ constexpr S64 COMPARE_MANTISSA_UP_TO_BIT = 0x02;
return (std::abs((S32) ((U64&)x - (U64&)y) ) < COMPARE_MANTISSA_UP_TO_BIT);
}
@@ -195,17 +195,17 @@ inline F64 ll_round(F64 val, F64 nearest)
// peak error = -31.4 dB
// RMS error = -28.1 dB
-const F32 FAST_MAG_ALPHA = 0.960433870103f;
-const F32 FAST_MAG_BETA = 0.397824734759f;
+constexpr F32 FAST_MAG_ALPHA = 0.960433870103f;
+constexpr F32 FAST_MAG_BETA = 0.397824734759f;
// these provide minimum RMS error
//
// avg error = 0.000003
// peak error = -32.6 dB
// RMS error = -25.7 dB
//
-//const F32 FAST_MAG_ALPHA = 0.948059448969f;
-//const F32 FAST_MAG_BETA = 0.392699081699f;
+//constexpr F32 FAST_MAG_ALPHA = 0.948059448969f;
+//constexpr F32 FAST_MAG_BETA = 0.392699081699f;
inline F32 fastMagnitude(F32 a, F32 b)
{
@@ -222,8 +222,8 @@ inline F32 fastMagnitude(F32 a, F32 b)
//
// Culled from www.stereopsis.com/FPU.html
-const F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor
-const S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation,
+constexpr F64 LL_DOUBLE_TO_FIX_MAGIC = 68719476736.0*1.5; //2^36 * 1.5, (52-_shiftamt=36) uses limited precisicion to floor
+constexpr S32 LL_SHIFT_AMOUNT = 16; //16.16 fixed point representation,
// Endian dependent code
#ifdef LL_LITTLE_ENDIAN
@@ -53,8 +53,6 @@
# include "zlib/zlib.h"
#endif
-
-
std::string model_names[] =
{
"lowest_lod",
@@ -68,7 +66,7 @@ const int MODEL_NAMES_LENGTH = sizeof(model_names) / sizeof(std::string);
LLModel::LLModel(LLVolumeParams& params, F32 detail)
: LLVolume(params, detail), mNormalizedScale(1,1,1), mNormalizedTranslation(0,0,0)
- , mPelvisOffset( 0.0f ), mStatus(NO_ERRORS)
+ , mPelvisOffset( 0.0f ), mStatus(NO_ERRORS), mSubmodelID(0)
{
mDecompID = -1;
mLocalID = -1;
@@ -1909,7 +1907,7 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
weight_map::iterator best = iter_up;
- F32 min_dist = (iter->first - pos).magVec();
+ F32 min_dist = (iter_up->first - pos).magVec();
bool done = false;
while (!done)
@@ -2015,21 +2013,20 @@ bool LLModel::loadModel(std::istream& is)
}
}
- std::string nm[] =
- {
+ mSubmodelID = header.has("submodel_id") ? header["submodel_id"].asInteger() : false;
+
+ static const std::array<std::string, 5> lod_name = {{
"lowest_lod",
"low_lod",
"medium_lod",
"high_lod",
"physics_mesh",
- };
-
- const S32 MODEL_LODS = 5;
+ }};
- S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS);
+ S32 lod = llclamp((S32) mDetail, 0, (S32)lod_name.size() - 1);
- if (header[nm[lod]]["offset"].asInteger() == -1 ||
- header[nm[lod]]["size"].asInteger() == 0 )
+ if (header[lod_name[lod]]["offset"].asInteger() == -1 ||
+ header[lod_name[lod]]["size"].asInteger() == 0 )
{ //cannot load requested LOD
LL_WARNS() << "LoD data is invalid!" << LL_ENDL;
return false;
@@ -2038,23 +2035,23 @@ bool LLModel::loadModel(std::istream& is)
bool has_skin = header["skin"]["offset"].asInteger() >=0 &&
header["skin"]["size"].asInteger() > 0;
- if (lod == LLModel::LOD_HIGH)
+ if ((lod == LLModel::LOD_HIGH) && !mSubmodelID)
{ //try to load skin info and decomp info
std::ios::pos_type cur_pos = is.tellg();
loadSkinInfo(header, is);
is.seekg(cur_pos);
}
- if (lod == LLModel::LOD_HIGH || lod == LLModel::LOD_PHYSICS)
+ if ((lod == LLModel::LOD_HIGH || lod == LLModel::LOD_PHYSICS) && !mSubmodelID)
{
std::ios::pos_type cur_pos = is.tellg();
loadDecomposition(header, is);
is.seekg(cur_pos);
}
- is.seekg(header[nm[lod]]["offset"].asInteger(), std::ios_base::cur);
+ is.seekg(header[lod_name[lod]]["offset"].asInteger(), std::ios_base::cur);
- if (unpackVolumeFaces(is, header[nm[lod]]["size"].asInteger()))
+ if (unpackVolumeFaces(is, header[lod_name[lod]]["size"].asInteger()))
{
if (has_skin)
{
@@ -2112,16 +2109,18 @@ bool LLModel::isMaterialListSubset( LLModel* ref )
for (S32 dst = 0; dst < refCnt; ++dst)
{
- //LL_INFOS() <<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<LL_ENDL;
+ //LL_INFOS()<<mMaterialList[src]<<" "<<ref->mMaterialList[dst]<<LL_ENDL;
foundRef = mMaterialList[src] == ref->mMaterialList[dst];
if ( foundRef )
{
break;
}
}
+
if (!foundRef)
{
+ LL_INFOS() << "Could not find material " << mMaterialList[src] << " in reference model " << ref->mLabel << LL_ENDL;
return false;
}
}
@@ -2157,7 +2156,7 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
bool isASubset = isMaterialListSubset( ref );
if ( !isASubset )
{
- LL_INFOS() <<"Material of model is not a subset of reference."<<LL_ENDL;
+ LL_INFOS()<<"Material of model is not a subset of reference."<<LL_ENDL;
return false;
}
@@ -2172,41 +2171,42 @@ bool LLModel::matchMaterialOrder(LLModel* ref, int& refFaceCnt, int& modelFaceCn
for (U32 i = 0; i < mMaterialList.size(); i++)
{
index_map[ref->mMaterialList[i]] = i;
- if (!reorder)
- { //if any material name does not match reference, we need to reorder
- reorder = ref->mMaterialList[i] != mMaterialList[i];
- }
+ //if any material name does not match reference, we need to reorder
+ reorder |= ref->mMaterialList[i] != mMaterialList[i];
base_mat.insert(ref->mMaterialList[i]);
cur_mat.insert(mMaterialList[i]);
}
- if (reorder &&
- base_mat == cur_mat) //don't reorder if material name sets don't match
+ if (reorder && (base_mat == cur_mat)) //don't reorder if material name sets don't match
{
std::vector<LLVolumeFace> new_face_list;
- new_face_list.resize(mVolumeFaces.size());
+ new_face_list.resize(mMaterialList.size());
std::vector<std::string> new_material_list;
- new_material_list.resize(mVolumeFaces.size());
+ new_material_list.resize(mMaterialList.size());
//rebuild face list so materials have the same order
//as the reference model
for (U32 i = 0; i < mMaterialList.size(); ++i)
{
U32 ref_idx = index_map[mMaterialList[i]];
- new_face_list[ref_idx] = mVolumeFaces[i];
+ if (i < mVolumeFaces.size())
+ {
+ new_face_list[ref_idx] = mVolumeFaces[i];
+ }
new_material_list[ref_idx] = mMaterialList[i];
}
llassert(new_material_list == ref->mMaterialList);
mVolumeFaces = new_face_list;
- }
- //override material list with reference model ordering
- mMaterialList = ref->mMaterialList;
+ //override material list with reference model ordering
+ mMaterialList = ref->mMaterialList;
+ }
+
return true;
}
@@ -2237,7 +2237,7 @@ bool LLModel::loadDecomposition(LLSD& header, std::istream& is)
S32 offset = header["physics_convex"]["offset"].asInteger();
S32 size = header["physics_convex"]["size"].asInteger();
- if (offset >= 0 && size > 0)
+ if (offset >= 0 && size > 0 && !mSubmodelID)
{
is.seekg(offset, std::ios_base::cur);
@@ -181,7 +181,11 @@ class LLModel : public LLVolume
bool isMaterialListSubset( LLModel* ref );
bool needToAddFaces( LLModel* ref, int& refFaceCnt, int& modelFaceCnt );
- std::vector<std::string> mMaterialList;
+ typedef std::vector<std::string> material_list;
+
+ material_list mMaterialList;
+
+ material_list& getMaterialList() { return mMaterialList; }
//data used for skin weights
class JointWeight
@@ -274,6 +278,8 @@ class LLModel : public LLVolume
Decomposition mPhysics;
EModelStatus mStatus ;
+
+ int mSubmodelID;
protected:
void addVolumeFacesFromDomMesh(domMesh* mesh);
virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh);
Oops, something went wrong.

0 comments on commit 2653567

Please sign in to comment.