From b8f74b42a7a2d08e9c7a2dcebec58dbd07ec0328 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Fri, 25 Jan 2013 17:29:44 -0600 Subject: MAINT-2268 Add right-click->"Mute Particle Owner" feature --- indra/newview/llvopartgroup.cpp | 119 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 11 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index fa34a6f1f5..1a9769f09d 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -232,6 +232,37 @@ LLDrawable* LLVOPartGroup::createDrawable(LLPipeline *pipeline) const F32 MAX_PARTICLE_AREA_SCALE = 0.02f; // some tuned constant, limits on how much particle area to draw + LLUUID LLVOPartGroup::getPartOwner(S32 idx) + { + LLUUID ret = LLUUID::null; + + if (idx < (S32) mViewerPartGroupp->mParticles.size()) + { + ret = mViewerPartGroupp->mParticles[idx]->mPartSourcep->getOwnerUUID(); + } + + return ret; + } + + LLUUID LLVOPartGroup::getPartSource(S32 idx) + { + LLUUID ret = LLUUID::null; + + if (idx < (S32) mViewerPartGroupp->mParticles.size()) + { + LLViewerPart* part = mViewerPartGroupp->mParticles[idx]; + if (part && part->mPartSourcep.notNull() && + part->mPartSourcep->mSourceObjectp.notNull()) + { + LLViewerObject* source = part->mPartSourcep->mSourceObjectp; + ret = source->getID(); + } + } + + return ret; + } + + F32 LLVOPartGroup::getPartSize(S32 idx) { if (idx < (S32) mViewerPartGroupp->mParticles.size()) @@ -385,20 +416,68 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) return TRUE; } -void LLVOPartGroup::getGeometry(S32 idx, - LLStrider& verticesp, - LLStrider& normalsp, - LLStrider& texcoordsp, - LLStrider& colorsp, - LLStrider& indicesp) + +BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face, + BOOL pick_transparent, + S32* face_hit, + LLVector3* intersection, + LLVector2* tex_coord, + LLVector3* normal, + LLVector3* bi_normal) { - if (idx >= (S32) mViewerPartGroupp->mParticles.size()) + LLVector4a starta, enda; + starta.load3(start.mV); + enda.load3(end.mV); + + LLVector4a dir; + dir.setSub(enda, starta); + + F32 closest_t = 2.f; + BOOL ret = FALSE; + + for (U32 idx = 0; idx < mViewerPartGroupp->mParticles.size(); ++idx) { - return; + const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx])); + + LLVector4a v[4]; + LLStrider verticesp; + verticesp = v; + + getGeometry(part, verticesp); + + F32 a,b,t; + if (LLTriangleRayIntersect(v[0], v[1], v[2], starta, dir, a,b,t) || + LLTriangleRayIntersect(v[1], v[3], v[2], starta, dir, a,b,t)) + { + if (t >= 0.f && + t <= 1.f && + t < closest_t) + { + ret = TRUE; + closest_t = t; + if (face_hit) + { + *face_hit = idx; + } + + if (intersection) + { + LLVector4a intersect = dir; + intersect.mul(closest_t); + intersect.add(starta); + intersection->set(intersect.getF32ptr()); + } + } + } } - const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx])); + return ret; +} +void LLVOPartGroup::getGeometry(const LLViewerPart& part, + LLStrider& verticesp) +{ LLVector4a part_pos_agent; part_pos_agent.load3(part.mPosAgent.mV); LLVector4a camera_agent; @@ -449,8 +528,6 @@ void LLVOPartGroup::getGeometry(S32 idx, up.mul(0.5f*part.mScale.mV[1]); - LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis(); - //HACK -- the verticesp->mV[3] = 0.f here are to set the texture index to 0 (particles don't use texture batching, maybe they should) // this works because there is actually a 4th float stored after the vertex position which is used as a texture index // also, somebody please VECTORIZE THIS @@ -469,6 +546,25 @@ void LLVOPartGroup::getGeometry(S32 idx, (*verticesp++).getF32ptr()[3] = 0.f; verticesp->setAdd(ppamu, right); (*verticesp++).getF32ptr()[3] = 0.f; +} + + + +void LLVOPartGroup::getGeometry(S32 idx, + LLStrider& verticesp, + LLStrider& normalsp, + LLStrider& texcoordsp, + LLStrider& colorsp, + LLStrider& indicesp) +{ + if (idx >= (S32) mViewerPartGroupp->mParticles.size()) + { + return; + } + + const LLViewerPart &part = *((LLViewerPart*) (mViewerPartGroupp->mParticles[idx])); + + getGeometry(part, verticesp); *colorsp++ = part.mColor; *colorsp++ = part.mColor; @@ -477,6 +573,7 @@ void LLVOPartGroup::getGeometry(S32 idx, if (!(part.mFlags & LLPartData::LL_PART_EMISSIVE_MASK)) { //not fullbright, needs normal + LLVector3 normal = -LLViewerCamera::getInstance()->getXAxis(); *normalsp++ = normal; *normalsp++ = normal; *normalsp++ = normal; -- cgit v1.2.3 From 1e3060f6d5658946395a618201fc6b9788c8f0be Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 20 Jun 2013 16:56:10 -0500 Subject: Merge cleanup --- indra/newview/llvopartgroup.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index e8cfafc784..d3c035ecdc 100755 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -193,8 +193,14 @@ void LLVOPartGroup::updateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) const LLVector3& pos_agent = getPositionAgent(); newMin.load3( (pos_agent - mScale).mV); newMax.load3( (pos_agent + mScale).mV); + + llassert(newMin.isFinite3()); + llassert(newMax.isFinite3()); + LLVector4a pos; pos.load3(pos_agent.mV); + + llassert(pos.isFinite3()); mDrawable->setPositionGroup(pos); } @@ -419,21 +425,17 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) } -BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, +BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector4a& start, const LLVector4a& end, S32 face, BOOL pick_transparent, S32* face_hit, - LLVector3* intersection, + LLVector4a* intersection, LLVector2* tex_coord, - LLVector3* normal, - LLVector3* bi_normal) + LLVector4a* normal, + LLVector4a* bi_normal) { - LLVector4a starta, enda; - starta.load3(start.mV); - enda.load3(end.mV); - LLVector4a dir; - dir.setSub(enda, starta); + dir.setSub(end, start); F32 closest_t = 2.f; BOOL ret = FALSE; @@ -449,8 +451,8 @@ BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector3& start, const LLVector3 getGeometry(part, verticesp); F32 a,b,t; - if (LLTriangleRayIntersect(v[0], v[1], v[2], starta, dir, a,b,t) || - LLTriangleRayIntersect(v[1], v[3], v[2], starta, dir, a,b,t)) + if (LLTriangleRayIntersect(v[0], v[1], v[2], start, dir, a,b,t) || + LLTriangleRayIntersect(v[1], v[3], v[2], start, dir, a,b,t)) { if (t >= 0.f && t <= 1.f && @@ -467,8 +469,7 @@ BOOL LLVOPartGroup::lineSegmentIntersect(const LLVector3& start, const LLVector3 { LLVector4a intersect = dir; intersect.mul(closest_t); - intersect.add(starta); - intersection->set(intersect.getF32ptr()); + intersection->setAdd(intersect, start); } } } -- cgit v1.2.3 From af860d09532f929510da0d4da7e965a0df4e6944 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 20 Jun 2013 17:17:54 -0500 Subject: Try to track down some bad bounding boxes in particles. --- indra/newview/llvopartgroup.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'indra/newview/llvopartgroup.cpp') diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index d3c035ecdc..8ed86b4fd5 100755 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -353,6 +353,10 @@ BOOL LLVOPartGroup::updateGeometry(LLDrawable *drawable) inv_camera_dist_squared = 1.f / camera_dist_squared; else inv_camera_dist_squared = 1.f; + + llassert(llfinite(inv_camera_dist_squared)); + llassert(!llisnan(inv_camera_dist_squared)); + F32 area = part->mScale.mV[0] * part->mScale.mV[1] * inv_camera_dist_squared; tot_area = llmax(tot_area, area); -- cgit v1.2.3