lldynamictexture.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /**
  2. * @file lldynamictexture.h
  3. * @brief Implementation of LLDynamicTexture class
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLDYNAMICTEXTURE_H
  33. #define LL_LLDYNAMICTEXTURE_H
  34. #include "llcoord.h"
  35. #include "llviewertexture.h"
  36. class LLViewerDynamicTexture : public LLViewerTexture
  37. {
  38. public:
  39. enum
  40. {
  41. LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
  42. LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
  43. LL_VISUAL_PARAM_HINT,
  44. LL_VISUAL_PARAM_RESET,
  45. LL_PREVIEW_ANIMATION,
  46. LL_IMAGE_PREVIEW_SCULPTED,
  47. LL_IMAGE_PREVIEW_AVATAR,
  48. INVALID_DYNAMIC_TEXTURE
  49. };
  50. protected:
  51. ~LLViewerDynamicTexture() override;
  52. public:
  53. enum EOrder
  54. {
  55. ORDER_FIRST = 0,
  56. ORDER_MIDDLE = 1,
  57. ORDER_LAST = 2,
  58. ORDER_RESET = 3,
  59. ORDER_COUNT = 4
  60. };
  61. LLViewerDynamicTexture(S32 width, S32 height,
  62. S32 components, // = 4,
  63. EOrder order, // = ORDER_MIDDLE,
  64. bool clamp);
  65. S8 getType() const override;
  66. LL_INLINE S32 getOriginX() const { return mOrigin.mX; }
  67. LL_INLINE S32 getOriginY() const { return mOrigin.mY; }
  68. LL_INLINE S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
  69. LL_INLINE virtual bool needsRender() { return true; }
  70. virtual void preRender(bool clear_depth = true);
  71. virtual bool render() { return false; }
  72. virtual void postRender(bool success);
  73. static bool updateAllInstances();
  74. protected:
  75. void generateGLTexture();
  76. void generateGLTexture(S32 internal_format, U32 primary_format,
  77. U32 type_format, bool swap_bytes = false);
  78. protected:
  79. alignas(16) LLCamera mCamera;
  80. LLCoordGL mOrigin;
  81. bool mClamp;
  82. typedef std::set<LLViewerDynamicTexture*> instance_list_t;
  83. static instance_list_t sInstances[ORDER_COUNT];
  84. static S32 sNumRenders;
  85. };
  86. #endif