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
00059 static void initClass();
00060 static void cleanupClass();
00061
00062 U32 processUpdateMessage(LLMessageSystem *mesgsys,
00063 void **user_data,
00064 U32 block_num, const EObjectUpdateType update_type,
00065 LLDataPacker *dp);
00066 BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00067
00068
00069 void render(LLAgent &agent);
00070 void setPixelAreaAndAngle(LLAgent &agent);
00071 void updateTextures(LLAgent &agent);
00072
00073 LLDrawable* createDrawable(LLPipeline *pipeline);
00074 BOOL updateGeometry(LLDrawable *drawable);
00075 void updateSpatialExtents(LLVector3 &min, LLVector3 &max);
00076
00077 virtual U32 getPartitionType() const;
00078
00079 void updateRadius();
00080
00081 U32 drawBranchPipeline(U32* indicesp, S32 trunk_LOD, S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha);
00082
00083 void drawBranch(S32 stop_level, U16 depth, U16 trunk_depth, F32 scale, F32 twist, F32 droop, F32 branches, F32 alpha, BOOL draw_leaves);
00084
00085 static S32 sMaxTreeSpecies;
00086
00087 struct TreeSpeciesData
00088 {
00089 LLUUID mTextureID;
00090
00091 F32 mBranchLength;
00092 F32 mDroop;
00093 F32 mTwist;
00094 F32 mBranches;
00095 U8 mDepth;
00096 F32 mScaleStep;
00097 U8 mTrunkDepth;
00098
00099 F32 mLeafScale;
00100 F32 mTrunkLength;
00101 F32 mBillboardScale;
00102 F32 mBillboardRatio;
00103 F32 mTrunkAspect;
00104 F32 mBranchAspect;
00105 F32 mRandomLeafRotate;
00106 F32 mNoiseScale;
00107 F32 mNoiseMag;
00108 F32 mTaper;
00109 F32 mRepeatTrunkZ;
00110 };
00111
00112 static F32 sTreeFactor;
00113
00114 friend class LLDrawPoolTree;
00115 protected:
00116 LLVector3 mTrunkBend;
00117 LLVector3 mTrunkVel;
00118 LLVector3 mWind;
00119
00120 LLPointer<LLViewerImage> mTreeImagep;
00121
00122 U8 mSpecies;
00123 F32 mBranchLength;
00124 F32 mTrunkLength;
00125 F32 mDroop;
00126 F32 mTwist;
00127 F32 mBranches;
00128 U8 mDepth;
00129 F32 mScaleStep;
00130 U8 mTrunkDepth;
00131
00132 F32 mLeafScale;
00133
00134 F32 mBillboardScale;
00135 F32 mBillboardRatio;
00136 F32 mTrunkAspect;
00137 F32 mBranchAspect;
00138 F32 mRandomLeafRotate;
00139
00140 U32 mFrameCount;
00141
00142 typedef std::map<U32, TreeSpeciesData*> SpeciesMap;
00143 static SpeciesMap sSpeciesTable;
00144
00145 static S32 sLODIndexOffset[4];
00146 static S32 sLODIndexCount[4];
00147 static S32 sLODVertexOffset[4];
00148 static S32 sLODVertexCount[4];
00149 static S32 sLODSlices[4];
00150 static F32 sLODAngles[4];
00151 };
00152
00153 #endif