Merge branch 'master' of git://github.com/Shyotl/SingularityViewer into ManagedMarketplace

This commit is contained in:
Lirusaito
2019-03-17 00:22:55 -04:00
33 changed files with 1043 additions and 380 deletions

View File

@@ -110,9 +110,9 @@ void LLModel::optimizeVolumeFaces()
{
for (U32 i = 0; i < (U32)getNumVolumeFaces(); ++i)
{
validate_face(mVolumeFaces[i]);
//validate_face(mVolumeFaces[i]);
mVolumeFaces[i].optimize();
validate_face(mVolumeFaces[i]);
//validate_face(mVolumeFaces[i]);
}
}
@@ -161,11 +161,11 @@ void LLModel::sortVolumeFacesByMaterialName()
mVolumeFaces = new_faces;
}
void LLModel::trimVolumeFacesToSize(S32 new_count, LLVolume::face_list_t* remainder)
void LLModel::trimVolumeFacesToSize(U32 new_count, LLVolume::face_list_t* remainder)
{
llassert(new_count <= LL_SCULPT_MESH_MAX_FACES);
if (new_count && (getNumVolumeFaces() > new_count))
if (new_count && ((U32)getNumVolumeFaces() > new_count))
{
// Copy out remaining volume faces for alternative handling, if provided
//
@@ -407,40 +407,6 @@ void LLModel::setVolumeFaceData(
LLVector4a::memcpyNonAliased16((F32*) face.mIndices, (F32*) ind.get(), size);
}
void LLModel::appendFaces(LLModel *model, LLMatrix4 &transform, LLMatrix4& norm_mat)
{
if (mVolumeFaces.empty())
{
setNumVolumeFaces(1);
}
LLVolumeFace& face = mVolumeFaces[mVolumeFaces.size()-1];
for (S32 i = 0; i < model->getNumFaces(); ++i)
{
face.appendFace(model->getVolumeFace(i), transform, norm_mat);
}
}
void LLModel::appendFace(const LLVolumeFace& src_face, std::string src_material, LLMatrix4& mat, LLMatrix4& norm_mat)
{
S32 rindex = getNumVolumeFaces()-1;
if (rindex == -1 ||
mVolumeFaces[rindex].mNumVertices + src_face.mNumVertices >= 65536)
{ //empty or overflow will occur, append new face
LLVolumeFace cur_face;
cur_face.appendFace(src_face, mat, norm_mat);
addFace(cur_face);
mMaterialList.push_back(src_material);
}
else
{ //append to existing end face
mVolumeFaces.rbegin()->appendFace(src_face, mat, norm_mat);
}
}
void LLModel::addFace(const LLVolumeFace& face)
{
if (face.mNumVertices == 0)
@@ -523,9 +489,9 @@ void LLModel::generateNormals(F32 angle_cutoff)
}
//weld vertices in temporary face, respecting angle_cutoff (step 2)
validate_face(faceted);
//validate_face(faceted);
faceted.optimize(angle_cutoff);
validate_face(faceted);
//validate_face(faceted);
//generate normals for welded face based on new topology (step 3)
@@ -657,9 +623,9 @@ void LLModel::generateNormals(F32 angle_cutoff)
}
//remove redundant vertices from new face (step 6)
validate_face(new_face);
//validate_face(new_face);
new_face.optimize();
validate_face(new_face);
//validate_face(new_face);
mVolumeFaces[j] = new_face;
}
@@ -1043,12 +1009,14 @@ LLModel::weight_list& LLModel::getJointInfluences(const LLVector3& pos)
{ //no exact match found, get closest point
const F32 epsilon = 1e-5f;
weight_map::iterator iter_up = mSkinWeights.lower_bound(pos);
weight_map::iterator iter_down = ++iter_up;
weight_map::iterator iter_down = iter_up;
if (iter_up != mSkinWeights.end())
{
iter_down = ++iter_up;
}
weight_map::iterator best = iter_up;
// iter == mSkinWeights.end()...
F32 min_dist = (iter_up->first - pos).magVec();
F32 min_dist = (iter->first - pos).magVec();
bool done = false;
while (!done)
@@ -1399,14 +1367,16 @@ bool LLModel::loadDecomposition(LLSD& header, std::istream& is)
LLMeshSkinInfo::LLMeshSkinInfo():
mPelvisOffset(0.0),
mLockScaleIfJointPosition(false),
mInvalidJointsScrubbed(false)
mInvalidJointsScrubbed(false),
mJointNumsInitialized(false)
{
}
LLMeshSkinInfo::LLMeshSkinInfo(LLSD& skin):
mPelvisOffset(0.0),
mLockScaleIfJointPosition(false),
mInvalidJointsScrubbed(false)
mInvalidJointsScrubbed(false),
mJointNumsInitialized(false)
{
fromLLSD(skin);
}

View File

@@ -57,6 +57,7 @@ public:
float mPelvisOffset;
bool mLockScaleIfJointPosition;
bool mInvalidJointsScrubbed;
bool mJointNumsInitialized;
};
class LLModel : public LLVolume
@@ -158,9 +159,6 @@ public:
EModelStatus getStatus() const {return mStatus;}
static std::string getStatusString(U32 status) ;
void appendFaces(LLModel* model, LLMatrix4& transform, LLMatrix4& normal_transform);
void appendFace(const LLVolumeFace& src_face, std::string src_material, LLMatrix4& mat, LLMatrix4& norm_mat);
void setNumVolumeFaces(S32 count);
void setVolumeFaceData(
S32 f,
@@ -177,7 +175,7 @@ public:
void sortVolumeFacesByMaterialName();
void normalizeVolumeFaces();
void trimVolumeFacesToSize(S32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL);
void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL);
void optimizeVolumeFaces();
void offsetMesh( const LLVector3& pivotPoint );
void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out);

View File

@@ -81,6 +81,7 @@ public:
GENERATING_VERTEX_BUFFERS,
GENERATING_LOD,
DONE,
WARNING_BIND_SHAPE_ORIENTATION,
ERROR_PARSING, //basically loading failed
ERROR_MATERIALS,
ERROR_PASSWORD_REQUIRED,

View File

@@ -175,7 +175,7 @@ LLPrimitive::~LLPrimitive()
{
clearTextureList();
// Cleanup handled by volume manager
if (mVolumep)
if (mVolumep && sVolumeManager)
{
sVolumeManager->unrefVolume(mVolumep);
}
@@ -586,7 +586,7 @@ U8 LLPrimitive::pCodeToLegacy(const LLPCode pcode)
// static
// Don't crash or llerrs here! This function is used for debug strings.
// Don't crash or LL_ERRS() here! This function is used for debug strings.
std::string LLPrimitive::pCodeToString(const LLPCode pcode)
{
std::string pcode_string;
@@ -729,6 +729,16 @@ S32 face_index_from_id(LLFaceID face_ID, const std::vector<LLProfile::Face>& fac
BOOL LLPrimitive::setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume)
{
if (NO_LOD == detail)
{
// build the new object
setChanged(GEOMETRY);
sVolumeManager->unrefVolume(mVolumep);
mVolumep = new LLVolume(volume_params, 1, TRUE, TRUE);
setNumTEs(mVolumep->getNumFaces());
return FALSE;
}
LLVolume *volumep;
if (unique_volume)
{
@@ -1577,6 +1587,8 @@ BOOL LLNetworkData::isValid(U16 param_type, U32 size)
return (size == 17);
case PARAMS_LIGHT_IMAGE:
return (size == 28);
case PARAMS_EXTENDED_MESH:
return (size == 4);
}
return FALSE;
@@ -2004,3 +2016,67 @@ bool LLLightImageParams::fromLLSD(LLSD& sd)
return false;
}
//============================================================================
LLExtendedMeshParams::LLExtendedMeshParams()
{
mType = PARAMS_EXTENDED_MESH;
mFlags = 0;
}
BOOL LLExtendedMeshParams::pack(LLDataPacker &dp) const
{
dp.packU32(mFlags, "flags");
return TRUE;
}
BOOL LLExtendedMeshParams::unpack(LLDataPacker &dp)
{
dp.unpackU32(mFlags, "flags");
return TRUE;
}
bool LLExtendedMeshParams::operator==(const LLNetworkData& data) const
{
if (data.mType != PARAMS_EXTENDED_MESH)
{
return false;
}
const LLExtendedMeshParams *param = (const LLExtendedMeshParams*)&data;
if ( (param->mFlags != mFlags) )
{
return false;
}
return true;
}
void LLExtendedMeshParams::copy(const LLNetworkData& data)
{
const LLExtendedMeshParams *param = (LLExtendedMeshParams*)&data;
mFlags = param->mFlags;
}
LLSD LLExtendedMeshParams::asLLSD() const
{
LLSD sd;
sd["flags"] = LLSD::Integer(mFlags);
return sd;
}
bool LLExtendedMeshParams::fromLLSD(LLSD& sd)
{
if (sd.has("flags"))
{
setFlags( sd["flags"].asInteger());
return true;
}
return false;
}

View File

@@ -106,6 +106,7 @@ public:
PARAMS_LIGHT_IMAGE = 0x40,
PARAMS_RESERVED = 0x50, // Used on server-side
PARAMS_MESH = 0x60,
PARAMS_EXTENDED_MESH = 0x70,
};
public:
@@ -288,6 +289,27 @@ public:
};
class LLExtendedMeshParams : public LLNetworkData
{
protected:
U32 mFlags;
public:
static const U32 ANIMATED_MESH_ENABLED_FLAG = 0x1 << 0;
LLExtendedMeshParams();
/*virtual*/ BOOL pack(LLDataPacker &dp) const;
/*virtual*/ BOOL unpack(LLDataPacker &dp);
/*virtual*/ bool operator==(const LLNetworkData& data) const;
/*virtual*/ void copy(const LLNetworkData& data);
LLSD asLLSD() const;
operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd);
void setFlags(const U32& flags) { mFlags = flags; }
U32 getFlags() const { return mFlags; }
};
// This code is not naming-standards compliant. Leaving it like this for
// now to make the connection to code in
@@ -308,9 +330,9 @@ struct LLTEContents
S16 image_rot[MAX_TES];
U8 bump[MAX_TES];
U8 media_flags[MAX_TES];
U8 glow[MAX_TES];
U8 glow[MAX_TES];
LLMaterialID material_ids[MAX_TES];
static const U32 MAX_TE_BUFFER = 4096;
U8 packed_buffer[MAX_TE_BUFFER];
@@ -483,6 +505,11 @@ protected:
U32 mMiscFlags; // home for misc bools
static LLVolumeMgr* sVolumeManager;
enum
{
NO_LOD = -1
};
};
inline BOOL LLPrimitive::isAvatar() const