PageRenderTime 129ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llvosurfacepatch.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 137 lines | 90 code | 21 blank | 26 comment | 0 complexity | 401cc0af5fb7efb1ab2d636b9b13450c MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llvosurfacepatch.h
  3. * @brief Description of LLVOSurfacePatch 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_VOSURFACEPATCH_H
  27. #define LL_VOSURFACEPATCH_H
  28. #include "llviewerobject.h"
  29. #include "llstrider.h"
  30. class LLSurfacePatch;
  31. class LLDrawPool;
  32. class LLVector2;
  33. class LLVOSurfacePatch : public LLStaticViewerObject
  34. {
  35. public:
  36. static F32 sLODFactor;
  37. enum
  38. {
  39. VERTEX_DATA_MASK = (1 << LLVertexBuffer::TYPE_VERTEX) |
  40. (1 << LLVertexBuffer::TYPE_NORMAL) |
  41. (1 << LLVertexBuffer::TYPE_TEXCOORD0) |
  42. (1 << LLVertexBuffer::TYPE_TEXCOORD1)
  43. };
  44. LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
  45. /*virtual*/ void markDead();
  46. // Initialize data that's only inited once per class.
  47. static void initClass();
  48. virtual U32 getPartitionType() const;
  49. /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline);
  50. /*virtual*/ void updateGL();
  51. /*virtual*/ BOOL updateGeometry(LLDrawable *drawable);
  52. /*virtual*/ BOOL updateLOD();
  53. /*virtual*/ void updateFaceSize(S32 idx);
  54. void getGeometry(LLStrider<LLVector3> &verticesp,
  55. LLStrider<LLVector3> &normalsp,
  56. LLStrider<LLVector2> &texCoords0p,
  57. LLStrider<LLVector2> &texCoords1p,
  58. LLStrider<U16> &indicesp);
  59. /*virtual*/ void updateTextures();
  60. /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); // generate accurate apparent angle and area
  61. /*virtual*/ void updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax);
  62. /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate.
  63. void setPatch(LLSurfacePatch *patchp);
  64. LLSurfacePatch *getPatch() const { return mPatchp; }
  65. void dirtyPatch();
  66. void dirtyGeom();
  67. /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end,
  68. S32 face = -1, // which face to check, -1 = ALL_SIDES
  69. BOOL pick_transparent = FALSE,
  70. S32* face_hit = NULL, // which face was hit
  71. LLVector3* intersection = NULL, // return the intersection point
  72. LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point
  73. LLVector3* normal = NULL, // return the surface normal at the intersection point
  74. LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point
  75. );
  76. BOOL mDirtiedPatch;
  77. protected:
  78. ~LLVOSurfacePatch();
  79. LLFacePool *mPool;
  80. LLFacePool *getPool();
  81. S32 mBaseComp;
  82. LLSurfacePatch *mPatchp;
  83. BOOL mDirtyTexture;
  84. BOOL mDirtyTerrain;
  85. S32 mLastNorthStride;
  86. S32 mLastEastStride;
  87. S32 mLastStride;
  88. S32 mLastLength;
  89. void getGeomSizesMain(const S32 stride, S32 &num_vertices, S32 &num_indices);
  90. void getGeomSizesNorth(const S32 stride, const S32 north_stride,
  91. S32 &num_vertices, S32 &num_indices);
  92. void getGeomSizesEast(const S32 stride, const S32 east_stride,
  93. S32 &num_vertices, S32 &num_indices);
  94. void updateMainGeometry(LLFace *facep,
  95. LLStrider<LLVector3> &verticesp,
  96. LLStrider<LLVector3> &normalsp,
  97. LLStrider<LLVector2> &texCoords0p,
  98. LLStrider<LLVector2> &texCoords1p,
  99. LLStrider<U16> &indicesp,
  100. U32 &index_offset);
  101. void updateNorthGeometry(LLFace *facep,
  102. LLStrider<LLVector3> &verticesp,
  103. LLStrider<LLVector3> &normalsp,
  104. LLStrider<LLVector2> &texCoords0p,
  105. LLStrider<LLVector2> &texCoords1p,
  106. LLStrider<U16> &indicesp,
  107. U32 &index_offset);
  108. void updateEastGeometry(LLFace *facep,
  109. LLStrider<LLVector3> &verticesp,
  110. LLStrider<LLVector3> &normalsp,
  111. LLStrider<LLVector2> &texCoords0p,
  112. LLStrider<LLVector2> &texCoords1p,
  113. LLStrider<U16> &indicesp,
  114. U32 &index_offset);
  115. };
  116. #endif // LL_VOSURFACEPATCH_H