aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/lltextureatlasmanager.h
diff options
context:
space:
mode:
authorArmin Weatherwax2010-09-07 13:41:02 +0200
committerArmin Weatherwax2010-09-23 15:42:40 +0200
commit087e15e89930d51c3964329befb273ae3b2d330d (patch)
tree684c49a772b0097ed88a25660e1fd3dd10b264cc /linden/indra/newview/lltextureatlasmanager.h
parentRobin Cornelius: fixes for building plugins on Linux 64bit (diff)
downloadmeta-impy-087e15e89930d51c3964329befb273ae3b2d330d.zip
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.gz
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.bz2
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.xz
port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system
Diffstat (limited to 'linden/indra/newview/lltextureatlasmanager.h')
-rw-r--r--linden/indra/newview/lltextureatlasmanager.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/linden/indra/newview/lltextureatlasmanager.h b/linden/indra/newview/lltextureatlasmanager.h
new file mode 100644
index 0000000..70689bf
--- /dev/null
+++ b/linden/indra/newview/lltextureatlasmanager.h
@@ -0,0 +1,112 @@
1/**
2 * @file lltextureatlasmanager.h
3 * @brief LLTextureAtlasManager base 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
33
34#ifndef LL_TEXTUREATLASMANAGER_H
35#define LL_TEXTUREATLASMANAGER_H
36
37#include "llmemory.h"
38
39class LLSpatialGroup ;
40class LLViewerImage ;
41
42//just use it as a structure.
43class LLTextureAtlasSlot : public LLRefCount
44{
45public:
46 LLTextureAtlasSlot(LLTextureAtlas* atlasp, LLSpatialGroup* groupp, S16 col, S16 row, F32 xoffset, F32 yoffset, S8 slot_width) ;
47
48protected:
49 virtual ~LLTextureAtlasSlot();
50
51public:
52
53 //
54 //do not allow to change those values
55 //
56 //void setAtlas(LLTextureAtlas* atlasp) ;
57 //void setSlotPos(S16 col, S16 row) ;
58 //void setSlotWidth(S8 width) ;
59 //void setTexCoordOffset(F32 xoffser, F32 yoffset) ;
60 //
61
62 void setSpatialGroup(LLSpatialGroup* groupp) ;
63 void setTexCoordScale(F32 xscale, F32 yscale) ;
64 void setValid() {mValid = TRUE ;}
65
66 LLTextureAtlas* getAtlas()const {return mAtlasp;}
67 LLSpatialGroup* getSpatialGroup() const {return mGroupp ;}
68 S16 getSlotCol()const {return mCol;}
69 S16 getSlotRow()const {return mRow;}
70 S8 getSlotWidth()const{return mReservedSlotWidth;}
71 BOOL isValid()const { return mValid;}
72 const LLVector2* getTexCoordOffset()const {return &mTexCoordOffset;}
73 const LLVector2* getTexCoordScale() const {return &mTexCoordScale;}
74
75 void setUpdatedTime(U32 t) {mUpdatedTime = t;}
76 U32 getUpdatedTime()const {return mUpdatedTime;}
77
78private:
79 LLTextureAtlas* mAtlasp;
80 S16 mCol ;//col of the slot
81 S16 mRow ;//row of the slot
82 S8 mReservedSlotWidth ; //slot is a square with each edge length a power-of-two number
83 LLSpatialGroup* mGroupp ;
84 BOOL mValid ;
85
86 LLVector2 mTexCoordOffset ;
87 LLVector2 mTexCoordScale ;
88
89 U32 mUpdatedTime ;
90} ;
91
92class LLTextureAtlasManager : public LLSingleton<LLTextureAtlasManager>
93{
94private:
95 typedef std::list<LLPointer<LLTextureAtlas> > ll_texture_atlas_list_t ;
96
97public:
98 LLTextureAtlasManager();
99 ~LLTextureAtlasManager();
100
101 LLPointer<LLTextureAtlasSlot> reserveAtlasSlot(S32 sub_texture_size, S8 ncomponents,
102 LLSpatialGroup* groupp, LLViewerImage* imagep) ;
103 void releaseAtlas(LLTextureAtlas* atlasp);
104
105 BOOL canAddToAtlas(S32 w, S32 h, S8 ncomponents, LLGLenum target) ;
106
107private:
108 std::vector<ll_texture_atlas_list_t> mAtlasMap ;
109 std::vector<ll_texture_atlas_list_t> mEmptyAtlasMap ; //delay some empty atlases deletion to avoid possible creation of new atlas immediately.
110};
111
112#endif