llvotree.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVOTREE_H
00033 #define LL_LLVOTREE_H
00034 
00035 #include "llviewerobject.h"
00036 #include "lldarray.h"
00037 #include "xform.h"
00038 
00039 class LLFace;
00040 class LLDrawPool;
00041 
00042 
00043 class LLVOTree : public LLViewerObject
00044 {
00045 protected:
00046         ~LLVOTree();
00047 
00048 public:
00049         enum
00050         {
00051                 VERTEX_DATA_MASK =      (1 << LLVertexBuffer::TYPE_VERTEX) |
00052                                                         (1 << LLVertexBuffer::TYPE_NORMAL) |
00053                                                         (1 << LLVertexBuffer::TYPE_TEXCOORD)
00054         };
00055 
00056         LLVOTree(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
00057 
00058         // Initialize data that's only inited once per class.
00059         static void initClass();
00060         static void cleanupClass();
00061 
00062         /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
00063                                                                                         void **user_data,
00064                                                                                         U32 block_num, const EObjectUpdateType update_type,
00065                                                                                         LLDataPacker *dp);
00066         /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00067         
00068         // Graphical stuff for objects - maybe broken out into render class later?
00069         /*virtual*/ void render(LLAgent &agent);
00070         /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent);
00071         /*virtual*/ void updateTextures(LLAgent &agent);
00072 
00073         /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
00074         /*virtual*/ BOOL                updateGeometry(LLDrawable *drawable);
00075         /*virtual*/ void                updateSpatialExtents(LLVector3 &min, LLVector3 &max);
00076 
00077         virtual U32 getPartitionType() const;
00078 
00079         void updateRadius();
00080 
00081         U32 drawBranchPipeline(LLMatrix4& matrix, U16* indicesp, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth,  F32 scale, F32 twist, F32 droop,  F32 branches, F32 alpha);
00082  
00083         static S32 sMaxTreeSpecies;
00084 
00085         struct TreeSpeciesData
00086         {
00087                 LLUUID mTextureID;
00088                 
00089                 F32                             mBranchLength;  // Scale (length) of tree branches
00090                 F32                             mDroop;                 // Droop from vertical (degrees) at each branch recursion
00091                 F32                             mTwist;                 // Twist 
00092                 F32                             mBranches;              // Number of branches emitted at each recursion level 
00093                 U8                              mDepth;                 // Number of recursions to tips of branches
00094                 F32                             mScaleStep;             // Multiplier for scale at each recursion level
00095                 U8                              mTrunkDepth;
00096 
00097                 F32                             mLeafScale;             // Scales leaf texture when rendering 
00098                 F32                             mTrunkLength;   // Scales branch diameters when rendering 
00099                 F32                             mBillboardScale; // Scales the billboard representation 
00100                 F32                             mBillboardRatio; // Height to width aspect ratio
00101                 F32                             mTrunkAspect;   
00102                 F32                             mBranchAspect;
00103                 F32                             mRandomLeafRotate;
00104                 F32                             mNoiseScale;    //  Scaling of noise function in perlin space (norm = 1.0)
00105                 F32                             mNoiseMag;              //  amount of perlin noise to deform by (0 = none)
00106                 F32                             mTaper;                 //  amount of perlin noise to deform by (0 = none)
00107                 F32                             mRepeatTrunkZ;  //  Times to repeat the trunk texture vertically along trunk 
00108         };
00109 
00110         static F32 sTreeFactor;                 // Tree level of detail factor
00111 
00112         friend class LLDrawPoolTree;
00113 protected:
00114         LLVector3               mTrunkBend;             // Accumulated wind (used for blowing trees)
00115         LLVector3               mTrunkVel;              // 
00116         LLVector3               mWind;
00117 
00118         LLPointer<LLViewerImage> mTreeImagep;   // Pointer to proper tree image
00119 
00120         U8                              mSpecies;               // Species of tree
00121         F32                             mBranchLength;  // Scale (length) of tree branches
00122         F32                             mTrunkLength;   // Trunk length (first recursion)
00123         F32                             mDroop;                 // Droop from vertical (degrees) at each branch recursion
00124         F32                             mTwist;                 // Twist 
00125         F32                             mBranches;              // Number of branches emitted at each recursion level 
00126         U8                              mDepth;                 // Number of recursions to tips of branches
00127         F32                             mScaleStep;             // Multiplier for scale at each recursion level
00128         U8                              mTrunkDepth;
00129 
00130         F32                             mLeafScale;             // Scales leaf texture when rendering 
00131 
00132         F32                             mBillboardScale;        //  How big to draw the billboard?
00133         F32                             mBillboardRatio;        //  Height to width ratio of billboard
00134         F32                             mTrunkAspect;           //  Ratio between width/length of trunk
00135         F32                             mBranchAspect;  //  Ratio between width/length of branch
00136         F32                             mRandomLeafRotate;      //      How much to randomly rotate leaves about arbitrary axis 
00137         
00138         U32 mFrameCount;
00139 
00140         typedef std::map<U32, TreeSpeciesData*> SpeciesMap;
00141         static SpeciesMap sSpeciesTable;
00142 
00143         static S32 sLODIndexOffset[4];
00144         static S32 sLODIndexCount[4];
00145         static S32 sLODVertexOffset[4];
00146         static S32 sLODVertexCount[4];
00147         static S32 sLODSlices[4];
00148         static F32 sLODAngles[4];
00149 };
00150 
00151 #endif

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