aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerimagelist.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llviewerimagelist.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerimagelist.h211
1 files changed, 211 insertions, 0 deletions
diff --git a/linden/indra/newview/llviewerimagelist.h b/linden/indra/newview/llviewerimagelist.h
new file mode 100644
index 0000000..68cfcaf
--- /dev/null
+++ b/linden/indra/newview/llviewerimagelist.h
@@ -0,0 +1,211 @@
1/**
2 * @file llviewerimagelist.h
3 * @brief Object for managing the list of images within a region
4 *
5 * Copyright (c) 2000-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLVIEWERIMAGELIST_H
29#define LL_LLVIEWERIMAGELIST_H
30
31#include "lluuid.h"
32#include "message.h"
33#include "llgl.h"
34#include "llstat.h"
35#include "llviewerimage.h"
36#include <list>
37#include <set>
38
39const BOOL MIPMAP_YES = TRUE;
40const BOOL MIPMAP_NO = FALSE;
41
42const BOOL GL_TEXTURE_YES = TRUE;
43const BOOL GL_TEXTURE_NO = FALSE;
44
45const BOOL IMMEDIATE_YES = TRUE;
46const BOOL IMMEDIATE_NO = FALSE;
47
48class LLViewerImage;
49class LLTextureView;
50
51typedef void (*LLImageCallback)(BOOL success,
52 LLViewerImage *src_vi,
53 LLImageRaw* src,
54 LLImageRaw* src_aux,
55 S32 discard_level,
56 BOOL final,
57 void* userdata);
58
59class LLViewerImageList : public LLImageProviderInterface
60{
61 friend class LLTextureView;
62
63public:
64 static BOOL createUploadFile(const LLString& filename, const LLString& out_filename, const U8 codec);
65 static void processImageNotInDatabase( LLMessageSystem *msg, void **user_data );
66 static S32 calcMaxTextureRAM();
67
68public:
69 LLViewerImageList();
70 ~LLViewerImageList();
71
72 // LLImageProviderInterface
73 LLImageGL* getUIImageByID(const LLUUID& id, BOOL clamped = TRUE);
74
75 void init();
76 void shutdown();
77 void dump();
78 void destroyGL(BOOL save_state = TRUE);
79 void restoreGL();
80
81 LLViewerImage * getImage(const LLString& filename,
82 const LLUUID &image_id,
83 BOOL usemipmap = TRUE,
84 BOOL level_immediate = FALSE // Get the requested level immediately upon creation.
85 );
86 LLViewerImage * getImage(const LLUUID &image_id,
87 BOOL usemipmap = TRUE,
88 BOOL level_immediate = FALSE // Get the requested level immediately upon creation.
89 );
90
91 LLViewerImage * getImageFromFile(const LLString& filename,
92 const LLUUID &image_id,
93 BOOL usemipmap,
94 BOOL level_immediate, // Get the requested level immediately upon creation.
95 LLGLint internal_format,
96 LLGLenum primary_format
97 );
98
99 LLViewerImage * getImageFromUUID(const LLUUID &image_id,
100 BOOL usemipmap,
101 BOOL level_immediate, // Get the requested level immediately upon creation.
102 LLGLint internal_format,
103 LLGLenum primary_format,
104 LLHost request_from_host = LLHost()
105 );
106
107 // Request image from a specific host, used for baked avatar textures.
108 // Implemented in header in case someone changes default params above. JC
109 LLViewerImage* getImageFromHost(const LLUUID& image_id, LLHost host)
110 { return getImageFromUUID(image_id, TRUE, FALSE, 0, 0, host); }
111
112 LLViewerImage *hasImage(const LLUUID &image_id);
113 void addImage(LLViewerImage *image);
114 void deleteImage(LLViewerImage *image);
115
116 void addImageToList(LLViewerImage *image);
117 void removeImageFromList(LLViewerImage *image);
118
119 void updateMovieImage(const LLUUID& image_id, BOOL active);
120
121 // Using image stats, determine what images are necessary, and perform image updates.
122 void updateImages(F32 decode_time);
123
124 // Decode and create textures for all images currently in list.
125 void decodeAllImages(F32 max_decode_time = 0.f);
126
127 void handleIRCallback(void **data, const S32 number);
128
129 void setUpdateStats(BOOL b) { mUpdateStats = b; }
130
131 S32 getMaxResidentTexMem() const { return mMaxResidentTexMem; }
132 S32 getVideoMemorySetting() const { return mVideoMemorySetting; }
133 S32 getNumImages() { return mImageList.size(); }
134
135 static S32 getMaxVideoRamSetting(S32 max = -1);
136 void updateMaxResidentTexMem(S32 max = -1, U32 fudge = 0);
137
138 void doPreloadImages();
139
140private:
141 LLViewerImage* preloadImage(const LLString& filename, const LLUUID &image_set_id, BOOL use_mips);
142 void updateImagesDecodePriorities();
143 void updateImagesSendRequests();
144 void updateImagesDecodeTextures(F32 decode_max_time);
145 void updateImagesMediaStreams();
146 void updateImagesPollVFS();
147 void updateImagesUpdateStats();
148
149public:
150 typedef std::set<LLPointer<LLViewerImage>, LLViewerImage::Compare> image_list_t;
151 typedef std::set<LLPointer<LLViewerImage>, LLViewerImage::CompareForRemoval> image_removal_list_t;
152 typedef std::set<LLPointer<LLViewerImage>, LLViewerImage::CompareForWorstVisibility> image_visibility_list_t;
153
154 // List of pending texture loads, waiting for the VFS.
155 // The asynchronous read has been initiated for all images in the list.
156 typedef std::list<LLPointer<LLViewerImage> > image_loading_list_t;
157 image_loading_list_t mLoadingStreamList;
158
159 // Images with "loaded" callbacks
160 typedef std::set<LLPointer<LLViewerImage> > image_callback_list_t;
161 image_callback_list_t mCallbackList;
162
163 BOOL mForceResetTextureStats;
164
165private:
166 typedef std::map< LLUUID, LLPointer<LLViewerImage> > uuid_map_t;
167 uuid_map_t mUUIDMap;
168 LLUUID mLastUpdateUUID;
169
170 image_list_t mImageList;
171
172 LLPointer<LLViewerImage> mCurrentDecodeImagep;
173
174 typedef std::vector<LLPointer<LLViewerImage> > callback_data_t;
175 typedef std::set< callback_data_t* > callback_data_list_t;
176 callback_data_list_t mIRCallbackData;
177
178 BOOL mUpdateStats;
179 S32 mMaxResidentTexMem;
180 S32 mVideoMemorySetting;
181 LLFrameTimer mForceDecodeTimer;
182
183 LLUUID mMovieImageUUID;
184 U8 mMovieImageHasMips;
185
186 std::vector<LLPointer<LLViewerImage> > mPreloadedImages;
187
188public:
189 static U32 sTextureBits;
190 static U32 sTexturePackets;
191
192 static LLStat sNumImagesStat;
193 static LLStat sNumRawImagesStat;
194 static LLStat sGLTexMemStat;
195 static LLStat sGLBoundMemStat;
196 static LLStat sRawMemStat;
197 static LLStat sFormattedMemStat;
198
199private:
200 static S32 sNumImages;
201 static void (*sUUIDCallback)(void**, const LLUUID &);
202};
203
204const BOOL GLTEXTURE_TRUE = TRUE;
205const BOOL GLTEXTURE_FALSE = FALSE;
206const BOOL MIPMAP_TRUE = TRUE;
207const BOOL MIPMAP_FALSE = FALSE;
208
209extern LLViewerImageList gImageList;
210
211#endif