summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive/llmodel.h')
-rwxr-xr-xindra/llprimitive/llmodel.h79
1 files changed, 64 insertions, 15 deletions
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index addf527d8d..e9450d2967 100755
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -27,6 +27,7 @@
#ifndef LL_LLMODEL_H
#define LL_LLMODEL_H
+#include "llpointer.h"
#include "llvolume.h"
#include "v4math.h"
#include "m4math.h"
@@ -36,6 +37,24 @@ class domMesh;
#define MAX_MODEL_FACES 8
+
+class LLMeshSkinInfo
+{
+public:
+ LLUUID mMeshID;
+ std::vector<std::string> mJointNames;
+ std::vector<LLMatrix4> mInvBindMatrix;
+ std::vector<LLMatrix4> mAlternateBindMatrix;
+ std::map<std::string, U32> mJointMap;
+
+ LLMeshSkinInfo() { }
+ LLMeshSkinInfo(LLSD& data);
+ void fromLLSD(LLSD& data);
+ LLSD asLLSD(bool include_joints) const;
+ LLMatrix4 mBindShapeMatrix;
+ float mPelvisOffset;
+};
+
class LLModel : public LLVolume
{
public:
@@ -58,6 +77,9 @@ public:
LLModel(LLVolumeParams& params, F32 detail);
~LLModel();
+ bool loadModel(std::istream& is);
+ bool loadSkinInfo(LLSD& header, std::istream& is);
+ bool loadDecomposition(LLSD& header, std::istream& is);
static LLSD writeModel(
std::string filename,
LLModel* physics,
@@ -98,8 +120,6 @@ public:
LLSD& mdl,
BOOL nowrite = FALSE);
- static LLModel* loadModelFromAsset(std::string filename, S32 lod);
- static LLModel* loadModelFromDae(std::string filename);
static LLModel* loadModelFromDomMesh(domMesh* mesh);
static std::string getElementLabel(daeElement* element);
std::string getName() const;
@@ -177,17 +197,8 @@ public:
//get list of weight influences closest to given position
weight_list& getJointInfluences(const LLVector3& pos);
- //should always be true that mJointList[mJointMap["foo"]] == "foo"
-
- //map of joint names to joint index
- std::map<std::string, U32> mJointMap;
-
- //list of joint names
- std::vector<std::string> mJointList;
-
- LLMatrix4 mBindShapeMatrix;
- std::vector<LLMatrix4> mInvBindMatrix;
- std::vector<LLMatrix4> mAlternateBindMatrix;
+ LLMeshSkinInfo mSkinInfo;
+
std::string mRequestedLabel; // name requested in UI, if any.
std::string mLabel; // name computed from dae.
@@ -197,9 +208,10 @@ public:
float mPelvisOffset;
// convex hull decomposition
S32 mDecompID;
- convex_hull_decomposition mConvexHullDecomp;
+
void setConvexHullDecomposition(
const convex_hull_decomposition& decomp);
+ void updateHullCenters();
LLVector3 mCenterOfHullCenters;
std::vector<LLVector3> mHullCenter;
@@ -208,9 +220,46 @@ public:
//ID for storing this model in a .slm file
S32 mLocalID;
+ class PhysicsMesh
+ {
+ public:
+ std::vector<LLVector3> mPositions;
+ std::vector<LLVector3> mNormals;
+
+ void clear()
+ {
+ mPositions.clear();
+ mNormals.clear();
+ }
+
+ bool empty() const
+ {
+ return mPositions.empty();
+ }
+ };
+
+ class Decomposition
+ {
+ public:
+ Decomposition() { }
+ Decomposition(LLSD& data);
+ void fromLLSD(LLSD& data);
+
+ void merge(const Decomposition* rhs);
+
+ LLUUID mMeshID;
+ LLModel::convex_hull_decomposition mHull;
+ LLModel::hull mBaseHull;
+
+ std::vector<LLModel::PhysicsMesh> mMesh;
+ LLModel::PhysicsMesh mBaseHullMesh;
+ LLModel::PhysicsMesh mPhysicsShapeMesh;
+ };
+
+ Decomposition mPhysics;
+
protected:
void addVolumeFacesFromDomMesh(domMesh* mesh);
- virtual BOOL createVolumeFacesFromFile(const std::string& file_name);
virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh);
};