PageRenderTime 360ms CodeModel.GetById 163ms app.highlight 5ms RepoModel.GetById 85ms app.codeStats 1ms

/indra/newview/lllocaltextureobject.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 87 lines | 41 code | 15 blank | 31 comment | 0 complexity | bb002047c68371cca65bf6de45a24a8a MD5 | raw file
 1/** 
 2 * @file lllocaltextureobject.h
 3 * @brief LLLocalTextureObject class header file
 4 *
 5 * $LicenseInfo:firstyear=2009&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
27#ifndef LL_LOCALTEXTUREOBJECT_H
28#define LL_LOCALTEXTUREOBJECT_H
29
30#include <boost/shared_ptr.hpp>
31
32#include "llviewertexture.h"
33
34class LLUUID;
35class LLTexLayer;
36class LLTextureEntry;
37class LLTexLayerTemplate;
38class LLWearable;
39
40// Stores all relevant information for a single texture 
41// assumed to have ownership of all objects referred to - 
42// will delete objects when being replaced or if object is destroyed.
43class LLLocalTextureObject
44{
45public:
46	LLLocalTextureObject();
47	LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id);
48	LLLocalTextureObject(const LLLocalTextureObject& lto);
49	~LLLocalTextureObject();
50
51	LLViewerFetchedTexture* getImage() const;
52	LLTexLayer* getTexLayer(U32 index) const;
53	LLTexLayer* getTexLayer(const std::string &name);
54	U32 		getNumTexLayers() const;
55	LLUUID		getID() const;
56	S32			getDiscard() const;
57	BOOL		getBakedReady() const;
58
59	void setImage(LLViewerFetchedTexture* new_image);
60	BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
61	BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
62	BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
63	BOOL removeTexLayer(U32 index);
64
65	void setID(LLUUID new_id);
66	void setDiscard(S32 new_discard);
67	void setBakedReady(BOOL ready);
68
69protected:
70
71private:
72
73	LLPointer<LLViewerFetchedTexture>  			mImage;
74	// NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
75	// using shared pointers here only for smart assignment & cleanup
76	// do NOT create new shared pointers to these objects, or keep pointers to them around
77	typedef std::vector<LLTexLayer*> tex_layer_vec_t;
78	tex_layer_vec_t mTexLayers;
79
80	LLUUID			mID;
81
82	BOOL mIsBakedReady;
83	S32 mDiscard;
84};
85
86 #endif // LL_LOCALTEXTUREOBJECT_H
87