diff options
author | Jacek Antonelli | 2008-12-01 17:39:58 -0600 |
---|---|---|
committer | Jacek Antonelli | 2008-12-01 17:40:06 -0600 |
commit | 7abecb48babe6a6f09bf6692ba55076546cfced9 (patch) | |
tree | 8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/newview/llvopartgroup.cpp | |
parent | Second Life viewer sources 1.21.6 (diff) | |
download | meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2 meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz |
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/newview/llvopartgroup.cpp')
-rw-r--r-- | linden/indra/newview/llvopartgroup.cpp | 61 |
1 files changed, 46 insertions, 15 deletions
diff --git a/linden/indra/newview/llvopartgroup.cpp b/linden/indra/newview/llvopartgroup.cpp index 11d7341..fb91cfa 100644 --- a/linden/indra/newview/llvopartgroup.cpp +++ b/linden/indra/newview/llvopartgroup.cpp | |||
@@ -95,7 +95,7 @@ void LLVOPartGroup::setPixelAreaAndAngle(LLAgent &agent) | |||
95 | { | 95 | { |
96 | // mPixelArea is calculated during render | 96 | // mPixelArea is calculated during render |
97 | F32 mid_scale = getMidScale(); | 97 | F32 mid_scale = getMidScale(); |
98 | F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).magVec(); | 98 | F32 range = (getRenderPosition()-LLViewerCamera::getInstance()->getOrigin()).length(); |
99 | 99 | ||
100 | if (range < 0.001f || isHUDAttachment()) // range == zero | 100 | if (range < 0.001f || isHUDAttachment()) // range == zero |
101 | { | 101 | { |
@@ -133,15 +133,16 @@ F32 LLVOPartGroup::getPartSize(S32 idx) | |||
133 | return 0.f; | 133 | return 0.f; |
134 | } | 134 | } |
135 | 135 | ||
136 | LLVector3 LLVOPartGroup::getCameraPosition() const | ||
137 | { | ||
138 | return gAgent.getCameraPositionAgent(); | ||
139 | } | ||
140 | |||
136 | BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) | 141 | BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) |
137 | { | 142 | { |
138 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_PARTICLES); | 143 | LLFastTimer ftm(LLFastTimer::FTM_UPDATE_PARTICLES); |
139 | 144 | ||
140 | dirtySpatialGroup(); | 145 | dirtySpatialGroup(); |
141 | |||
142 | LLVector3 at; | ||
143 | LLVector3 position_agent; | ||
144 | LLVector3 camera_agent = LLViewerCamera::getInstance()->getOrigin(); | ||
145 | 146 | ||
146 | S32 num_parts = mViewerPartGroupp->getCount(); | 147 | S32 num_parts = mViewerPartGroupp->getCount(); |
147 | LLFace *facep; | 148 | LLFace *facep; |
@@ -187,9 +188,9 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) | |||
187 | const LLViewerPart *part = mViewerPartGroupp->mParticles[i]; | 188 | const LLViewerPart *part = mViewerPartGroupp->mParticles[i]; |
188 | 189 | ||
189 | LLVector3 part_pos_agent(part->mPosAgent); | 190 | LLVector3 part_pos_agent(part->mPosAgent); |
190 | at = part_pos_agent - camera_agent; | 191 | LLVector3 at(part_pos_agent - LLViewerCamera::getInstance()->getOrigin()); |
191 | 192 | ||
192 | F32 camera_dist_squared = at.magVecSquared(); | 193 | F32 camera_dist_squared = at.lengthSquared(); |
193 | F32 inv_camera_dist_squared; | 194 | F32 inv_camera_dist_squared; |
194 | if (camera_dist_squared > 1.f) | 195 | if (camera_dist_squared > 1.f) |
195 | inv_camera_dist_squared = 1.f / camera_dist_squared; | 196 | inv_camera_dist_squared = 1.f / camera_dist_squared; |
@@ -278,36 +279,38 @@ void LLVOPartGroup::getGeometry(S32 idx, | |||
278 | 279 | ||
279 | 280 | ||
280 | LLVector3 part_pos_agent(part.mPosAgent); | 281 | LLVector3 part_pos_agent(part.mPosAgent); |
281 | LLVector3 camera_agent = gAgent.getCameraPositionAgent(); | 282 | LLVector3 camera_agent = getCameraPosition(); |
282 | LLVector3 at = part_pos_agent - camera_agent; | 283 | LLVector3 at = part_pos_agent - camera_agent; |
283 | LLVector3 up, right; | 284 | LLVector3 up; |
285 | LLVector3 right; | ||
284 | 286 | ||
285 | right = at % LLVector3(0.f, 0.f, 1.f); | 287 | right = at % LLVector3(0.f, 0.f, 1.f); |
286 | right.normVec(); | 288 | right.normalize(); |
287 | up = right % at; | 289 | up = right % at; |
288 | up.normVec(); | 290 | up.normalize(); |
289 | 291 | ||
290 | if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) | 292 | if (part.mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK) |
291 | { | 293 | { |
292 | LLVector3 normvel = part.mVelocity; | 294 | LLVector3 normvel = part.mVelocity; |
293 | normvel.normVec(); | 295 | normvel.normalize(); |
294 | LLVector2 up_fracs; | 296 | LLVector2 up_fracs; |
295 | up_fracs.mV[0] = normvel*right; | 297 | up_fracs.mV[0] = normvel*right; |
296 | up_fracs.mV[1] = normvel*up; | 298 | up_fracs.mV[1] = normvel*up; |
297 | up_fracs.normVec(); | 299 | up_fracs.normalize(); |
298 | LLVector3 new_up; | 300 | LLVector3 new_up; |
299 | LLVector3 new_right; | 301 | LLVector3 new_right; |
300 | new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up; | 302 | new_up = up_fracs.mV[0] * right + up_fracs.mV[1]*up; |
301 | new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up; | 303 | new_right = up_fracs.mV[1] * right - up_fracs.mV[0]*up; |
302 | up = new_up; | 304 | up = new_up; |
303 | right = new_right; | 305 | right = new_right; |
304 | up.normVec(); | 306 | up.normalize(); |
305 | right.normVec(); | 307 | right.normalize(); |
306 | } | 308 | } |
307 | 309 | ||
308 | right *= 0.5f*part.mScale.mV[0]; | 310 | right *= 0.5f*part.mScale.mV[0]; |
309 | up *= 0.5f*part.mScale.mV[1]; | 311 | up *= 0.5f*part.mScale.mV[1]; |
310 | 312 | ||
313 | |||
311 | const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis(); | 314 | const LLVector3& normal = -LLViewerCamera::getInstance()->getXAxis(); |
312 | 315 | ||
313 | *verticesp++ = part_pos_agent + up - right; | 316 | *verticesp++ = part_pos_agent + up - right; |
@@ -355,6 +358,13 @@ LLParticlePartition::LLParticlePartition() | |||
355 | mLODPeriod = 1; | 358 | mLODPeriod = 1; |
356 | } | 359 | } |
357 | 360 | ||
361 | LLHUDParticlePartition::LLHUDParticlePartition() : | ||
362 | LLParticlePartition() | ||
363 | { | ||
364 | mDrawableType = LLPipeline::RENDER_TYPE_HUD; | ||
365 | mPartitionType = LLViewerRegion::PARTITION_HUD_PARTICLE; | ||
366 | } | ||
367 | |||
358 | void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count) | 368 | void LLParticlePartition::addGeometryCount(LLSpatialGroup* group, U32& vertex_count, U32& index_count) |
359 | { | 369 | { |
360 | group->mBufferUsage = mBufferUsage; | 370 | group->mBufferUsage = mBufferUsage; |
@@ -480,3 +490,24 @@ F32 LLParticlePartition::calcPixelArea(LLSpatialGroup* group, LLCamera& camera) | |||
480 | return 1024.f; | 490 | return 1024.f; |
481 | } | 491 | } |
482 | 492 | ||
493 | U32 LLVOHUDPartGroup::getPartitionType() const | ||
494 | { | ||
495 | // Commenting out and returning PARTITION_NONE because DEV-16909 | ||
496 | // (SVC-2396: Particles not handled properly as hud) didn't work completely | ||
497 | // so this disables HUD particles until they can be fixed properly. -MG | ||
498 | //return LLViewerRegion::PARTITION_HUD_PARTICLE; | ||
499 | return LLViewerRegion::PARTITION_NONE; | ||
500 | } | ||
501 | |||
502 | LLDrawable* LLVOHUDPartGroup::createDrawable(LLPipeline *pipeline) | ||
503 | { | ||
504 | pipeline->allocDrawable(this); | ||
505 | mDrawable->setLit(FALSE); | ||
506 | mDrawable->setRenderType(LLPipeline::RENDER_TYPE_HUD); | ||
507 | return mDrawable; | ||
508 | } | ||
509 | |||
510 | LLVector3 LLVOHUDPartGroup::getCameraPosition() const | ||
511 | { | ||
512 | return LLVector3(-1,0,0); | ||
513 | } | ||