line ending fixes

meow-7.2.2
Brad Payne (Vir Linden) 2011-03-30 10:49:14 -04:00
parent 865efe9af6
commit 73bf43b593
2 changed files with 99 additions and 99 deletions

View File

@ -1909,99 +1909,99 @@ void LLModel::updateHullCenters()
mCenterOfHullCenters *= 1.f / mHullPoints;
}
bool LLModel::loadModel(std::istream& is)
{
mSculptLevel = -1; // default is an error occured
LLSD header;
{
if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024))
{
llwarns << "Mesh header parse error. Not a valid mesh asset!" << llendl;
return false;
}
}
std::string nm[] =
{
"lowest_lod",
"low_lod",
"medium_lod",
"high_lod",
"physics_shape",
};
const S32 MODEL_LODS = 5;
S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS);
if (header[nm[lod]]["offset"].asInteger() == -1 ||
header[nm[lod]]["size"].asInteger() == 0 )
{ //cannot load requested LOD
return false;
}
bool has_skin = header["skin"]["offset"].asInteger() >=0 &&
header["skin"]["size"].asInteger() > 0;
if (lod == LLModel::LOD_HIGH)
{ //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_PHYSICS)
{
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);
if (unpackVolumeFaces(is, header[nm[lod]]["size"].asInteger()))
{
if (has_skin)
{
//build out mSkinWeight from face info
for (S32 i = 0; i < getNumVolumeFaces(); ++i)
{
const LLVolumeFace& face = getVolumeFace(i);
if (face.mWeights)
{
for (S32 j = 0; j < face.mNumVertices; ++j)
{
LLVector4a& w = face.mWeights[j];
std::vector<JointWeight> wght;
for (S32 k = 0; k < 4; ++k)
{
S32 idx = (S32) w[k];
F32 f = w[k] - idx;
if (f > 0.f)
{
wght.push_back(JointWeight(idx, f));
}
}
if (!wght.empty())
{
LLVector3 pos(face.mPositions[j].getF32ptr());
mSkinWeights[pos] = wght;
}
}
}
}
}
return true;
}
return false;
}
bool LLModel::loadModel(std::istream& is)
{
mSculptLevel = -1; // default is an error occured
LLSD header;
{
if (!LLSDSerialize::fromBinary(header, is, 1024*1024*1024))
{
llwarns << "Mesh header parse error. Not a valid mesh asset!" << llendl;
return false;
}
}
std::string nm[] =
{
"lowest_lod",
"low_lod",
"medium_lod",
"high_lod",
"physics_shape",
};
const S32 MODEL_LODS = 5;
S32 lod = llclamp((S32) mDetail, 0, MODEL_LODS);
if (header[nm[lod]]["offset"].asInteger() == -1 ||
header[nm[lod]]["size"].asInteger() == 0 )
{ //cannot load requested LOD
return false;
}
bool has_skin = header["skin"]["offset"].asInteger() >=0 &&
header["skin"]["size"].asInteger() > 0;
if (lod == LLModel::LOD_HIGH)
{ //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_PHYSICS)
{
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);
if (unpackVolumeFaces(is, header[nm[lod]]["size"].asInteger()))
{
if (has_skin)
{
//build out mSkinWeight from face info
for (S32 i = 0; i < getNumVolumeFaces(); ++i)
{
const LLVolumeFace& face = getVolumeFace(i);
if (face.mWeights)
{
for (S32 j = 0; j < face.mNumVertices; ++j)
{
LLVector4a& w = face.mWeights[j];
std::vector<JointWeight> wght;
for (S32 k = 0; k < 4; ++k)
{
S32 idx = (S32) w[k];
F32 f = w[k] - idx;
if (f > 0.f)
{
wght.push_back(JointWeight(idx, f));
}
}
if (!wght.empty())
{
LLVector3 pos(face.mPositions[j].getF32ptr());
mSkinWeights[pos] = wght;
}
}
}
}
}
return true;
}
return false;
}
bool LLModel::loadSkinInfo(LLSD& header, std::istream &is)

View File

@ -3475,10 +3475,10 @@ LLSD LLImportMaterial::asLLSD()
void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
{
decomp.mMesh.resize(decomp.mHull.size());
for (U32 i = 0; i < decomp.mHull.size(); ++i)
{
decomp.mMesh.resize(decomp.mHull.size());
for (U32 i = 0; i < decomp.mHull.size(); ++i)
{
LLCDHull hull;
hull.mNumVertices = decomp.mHull[i].size();
hull.mVertexBase = decomp.mHull[i][0].mV;
@ -3492,8 +3492,8 @@ void LLMeshRepository::buildPhysicsMesh(LLModel::Decomposition& decomp)
}
if (res == LLCD_OK)
{
get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]);
}
get_vertex_buffer_from_mesh(mesh, decomp.mMesh[i]);
}
}
if (!decomp.mBaseHull.empty() && decomp.mBaseHullMesh.empty())