llviewerjoint.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVIEWERJOINT_H
00033 #define LL_LLVIEWERJOINT_H
00034 
00035 //-----------------------------------------------------------------------------
00036 // Header Files
00037 //-----------------------------------------------------------------------------
00038 #include "lljoint.h"
00039 #include "llapr.h"
00040 
00041 class LLFace;
00042 
00043 //-----------------------------------------------------------------------------
00044 // class LLViewerJoint
00045 //-----------------------------------------------------------------------------
00046 class LLViewerJoint :
00047         public LLJoint
00048 {
00049 public:
00050         LLViewerJoint();
00051         LLViewerJoint(const std::string &name, LLJoint *parent = NULL);
00052         virtual ~LLViewerJoint();
00053 
00054         // Gets the validity of this joint
00055         BOOL getValid() { return mValid; }
00056 
00057         // Sets the validity of this joint
00058         virtual void setValid( BOOL valid, BOOL recursive=FALSE );
00059 
00060         // Primarily for debugging and character setup
00061         // Derived classes may add text/graphic output.
00062         // Draw skeleton graphic for debugging and character setup
00063         virtual void renderSkeleton(BOOL recursive=TRUE);
00064 
00065         // Render character hierarchy.
00066         // Traverses the entire joint hierarchy, setting up
00067         // transforms and calling the drawShape().
00068         // Derived classes may add text/graphic output.
00069         virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE );    // Returns triangle count
00070 
00071         // Draws a bone graphic to the parent joint.
00072         // Derived classes may add text/graphic output.
00073         // Called by renderSkeleton().
00074         virtual void drawBone();
00075 
00076         // Returns true if this object is transparent.
00077         // This is used to determine in which order to draw objects.
00078         virtual BOOL isTransparent();
00079 
00080         // Returns true if this object should inherit scale modifiers from its immediate parent
00081         virtual BOOL inheritScale() { return FALSE; }
00082 
00083         // Draws the shape attached to a joint.
00084         // Called by render().
00085         virtual U32 drawShape( F32 pixelArea, BOOL first_pass = TRUE );
00086         virtual void drawNormals() {}
00087 
00088         enum Components
00089         {
00090                 SC_BONE         = 1,
00091                 SC_JOINT        = 2,
00092                 SC_AXES         = 4
00093         };
00094 
00095         // Selects which skeleton components to draw
00096         void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
00097 
00098         // Returns which skeleton components are enables for drawing
00099         U32 getSkeletonComponents() { return mComponents; }
00100 
00101         // Sets the level of detail for this node as a minimum
00102         // pixel area threshold.  If the current pixel area for this
00103         // object is less than the specified threshold, the node is
00104         // not traversed.  In addition, if a value is specified (not
00105         // default of 0.0), and the pixel area is larger than the
00106         // specified minimum, the node is rendered, but no other siblings
00107         // of this node under the same parent will be.
00108         F32 getLOD() { return mMinPixelArea; }
00109         void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
00110         
00111         // Sets the OpenGL selection stack name that is pushed and popped
00112         // with this joint state.  The default value indicates that no name
00113         // should be pushed/popped.
00114         enum PickName
00115         {
00116                 PN_DEFAULT = -1,
00117                 PN_0 = 0,
00118                 PN_1 = 1,
00119                 PN_2 = 2,
00120                 PN_3 = 3,
00121                 PN_4 = 4,
00122                 PN_5 = 5
00123         };
00124         void setPickName(PickName name) { mPickName = name; }
00125         PickName getPickName() { return mPickName; }
00126 
00127         virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
00128         virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE);
00129         virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
00130         virtual void updateGeometry();
00131         virtual void dump();
00132 
00133         void setVisible( BOOL visible, BOOL recursive );
00134 
00135 public:
00136         static BOOL     sDisableLOD;
00137 
00138 protected:
00139         BOOL            mValid;
00140         U32                     mComponents;
00141         F32                     mMinPixelArea;
00142         PickName        mPickName;
00143         BOOL            mVisible;
00144 };
00145 
00146 class LLViewerJointCollisionVolume : public LLViewerJoint
00147 {
00148 public:
00149         LLViewerJointCollisionVolume();
00150         LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL);
00151         virtual ~LLViewerJointCollisionVolume() {};
00152 
00153         virtual BOOL inheritScale() { return TRUE; }
00154 
00155         void renderCollision();
00156         LLVector3 getVolumePos(LLVector3 &offset);
00157 };
00158 
00159 #endif // LL_LLVIEWERJOINT_H
00160 
00161 

Generated on Fri May 16 08:34:10 2008 for SecondLife by  doxygen 1.5.5