PageRenderTime 19ms CodeModel.GetById 10ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/lldynamictexture.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 95 lines | 55 code | 15 blank | 25 comment | 0 complexity | 11f5ec100d957b4a389ef8017f1cbb96 MD5 | raw file
 1/** 
 2 * @file lldynamictexture.h
 3 * @brief Implementation of LLViewerDynamicTexture class
 4 *
 5 * $LicenseInfo:firstyear=2002&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_LLDYNAMICTEXTURE_H
28#define LL_LLDYNAMICTEXTURE_H
29
30#include "llcamera.h"
31#include "llgl.h"
32#include "llcoord.h"
33#include "llviewertexture.h"
34#include "llcamera.h"
35
36class LLViewerDynamicTexture : public LLViewerTexture
37{
38public:
39	enum
40	{
41		LL_VIEWER_DYNAMIC_TEXTURE = LLViewerTexture::DYNAMIC_TEXTURE,
42		LL_TEX_LAYER_SET_BUFFER = LLViewerTexture::INVALID_TEXTURE_TYPE + 1,
43		LL_VISUAL_PARAM_HINT,
44		LL_VISUAL_PARAM_RESET,
45		LL_PREVIEW_ANIMATION,
46		LL_IMAGE_PREVIEW_SCULPTED,
47		LL_IMAGE_PREVIEW_AVATAR,
48		INVALID_DYNAMIC_TEXTURE
49	};
50
51protected:
52	/*virtual*/ ~LLViewerDynamicTexture();
53
54public:
55	enum EOrder { ORDER_FIRST = 0, ORDER_MIDDLE = 1, ORDER_LAST = 2, ORDER_RESET = 3, ORDER_COUNT = 4 };
56
57	LLViewerDynamicTexture(S32 width,
58					 S32 height,
59					 S32 components,		// = 4,
60					 EOrder order,			// = ORDER_MIDDLE,
61					 BOOL clamp);
62	
63	/*virtual*/ S8 getType() const ;
64
65	S32			getOriginX()	{ return mOrigin.mX; }
66	S32			getOriginY()	{ return mOrigin.mY; }
67	
68	S32			getSize()		{ return mFullWidth * mFullHeight * mComponents; }
69
70	virtual BOOL needsRender() { return TRUE; }
71	virtual void preRender(BOOL clear_depth = TRUE);
72	virtual BOOL render();
73	virtual void postRender(BOOL success);
74
75	virtual void restoreGLTexture() {}
76	virtual void destroyGLTexture() {}
77
78	static BOOL	updateAllInstances();
79	static void destroyGL() ;
80	static void restoreGL() ;
81protected:
82	void generateGLTexture();
83	void generateGLTexture(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format, BOOL swap_bytes = FALSE);
84
85protected:
86	BOOL mClamp;
87	LLCoordGL mOrigin;
88	LLCamera mCamera;
89	
90	typedef std::set<LLViewerDynamicTexture*> instance_list_t;
91	static instance_list_t sInstances[ LLViewerDynamicTexture::ORDER_COUNT ];
92	static S32 sNumRenders;
93};
94
95#endif