diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lldrawpoolsky.cpp | |
parent | README.txt (diff) | |
download | meta-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/lldrawpoolsky.cpp | 199 |
1 files changed, 199 insertions, 0 deletions
diff --git a/linden/indra/newview/lldrawpoolsky.cpp b/linden/indra/newview/lldrawpoolsky.cpp new file mode 100644 index 0000000..52f9f16 --- /dev/null +++ b/linden/indra/newview/lldrawpoolsky.cpp | |||
@@ -0,0 +1,199 @@ | |||
1 | /** | ||
2 | * @file lldrawpoolsky.cpp | ||
3 | * @brief LLDrawPoolSky class implementation | ||
4 | * | ||
5 | * Copyright (c) 2002-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 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "lldrawpoolsky.h" | ||
31 | |||
32 | #include "imageids.h" | ||
33 | |||
34 | #include "llagparray.h" | ||
35 | #include "llagent.h" | ||
36 | #include "lldrawable.h" | ||
37 | #include "llface.h" | ||
38 | #include "llsky.h" | ||
39 | #include "llviewercamera.h" | ||
40 | #include "llviewerimagelist.h" | ||
41 | #include "llviewerregion.h" | ||
42 | #include "llviewerwindow.h" | ||
43 | #include "llvosky.h" | ||
44 | #include "llworld.h" // To get water height | ||
45 | #include "pipeline.h" | ||
46 | |||
47 | LLDrawPoolSky::LLDrawPoolSky() : | ||
48 | LLDrawPool(POOL_SKY, DATA_SIMPLE_IL_MASK, DATA_SIMPLE_NIL_MASK) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | LLDrawPool *LLDrawPoolSky::instancePool() | ||
53 | { | ||
54 | return new LLDrawPoolSky(); | ||
55 | } | ||
56 | |||
57 | void LLDrawPoolSky::prerender() | ||
58 | { | ||
59 | mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_ENVIRONMENT); | ||
60 | } | ||
61 | |||
62 | void LLDrawPoolSky::render(S32 pass) | ||
63 | { | ||
64 | if (mDrawFace.empty()) | ||
65 | { | ||
66 | return; | ||
67 | } | ||
68 | |||
69 | LLVOSky *voskyp = gSky.mVOSkyp; | ||
70 | LLGLSPipelineSkyBox gls_skybox; | ||
71 | LLGLDepthTest gls_depth(GL_FALSE, GL_FALSE); | ||
72 | |||
73 | if (gCamera->getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight()) | ||
74 | //gWorldPointer->getWaterHeight()) | ||
75 | { | ||
76 | //gGLSFog.set(); | ||
77 | } | ||
78 | |||
79 | gPipeline.disableLights(); | ||
80 | |||
81 | glMatrixMode( GL_PROJECTION ); | ||
82 | |||
83 | glPushMatrix(); | ||
84 | gViewerWindow->setup3DRender(); | ||
85 | |||
86 | glEnableClientState(GL_VERTEX_ARRAY); | ||
87 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | ||
88 | glDisableClientState(GL_NORMAL_ARRAY); | ||
89 | |||
90 | bindGLVertexPointer(); | ||
91 | bindGLTexCoordPointer(); | ||
92 | |||
93 | S32 face_count = (S32)mDrawFace.size(); | ||
94 | |||
95 | for (S32 i = 0; i < llmin(6, face_count); ++i) | ||
96 | { | ||
97 | renderSkyCubeFace(i); | ||
98 | } | ||
99 | |||
100 | const LLFace *hbfaces[3]; | ||
101 | hbfaces[0] = NULL; | ||
102 | hbfaces[1] = NULL; | ||
103 | hbfaces[2] = NULL; | ||
104 | for (S32 curr_face = 0; curr_face < face_count; curr_face++) | ||
105 | { | ||
106 | const LLFace* facep = mDrawFace[curr_face]; | ||
107 | if (voskyp->isSameFace(LLVOSky::FACE_SUN, facep)) | ||
108 | { | ||
109 | hbfaces[0] = facep; | ||
110 | } | ||
111 | if (voskyp->isSameFace(LLVOSky::FACE_MOON, facep)) | ||
112 | { | ||
113 | hbfaces[1] = facep; | ||
114 | } | ||
115 | if (voskyp->isSameFace(LLVOSky::FACE_BLOOM, facep)) | ||
116 | { | ||
117 | hbfaces[2] = facep; | ||
118 | } | ||
119 | } | ||
120 | |||
121 | LLGLEnable blend(GL_BLEND); | ||
122 | |||
123 | if (hbfaces[2]) | ||
124 | { | ||
125 | renderSunHalo(hbfaces[2]); | ||
126 | } | ||
127 | if (hbfaces[0]) | ||
128 | { | ||
129 | renderHeavenlyBody(0, hbfaces[0]); | ||
130 | } | ||
131 | if (hbfaces[1]) | ||
132 | { | ||
133 | renderHeavenlyBody(1, hbfaces[1]); | ||
134 | } | ||
135 | |||
136 | |||
137 | glMatrixMode( GL_PROJECTION ); | ||
138 | glPopMatrix(); | ||
139 | glMatrixMode( GL_MODELVIEW ); | ||
140 | } | ||
141 | |||
142 | void LLDrawPoolSky::renderSkyCubeFace(U8 side) | ||
143 | { | ||
144 | const LLFace &face = *mDrawFace[LLVOSky::FACE_SIDE0 + side]; | ||
145 | if (!face.getGeomCount()) | ||
146 | { | ||
147 | return; | ||
148 | } | ||
149 | |||
150 | mSkyTex[side].bindTexture(TRUE); | ||
151 | |||
152 | face.renderIndexed(getRawIndices()); | ||
153 | |||
154 | if (LLSkyTex::doInterpolate()) | ||
155 | { | ||
156 | LLGLEnable blend(GL_BLEND); | ||
157 | mSkyTex[side].bindTexture(FALSE); | ||
158 | glColor4f(1, 1, 1, LLSkyTex::getInterpVal()); // lighting is disabled | ||
159 | face.renderIndexed(getRawIndices()); | ||
160 | } | ||
161 | |||
162 | mIndicesDrawn += face.getIndicesCount(); | ||
163 | } | ||
164 | |||
165 | void LLDrawPoolSky::renderHeavenlyBody(U8 hb, const LLFace* face) | ||
166 | { | ||
167 | if ( !mHB[hb]->getDraw() ) return; | ||
168 | if (! face->getGeomCount()) return; | ||
169 | |||
170 | LLImageGL* tex = face->getTexture(); | ||
171 | tex->bind(); | ||
172 | LLColor4 color(mHB[hb]->getInterpColor()); | ||
173 | LLOverrideFaceColor override(this, color); | ||
174 | face->renderIndexed(getRawIndices()); | ||
175 | mIndicesDrawn += face->getIndicesCount(); | ||
176 | } | ||
177 | |||
178 | |||
179 | |||
180 | void LLDrawPoolSky::renderSunHalo(const LLFace* face) | ||
181 | { | ||
182 | if (! mHB[0]->getDraw()) return; | ||
183 | if (! face->getGeomCount()) return; | ||
184 | |||
185 | LLImageGL* tex = face->getTexture(); | ||
186 | tex->bind(); | ||
187 | LLColor4 color(mHB[0]->getInterpColor()); | ||
188 | color.mV[3] = llclamp(mHB[0]->getHaloBrighness(), 0.f, 1.f); | ||
189 | |||
190 | LLOverrideFaceColor override(this, color); | ||
191 | face->renderIndexed(getRawIndices()); | ||
192 | mIndicesDrawn += face->getIndicesCount(); | ||
193 | } | ||
194 | |||
195 | |||
196 | void LLDrawPoolSky::renderForSelect() | ||
197 | { | ||
198 | } | ||
199 | |||