aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoclouds.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llvoclouds.cpp159
1 files changed, 75 insertions, 84 deletions
diff --git a/linden/indra/newview/llvoclouds.cpp b/linden/indra/newview/llvoclouds.cpp
index 56f7be9..6ca8ac0 100644
--- a/linden/indra/newview/llvoclouds.cpp
+++ b/linden/indra/newview/llvoclouds.cpp
@@ -49,6 +49,7 @@
49#include "llvosky.h" 49#include "llvosky.h"
50#include "llworld.h" 50#include "llworld.h"
51#include "pipeline.h" 51#include "pipeline.h"
52#include "llspatialpartition.h"
52 53
53LLUUID gCloudTextureID = IMG_CLOUD_POOF; 54LLUUID gCloudTextureID = IMG_CLOUD_POOF;
54 55
@@ -78,14 +79,17 @@ BOOL LLVOClouds::isActive() const
78 79
79BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) 80BOOL LLVOClouds::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
80{ 81{
81 if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS))) 82 if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
83 {
82 return TRUE; 84 return TRUE;
85 }
83 86
84 // Set dirty flag (so renderer will rebuild primitive) 87 // Set dirty flag (so renderer will rebuild primitive)
85 if (mDrawable) 88 if (mDrawable)
86 { 89 {
87 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE); 90 gPipeline.markRebuild(mDrawable, LLDrawable::REBUILD_VOLUME, TRUE);
88 } 91 }
92
89 return TRUE; 93 return TRUE;
90} 94}
91 95
@@ -113,9 +117,13 @@ LLDrawable* LLVOClouds::createDrawable(LLPipeline *pipeline)
113BOOL LLVOClouds::updateGeometry(LLDrawable *drawable) 117BOOL LLVOClouds::updateGeometry(LLDrawable *drawable)
114{ 118{
115 LLFastTimer ftm(LLFastTimer::FTM_UPDATE_CLOUDS); 119 LLFastTimer ftm(LLFastTimer::FTM_UPDATE_CLOUDS);
116 if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS))) 120 if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS)))
121 {
117 return TRUE; 122 return TRUE;
123 }
118 124
125 dirtySpatialGroup();
126
119 LLFace *facep; 127 LLFace *facep;
120 128
121 S32 num_faces = mCloudGroupp->getNumPuffs(); 129 S32 num_faces = mCloudGroupp->getNumPuffs();
@@ -137,19 +145,16 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable)
137 continue; 145 continue;
138 } 146 }
139 147
140 if (isParticle()) 148 facep->setSize(4, 6);
141 { 149
142 facep->setSize(1,1);
143 }
144 else
145 {
146 facep->setSize(4, 6);
147 }
148 facep->setTEOffset(face_indx); 150 facep->setTEOffset(face_indx);
149 facep->setTexture(getTEImage(0)); 151 facep->setTexture(getTEImage(0));
150 const LLCloudPuff &puff = mCloudGroupp->getPuff(face_indx); 152 const LLCloudPuff &puff = mCloudGroupp->getPuff(face_indx);
151 const LLVector3 puff_pos_agent = gAgent.getPosAgentFromGlobal(puff.getPositionGlobal()); 153 const LLVector3 puff_pos_agent = gAgent.getPosAgentFromGlobal(puff.getPositionGlobal());
152 facep->mCenterLocal = puff_pos_agent; 154 facep->mCenterLocal = puff_pos_agent;
155 /// Update cloud color based on sun color.
156 LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
157 facep->setFaceColor(float_color);
153 } 158 }
154 for ( ; face_indx < drawable->getNumFaces(); face_indx++) 159 for ( ; face_indx < drawable->getNumFaces(); face_indx++)
155 { 160 {
@@ -169,11 +174,6 @@ BOOL LLVOClouds::updateGeometry(LLDrawable *drawable)
169 return TRUE; 174 return TRUE;
170} 175}
171 176
172BOOL LLVOClouds::isParticle()
173{
174 return FALSE; // gGLManager.mHasPointParameters;
175}
176
177F32 LLVOClouds::getPartSize(S32 idx) 177F32 LLVOClouds::getPartSize(S32 idx)
178{ 178{
179 return (CLOUD_PUFF_HEIGHT+CLOUD_PUFF_WIDTH)*0.5f; 179 return (CLOUD_PUFF_HEIGHT+CLOUD_PUFF_WIDTH)*0.5f;
@@ -184,7 +184,7 @@ void LLVOClouds::getGeometry(S32 te,
184 LLStrider<LLVector3>& normalsp, 184 LLStrider<LLVector3>& normalsp,
185 LLStrider<LLVector2>& texcoordsp, 185 LLStrider<LLVector2>& texcoordsp,
186 LLStrider<LLColor4U>& colorsp, 186 LLStrider<LLColor4U>& colorsp,
187 LLStrider<U32>& indicesp) 187 LLStrider<U16>& indicesp)
188{ 188{
189 189
190 if (te >= mCloudGroupp->getNumPuffs()) 190 if (te >= mCloudGroupp->getNumPuffs())
@@ -204,80 +204,71 @@ void LLVOClouds::getGeometry(S32 te,
204 204
205 const LLCloudPuff &puff = mCloudGroupp->getPuff(te); 205 const LLCloudPuff &puff = mCloudGroupp->getPuff(te);
206 S32 index_offset = facep->getGeomIndex(); 206 S32 index_offset = facep->getGeomIndex();
207 LLColor4U color(255, 255, 255, (U8) (puff.getAlpha()*255)); 207 LLColor4 float_color(LLColor3(gSky.getSunDiffuseColor() + gSky.getSunAmbientColor()),puff.getAlpha());
208 facep->setFaceColor(LLColor4(color)); 208 LLColor4U color;
209 color.setVec(float_color);
210 facep->setFaceColor(float_color);
209 211
210 212
211 if (isParticle()) 213 LLVector3 up;
212 { 214 LLVector3 right;
213 *verticesp++ = facep->mCenterLocal; 215 LLVector3 at;
214 *texcoordsp++ = LLVector2(0.5f, 0.5f); 216
215 *colorsp++ = color; 217 const LLVector3& puff_pos_agent = facep->mCenterLocal;
216 *normalsp++ = normal; 218 LLVector2 uvs[4];
217 *indicesp++ = facep->getGeomIndex(); 219
218 } 220 uvs[0].setVec(0.f, 1.f);
219 else 221 uvs[1].setVec(0.f, 0.f);
220 { 222 uvs[2].setVec(1.f, 1.f);
221 LLVector3 up; 223 uvs[3].setVec(1.f, 0.f);
222 LLVector3 right; 224
223 LLVector3 at; 225 LLVector3 vtx[4];
224 226
225 const LLVector3& puff_pos_agent = facep->mCenterLocal; 227 at = gCamera->getAtAxis();
226 LLVector2 uvs[4]; 228 right = at % LLVector3(0.f, 0.f, 1.f);
227 229 right.normVec();
228 uvs[0].setVec(0.f, 1.f); 230 up = right % at;
229 uvs[1].setVec(0.f, 0.f); 231 up.normVec();
230 uvs[2].setVec(1.f, 1.f); 232 right *= 0.5f*CLOUD_PUFF_WIDTH;
231 uvs[3].setVec(1.f, 0.f); 233 up *= 0.5f*CLOUD_PUFF_HEIGHT;;
232
233 LLVector3 vtx[4];
234
235 at = gCamera->getAtAxis();
236 right = at % LLVector3(0.f, 0.f, 1.f);
237 right.normVec();
238 up = right % at;
239 up.normVec();
240 right *= 0.5f*CLOUD_PUFF_WIDTH;
241 up *= 0.5f*CLOUD_PUFF_HEIGHT;;
242 234
243 *colorsp++ = color; 235 *colorsp++ = color;
244 *colorsp++ = color; 236 *colorsp++ = color;
245 *colorsp++ = color; 237 *colorsp++ = color;
246 *colorsp++ = color; 238 *colorsp++ = color;
247 239
248 vtx[0] = puff_pos_agent - right + up; 240 vtx[0] = puff_pos_agent - right + up;
249 vtx[1] = puff_pos_agent - right - up; 241 vtx[1] = puff_pos_agent - right - up;
250 vtx[2] = puff_pos_agent + right + up; 242 vtx[2] = puff_pos_agent + right + up;
251 vtx[3] = puff_pos_agent + right - up; 243 vtx[3] = puff_pos_agent + right - up;
252 244
253 *verticesp++ = vtx[0]; 245 *verticesp++ = vtx[0];
254 *verticesp++ = vtx[1]; 246 *verticesp++ = vtx[1];
255 *verticesp++ = vtx[2]; 247 *verticesp++ = vtx[2];
256 *verticesp++ = vtx[3]; 248 *verticesp++ = vtx[3];
257 249
258 *texcoordsp++ = uvs[0]; 250 *texcoordsp++ = uvs[0];
259 *texcoordsp++ = uvs[1]; 251 *texcoordsp++ = uvs[1];
260 *texcoordsp++ = uvs[2]; 252 *texcoordsp++ = uvs[2];
261 *texcoordsp++ = uvs[3]; 253 *texcoordsp++ = uvs[3];
262 254
263 *normalsp++ = normal; 255 *normalsp++ = normal;
264 *normalsp++ = normal; 256 *normalsp++ = normal;
265 *normalsp++ = normal; 257 *normalsp++ = normal;
266 *normalsp++ = normal; 258 *normalsp++ = normal;
267 259
268 *indicesp++ = index_offset + 0; 260 *indicesp++ = index_offset + 0;
269 *indicesp++ = index_offset + 1; 261 *indicesp++ = index_offset + 1;
270 *indicesp++ = index_offset + 2; 262 *indicesp++ = index_offset + 2;
271 263
272 *indicesp++ = index_offset + 1; 264 *indicesp++ = index_offset + 1;
273 *indicesp++ = index_offset + 3; 265 *indicesp++ = index_offset + 3;
274 *indicesp++ = index_offset + 2; 266 *indicesp++ = index_offset + 2;
275 }
276} 267}
277 268
278U32 LLVOClouds::getPartitionType() const 269U32 LLVOClouds::getPartitionType() const
279{ 270{
280 return LLPipeline::PARTITION_CLOUD; 271 return LLViewerRegion::PARTITION_CLOUD;
281} 272}
282 273
283// virtual 274// virtual
@@ -295,6 +286,6 @@ void LLVOClouds::updateDrawable(BOOL force_damped)
295LLCloudPartition::LLCloudPartition() 286LLCloudPartition::LLCloudPartition()
296{ 287{
297 mDrawableType = LLPipeline::RENDER_TYPE_CLOUDS; 288 mDrawableType = LLPipeline::RENDER_TYPE_CLOUDS;
298 mPartitionType = LLPipeline::PARTITION_CLOUD; 289 mPartitionType = LLViewerRegion::PARTITION_CLOUD;
299} 290}
300 291