summaryrefslogtreecommitdiff
path: root/indra/llprimitive/llmodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llprimitive/llmodel.h')
-rw-r--r--indra/llprimitive/llmodel.h119
1 files changed, 74 insertions, 45 deletions
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index a91c80d5b7..b81bc662a0 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -2,30 +2,25 @@
* @file llmodel.h
* @brief Model handling class definitions
*
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- *
- * Copyright (c) 2001-2007, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -36,8 +31,6 @@
#include "v4math.h"
#include "m4math.h"
-#if LL_MESH_ENABLED
-
class daeElement;
class domMesh;
@@ -57,14 +50,52 @@ public:
NUM_LODS
};
- //physics shape is a vector of convex hulls
+ //convex_hull_decomposition is a vector of convex hulls
//each convex hull is a set of points
- typedef std::vector<std::vector<LLVector3> > physics_shape;
+ typedef std::vector<std::vector<LLVector3> > convex_hull_decomposition;
+ typedef std::vector<LLVector3> hull;
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 writeModelToStream(std::ostream& ostr, LLSD& mdl, BOOL nowrite = FALSE);
+ static LLSD writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* imposotr,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ const LLModel::hull& base_hull,
+ BOOL upload_skin,
+ BOOL upload_joints,
+ BOOL nowrite = FALSE);
+ static LLSD writeModel(
+ std::string filename,
+ LLModel* physics,
+ LLModel* high,
+ LLModel* medium,
+ LLModel* low,
+ LLModel* imposotr,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ 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,
+ const LLModel::convex_hull_decomposition& convex_hull_decomposition,
+ const LLModel::hull& base_hull,
+ 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);
static LLModel* loadModelFromDomMesh(domMesh* mesh);
@@ -74,23 +105,22 @@ public:
void appendFace(const LLVolumeFace& src_face, std::string src_material, LLMatrix4& mat, LLMatrix4& norm_mat);
void setNumVolumeFaces(S32 count);
- void setVolumeFaceData(S32 f,
- LLStrider<LLVector3> pos,
- LLStrider<LLVector3> norm,
- LLStrider<LLVector2> tc,
- LLStrider<U16> ind,
- U32 num_verts,
- U32 num_indices);
+ void setVolumeFaceData(
+ S32 f,
+ LLStrider<LLVector3> pos,
+ LLStrider<LLVector3> norm,
+ LLStrider<LLVector2> tc,
+ LLStrider<U16> ind,
+ U32 num_verts,
+ U32 num_indices);
- void smoothNormals(F32 angle_cutoff);
+ void generateNormals(F32 angle_cutoff);
void addFace(const LLVolumeFace& face);
void normalizeVolumeFaces();
void optimizeVolumeFaces();
-
- U32 getResourceCost();
void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out);
std::vector<std::string> mMaterialList;
@@ -154,18 +184,20 @@ public:
LLMatrix4 mBindShapeMatrix;
std::vector<LLMatrix4> mInvBindMatrix;
-
+ std::vector<LLMatrix4> mAlternateBindMatrix;
std::string mLabel;
LLVector3 mNormalizedScale;
LLVector3 mNormalizedTranslation;
- //physics shape
- physics_shape mPhysicsShape;
+ // convex hull decomposition
+ convex_hull_decomposition mConvexHullDecomp;
+ void setConvexHullDecomposition(
+ const convex_hull_decomposition& decomp);
- LLVector3 mPhysicsCenter;
+ LLVector3 mCenterOfHullCenters;
std::vector<LLVector3> mHullCenter;
- U32 mPhysicsPoints;
+ U32 mHullPoints;
protected:
void addVolumeFacesFromDomMesh(domMesh* mesh);
@@ -173,7 +205,4 @@ protected:
virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh);
};
-
-#endif
-
#endif //LL_LLMODEL_H