PageRenderTime 28ms CodeModel.GetById 20ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llviewerjointmesh.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 159 lines | 79 code | 33 blank | 47 comment | 0 complexity | 5eddae55fc47a36f7fcd31494046b03e MD5 | raw file
  1/** 
  2 * @file llviewerjointmesh.h
  3 * @brief Implementation of LLViewerJointMesh class
  4 *
  5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_LLVIEWERJOINTMESH_H
 28#define LL_LLVIEWERJOINTMESH_H
 29
 30#include "llviewerjoint.h"
 31#include "llviewertexture.h"
 32#include "llpolymesh.h"
 33#include "v4color.h"
 34
 35class LLDrawable;
 36class LLFace;
 37class LLCharacter;
 38class LLTexLayerSet;
 39
 40typedef enum e_avatar_render_pass
 41{
 42	AVATAR_RENDER_PASS_SINGLE,
 43	AVATAR_RENDER_PASS_CLOTHING_INNER,
 44	AVATAR_RENDER_PASS_CLOTHING_OUTER
 45} EAvatarRenderPass;
 46
 47class LLSkinJoint
 48{
 49public:
 50	LLSkinJoint();
 51	~LLSkinJoint();
 52	BOOL setupSkinJoint( LLViewerJoint *joint);
 53
 54	LLViewerJoint	*mJoint;
 55	LLVector3		mRootToJointSkinOffset;
 56	LLVector3		mRootToParentJointSkinOffset;
 57};
 58
 59//-----------------------------------------------------------------------------
 60// class LLViewerJointMesh
 61//-----------------------------------------------------------------------------
 62class LLViewerJointMesh : public LLViewerJoint
 63{
 64protected:
 65	LLColor4					mColor;			// color value
 66// 	LLColor4					mSpecular;		// specular color (always white for now)
 67	F32							mShiny;			// shiny value
 68	LLPointer<LLViewerTexture>	mTexture;		// ptr to a global texture
 69	LLTexLayerSet*				mLayerSet;		// ptr to a layer set owned by the avatar
 70	U32 						mTestImageName;		// handle to a temporary texture for previewing uploads
 71	LLPolyMesh*					mMesh;			// ptr to a global polymesh
 72	BOOL						mCullBackFaces;	// true by default
 73	LLFace*						mFace;			// ptr to a face w/ AGP copy of mesh
 74
 75	U32							mFaceIndexCount;
 76	BOOL						mIsTransparent;
 77
 78	U32							mNumSkinJoints;
 79	LLSkinJoint*				mSkinJoints;
 80	S32							mMeshID;
 81
 82public:
 83	static BOOL					sPipelineRender;
 84	//RN: this is here for testing purposes
 85	static U32					sClothingMaskImageName;
 86	static EAvatarRenderPass	sRenderPass;
 87	static LLColor4				sClothingInnerColor;
 88
 89public:
 90	// Constructor
 91	LLViewerJointMesh();
 92
 93	// Destructor
 94	virtual ~LLViewerJointMesh();
 95
 96	// Gets the shape color
 97	void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
 98
 99	// Sets the shape color
100	void setColor( F32 red, F32 green, F32 blue, F32 alpha );
101
102	// Sets the shininess
103	void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
104
105	// Sets the shape texture
106	void setTexture( LLViewerTexture *texture );
107
108	void setTestTexture( U32 name ) { mTestImageName = name; }
109
110	// Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
111	void setLayerSet( LLTexLayerSet* layer_set );
112
113	// Gets the poly mesh
114	LLPolyMesh *getMesh();
115
116	// Sets the poly mesh
117	void setMesh( LLPolyMesh *mesh );
118
119	// Sets up joint matrix data for rendering
120	void setupJoint(LLViewerJoint* current_joint);
121
122	// Render time method to upload batches of joint matrices
123	void uploadJointMatrices();
124
125	// Sets ID for picking
126	void setMeshID( S32 id ) {mMeshID = id;}
127
128	// Gets ID for picking
129	S32 getMeshID() { return mMeshID; }	
130
131	// overloaded from base class
132	/*virtual*/ void drawBone();
133	/*virtual*/ BOOL isTransparent();
134	/*virtual*/ U32 drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy );
135
136	/*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
137	/*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
138	/*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate);
139	/*virtual*/ void updateJointGeometry();
140	/*virtual*/ void dump();
141
142	void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
143
144	/*virtual*/ BOOL isAnimatable() const { return FALSE; }
145	
146private:
147
148	//copy mesh into given face's vertex buffer, applying current animation pose
149	static void updateGeometry(LLFace* face, LLPolyMesh* mesh);
150
151private:
152	// Allocate skin data
153	BOOL allocateSkinData( U32 numSkinJoints );
154
155	// Free skin data
156	void freeSkinData();
157};
158
159#endif // LL_LLVIEWERJOINTMESH_H