From 003aa6a4ebca789eac75e51dc3b234e49408eea4 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Thu, 20 Dec 2012 02:55:34 -0600 Subject: [PATCH] Migrate llpoly* files to llappearance --- indra/llappearance/CMakeLists.txt | 14 +- indra/llappearance/llavatarappearance.h | 5 + indra/llappearance/llavatarjoint.h | 140 ++++++++++++++++++ .../{newview => llappearance}/llpolymesh.cpp | 15 +- indra/{newview => llappearance}/llpolymesh.h | 0 .../{newview => llappearance}/llpolymorph.cpp | 19 ++- indra/{newview => llappearance}/llpolymorph.h | 44 +++--- .../llpolyskeletaldistortion.cpp | 8 +- .../llpolyskeletaldistortion.h | 0 indra/newview/CMakeLists.txt | 6 - indra/newview/llviewerjoint.h | 12 +- indra/newview/llvoavatar.h | 3 + 12 files changed, 203 insertions(+), 63 deletions(-) create mode 100644 indra/llappearance/llavatarjoint.h rename indra/{newview => llappearance}/llpolymesh.cpp (99%) rename indra/{newview => llappearance}/llpolymesh.h (100%) rename indra/{newview => llappearance}/llpolymorph.cpp (98%) rename indra/{newview => llappearance}/llpolymorph.h (79%) rename indra/{newview => llappearance}/llpolyskeletaldistortion.cpp (98%) rename indra/{newview => llappearance}/llpolyskeletaldistortion.h (100%) diff --git a/indra/llappearance/CMakeLists.txt b/indra/llappearance/CMakeLists.txt index c5245e381..1552dbbec 100644 --- a/indra/llappearance/CMakeLists.txt +++ b/indra/llappearance/CMakeLists.txt @@ -33,9 +33,9 @@ set(llappearance_SOURCE_FILES #llavatarjointmesh.cpp #lldriverparam.cpp #lllocaltextureobject.cpp - #llpolyskeletaldistortion.cpp - #llpolymesh.cpp - #llpolymorph.cpp + llpolyskeletaldistortion.cpp + llpolymesh.cpp + llpolymorph.cpp #lltexglobalcolor.cpp #lltexlayer.cpp #lltexlayerparams.cpp @@ -51,14 +51,14 @@ set(llappearance_HEADER_FILES CMakeLists.txt llavatarappearance.h - #llavatarjoint.h + llavatarjoint.h #llavatarjointmesh.h #lldriverparam.h lljointpickname.h #lllocaltextureobject.h - #llpolyskeletaldistortion.h - #llpolymesh.h - #llpolymorph.h + llpolyskeletaldistortion.h + llpolymesh.h + llpolymorph.h #lltexglobalcolor.h #lltexlayer.h #lltexlayerparams.h diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index 28d7f1acf..741265a9d 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -42,6 +42,7 @@ class LLWearableData; class LLAvatarBoneInfo; class LLAvatarSkeletonInfo; class LLPolyMeshSharedData; +class LLAvatarJointCollisionVolume; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLAvatarAppearance @@ -264,6 +265,10 @@ public: public: virtual LLColor4 getGlobalColor(const std::string& color_name ) const = 0; virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) = 0; + + virtual S32 getNumCollisionVolumes() = 0; + virtual LLAvatarJointCollisionVolume* getCollisionVolume(S32 i) = 0; + protected: //LLTexGlobalColor* mTexSkinColor; //LLTexGlobalColor* mTexHairColor; diff --git a/indra/llappearance/llavatarjoint.h b/indra/llappearance/llavatarjoint.h new file mode 100644 index 000000000..71b03c905 --- /dev/null +++ b/indra/llappearance/llavatarjoint.h @@ -0,0 +1,140 @@ +/** + * @file llavatarjoint.h + * @brief Implementation of LLAvatarJoint class + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * 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. + * + * 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. + * + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLAVATARJOINT_H +#define LL_LLAVATARJOINT_H + +//----------------------------------------------------------------------------- +// Header Files +//----------------------------------------------------------------------------- +#include "lljoint.h" +#include "lljointpickname.h" + +class LLFace; +class LLAvatarJointMesh; + +extern const F32 DEFAULT_AVATAR_JOINT_LOD; + +//----------------------------------------------------------------------------- +// class LLViewerJoint +//----------------------------------------------------------------------------- +class LLAvatarJoint : + public LLJoint +{ +public: + /*LLAvatarJoint(); + LLAvatarJoint(S32 joint_num); + // *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform* + LLAvatarJoint(const std::string &name, LLJoint *parent = NULL); + virtual ~LLAvatarJoint(); + + // Gets the validity of this joint + BOOL getValid() { return mValid; } + + // Sets the validity of this joint + virtual void setValid( BOOL valid, BOOL recursive=FALSE ); + + // Returns true if this object is transparent. + // This is used to determine in which order to draw objects. + virtual BOOL isTransparent() { return mIsTransparent; }*/ + + // Returns true if this object should inherit scale modifiers from its immediate parent + virtual BOOL inheritScale() = 0; + + /*enum Components + { + SC_BONE = 1, + SC_JOINT = 2, + SC_AXES = 4 + }; + + // Selects which skeleton components to draw + void setSkeletonComponents( U32 comp, BOOL recursive = TRUE ); + + // Returns which skeleton components are enables for drawing + U32 getSkeletonComponents() { return mComponents; } + + // Sets the level of detail for this node as a minimum + // pixel area threshold. If the current pixel area for this + // object is less than the specified threshold, the node is + // not traversed. In addition, if a value is specified (not + // default of 0.0), and the pixel area is larger than the + // specified minimum, the node is rendered, but no other siblings + // of this node under the same parent will be. + F32 getLOD() { return mMinPixelArea; } + void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; } + + void setPickName(LLJointPickName name) { mPickName = name; } + LLJointPickName getPickName() { return mPickName; } + + void setVisible( BOOL visible, BOOL recursive ); + + // Takes meshes in mMeshParts and sets each one as a child joint + void setMeshesToChildren(); + + // LLViewerJoint interface + virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0; + virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); + virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false); + virtual BOOL updateLOD(F32 pixel_area, BOOL activate); + virtual void updateJointGeometry(); + virtual void dump(); + + +public: + static BOOL sDisableLOD; + avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh* + void setMeshID( S32 id ) {mMeshID = id;} + +protected: + void init(); + + BOOL mValid; + BOOL mIsTransparent; + U32 mComponents; + F32 mMinPixelArea; + LLJointPickName mPickName; + BOOL mVisible; + S32 mMeshID;*/ +}; + +class LLAvatarJointCollisionVolume : public LLAvatarJoint +{ +public: + LLAvatarJointCollisionVolume() {}; + virtual ~LLAvatarJointCollisionVolume() {}; + + //*virtual*/ BOOL inheritScale() { return TRUE; } + //*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0; + + virtual void renderCollision() = 0; + + virtual LLVector3 getVolumePos(LLVector3 &offset) = 0; +}; + +#endif // LL_LLAVATARJOINT_H + + diff --git a/indra/newview/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp similarity index 99% rename from indra/newview/llpolymesh.cpp rename to indra/llappearance/llpolymesh.cpp index 0331c7e9f..7ddfc874e 100644 --- a/indra/newview/llpolymesh.cpp +++ b/indra/llappearance/llpolymesh.cpp @@ -27,25 +27,24 @@ //----------------------------------------------------------------------------- // Header Files //----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" - +#include "linden_common.h" +#include "llpolymesh.h" #include "llfasttimer.h" #include "llmemory.h" -#include "llviewercontrol.h" +//#include "llviewercontrol.h" #include "llxmltree.h" -#include "llvoavatar.h" -#include "llwearable.h" +#include "llavatarappearance.h" +//#include "llwearable.h" #include "lldir.h" #include "llvolume.h" #include "llendianswizzle.h" -#include "llpolymesh.h" #define HEADER_ASCII "Linden Mesh 1.0" #define HEADER_BINARY "Linden Binary Mesh 1.0" -extern LLControlGroup gSavedSettings; // read only +//extern LLControlGroup gSavedSettings; // read only LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data, const std::string &name); @@ -1492,7 +1491,7 @@ BOOL LLPolyMesh::setSharedFromCurrent() std::vector< LLCharacter* >::iterator avatar_it; for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it) { - LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it; + LLAvatarAppearance* avatarp = (LLAvatarAppearance*)*avatar_it; LLPolyMesh* mesh = avatarp->getMesh(mSharedData); if (mesh) { diff --git a/indra/newview/llpolymesh.h b/indra/llappearance/llpolymesh.h similarity index 100% rename from indra/newview/llpolymesh.h rename to indra/llappearance/llpolymesh.h diff --git a/indra/newview/llpolymorph.cpp b/indra/llappearance/llpolymorph.cpp similarity index 98% rename from indra/newview/llpolymorph.cpp rename to indra/llappearance/llpolymorph.cpp index b66cb21ae..5ce281e42 100644 --- a/indra/newview/llpolymorph.cpp +++ b/indra/llappearance/llpolymorph.cpp @@ -27,15 +27,16 @@ //----------------------------------------------------------------------------- // Header Files //----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" #include "llpolymorph.h" -#include "llpolymesh.h" #include "llavatarappearance.h" -#include "llwearable.h" +#include "llavatarjoint.h" +//#include "llwearable.h" #include "llxmltree.h" #include "llendianswizzle.h" -#include "llvoavatar.h" +//#include "llvoavatar.h" +#include "llpolymesh.h" +#include "v2math.h" //#include "../tools/imdebug/imdebug.h" @@ -635,16 +636,18 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info) mID = info->mID; setWeight(getDefaultWeight(), FALSE ); - LLVOAvatar* avatarp = (LLVOAvatar*)mMesh->getAvatar(); + LLAvatarAppearance* avatarp = mMesh->getAvatar(); LLPolyMorphTargetInfo::volume_info_list_t::iterator iter; for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++) { LLPolyVolumeMorphInfo *volume_info = &(*iter); - for (S32 i = 0; i < avatarp->mNumCollisionVolumes; i++) + S32 volumes = avatarp->getNumCollisionVolumes(); + for (S32 i = 0; i < volumes; i++) { - if (avatarp->mCollisionVolumes[i].getName() == volume_info->mName) + LLAvatarJointCollisionVolume* vol = avatarp->getCollisionVolume(i); + if (vol->getName() == volume_info->mName) { - mVolumeMorphs.push_back(LLPolyVolumeMorph(&avatarp->mCollisionVolumes[i], + mVolumeMorphs.push_back(LLPolyVolumeMorph(vol, volume_info->mScale, volume_info->mPos)); break; diff --git a/indra/newview/llpolymorph.h b/indra/llappearance/llpolymorph.h similarity index 79% rename from indra/newview/llpolymorph.h rename to indra/llappearance/llpolymorph.h index 02f5be42f..f7782ffb3 100644 --- a/indra/newview/llpolymorph.h +++ b/indra/llappearance/llpolymorph.h @@ -2,31 +2,25 @@ * @file llpolymorph.h * @brief Implementation of LLPolyMesh class * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, 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://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * 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://secondlifegrid.net/programs/open_source/licensing/flossexception + * 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. * - * 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. + * 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. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * 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 + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -38,10 +32,10 @@ #include "llviewervisualparam.h" +class LLAvatarJointCollisionVolume; class LLPolyMeshSharedData; -class LLVOAvatar; class LLVector2; -class LLViewerJointCollisionVolume; +class LLAvatarJointCollisionVolume; class LLWearable; //----------------------------------------------------------------------------- @@ -127,10 +121,10 @@ struct LLPolyVolumeMorphInfo struct LLPolyVolumeMorph { - LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos) + LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos) : mVolume(volume), mScale(scale), mPos(pos) {}; - LLViewerJointCollisionVolume* mVolume; + LLAvatarJointCollisionVolume* mVolume; LLVector3 mScale; LLVector3 mPos; }; diff --git a/indra/newview/llpolyskeletaldistortion.cpp b/indra/llappearance/llpolyskeletaldistortion.cpp similarity index 98% rename from indra/newview/llpolyskeletaldistortion.cpp rename to indra/llappearance/llpolyskeletaldistortion.cpp index e8ce4de0d..3263792a3 100644 --- a/indra/newview/llpolyskeletaldistortion.cpp +++ b/indra/llappearance/llpolyskeletaldistortion.cpp @@ -27,17 +27,17 @@ //----------------------------------------------------------------------------- // Header Files //----------------------------------------------------------------------------- -#include "llviewerprecompiledheaders.h" +#include "llpreprocessor.h" #include "llerrorlegacy.h" //#include "llcommon.h" //#include "llmemory.h" #include "llavatarappearance.h" -#include "llviewerjoint.h" +#include "llavatarjoint.h" #include "llpolymorph.h" //#include "llviewercontrol.h" //#include "llxmltree.h" //#include "llvoavatar.h" -#include "llwearable.h" +//#include "llwearable.h" //#include "lldir.h" //#include "llvolume.h" //#include "llendianswizzle.h" @@ -155,7 +155,7 @@ BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info) for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin(); iter != joint->mChildren.end(); ++iter) { - LLViewerJoint* child_joint = (LLViewerJoint*)(*iter); + LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter); if (child_joint->inheritScale()) { LLVector3 childDeformation = LLVector3(child_joint->getScale()); diff --git a/indra/newview/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h similarity index 100% rename from indra/newview/llpolyskeletaldistortion.h rename to indra/llappearance/llpolyskeletaldistortion.h diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5af77e2dd..4cfdf67a8 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -389,9 +389,6 @@ set(viewer_SOURCE_FILES llpathfindingobjectlist.cpp llphysicsmotion.cpp llphysicsshapebuilderutil.cpp - llpolymesh.cpp - llpolymorph.cpp - llpolyskeletaldistortion.cpp llprefschat.cpp llprefsim.cpp llprefsvoice.cpp @@ -895,9 +892,6 @@ set(viewer_HEADER_FILES llpathfindingobjectlist.h llphysicsmotion.h llphysicsshapebuilderutil.h - llpolymesh.h - llpolymorph.h - llpolyskeletaldistortion.h llprefschat.h llprefsim.h llprefsvoice.h diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 5c0e3225e..5750c81b4 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -31,7 +31,9 @@ // Header Files //----------------------------------------------------------------------------- #include "lljoint.h" +#include "llavatarjoint.h" #include "lljointpickname.h" +#include "llavatarjoint.h" class LLFace; class LLViewerJointMesh; @@ -40,7 +42,7 @@ class LLViewerJointMesh; // class LLViewerJoint //----------------------------------------------------------------------------- class LLViewerJoint : - public LLJoint + public LLAvatarJoint { public: LLViewerJoint(); @@ -134,17 +136,17 @@ protected: S32 mMeshID; }; -class LLViewerJointCollisionVolume : public LLViewerJoint +class LLViewerJointCollisionVolume : public LLAvatarJointCollisionVolume { public: LLViewerJointCollisionVolume(); - LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL); + LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL) {} virtual ~LLViewerJointCollisionVolume() {}; virtual BOOL inheritScale() { return TRUE; } - void renderCollision(); - LLVector3 getVolumePos(LLVector3 &offset); + virtual void renderCollision(); + virtual LLVector3 getVolumePos(LLVector3 &offset); }; #endif // LL_LLVIEWERJOINT_H diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index db12a8efb..7ecaf074e 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -918,6 +918,9 @@ private: public: S32 mNumCollisionVolumes; LLViewerJointCollisionVolume* mCollisionVolumes; + virtual S32 getNumCollisionVolumes() { return mNumCollisionVolumes; } + virtual LLAvatarJointCollisionVolume* getCollisionVolume(S32 i) { return (LLAvatarJointCollisionVolume*)&mCollisionVolumes[i]; } + protected: virtual BOOL allocateCollisionVolumes(U32 num);