PageRenderTime 36ms CodeModel.GetById 25ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/llrender/llcubemap.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 86 lines | 46 code | 14 blank | 26 comment | 0 complexity | 637147fdc6969966e6867db3ebd1a443 MD5 | raw file
 1/** 
 2 * @file llcubemap.h
 3 * @brief LLCubeMap class definition
 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_LLCUBEMAP_H
28#define LL_LLCUBEMAP_H
29
30#include "llgl.h"
31
32#include <vector>
33
34class LLVector3;
35
36// Environment map hack!
37class LLCubeMap : public LLRefCount
38{
39public:
40	LLCubeMap();
41	void init(const std::vector<LLPointer<LLImageRaw> >& rawimages);
42	void initGL();
43	void initRawData(const std::vector<LLPointer<LLImageRaw> >& rawimages);
44	void initGLData();
45
46	void bind();
47	void enable(S32 stage);
48	
49	void enableTexture(S32 stage);
50	void enableTextureCoords(S32 stage);
51	S32	 getStage(void) { return mTextureStage; }
52	
53	void disable(void);
54	void disableTexture(void);
55	void disableTextureCoords(void);
56	void setMatrix(S32 stage);
57	void restoreMatrix();
58	void setReflection (void);
59
60	void finishPaint();
61
62	GLuint getGLName();
63
64	LLVector3 map(U8 side, U16 v_val, U16 h_val) const;
65	BOOL project(F32& v_val, F32& h_val, BOOL& outside,
66						U8 side, const LLVector3& dir) const;
67	BOOL project(F32& v_min, F32& v_max, F32& h_min, F32& h_max, 
68						U8 side, LLVector3 dir[4]) const;
69	void paintIn(LLVector3 dir[4], const LLColor4U& col);
70	void destroyGL();
71
72public:
73	static bool sUseCubeMaps;
74
75protected:
76	friend class LLTexUnit;
77	~LLCubeMap();
78	LLGLenum mTargets[6];
79	LLPointer<LLImageGL> mImages[6];
80	LLPointer<LLImageRaw> mRawImages[6];
81	S32 mTextureStage;
82	S32 mTextureCoordStage;
83	S32 mMatrixStage;
84};
85
86#endif