PageRenderTime 29ms CodeModel.GetById 12ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llviewerjoint.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 164 lines | 74 code | 29 blank | 61 comment | 0 complexity | 18c28ebab7d4ff1036d38c617f701ff9 MD5 | raw file
  1/** 
  2 * @file llviewerjoint.h
  3 * @brief Implementation of LLViewerJoint 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_LLVIEWERJOINT_H
 28#define LL_LLVIEWERJOINT_H
 29
 30//-----------------------------------------------------------------------------
 31// Header Files
 32//-----------------------------------------------------------------------------
 33#include "lljoint.h"
 34
 35class LLFace;
 36class LLViewerJointMesh;
 37
 38//-----------------------------------------------------------------------------
 39// class LLViewerJoint
 40//-----------------------------------------------------------------------------
 41class LLViewerJoint :
 42	public LLJoint
 43{
 44public:
 45	LLViewerJoint();
 46	LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
 47	virtual ~LLViewerJoint();
 48
 49	// Gets the validity of this joint
 50	BOOL getValid() { return mValid; }
 51
 52	// Sets the validity of this joint
 53	virtual void setValid( BOOL valid, BOOL recursive=FALSE );
 54
 55	// Primarily for debugging and character setup
 56	// Derived classes may add text/graphic output.
 57	// Draw skeleton graphic for debugging and character setup
 58 	void renderSkeleton(BOOL recursive=TRUE); // debug only (unused)
 59
 60	// Draws a bone graphic to the parent joint.
 61	// Derived classes may add text/graphic output.
 62	// Called by renderSkeleton().
 63 	void drawBone(); // debug only (unused)
 64
 65	// Render character hierarchy.
 66	// Traverses the entire joint hierarchy, setting up
 67	// transforms and calling the drawShape().
 68	// Derived classes may add text/graphic output.
 69	virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );	// Returns triangle count
 70
 71	// Returns true if this object is transparent.
 72	// This is used to determine in which order to draw objects.
 73	virtual BOOL isTransparent();
 74
 75	// Returns true if this object should inherit scale modifiers from its immediate parent
 76	virtual BOOL inheritScale() { return FALSE; }
 77
 78	// Draws the shape attached to a joint.
 79	// Called by render().
 80	virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
 81	virtual void drawNormals() {}
 82
 83	enum Components
 84	{
 85		SC_BONE		= 1,
 86		SC_JOINT	= 2,
 87		SC_AXES		= 4
 88	};
 89
 90	// Selects which skeleton components to draw
 91	void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
 92
 93	// Returns which skeleton components are enables for drawing
 94	U32 getSkeletonComponents() { return mComponents; }
 95
 96	// Sets the level of detail for this node as a minimum
 97	// pixel area threshold.  If the current pixel area for this
 98	// object is less than the specified threshold, the node is
 99	// not traversed.  In addition, if a value is specified (not
100	// default of 0.0), and the pixel area is larger than the
101	// specified minimum, the node is rendered, but no other siblings
102	// of this node under the same parent will be.
103	F32 getLOD() { return mMinPixelArea; }
104	void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
105	
106	// Sets the OpenGL selection stack name that is pushed and popped
107	// with this joint state.  The default value indicates that no name
108	// should be pushed/popped.
109	enum PickName
110	{
111		PN_DEFAULT = -1,
112		PN_0 = 0,
113		PN_1 = 1,
114		PN_2 = 2,
115		PN_3 = 3,
116		PN_4 = 4,
117		PN_5 = 5
118	};
119	void setPickName(PickName name) { mPickName = name; }
120	PickName getPickName() { return mPickName; }
121
122	virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
123	virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
124	virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
125	virtual void updateJointGeometry();
126	virtual void dump();
127
128	void setVisible( BOOL visible, BOOL recursive );
129
130	// Takes meshes in mMeshParts and sets each one as a child joint
131	void setMeshesToChildren();
132
133public:
134	static BOOL	sDisableLOD;
135	std::vector<LLViewerJointMesh*> mMeshParts;
136	void setMeshID( S32 id ) {mMeshID = id;}
137
138protected:
139	void init();
140
141	BOOL		mValid;
142	U32			mComponents;
143	F32			mMinPixelArea;
144	PickName	mPickName;
145	BOOL		mVisible;
146	S32			mMeshID;
147};
148
149class LLViewerJointCollisionVolume : public LLViewerJoint
150{
151public:
152	LLViewerJointCollisionVolume();
153	LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL);
154	virtual ~LLViewerJointCollisionVolume() {};
155
156	virtual BOOL inheritScale() { return TRUE; }
157
158	void renderCollision();
159	LLVector3 getVolumePos(LLVector3 &offset);
160};
161
162#endif // LL_LLVIEWERJOINT_H
163
164