PageRenderTime 32ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llprimitive/llprimtexturelist.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 121 lines | 53 code | 19 blank | 49 comment | 0 complexity | 263db7739272da39a9a1a711957db52e MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llprimtexturelist.h
  3. * @brief LLPrimTextureList (virtual) base class
  4. *
  5. * $LicenseInfo:firstyear=2008&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_LLPRIMTEXTURELIST_H
  27. #define LL_LLPRIMTEXTURELIST_H
  28. #include <vector>
  29. #include "lluuid.h"
  30. #include "v3color.h"
  31. #include "v4color.h"
  32. class LLTextureEntry;
  33. // this is a list of LLTextureEntry*'s because in practice the list's elements
  34. // are of some derived class: LLFooTextureEntry
  35. typedef std::vector<LLTextureEntry*> texture_list_t;
  36. class LLPrimTextureList
  37. {
  38. public:
  39. // the LLPrimTextureList needs to know what type of LLTextureEntry
  40. // to generate when it needs a new one, so we may need to set a
  41. // callback for generating it, (or else use the base class default:
  42. // static LLPrimTextureEntry::newTextureEntry() )
  43. //typedef LLTextureEntry* (__stdcall *NewTextureEntryFunction)();
  44. //static NewTextureEntryFunction sNewTextureEntryCallback;
  45. static LLTextureEntry* newTextureEntry();
  46. static void setNewTextureEntryCallback( LLTextureEntry* (*callback)() );
  47. static LLTextureEntry* (*sNewTextureEntryCallback)();
  48. LLPrimTextureList();
  49. virtual ~LLPrimTextureList();
  50. void clear();
  51. // clears current entries
  52. // copies contents of other_list
  53. // this is somewhat expensive, so it must be called explicitly
  54. void copy(const LLPrimTextureList& other_list);
  55. // clears current copies
  56. // takes contents of other_list
  57. // clears other_list
  58. void take(LLPrimTextureList& other_list);
  59. // copies LLTextureEntry 'te'
  60. // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
  61. S32 copyTexture(const U8 index, const LLTextureEntry& te);
  62. // takes ownership of LLTextureEntry* 'te'
  63. // returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
  64. // IMPORTANT! -- if you use this function you must check the return value
  65. S32 takeTexture(const U8 index, LLTextureEntry* te);
  66. // // copies contents of 'entry' and stores it in 'index' slot
  67. // void copyTexture(const U8 index, const LLTextureEntry* entry);
  68. // returns pointer to texture at 'index' slot
  69. LLTextureEntry* getTexture(const U8 index) const;
  70. S32 setID(const U8 index, const LLUUID& id);
  71. S32 setColor(const U8 index, const LLColor3& color);
  72. S32 setColor(const U8 index, const LLColor4& color);
  73. S32 setAlpha(const U8 index, const F32 alpha);
  74. S32 setScale(const U8 index, const F32 s, const F32 t);
  75. S32 setScaleS(const U8 index, const F32 s);
  76. S32 setScaleT(const U8 index, const F32 t);
  77. S32 setOffset(const U8 index, const F32 s, const F32 t);
  78. S32 setOffsetS(const U8 index, const F32 s);
  79. S32 setOffsetT(const U8 index, const F32 t);
  80. S32 setRotation(const U8 index, const F32 r);
  81. S32 setBumpShinyFullbright(const U8 index, const U8 bump);
  82. S32 setMediaTexGen(const U8 index, const U8 media);
  83. S32 setBumpMap(const U8 index, const U8 bump);
  84. S32 setBumpShiny(const U8 index, const U8 bump_shiny);
  85. S32 setTexGen(const U8 index, const U8 texgen);
  86. S32 setShiny(const U8 index, const U8 shiny);
  87. S32 setFullbright(const U8 index, const U8 t);
  88. S32 setMediaFlags(const U8 index, const U8 media_flags);
  89. S32 setGlow(const U8 index, const F32 glow);
  90. S32 size() const;
  91. // void forceResize(S32 new_size);
  92. void setSize(S32 new_size);
  93. void setAllIDs(const LLUUID& id);
  94. protected:
  95. texture_list_t mEntryList;
  96. private:
  97. LLPrimTextureList(const LLPrimTextureList& other_list)
  98. {
  99. // private so that it can't be used
  100. }
  101. };
  102. #endif