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         virtual void writeCAL3D(apr_file_t* fp);
00135 
00136 public:
00137         static BOOL     sDisableLOD;
00138 
00139 protected:
00140         BOOL            mValid;
00141         U32                     mComponents;
00142         F32                     mMinPixelArea;
00143         PickName        mPickName;
00144         BOOL            mVisible;
00145 };
00146 
00147 class LLViewerJointCollisionVolume : public LLViewerJoint
00148 {
00149 public:
00150         LLViewerJointCollisionVolume();
00151         LLViewerJointCollisionVolume(const std::string &name, LLJoint *parent = NULL);
00152         virtual ~LLViewerJointCollisionVolume() {};
00153 
00154         virtual BOOL inheritScale() { return TRUE; }
00155 
00156         void render();
00157         LLVector3 getVolumePos(LLVector3 &offset);
00158 };
00159 
00160 #endif // LL_LLVIEWERJOINT_H
00161 
00162 

Generated on Thu Jul 1 06:09:28 2010 for Second Life Viewer by  doxygen 1.4.7