llvograss.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLVOGRASS_H
00033 #define LL_LLVOGRASS_H
00034 
00035 #include "llviewerobject.h"
00036 #include "lldarray.h"
00037 #include <map>
00038 
00039 class LLSurfacePatch;
00040 class LLViewerImage;
00041 
00042 
00043 class LLVOGrass : public LLAlphaObject
00044 {
00045 public:
00046         LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
00047 
00048         // Initialize data that's only inited once per class.
00049         static void initClass();
00050         static void cleanupClass();
00051 
00052         virtual U32 getPartitionType() const;
00053 
00054         /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
00055                                                                                         void **user_data,
00056                                                                                         U32 block_num, 
00057                                                                                         const EObjectUpdateType update_type,
00058                                                                                         LLDataPacker *dp);
00059         static void import(FILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos);
00060         /*virtual*/ void exportFile(FILE *file, const LLVector3 &position);
00061 
00062         void updateDrawable(BOOL force_damped);
00063 
00064         /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
00065         /*virtual*/ BOOL                updateGeometry(LLDrawable *drawable);
00066         /*virtual*/ void                getGeometry(S32 idx,
00067                                                                 LLStrider<LLVector3>& verticesp,
00068                                                                 LLStrider<LLVector3>& normalsp, 
00069                                                                 LLStrider<LLVector2>& texcoordsp,
00070                                                                 LLStrider<LLColor4U>& colorsp, 
00071                                                                 LLStrider<U32>& indicesp);
00072 
00073         void updateFaceSize(S32 idx) { }
00074         /*virtual*/ void updateTextures(LLAgent &agent);                                                                                        
00075         /*virtual*/ BOOL updateLOD();
00076         /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
00077 
00078         void plantBlades();
00079 
00080         /*virtual*/ BOOL    isActive() const; // Whether this object needs to do an idleUpdate.
00081         BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
00082 
00083         static S32 sMaxGrassSpecies;
00084 
00085         struct GrassSpeciesData
00086         {
00087                 LLUUID  mTextureID;
00088                 
00089                 F32             mBladeSizeX;
00090                 F32             mBladeSizeY;
00091         };
00092 
00093         typedef std::map<U32, GrassSpeciesData*> SpeciesMap;
00094 
00095         U8                              mSpecies;               // Species of grass
00096         F32                             mBladeSizeX;
00097         F32                             mBladeSizeY;
00098         
00099         LLSurfacePatch           *mPatch;                       //  Stores the land patch where the grass is centered
00100 
00101         U64 mLastPatchUpdateTime;
00102 
00103         LLVector3                         mGrassBend;           // Accumulated wind (used for blowing trees)
00104         LLVector3                         mGrassVel;            
00105         LLVector3                         mWind;
00106         F32                                       mBladeWindAngle;
00107         F32                                       mBWAOverlap;
00108 
00109 protected:
00110         ~LLVOGrass();
00111 
00112 private:
00113         void updateSpecies();
00114         F32 mLastHeight;                // For cheap update hack
00115         S32 mNumBlades;
00116 
00117         static SpeciesMap sSpeciesTable;
00118 };
00119 #endif // LL_VO_GRASS_

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