From 7abecb48babe6a6f09bf6692ba55076546cfced9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Mon, 1 Dec 2008 17:39:58 -0600 Subject: Second Life viewer sources 1.22.0-RC --- linden/indra/newview/llviewerpartsim.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'linden/indra/newview/llviewerpartsim.cpp') diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp index d27e0df..95fb307 100644 --- a/linden/indra/newview/llviewerpartsim.cpp +++ b/linden/indra/newview/llviewerpartsim.cpp @@ -116,7 +116,8 @@ void LLViewerPart::init(LLPointer sourcep, LLViewerImage *im // -LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 box_side) +LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 box_side, bool hud) + : mHud(hud) { LLMemType mt(LLMemType::MTYPE_PARTICLES); mVOPartGroupp = NULL; @@ -133,7 +134,14 @@ LLViewerPartGroup::LLViewerPartGroup(const LLVector3 ¢er_agent, const F32 bo mCenterAgent = center_agent; mBoxRadius = F_SQRT3*box_side*0.5f; + if (mHud) + { + mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_HUD_PART_GROUP, getRegion()); + } + else + { mVOPartGroupp = (LLVOPartGroup *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_PART_GROUP, getRegion()); + } mVOPartGroupp->setViewerPartGroup(this); mVOPartGroupp->setPositionAgent(getCenterAgent()); F32 scale = box_side * 0.5f; @@ -223,6 +231,12 @@ BOOL LLViewerPartGroup::posInGroup(const LLVector3 &pos, const F32 desired_size) BOOL LLViewerPartGroup::addPart(LLViewerPart* part, F32 desired_size) { LLMemType mt(LLMemType::MTYPE_PARTICLES); + + if (part->mFlags & LLPartData::LL_PART_HUD && !mHud) + { + return FALSE; + } + BOOL uniform_part = part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK); @@ -530,7 +544,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) if(!return_group) { llassert_always(part->mPosAgent.isFinite()); - LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size); + LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD); groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)); if (!groupp->addPart(part)) @@ -555,12 +569,12 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) return return_group ; } -LLViewerPartGroup *LLViewerPartSim::createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size) +LLViewerPartGroup *LLViewerPartSim::createViewerPartGroup(const LLVector3 &pos_agent, const F32 desired_size, bool hud) { LLMemType mt(LLMemType::MTYPE_PARTICLES); //find a box that has a center position divisible by PART_SIM_BOX_SIDE that encompasses //pos_agent - LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size); + LLViewerPartGroup *groupp = new LLViewerPartGroup(pos_agent, desired_size, hud); mViewerPartGroups.push_back(groupp); return groupp; } -- cgit v1.1 From a87e38229921b48c32187c672a942516722f1b52 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Sun, 11 Jan 2009 16:10:39 -0600 Subject: Second Life viewer sources 1.22.5-RC --- linden/indra/newview/llviewerpartsim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linden/indra/newview/llviewerpartsim.cpp') diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp index 95fb307..529ec4d 100644 --- a/linden/indra/newview/llviewerpartsim.cpp +++ b/linden/indra/newview/llviewerpartsim.cpp @@ -4,7 +4,7 @@ * * $LicenseInfo:firstyear=2003&license=viewergpl$ * - * Copyright (c) 2003-2008, Linden Research, Inc. + * Copyright (c) 2003-2009, Linden Research, Inc. * * Second Life Viewer Source Code * The source code in this file ("Source Code") is provided by Linden Lab -- cgit v1.1 From 0ef11cf31364456ec247b0fc7ad8f6d1de408400 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Wed, 28 Jan 2009 20:04:52 -0600 Subject: Second Life viewer sources 1.22.6-RC --- linden/indra/newview/llviewerpartsim.cpp | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'linden/indra/newview/llviewerpartsim.cpp') diff --git a/linden/indra/newview/llviewerpartsim.cpp b/linden/indra/newview/llviewerpartsim.cpp index 529ec4d..c303fc5 100644 --- a/linden/indra/newview/llviewerpartsim.cpp +++ b/linden/indra/newview/llviewerpartsim.cpp @@ -53,6 +53,7 @@ const F32 PART_SIM_BOX_RAD = 0.5f*F_SQRT3*PART_SIM_BOX_SIDE; //static S32 LLViewerPartSim::sMaxParticleCount = 0; S32 LLViewerPartSim::sParticleCount = 0; +S32 LLViewerPartSim::sParticleCount2 = 0; // This controls how greedy individual particle burst sources are allowed to be, and adapts according to how near the particle-count limit we are. F32 LLViewerPartSim::sParticleAdaptiveRate = 0.0625f; F32 LLViewerPartSim::sParticleBurstRate = 0.5f; @@ -84,12 +85,16 @@ LLViewerPart::LLViewerPart() : { LLMemType mt(LLMemType::MTYPE_PARTICLES); mPartSourcep = NULL; + + ++LLViewerPartSim::sParticleCount2 ; } LLViewerPart::~LLViewerPart() { LLMemType mt(LLMemType::MTYPE_PARTICLES); mPartSourcep = NULL; + + --LLViewerPartSim::sParticleCount2 ; } void LLViewerPart::init(LLPointer sourcep, LLViewerImage *imagep, LLVPCallback cb) @@ -263,6 +268,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) LLVector3 gravity(0.f, 0.f, GRAVITY); + LLViewerPartSim::checkParticleCount(mParticles.size()); + LLViewerRegion *regionp = getRegion(); S32 end = (S32) mParticles.size(); for (S32 i = 0 ; i < (S32)mParticles.size();) @@ -416,6 +423,8 @@ void LLViewerPartGroup::updateParticles(const F32 lastdt) gObjectList.killObject(mVOPartGroupp); mVOPartGroupp = NULL; } + + LLViewerPartSim::checkParticleCount() ; } @@ -451,6 +460,19 @@ void LLViewerPartGroup::removeParticlesByID(const U32 source_id) // // +//static +void LLViewerPartSim::checkParticleCount(U32 size) +{ + if(LLViewerPartSim::sParticleCount2 != LLViewerPartSim::sParticleCount) + { + llerrs << "sParticleCount: " << LLViewerPartSim::sParticleCount << " ; sParticleCount2: " << LLViewerPartSim::sParticleCount2 << llendl ; + } + + if(size > (U32)LLViewerPartSim::sParticleCount2) + { + llerrs << "curren particle size: " << LLViewerPartSim::sParticleCount2 << " array size: " << size << llendl ; + } +} LLViewerPartSim::LLViewerPartSim() { @@ -509,6 +531,12 @@ void LLViewerPartSim::addPart(LLViewerPart* part) { put(part); } + else + { + //delete the particle if can not add it in + delete part ; + part = NULL ; + } } @@ -544,7 +572,7 @@ LLViewerPartGroup *LLViewerPartSim::put(LLViewerPart* part) if(!return_group) { llassert_always(part->mPosAgent.isFinite()); - LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD); + LLViewerPartGroup *groupp = createViewerPartGroup(part->mPosAgent, desired_size, part->mFlags & LLPartData::LL_PART_HUD); groupp->mUniformParticles = (part->mScale.mV[0] == part->mScale.mV[1] && !(part->mFlags & LLPartData::LL_PART_FOLLOW_VELOCITY_MASK)); if (!groupp->addPart(part)) -- cgit v1.1