summaryrefslogtreecommitdiff
path: root/indra/llprimitive
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive')
-rw-r--r--indra/llprimitive/llmodel.cpp25
-rw-r--r--indra/llprimitive/llmodel.h6
-rw-r--r--indra/llprimitive/tests/llmediaentry_test.cpp2
-rw-r--r--indra/llprimitive/tests/llprimitive_test.cpp2
4 files changed, 25 insertions, 10 deletions
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 349c844470..9e3d9704ae 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -1288,11 +1288,11 @@ LLModel* LLModel::loadModelFromDomMesh(domMesh *mesh)
}
//static
-LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, BOOL nowrite)
+LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, bool upload_skin, bool upload_joints, bool nowrite)
{
std::ofstream os(filename.c_str(), std::ofstream::out | std::ofstream::binary);
- LLSD header = writeModel(os, physics, high, medium, low, impostor, decomp, nowrite);
+ LLSD header = writeModel(os, physics, high, medium, low, impostor, decomp, upload_skin, upload_joints, nowrite);
os.close();
@@ -1300,7 +1300,7 @@ LLSD LLModel::writeModel(std::string filename, LLModel* physics, LLModel* high,
}
//static
-LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, BOOL nowrite)
+LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* impostor, LLModel::physics_shape& decomp, bool upload_skin, bool upload_joints, bool nowrite)
{
LLSD mdl;
@@ -1313,7 +1313,7 @@ LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LL
physics
};
- bool skinning = high && !high->mSkinWeights.empty();
+ bool skinning = upload_skin && high && !high->mSkinWeights.empty();
if (skinning)
{ //write skinning block
@@ -1342,6 +1342,21 @@ LLSD LLModel::writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LL
mdl["skin"]["bind_shape_matrix"][i*4+j] = high->mBindShapeMatrix.mMatrix[i][j];
}
}
+
+ if ( upload_joints && high->mAlternateBindMatrix.size() > 0 )
+ {
+ for (U32 i = 0; i < high->mJointList.size(); ++i)
+ {
+ for (U32 j = 0; j < 4; j++)
+ {
+ for (U32 k = 0; k < 4; k++)
+ {
+ mdl["skin"]["alt_inverse_bind_matrix"][i][j*4+k] = high->mAlternateBindMatrix[i].mMatrix[j][k];
+ }
+ }
+ }
+ }
+
}
if (!decomp.empty())
@@ -1645,7 +1660,7 @@ LLSD LLModel::writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite)
if (!nowrite)
{
- LLSDSerialize::serialize(header, ostr, LLSDSerialize::LLSD_BINARY);
+ LLSDSerialize::toBinary(header, ostr);
if (!skin.empty())
{ //write skin block
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index ea703d7228..e6696b984f 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -60,8 +60,8 @@ public:
typedef std::vector<std::vector<LLVector3> > physics_shape;
LLModel(LLVolumeParams& params, F32 detail);
- static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, BOOL nowrite = FALSE);
- static LLSD writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, BOOL nowrite = FALSE);
+ static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
+ static LLSD writeModel(std::ostream& ostr, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, bool upload_skin, bool upload_joints, bool nowrite = FALSE);
static LLSD writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite = FALSE);
static LLModel* loadModelFromAsset(std::string filename, S32 lod);
static LLModel* loadModelFromDae(std::string filename);
@@ -152,7 +152,7 @@ public:
LLMatrix4 mBindShapeMatrix;
std::vector<LLMatrix4> mInvBindMatrix;
-
+ std::vector<LLMatrix4> mAlternateBindMatrix;
std::string mLabel;
LLVector3 mNormalizedScale;
diff --git a/indra/llprimitive/tests/llmediaentry_test.cpp b/indra/llprimitive/tests/llmediaentry_test.cpp
index 88cd96ebe4..1fe0e722e2 100644
--- a/indra/llprimitive/tests/llmediaentry_test.cpp
+++ b/indra/llprimitive/tests/llmediaentry_test.cpp
@@ -152,7 +152,7 @@ namespace tut
namespace
{
// this is for naming our tests to make pretty output
- tut::factory tf("MediaEntry Test");
+ tut::factory tf("LLMediaEntry");
}
namespace tut
diff --git a/indra/llprimitive/tests/llprimitive_test.cpp b/indra/llprimitive/tests/llprimitive_test.cpp
index 1805a9e968..590b97645f 100644
--- a/indra/llprimitive/tests/llprimitive_test.cpp
+++ b/indra/llprimitive/tests/llprimitive_test.cpp
@@ -79,7 +79,7 @@ namespace tut
typedef test_group<llprimitive> llprimitive_t;
typedef llprimitive_t::object llprimitive_object_t;
- tut::llprimitive_t tut_llprimitive("llprimitive");
+ tut::llprimitive_t tut_llprimitive("LLPrimitive");
template<> template<>
void llprimitive_object_t::test<1>()