From 71de5f622a7917f78823a7e7840194e1b0f8f070 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 26 Aug 2010 14:23:12 -0500 Subject: Add missing files from viewer-experimental --- indra/llprimitive/llmodel.h | 179 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 indra/llprimitive/llmodel.h (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h new file mode 100644 index 0000000000..a91c80d5b7 --- /dev/null +++ b/indra/llprimitive/llmodel.h @@ -0,0 +1,179 @@ +/** + * @file llmodel.h + * @brief Model handling class definitions + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2007, Linden Research, Inc. + * + * 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 + * + * 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 + * + * 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. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#ifndef LL_LLMODEL_H +#define LL_LLMODEL_H + +#include "llvolume.h" +#include "v4math.h" +#include "m4math.h" + +#if LL_MESH_ENABLED + +class daeElement; +class domMesh; + +#define MAX_MODEL_FACES 8 + +class LLModel : public LLVolume +{ +public: + + enum + { + LOD_IMPOSTOR = 0, + LOD_LOW, + LOD_MEDIUM, + LOD_HIGH, + LOD_PHYSICS, + NUM_LODS + }; + + //physics shape is a vector of convex hulls + //each convex hull is a set of points + typedef std::vector > 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 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); + static std::string getElementLabel(daeElement* element); + + 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, + LLStrider pos, + LLStrider norm, + LLStrider tc, + LLStrider ind, + U32 num_verts, + U32 num_indices); + + void smoothNormals(F32 angle_cutoff); + + void addFace(const LLVolumeFace& face); + + void normalizeVolumeFaces(); + void optimizeVolumeFaces(); + + + U32 getResourceCost(); + void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out); + std::vector mMaterialList; + + //data used for skin weights + class JointWeight + { + public: + S32 mJointIdx; + F32 mWeight; + + JointWeight() + { + mJointIdx = 0; + mWeight = 0.f; + } + + JointWeight(S32 idx, F32 weight) + : mJointIdx(idx), mWeight(weight) + { + } + + bool operator<(const JointWeight& rhs) const + { + if (mWeight == rhs.mWeight) + { + return mJointIdx < rhs.mJointIdx; + } + + return mWeight < rhs.mWeight; + } + + }; + + struct CompareWeightGreater + { + bool operator()(const JointWeight& lhs, const JointWeight& rhs) + { + return rhs < lhs; // strongest = first + } + }; + + //copy of position array for this model -- mPosition[idx].mV[X,Y,Z] + std::vector mPosition; + + //map of positions to skin weights --- mSkinWeights[pos].mV[0..4] == . + //joint_index corresponds to mJointList + typedef std::vector weight_list; + typedef std::map weight_map; + weight_map mSkinWeights; + + //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 mJointMap; + + //list of joint names + std::vector mJointList; + + LLMatrix4 mBindShapeMatrix; + std::vector mInvBindMatrix; + + std::string mLabel; + + LLVector3 mNormalizedScale; + LLVector3 mNormalizedTranslation; + + //physics shape + physics_shape mPhysicsShape; + + LLVector3 mPhysicsCenter; + std::vector mHullCenter; + U32 mPhysicsPoints; + +protected: + void addVolumeFacesFromDomMesh(domMesh* mesh); + virtual BOOL createVolumeFacesFromFile(const std::string& file_name); + virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); +}; + + +#endif + +#endif //LL_LLMODEL_H -- cgit v1.2.3 From 90e3d83a5cb35e98a02a3017dd79ebc272bbfe85 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 21 Sep 2010 13:26:52 -0400 Subject: Fix for build failures - disabling tcmalloc for now --- indra/llprimitive/llmodel.h | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 indra/llprimitive/llmodel.h (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h old mode 100644 new mode 100755 -- cgit v1.2.3 From cf09d6c58a741263cddcf338c2f79836873475b1 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 22 Sep 2010 03:04:21 -0500 Subject: Remove LL_MESH_ENABLED macros (fixes drag and drop). Add mesh stitching type back into tools floater. --- indra/llprimitive/llmodel.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index a91c80d5b7..ea703d7228 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -36,8 +36,6 @@ #include "v4math.h" #include "m4math.h" -#if LL_MESH_ENABLED - class daeElement; class domMesh; @@ -173,7 +171,4 @@ protected: virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); }; - -#endif - #endif //LL_LLMODEL_H -- cgit v1.2.3 From c7f5a9419b4b93efdc04ebfbb8e05a2ef0e09142 Mon Sep 17 00:00:00 2001 From: prep linden Date: Fri, 24 Sep 2010 13:11:53 -0400 Subject: Added support for joint offsets --- indra/llprimitive/llmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ea703d7228..ff22d39e60 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -152,7 +152,7 @@ public: LLMatrix4 mBindShapeMatrix; std::vector mInvBindMatrix; - + std::vector mAlternateBindMatrix; std::string mLabel; LLVector3 mNormalizedScale; -- cgit v1.2.3 From 613894c8cca25f9fa86da7056da3594fe8771d46 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 28 Sep 2010 13:45:42 -0500 Subject: SH-238 Add check boxes to upload skin weights (or not) and/or joint positions (or not). Remove llfloaterimportcollada Reviewed by Prep. --- indra/llprimitive/llmodel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ff22d39e60..e6696b984f 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -60,8 +60,8 @@ public: typedef std::vector > 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); -- cgit v1.2.3 From 87a9f475756d54d9d98c8cbb6395f89d6fc4606a Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 5 Oct 2010 16:49:05 -0500 Subject: Rewrite LLPhysicsDecomp to have a more generic callback system. Reviewed by prep. --- indra/llprimitive/llmodel.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index e6696b984f..ec21ef2fcd 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -160,6 +160,7 @@ public: //physics shape physics_shape mPhysicsShape; + void setPhysicsShape(const physics_shape& shape); LLVector3 mPhysicsCenter; std::vector mHullCenter; -- cgit v1.2.3 From 24e0d62a5eb3299a877d7a6b37e1881ec3d1ca0c Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 6 Oct 2010 01:17:12 -0500 Subject: Added mandatory single hull simplification to mesh upload. --- indra/llprimitive/llmodel.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ec21ef2fcd..d043015f74 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -57,11 +57,13 @@ public: //physics shape is a vector of convex hulls //each convex hull is a set of points - typedef std::vector > physics_shape; + typedef std::vector hull; + typedef std::vector 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 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 writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, LLModel::hull& base_hull, 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, 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); -- cgit v1.2.3 From a5619d16f74863168f45b04b37cc6383e1a92263 Mon Sep 17 00:00:00 2001 From: Oz Linden Date: Wed, 13 Oct 2010 07:24:37 -0400 Subject: correct licenses (fix problem with license change merge) --- indra/llprimitive/llmodel.h | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index d043015f74..c95ffd882d 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$ */ -- cgit v1.2.3 From 256c6e6a252feaa7ae50f81778aab1e0246a526a Mon Sep 17 00:00:00 2001 From: Jonathan Wolk Date: Tue, 19 Oct 2010 11:29:42 -0700 Subject: Moved retry logic for certain mesh header fetches to help with SH-323 'Some mesh objects fail to load data for valid meshes'. Renamed some variables to be more clear. --- indra/llprimitive/llmodel.h | 76 +++++++++++++++++++++++++++++++++------------ 1 file changed, 56 insertions(+), 20 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index c95ffd882d..b45bca626a 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -50,16 +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 > convex_hull_decomposition; typedef std::vector hull; - typedef std::vector 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 upload_skin, bool upload_joints, bool nowrite = FALSE); - static LLSD writeModel(std::string filename, LLModel* physics, LLModel* high, LLModel* medium, LLModel* low, LLModel* imposotr, LLModel::physics_shape& physics_shape, LLModel::hull& base_hull, 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, 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 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); @@ -69,13 +105,14 @@ 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 pos, - LLStrider norm, - LLStrider tc, - LLStrider ind, - U32 num_verts, - U32 num_indices); + void setVolumeFaceData( + S32 f, + LLStrider pos, + LLStrider norm, + LLStrider tc, + LLStrider ind, + U32 num_verts, + U32 num_indices); void smoothNormals(F32 angle_cutoff); @@ -84,8 +121,6 @@ public: void normalizeVolumeFaces(); void optimizeVolumeFaces(); - - U32 getResourceCost(); void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out); std::vector mMaterialList; @@ -155,13 +190,14 @@ public: LLVector3 mNormalizedScale; LLVector3 mNormalizedTranslation; - //physics shape - physics_shape mPhysicsShape; - void setPhysicsShape(const physics_shape& shape); + // convex hull decomposition + convex_hull_decomposition mConvexHullDecomp; + void setConvexHullDecomposition( + const convex_hull_decomposition& decomp); - LLVector3 mPhysicsCenter; + LLVector3 mCenterOfHullCenters; std::vector mHullCenter; - U32 mPhysicsPoints; + U32 mHullPoints; protected: void addVolumeFacesFromDomMesh(domMesh* mesh); -- cgit v1.2.3 From 3a1fbcab2a745e8e0d85720d6df9c83d7be2c1d8 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 19 Nov 2010 17:07:01 -0600 Subject: SH-448 Initial draft of implementing UI spec for "advanced" importer. --- indra/llprimitive/llmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index b45bca626a..b81bc662a0 100644 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -114,7 +114,7 @@ public: U32 num_verts, U32 num_indices); - void smoothNormals(F32 angle_cutoff); + void generateNormals(F32 angle_cutoff); void addFace(const LLVolumeFace& face); -- cgit v1.2.3 From 5f8110a68ed2fdfe70e2dbd7363f1194b0f3e67d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 14 Dec 2010 15:52:26 -0500 Subject: SH-439 FIX: track name requested in UI separately, so we can fall back to name from dae if needed --- indra/llprimitive/llmodel.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) mode change 100644 => 100755 indra/llprimitive/llmodel.h (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h old mode 100644 new mode 100755 index b81bc662a0..9cc734ff59 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -100,6 +100,7 @@ public: static LLModel* loadModelFromDae(std::string filename); static LLModel* loadModelFromDomMesh(domMesh* mesh); static std::string getElementLabel(daeElement* element); + std::string getName() const; void appendFaces(LLModel* model, LLMatrix4& transform, LLMatrix4& normal_transform); void appendFace(const LLVolumeFace& src_face, std::string src_material, LLMatrix4& mat, LLMatrix4& norm_mat); @@ -185,7 +186,8 @@ public: LLMatrix4 mBindShapeMatrix; std::vector mInvBindMatrix; std::vector mAlternateBindMatrix; - std::string mLabel; + std::string mRequestedLabel; // name requested in UI, if any. + std::string mLabel; // name computed from dae. LLVector3 mNormalizedScale; LLVector3 mNormalizedTranslation; -- cgit v1.2.3 From e1b1db9575945fa8436b4ebabf55242635b61f38 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 22 Dec 2010 01:05:35 -0600 Subject: SH-636 Update physics tab to new spec, move "completed" physics decomp callbacks to main thread, add object model to decomposition tool, make imported model scales non-uniform. --- indra/llprimitive/llmodel.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 9cc734ff59..ebf37904d4 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -56,6 +56,8 @@ public: typedef std::vector hull; LLModel(LLVolumeParams& params, F32 detail); + ~LLModel(); + static LLSD writeModel( std::string filename, LLModel* physics, @@ -193,6 +195,7 @@ public: LLVector3 mNormalizedTranslation; // convex hull decomposition + S32 mDecompID; convex_hull_decomposition mConvexHullDecomp; void setConvexHullDecomposition( const convex_hull_decomposition& decomp); -- cgit v1.2.3 From 4abb8b33fa0c3b5e5f809a783cfc62a9e02af338 Mon Sep 17 00:00:00 2001 From: prep linden Date: Mon, 28 Feb 2011 12:20:31 -0500 Subject: sh-517 Content authors can specify a pivot node (Assetpivot). --- indra/llprimitive/llmodel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index ebf37904d4..c10ca1c11b 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -123,7 +123,7 @@ public: void normalizeVolumeFaces(); void optimizeVolumeFaces(); - + void offsetMesh( const LLVector3& pivotPoint ); void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out); std::vector mMaterialList; -- cgit v1.2.3 From 16ff50719055aae202011e4b20aeae41d98493fa Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 14 Mar 2011 18:02:25 -0400 Subject: WIP:Added pelvis offset to skinning info --- indra/llprimitive/llmodel.h | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index c10ca1c11b..e9e33bdee5 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -194,6 +194,7 @@ public: LLVector3 mNormalizedScale; LLVector3 mNormalizedTranslation; + float mPelvisOffset; // convex hull decomposition S32 mDecompID; convex_hull_decomposition mConvexHullDecomp; -- cgit v1.2.3 From 51a4867ae6bcf0ec71882ba77b1c995d98834126 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 21 Mar 2011 17:31:25 -0500 Subject: SH-1168 Export upload data to disk on upload. --- indra/llprimitive/llmodel.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index e9e33bdee5..addf527d8d 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -205,6 +205,9 @@ public: std::vector mHullCenter; U32 mHullPoints; + //ID for storing this model in a .slm file + S32 mLocalID; + protected: void addVolumeFacesFromDomMesh(domMesh* mesh); virtual BOOL createVolumeFacesFromFile(const std::string& file_name); -- cgit v1.2.3 From 1ff79683128f09baf6dbaf081092fda7e5f2fe65 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Mon, 28 Mar 2011 23:50:23 -0500 Subject: SH-1225 Add skinning info to import path of .slm files. --- indra/llprimitive/llmodel.h | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index addf527d8d..81be9d1835 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -36,6 +36,25 @@ class domMesh; #define MAX_MODEL_FACES 8 + +class LLMeshSkinInfo +{ +public: + LLUUID mMeshID; + std::vector mJointNames; + std::vector mInvBindMatrix; + std::vector mAlternateBindMatrix; + std::map 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 mJointMap; - - //list of joint names - std::vector mJointList; - - LLMatrix4 mBindShapeMatrix; - std::vector mInvBindMatrix; - std::vector mAlternateBindMatrix; + LLMeshSkinInfo mSkinInfo; + std::string mRequestedLabel; // name requested in UI, if any. std::string mLabel; // name computed from dae. @@ -210,7 +221,6 @@ public: protected: void addVolumeFacesFromDomMesh(domMesh* mesh); - virtual BOOL createVolumeFacesFromFile(const std::string& file_name); virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); }; -- cgit v1.2.3 From 719610e68ba8275f08f51d127ab760799cb1d1c3 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Tue, 29 Mar 2011 11:50:02 -0500 Subject: SH-1225 Import convex hull data from .slm --- indra/llprimitive/llmodel.h | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 81be9d1835..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" @@ -54,7 +55,6 @@ public: float mPelvisOffset; }; - class LLModel : public LLVolume { public: @@ -208,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 mHullCenter; @@ -219,6 +220,44 @@ public: //ID for storing this model in a .slm file S32 mLocalID; + class PhysicsMesh + { + public: + std::vector mPositions; + std::vector 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 mMesh; + LLModel::PhysicsMesh mBaseHullMesh; + LLModel::PhysicsMesh mPhysicsShapeMesh; + }; + + Decomposition mPhysics; + protected: void addVolumeFacesFromDomMesh(domMesh* mesh); virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); -- cgit v1.2.3 From 6b9a2d24cce8efaa72c2fd60655998844394312d Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 30 Mar 2011 18:38:22 -0500 Subject: SH-477 Better mesh streaming cost estimation. --- indra/llprimitive/llmodel.h | 103 ++++++++++++++++++-------------------------- 1 file changed, 41 insertions(+), 62 deletions(-) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index e9450d2967..962e422a26 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -71,38 +71,53 @@ public: //convex_hull_decomposition is a vector of convex hulls //each convex hull is a set of points - typedef std::vector > convex_hull_decomposition; + typedef std::vector > convex_hull_decomposition; typedef std::vector hull; + class PhysicsMesh + { + public: + std::vector mPositions; + std::vector mNormals; + + void clear() + { + mPositions.clear(); + mNormals.clear(); + } + + bool empty() const + { + return mPositions.empty(); + } + }; + + class Decomposition + { + public: + Decomposition() { } + Decomposition(LLSD& data); + void fromLLSD(LLSD& data); + LLSD asLLSD() const; + + void merge(const Decomposition* rhs); + + LLUUID mMeshID; + LLModel::convex_hull_decomposition mHull; + LLModel::hull mBaseHull; + + std::vector mMesh; + LLModel::PhysicsMesh mBaseHullMesh; + LLModel::PhysicsMesh mPhysicsShapeMesh; + }; + 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, - 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, @@ -110,11 +125,11 @@ public: LLModel* medium, LLModel* low, LLModel* imposotr, - const LLModel::convex_hull_decomposition& convex_hull_decomposition, - const LLModel::hull& base_hull, + const LLModel::Decomposition& decomp, BOOL upload_skin, BOOL upload_joints, BOOL nowrite = FALSE); + static LLSD writeModelToStream( std::ostream& ostr, LLSD& mdl, @@ -220,42 +235,6 @@ public: //ID for storing this model in a .slm file S32 mLocalID; - class PhysicsMesh - { - public: - std::vector mPositions; - std::vector 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 mMesh; - LLModel::PhysicsMesh mBaseHullMesh; - LLModel::PhysicsMesh mPhysicsShapeMesh; - }; - Decomposition mPhysics; protected: -- cgit v1.2.3 From f0c70a4ee3739c34b1da2ce384bfcf420f8c6c72 Mon Sep 17 00:00:00 2001 From: Xiaohong Bao Date: Fri, 1 Apr 2011 10:58:34 -0600 Subject: fix for SH-1176: A Mesh That Crashes Client on Upload Attempt (due to triangle number overflowing) --- indra/llprimitive/llmodel.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/llprimitive/llmodel.h') diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h index 962e422a26..23f4b5cb42 100755 --- a/indra/llprimitive/llmodel.h +++ b/indra/llprimitive/llmodel.h @@ -69,6 +69,13 @@ public: NUM_LODS }; + enum EModelStatus + { + NO_ERRORS = 0, + VERTEX_NUMBER_OVERFLOW, //vertex number is >= 65535. + INVALID_STATUS + } ; + //convex_hull_decomposition is a vector of convex hulls //each convex hull is a set of points typedef std::vector > convex_hull_decomposition; @@ -138,6 +145,8 @@ public: static LLModel* loadModelFromDomMesh(domMesh* mesh); static std::string getElementLabel(daeElement* element); std::string getName() const; + 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); @@ -237,6 +246,7 @@ public: Decomposition mPhysics; + EModelStatus mStatus ; protected: void addVolumeFacesFromDomMesh(domMesh* mesh); virtual BOOL createVolumeFacesFromDomMesh(domMesh *mesh); -- cgit v1.2.3