aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpolymorph.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpolymorph.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llpolymorph.h')
-rw-r--r--linden/indra/newview/llpolymorph.h182
1 files changed, 182 insertions, 0 deletions
diff --git a/linden/indra/newview/llpolymorph.h b/linden/indra/newview/llpolymorph.h
new file mode 100644
index 0000000..b372398
--- /dev/null
+++ b/linden/indra/newview/llpolymorph.h
@@ -0,0 +1,182 @@
1/**
2 * @file llpolymorph.h
3 * @brief Implementation of LLPolyMesh class
4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLPOLYMORPH_H
29#define LL_LLPOLYMORPH_H
30
31#include <string>
32#include <vector>
33
34#include "llviewervisualparam.h"
35#include "llskiplist.h"
36#include "linked_lists.h"
37
38class LLPolyMeshSharedData;
39class LLVOAvatar;
40class LLVector2;
41class LLViewerJointCollisionVolume;
42
43//-----------------------------------------------------------------------------
44// LLPolyMorphData()
45//-----------------------------------------------------------------------------
46class LLPolyMorphData
47{
48public:
49 LLPolyMorphData(char *morph_name);
50 ~LLPolyMorphData();
51
52 BOOL loadBinary(FILE* fp, LLPolyMeshSharedData *mesh);
53 char* loadASCII(char* text, LLPolyMeshSharedData *mesh);
54 char* getName() { return mName; }
55
56public:
57 char* mName;
58
59 // morphology
60 U32 mNumIndices;
61 U32* mVertexIndices;
62 U32 mCurrentIndex;
63 LLVector3* mCoords;
64 LLVector3* mNormals;
65 LLVector3* mBinormals;
66 LLVector2* mTexCoords;
67
68 F32 mTotalDistortion; // vertex distortion summed over entire morph
69 F32 mMaxDistortion; // maximum single vertex distortion in a given morph
70 LLVector3 mAvgDistortion; // average vertex distortion, to infer directionality of the morph
71 LLPolyMeshSharedData* mMesh;
72};
73
74//-----------------------------------------------------------------------------
75// LLPolyVertexMask()
76//-----------------------------------------------------------------------------
77class LLPolyVertexMask
78{
79public:
80 LLPolyVertexMask(LLPolyMorphData* morph_data);
81 ~LLPolyVertexMask();
82
83 void generateMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert, LLVector4 *clothing_weights);
84 F32* getMorphMaskWeights();
85
86
87protected:
88 F32* mWeights;
89 LLPolyMorphData *mMorphData;
90 BOOL mWeightsGenerated;
91
92};
93
94//-----------------------------------------------------------------------------
95// LLPolyMorphTarget Data structs
96//-----------------------------------------------------------------------------
97struct LLPolyVolumeMorphInfo
98{
99 LLPolyVolumeMorphInfo(LLString &name, LLVector3 &scale, LLVector3 &pos)
100 : mName(name), mScale(scale), mPos(pos) {};
101
102 LLString mName;
103 LLVector3 mScale;
104 LLVector3 mPos;
105};
106
107struct LLPolyVolumeMorph
108{
109 LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
110 : mVolume(volume), mScale(scale), mPos(pos) {};
111
112 LLViewerJointCollisionVolume* mVolume;
113 LLVector3 mScale;
114 LLVector3 mPos;
115};
116
117//-----------------------------------------------------------------------------
118// LLPolyMorphTargetInfo
119// Shared information for LLPolyMorphTargets
120//-----------------------------------------------------------------------------
121class LLPolyMorphTargetInfo : public LLViewerVisualParamInfo
122{
123 friend class LLPolyMorphTarget;
124public:
125 LLPolyMorphTargetInfo();
126 /*virtual*/ ~LLPolyMorphTargetInfo() {};
127
128 /*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
129
130protected:
131 LLString mMorphName;
132 BOOL mIsClothingMorph;
133 typedef std::vector<LLPolyVolumeMorphInfo> volume_info_list_t;
134 volume_info_list_t mVolumeInfoList;
135};
136
137//-----------------------------------------------------------------------------
138// LLPolyMorphTarget
139// A set of vertex data associated with morph target.
140// These morph targets must be topologically consistent with a given Polymesh
141// (share face sets)
142//-----------------------------------------------------------------------------
143class LLPolyMorphTarget : public LLViewerVisualParam
144{
145public:
146 LLPolyMorphTarget(LLPolyMesh *poly_mesh);
147 ~LLPolyMorphTarget();
148
149 // Special: These functions are overridden by child classes
150 LLPolyMorphTargetInfo* getInfo() const { return (LLPolyMorphTargetInfo*)mInfo; }
151 // This sets mInfo and calls initialization functions
152 BOOL setInfo(LLPolyMorphTargetInfo *info);
153
154 // LLVisualParam Virtual functions
155 ///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
156 /*virtual*/ void apply( ESex sex );
157
158 // LLViewerVisualParam Virtual functions
159 /*virtual*/ F32 getTotalDistortion();
160 /*virtual*/ const LLVector3& getAvgDistortion();
161 /*virtual*/ F32 getMaxDistortion();
162 /*virtual*/ LLVector3 getVertexDistortion(S32 index, LLPolyMesh *poly_mesh);
163 /*virtual*/ const LLVector3* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
164 /*virtual*/ const LLVector3* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
165
166 void applyMask(U8 *maskData, S32 width, S32 height, S32 num_components, BOOL invert);
167 void addPendingMorphMask() { mNumMorphMasksPending++; }
168
169protected:
170 LLPolyMorphData* mMorphData;
171 LLPolyMesh* mMesh;
172 LLPolyVertexMask * mVertMask;
173 ESex mLastSex;
174 // number of morph masks that haven't been generated, must be 0 before this morph is applied
175 BOOL mNumMorphMasksPending;
176
177 typedef std::vector<LLPolyVolumeMorph> volume_list_t;
178 volume_list_t mVolumeMorphs;
179
180};
181
182#endif // LL_LLPOLYMORPH_H