llprimtexturelist.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /**
  2. * @file llprimtexturelist.h
  3. * @brief LLPrimTextureList (virtual) base class
  4. *
  5. * $LicenseInfo:firstyear=2008&license=viewergpl$
  6. *
  7. * Copyright (c) 2010, 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_LLPRIMTEXTURELIST_H
  33. #define LL_LLPRIMTEXTURELIST_H
  34. #include <vector>
  35. #include "llmaterial.h"
  36. #include "lluuid.h"
  37. #include "llcolor3.h"
  38. #include "llcolor4.h"
  39. class LLMaterialID;
  40. class LLTextureEntry;
  41. // This is a list of LLTextureEntry*'s because in practice the list elements
  42. // are of some derived class: LLFooTextureEntry
  43. typedef std::vector<LLTextureEntry*> texture_list_t;
  44. class LLPrimTextureList
  45. {
  46. protected:
  47. LOG_CLASS(LLPrimTextureList);
  48. public:
  49. // The LLPrimTextureList needs to know what type of LLTextureEntry to
  50. // generate when it needs a new one, so we may need to set a callback for
  51. // generating it (or else use the base class default:
  52. // static LLPrimTextureEntry::newTextureEntry() )
  53. // typedef LLTextureEntry* (__stdcall* NewTextureEntryFunction)();
  54. // static NewTextureEntryFunction sNewTextureEntryCallback;
  55. static LLTextureEntry* newTextureEntry();
  56. static void setNewTextureEntryCallback(LLTextureEntry* (*callback)());
  57. static LLTextureEntry* (*sNewTextureEntryCallback)();
  58. LLPrimTextureList();
  59. virtual ~LLPrimTextureList();
  60. void clear();
  61. // Clears current entries and copies contents of other_list;
  62. // this is somewhat expensive, so it must be called explicitly
  63. void copy(const LLPrimTextureList& other_list);
  64. // Clears current copies, takes contents of other_list and clears
  65. // other_list
  66. void take(LLPrimTextureList& other_list);
  67. // Copies LLTextureEntry 'te'. Returns TEM_CHANGE_TEXTURE if successful,
  68. // otherwise TEM_CHANGE_NONE
  69. S32 copyTexture(U8 index, const LLTextureEntry* te);
  70. // Takes ownership of LLTextureEntry* 'te', returns TEM_CHANGE_TEXTURE if
  71. // successful, otherwise TEM_CHANGE_NONE.
  72. // IMPORTANT: if you use this method you must check the return value
  73. S32 takeTexture(U8 index, LLTextureEntry* te);
  74. // Returns pointer to texture at 'index' slot
  75. LLTextureEntry* getTexture(U8 index) const;
  76. S32 setID(U8 index, const LLUUID& id);
  77. S32 setColor(U8 index, const LLColor3& color);
  78. S32 setColor(U8 index, const LLColor4& color);
  79. S32 setAlpha(U8 index, F32 alpha);
  80. S32 setScale(U8 index, F32 s, F32 t);
  81. S32 setScaleS(U8 index, F32 s);
  82. S32 setScaleT(U8 index, F32 t);
  83. S32 setOffset(U8 index, F32 s, F32 t);
  84. S32 setOffsetS(U8 index, F32 s);
  85. S32 setOffsetT(U8 index, F32 t);
  86. S32 setRotation(U8 index, F32 r);
  87. S32 setBumpShinyFullbright(U8 index, U8 bump);
  88. S32 setMediaTexGen(U8 index, U8 media);
  89. S32 setBumpMap(U8 index, U8 bump);
  90. S32 setBumpShiny(U8 index, U8 bump_shiny);
  91. S32 setTexGen(U8 index, U8 texgen);
  92. S32 setShiny(U8 index, U8 shiny);
  93. S32 setFullbright(U8 index, U8 t);
  94. S32 setMediaFlags(U8 index, U8 media_flags);
  95. S32 setGlow(U8 index, F32 glow);
  96. S32 setMaterialID(U8 index, const LLMaterialID& matidp);
  97. S32 setMaterialParams(U8 index, const LLMaterialPtr paramsp);
  98. LLMaterialPtr getMaterialParams(U8 index);
  99. S32 size() const;
  100. #if 0
  101. void forceResize(S32 new_size);
  102. #endif
  103. void setSize(S32 new_size);
  104. void setAllIDs(const LLUUID& id);
  105. private:
  106. // Private so that it cannot be used
  107. LLPrimTextureList(const LLPrimTextureList&)
  108. {
  109. }
  110. protected:
  111. texture_list_t mEntryList;
  112. };
  113. #endif