/indra/newview/llvograss.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 124 lines · 73 code · 25 blank · 26 comment · 0 complexity · 5d66b04e16ffad183091f009dd6acc99 MD5 · raw file

  1. /**
  2. * @file llvograss.h
  3. * @brief Description of LLVOGrass class
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLVOGRASS_H
  27. #define LL_LLVOGRASS_H
  28. #include "llviewerobject.h"
  29. #include "lldarray.h"
  30. #include <map>
  31. class LLSurfacePatch;
  32. class LLViewerTexture;
  33. class LLVOGrass : public LLAlphaObject
  34. {
  35. public:
  36. LLVOGrass(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
  37. // Initialize data that's only inited once per class.
  38. static void initClass();
  39. static void cleanupClass();
  40. virtual U32 getPartitionType() const;
  41. /*virtual*/ U32 processUpdateMessage(LLMessageSystem *mesgsys,
  42. void **user_data,
  43. U32 block_num,
  44. const EObjectUpdateType update_type,
  45. LLDataPacker *dp);
  46. static void import(LLFILE *file, LLMessageSystem *mesgsys, const LLVector3 &pos);
  47. /*virtual*/ void exportFile(LLFILE *file, const LLVector3 &position);
  48. void updateDrawable(BOOL force_damped);
  49. /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
  50. /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
  51. /*virtual*/ void getGeometry(S32 idx,
  52. LLStrider<LLVector4a>& verticesp,
  53. LLStrider<LLVector3>& normalsp,
  54. LLStrider<LLVector2>& texcoordsp,
  55. LLStrider<LLColor4U>& colorsp,
  56. LLStrider<U16>& indicesp);
  57. void updateFaceSize(S32 idx) { }
  58. /*virtual*/ void updateTextures();
  59. /*virtual*/ BOOL updateLOD();
  60. /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
  61. void plantBlades();
  62. /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
  63. BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
  64. /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
  65. S32 face = -1, // which face to check, -1 = ALL_SIDES
  66. BOOL pick_transparent = FALSE,
  67. S32* face_hit = NULL, // which face was hit
  68. LLVector3* intersection = NULL, // return the intersection point
  69. LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
  70. LLVector3* normal = NULL, // return the surface normal at the intersection point
  71. LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point
  72. );
  73. static S32 sMaxGrassSpecies;
  74. struct GrassSpeciesData
  75. {
  76. LLUUID mTextureID;
  77. F32 mBladeSizeX;
  78. F32 mBladeSizeY;
  79. };
  80. typedef std::map<U32, GrassSpeciesData*> SpeciesMap;
  81. U8 mSpecies; // Species of grass
  82. F32 mBladeSizeX;
  83. F32 mBladeSizeY;
  84. LLSurfacePatch *mPatch; // Stores the land patch where the grass is centered
  85. U64 mLastPatchUpdateTime;
  86. LLVector3 mGrassBend; // Accumulated wind (used for blowing trees)
  87. LLVector3 mGrassVel;
  88. LLVector3 mWind;
  89. F32 mBladeWindAngle;
  90. F32 mBWAOverlap;
  91. protected:
  92. ~LLVOGrass();
  93. private:
  94. void updateSpecies();
  95. F32 mLastHeight; // For cheap update hack
  96. S32 mNumBlades;
  97. static SpeciesMap sSpeciesTable;
  98. };
  99. #endif // LL_VO_GRASS_