diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lldrawpooltreenew.cpp | 200 |
1 files changed, 0 insertions, 200 deletions
diff --git a/linden/indra/newview/lldrawpooltreenew.cpp b/linden/indra/newview/lldrawpooltreenew.cpp deleted file mode 100644 index 326ab5f..0000000 --- a/linden/indra/newview/lldrawpooltreenew.cpp +++ /dev/null | |||
@@ -1,200 +0,0 @@ | |||
1 | /** | ||
2 | * @file lldrawpooltreenew.cpp | ||
3 | * @brief LLDrawPoolTreeNew class implementation | ||
4 | * | ||
5 | * Copyright (c) 2003-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 "lldrawpooltreenew.h" | ||
31 | |||
32 | #include "llagparray.h" | ||
33 | #include "lldrawable.h" | ||
34 | #include "llface.h" | ||
35 | #include "llsky.h" | ||
36 | #include "llvotreenew.h" | ||
37 | #include "pipeline.h" | ||
38 | |||
39 | LLDrawPoolTreeNew::LLDrawPoolTreeNew(LLViewerImage *texturep) : | ||
40 | LLDrawPool(POOL_TREE_NEW, | ||
41 | DATA_VERTICES_MASK | DATA_TEX_COORDS0_MASK | DATA_NORMALS_MASK, | ||
42 | 0), | ||
43 | mTexturep(texturep) | ||
44 | { | ||
45 | } | ||
46 | |||
47 | LLDrawPool *LLDrawPoolTreeNew::instancePool() | ||
48 | { | ||
49 | return new LLDrawPoolTreeNew(mTexturep); | ||
50 | } | ||
51 | |||
52 | |||
53 | void LLDrawPoolTreeNew::prerender() | ||
54 | { | ||
55 | mVertexShaderLevel = gPipeline.getVertexShaderLevel(LLPipeline::SHADER_OBJECT); | ||
56 | } | ||
57 | |||
58 | void LLDrawPoolTreeNew::render( S32 pass ) | ||
59 | { | ||
60 | if (mDrawFace.empty()) | ||
61 | { | ||
62 | return; | ||
63 | } | ||
64 | |||
65 | LLGLSPipelineAlpha gls_pipeline_alpha; | ||
66 | |||
67 | glEnableClientState(GL_VERTEX_ARRAY); | ||
68 | glEnableClientState(GL_TEXTURE_COORD_ARRAY); | ||
69 | glEnableClientState(GL_NORMAL_ARRAY); | ||
70 | |||
71 | bindGLVertexPointer(); | ||
72 | bindGLTexCoordPointer(); | ||
73 | bindGLNormalPointer(); | ||
74 | |||
75 | LLOverrideFaceColor color(this, 1.f, 1.f, 1.f, 1.f); | ||
76 | |||
77 | renderTree(); | ||
78 | } | ||
79 | |||
80 | |||
81 | void LLDrawPoolTreeNew::renderForSelect() | ||
82 | { | ||
83 | if (mDrawFace.empty()) | ||
84 | { | ||
85 | return; | ||
86 | } | ||
87 | |||
88 | LLGLSPipelineAlpha gls_pipeline_alpha; | ||
89 | |||
90 | glEnableClientState(GL_VERTEX_ARRAY); | ||
91 | glDisableClientState(GL_TEXTURE_COORD_ARRAY); | ||
92 | glDisableClientState(GL_NORMAL_ARRAY); | ||
93 | |||
94 | bindGLVertexPointer(); | ||
95 | |||
96 | renderTree(TRUE); | ||
97 | |||
98 | glDisableClientState(GL_VERTEX_ARRAY); | ||
99 | |||
100 | } | ||
101 | |||
102 | |||
103 | |||
104 | |||
105 | void LLDrawPoolTreeNew::renderTree(BOOL selecting) | ||
106 | { | ||
107 | |||
108 | // Bind the texture for this tree. | ||
109 | LLViewerImage::bindTexture(mTexturep); | ||
110 | |||
111 | glMatrixMode(GL_MODELVIEW); | ||
112 | for (std::vector<LLFace*>::iterator iter = mDrawFace.begin(); | ||
113 | iter != mDrawFace.end(); iter++) | ||
114 | { | ||
115 | LLFace *face = *iter; | ||
116 | LLDrawable *drawablep = face->getDrawable(); | ||
117 | |||
118 | if (drawablep->isDead()) | ||
119 | { | ||
120 | continue; | ||
121 | } | ||
122 | // Render each of the trees | ||
123 | LLVOTreeNew *treep = (LLVOTreeNew *)drawablep->getVObj(); | ||
124 | if (!selecting || treep->mGLName != 0) | ||
125 | { | ||
126 | glPushMatrix(); | ||
127 | |||
128 | // Translate to tree base HACK - adjustment in Z plants tree underground | ||
129 | const LLVector3 &pos_agent = treep->getPositionAgent(); | ||
130 | glTranslatef(pos_agent.mV[VX], pos_agent.mV[VY], pos_agent.mV[VZ] - 0.1f); | ||
131 | |||
132 | // Rotate to tree position | ||
133 | F32 angle_radians, x, y, z; | ||
134 | treep->getRotation().getAngleAxis(&angle_radians, &x, &y, &z); | ||
135 | glRotatef(angle_radians * RAD_TO_DEG, x, y, z); | ||
136 | |||
137 | //glAlphaFunc(GL_GREATER, 0.5f); | ||
138 | |||
139 | treep->drawTree(*this); | ||
140 | glPopMatrix(); | ||
141 | } | ||
142 | } | ||
143 | |||
144 | glAlphaFunc(GL_GREATER, 0.01f); | ||
145 | } | ||
146 | |||
147 | |||
148 | S32 LLDrawPoolTreeNew::rebuild() | ||
149 | { | ||
150 | mRebuildTime++; | ||
151 | if (mRebuildTime > mRebuildFreq) | ||
152 | { | ||
153 | // Flush AGP to force an AGP realloc and reduce AGP fragmentation | ||
154 | flushAGP(); | ||
155 | mRebuildTime = 0; | ||
156 | } | ||
157 | |||
158 | return 0; | ||
159 | } | ||
160 | |||
161 | BOOL LLDrawPoolTreeNew::verify() const | ||
162 | { | ||
163 | BOOL ok = TRUE; | ||
164 | |||
165 | // shared geometry. Just verify that it's there and correct. | ||
166 | |||
167 | // Verify all indices in the pool are in the right range | ||
168 | const U32 *indicesp = getRawIndices(); | ||
169 | U32 i; | ||
170 | for (i = 0; i < getIndexCount(); i++) | ||
171 | { | ||
172 | if (indicesp[i] > getVertexCount()) | ||
173 | { | ||
174 | ok = FALSE; | ||
175 | llinfos << "Bad index in tree pool!" << llendl; | ||
176 | } | ||
177 | } | ||
178 | |||
179 | if (!ok) | ||
180 | { | ||
181 | printDebugInfo(); | ||
182 | } | ||
183 | return ok; | ||
184 | } | ||
185 | |||
186 | LLViewerImage *LLDrawPoolTreeNew::getTexture() | ||
187 | { | ||
188 | return mTexturep; | ||
189 | } | ||
190 | |||
191 | LLViewerImage *LLDrawPoolTreeNew::getDebugTexture() | ||
192 | { | ||
193 | return mTexturep; | ||
194 | } | ||
195 | |||
196 | |||
197 | LLColor3 LLDrawPoolTreeNew::getDebugColor() const | ||
198 | { | ||
199 | return LLColor3(1.f, 0.f, 1.f); | ||
200 | } | ||