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(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;
00090 F32 mDroop;
00091 F32 mTwist;
00092 F32 mBranches;
00093 U8 mDepth;
00094 F32 mScaleStep;
00095 U8 mTrunkDepth;
00096
00097 F32 mLeafScale;
00098 F32 mTrunkLength;
00099 F32 mBillboardScale;
00100 F32 mBillboardRatio;
00101 F32 mTrunkAspect;
00102 F32 mBranchAspect;
00103 F32 mRandomLeafRotate;
00104 F32 mNoiseScale;
00105 F32 mNoiseMag;
00106 F32 mTaper;
00107 F32 mRepeatTrunkZ;
00108 };
00109
00110 static F32 sTreeFactor;
00111
00112 friend class LLDrawPoolTree;
00113 protected:
00114 LLVector3 mTrunkBend;
00115 LLVector3 mTrunkVel;
00116 LLVector3 mWind;
00117
00118 LLPointer<LLViewerImage> mTreeImagep;
00119
00120 U8 mSpecies;
00121 F32 mBranchLength;
00122 F32 mTrunkLength;
00123 F32 mDroop;
00124 F32 mTwist;
00125 F32 mBranches;
00126 U8 mDepth;
00127 F32 mScaleStep;
00128 U8 mTrunkDepth;
00129
00130 F32 mLeafScale;
00131
00132 F32 mBillboardScale;
00133 F32 mBillboardRatio;
00134 F32 mTrunkAspect;
00135 F32 mBranchAspect;
00136 F32 mRandomLeafRotate;
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