PageRenderTime 121ms CodeModel.GetById 71ms app.highlight 24ms RepoModel.GetById 16ms 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
  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
 27#ifndef LL_LLPRIMTEXTURELIST_H
 28#define LL_LLPRIMTEXTURELIST_H
 29
 30#include <vector>
 31#include "lluuid.h"
 32#include "v3color.h"
 33#include "v4color.h"
 34
 35
 36class LLTextureEntry;
 37
 38// this is a list of LLTextureEntry*'s because in practice the list's elements
 39// are of some derived class: LLFooTextureEntry
 40typedef std::vector<LLTextureEntry*> texture_list_t;
 41
 42class LLPrimTextureList
 43{
 44public:
 45	// the LLPrimTextureList needs to know what type of LLTextureEntry 
 46	// to generate when it needs a new one, so we may need to set a 
 47	// callback for generating it, (or else use the base class default: 
 48	// static LLPrimTextureEntry::newTextureEntry() )
 49	//typedef LLTextureEntry* (__stdcall *NewTextureEntryFunction)();
 50	//static NewTextureEntryFunction sNewTextureEntryCallback;
 51	static LLTextureEntry* newTextureEntry();
 52	static void setNewTextureEntryCallback( LLTextureEntry* (*callback)() );
 53	static LLTextureEntry* (*sNewTextureEntryCallback)(); 
 54
 55	LLPrimTextureList();
 56	virtual ~LLPrimTextureList();
 57
 58	void clear();
 59
 60	// clears current entries
 61	// copies contents of other_list
 62	// this is somewhat expensive, so it must be called explicitly
 63	void copy(const LLPrimTextureList& other_list);
 64
 65	// clears current copies
 66	// takes contents of other_list
 67	// clears other_list
 68	void take(LLPrimTextureList& other_list);
 69
 70	// copies LLTextureEntry 'te'
 71	// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
 72	S32 copyTexture(const U8 index, const LLTextureEntry& te);
 73
 74	// takes ownership of LLTextureEntry* 'te'
 75	// returns TEM_CHANGE_TEXTURE if successful, otherwise TEM_CHANGE_NONE
 76	// IMPORTANT! -- if you use this function you must check the return value
 77	S32 takeTexture(const U8 index, LLTextureEntry* te);
 78
 79//	// copies contents of 'entry' and stores it in 'index' slot
 80//	void copyTexture(const U8 index, const LLTextureEntry* entry);
 81
 82	// returns pointer to texture at 'index' slot
 83	LLTextureEntry* getTexture(const U8 index) const;
 84
 85	S32 setID(const U8 index, const LLUUID& id);
 86	S32 setColor(const U8 index, const LLColor3& color);
 87	S32 setColor(const U8 index, const LLColor4& color);
 88	S32 setAlpha(const U8 index, const F32 alpha);
 89	S32 setScale(const U8 index, const F32 s, const F32 t);
 90	S32 setScaleS(const U8 index, const F32 s);
 91	S32 setScaleT(const U8 index, const F32 t);
 92	S32 setOffset(const U8 index, const F32 s, const F32 t);
 93	S32 setOffsetS(const U8 index, const F32 s);
 94	S32 setOffsetT(const U8 index, const F32 t);
 95	S32 setRotation(const U8 index, const F32 r);
 96	S32 setBumpShinyFullbright(const U8 index, const U8 bump);
 97	S32 setMediaTexGen(const U8 index, const U8 media);
 98	S32 setBumpMap(const U8 index, const U8 bump);
 99	S32 setBumpShiny(const U8 index, const U8 bump_shiny);
100	S32 setTexGen(const U8 index, const U8 texgen);
101	S32 setShiny(const U8 index, const U8 shiny);
102	S32 setFullbright(const U8 index, const U8 t);
103	S32 setMediaFlags(const U8 index, const U8 media_flags);
104	S32 setGlow(const U8 index, const F32 glow);
105
106	S32 size() const;
107
108//	void forceResize(S32 new_size);
109	void setSize(S32 new_size);
110
111	void setAllIDs(const LLUUID& id);
112protected:
113	texture_list_t mEntryList;
114private:
115	LLPrimTextureList(const LLPrimTextureList& other_list)
116	{
117		// private so that it can't be used
118	}
119};
120
121#endif