Annotation of /trunk/indra/newview/llviewerjointmesh.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llviewerjointmesh.h | ||
| 3 : | * @brief Implementation of LLViewerJointMesh class | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2001&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2001-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 13 : | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
| 14 : | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 17 : | * There are special exceptions to the terms and conditions of the GPL as | ||
| 18 : | * it is applied to this Source Code. View the full text of the exception | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLVIEWERJOINTMESH_H | ||
| 34 : | #define LL_LLVIEWERJOINTMESH_H | ||
| 35 : | |||
| 36 : | #include "llviewerjoint.h" | ||
| 37 : | #include "llviewerimage.h" | ||
| 38 : | #include "llpolymesh.h" | ||
| 39 : | #include "v4color.h" | ||
| 40 : | #include "llapr.h" | ||
| 41 : | |||
| 42 : | class LLDrawable; | ||
| 43 : | class LLFace; | ||
| 44 : | class LLCharacter; | ||
| 45 : | class LLTexLayerSet; | ||
| 46 : | |||
| 47 : | typedef enum e_avatar_render_pass | ||
| 48 : | { | ||
| 49 : | AVATAR_RENDER_PASS_SINGLE, | ||
| 50 : | AVATAR_RENDER_PASS_CLOTHING_INNER, | ||
| 51 : | AVATAR_RENDER_PASS_CLOTHING_OUTER | ||
| 52 : | } EAvatarRenderPass; | ||
| 53 : | |||
| 54 : | class LLSkinJoint | ||
| 55 : | { | ||
| 56 : | public: | ||
| 57 : | LLSkinJoint(); | ||
| 58 : | ~LLSkinJoint(); | ||
| 59 : | BOOL setupSkinJoint( LLViewerJoint *joint); | ||
| 60 : | |||
| 61 : | LLViewerJoint *mJoint; | ||
| 62 : | LLVector3 mRootToJointSkinOffset; | ||
| 63 : | LLVector3 mRootToParentJointSkinOffset; | ||
| 64 : | }; | ||
| 65 : | |||
| 66 : | //----------------------------------------------------------------------------- | ||
| 67 : | // class LLViewerJointMesh | ||
| 68 : | //----------------------------------------------------------------------------- | ||
| 69 : | class LLViewerJointMesh : public LLViewerJoint | ||
| 70 : | { | ||
| 71 : | protected: | ||
| 72 : | LLColor4 mColor; // color value | ||
| 73 : | // LLColor4 mSpecular; // specular color (always white for now) | ||
| 74 : | F32 mShiny; // shiny value | ||
| 75 : | LLPointer<LLViewerImage> mTexture; // ptr to a global texture | ||
| 76 : | LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar | ||
| 77 : | U32 mTestImageName; // handle to a temporary texture for previewing uploads | ||
| 78 : | LLPolyMesh* mMesh; // ptr to a global polymesh | ||
| 79 : | BOOL mCullBackFaces; // true by default | ||
| 80 : | LLFace* mFace; // ptr to a face w/ AGP copy of mesh | ||
| 81 : | |||
| 82 : | U32 mFaceIndexCount; | ||
| 83 : | BOOL mIsTransparent; | ||
| 84 : | |||
| 85 : | U32 mNumSkinJoints; | ||
| 86 : | LLSkinJoint* mSkinJoints; | ||
| 87 : | S32 mMeshID; | ||
| 88 : | |||
| 89 : | public: | ||
| 90 : | static BOOL sPipelineRender; | ||
| 91 : | //RN: this is here for testing purposes | ||
| 92 : | static U32 sClothingMaskImageName; | ||
| 93 : | static EAvatarRenderPass sRenderPass; | ||
| 94 : | static LLColor4 sClothingInnerColor; | ||
| 95 : | |||
| 96 : | public: | ||
| 97 : | // Constructor | ||
| 98 : | LLViewerJointMesh(); | ||
| 99 : | |||
| 100 : | // Destructor | ||
| 101 : | virtual ~LLViewerJointMesh(); | ||
| 102 : | |||
| 103 : | // Gets the shape color | ||
| 104 : | void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha ); | ||
| 105 : | |||
| 106 : | // Sets the shape color | ||
| 107 : | void setColor( F32 red, F32 green, F32 blue, F32 alpha ); | ||
| 108 : | |||
| 109 : | // Sets the shininess | ||
| 110 : | void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; }; | ||
| 111 : | |||
| 112 : | // Sets the shape texture | ||
| 113 : | void setTexture( LLViewerImage *texture ); | ||
| 114 : | |||
| 115 : | void setTestTexture( U32 name ) { mTestImageName = name; } | ||
| 116 : | |||
| 117 : | // Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture) | ||
| 118 : | void setLayerSet( LLTexLayerSet* layer_set ); | ||
| 119 : | |||
| 120 : | // Gets the poly mesh | ||
| 121 : | LLPolyMesh *getMesh(); | ||
| 122 : | |||
| 123 : | // Sets the poly mesh | ||
| 124 : | void setMesh( LLPolyMesh *mesh ); | ||
| 125 : | |||
| 126 : | // Sets up joint matrix data for rendering | ||
| 127 : | void setupJoint(LLViewerJoint* current_joint); | ||
| 128 : | |||
| 129 : | // Render time method to upload batches of joint matrices | ||
| 130 : | void uploadJointMatrices(); | ||
| 131 : | |||
| 132 : | // Sets ID for picking | ||
| 133 : | void setMeshID( S32 id ) {mMeshID = id;} | ||
| 134 : | |||
| 135 : | // Gets ID for picking | ||
| 136 : | S32 getMeshID() { return mMeshID; } | ||
| 137 : | |||
| 138 : | // overloaded from base class | ||
| 139 : | /*virtual*/ void drawBone(); | ||
| 140 : | /*virtual*/ BOOL isTransparent(); | ||
| 141 : | /*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy ); | ||
| 142 : | |||
| 143 : | /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); | ||
| 144 : | /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE); | ||
| 145 : | /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate); | ||
| 146 : | /*virtual*/ void updateJointGeometry(); | ||
| 147 : | /*virtual*/ void dump(); | ||
| 148 : | |||
| 149 : | void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; } | ||
| 150 : | |||
| 151 : | /*virtual*/ BOOL isAnimatable() { return FALSE; } | ||
| 152 : | |||
| 153 : | static void updateVectorize(); // Update globals when settings variables change | ||
| 154 : | |||
| 155 : | private: | ||
| 156 : | // Avatar vertex skinning is a significant performance issue on computers | ||
| 157 : | // with avatar vertex programs turned off (for example, most Macs). We | ||
| 158 : | // therefore have custom versions that use SIMD instructions. | ||
| 159 : | // | ||
| 160 : | // These functions require compiler options for SSE2, SSE, or neither, and | ||
| 161 : | // hence are contained in separate individual .cpp files. JC | ||
| 162 : | static void updateGeometryOriginal(LLFace* face, LLPolyMesh* mesh); | ||
| 163 : | // generic vector code, used for Altivec | ||
| 164 : | static void updateGeometryVectorized(LLFace* face, LLPolyMesh* mesh); | ||
| 165 : | static void updateGeometrySSE(LLFace* face, LLPolyMesh* mesh); | ||
| 166 : | static void updateGeometrySSE2(LLFace* face, LLPolyMesh* mesh); | ||
| 167 : | |||
| 168 : | // Use a fuction pointer to indicate which version we are running. | ||
| 169 : | static void (*sUpdateGeometryFunc)(LLFace* face, LLPolyMesh* mesh); | ||
| 170 : | |||
| 171 : | private: | ||
| 172 : | // Allocate skin data | ||
| 173 : | BOOL allocateSkinData( U32 numSkinJoints ); | ||
| 174 : | |||
| 175 : | // Free skin data | ||
| 176 : | void freeSkinData(); | ||
| 177 : | }; | ||
| 178 : | |||
| 179 : | #endif // LL_LLVIEWERJOINTMESH_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

