PageRenderTime 101ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/lldynamictexture.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 95 lines | 55 code | 15 blank | 25 comment | 0 complexity | 11f5ec100d957b4a389ef8017f1cbb96 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file lldynamictexture.h
  3. * @brief Implementation of LLViewerDynamicTexture class
  4. *
  5. * $LicenseInfo:firstyear=2002&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_LLDYNAMICTEXTURE_H
  27. #define LL_LLDYNAMICTEXTURE_H
  28. #include "llcamera.h"
  29. #include "llgl.h"
  30. #include "llcoord.h"
  31. #include "llviewertexture.h"
  32. #include "llcamera.h"
  33. class LLViewerDynamicTexture : public LLViewerTexture
  34. {
  35. public:
  36. enum
  37. {
  38. LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
  39. LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
  40. LL_VISUAL_PARAM_HINT,
  41. LL_VISUAL_PARAM_RESET,
  42. LL_PREVIEW_ANIMATION,
  43. LL_IMAGE_PREVIEW_SCULPTED,
  44. LL_IMAGE_PREVIEW_AVATAR,
  45. INVALID_DYNAMIC_TEXTURE
  46. };
  47. protected:
  48. /*virtual*/ ~LLViewerDynamicTexture();
  49. public:
  50. enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
  51. LLViewerDynamicTexture(S32 width,
  52. S32 height,
  53. S32 components, // = 4,
  54. EOrder order, // = ORDER_MIDDLE,
  55. BOOL clamp);
  56. /*virtual*/ S8 getType() const ;
  57. S32 getOriginX() { return mOrigin.mX; }
  58. S32 getOriginY() { return mOrigin.mY; }
  59. S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
  60. virtual BOOL needsRender() { return TRUE; }
  61. virtual void preRender(BOOL clear_depth = TRUE);
  62. virtual BOOL render();
  63. virtual void postRender(BOOL success);
  64. virtual void restoreGLTexture() {}
  65. virtual void destroyGLTexture() {}
  66. static BOOL updateAllInstances();
  67. static void destroyGL() ;
  68. static void restoreGL() ;
  69. protected:
  70. void generateGLTexture();
  71. void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE);
  72. protected:
  73. BOOL mClamp;
  74. LLCoordGL mOrigin;
  75. LLCamera mCamera;
  76. typedef std::set<LLViewerDynamicTexture*> instance_list_t;
  77. static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
  78. static S32 sNumRenders;
  79. };
  80. #endif