summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/llviewerpartsim.cpp3
-rw-r--r--indra/newview/llvopartgroup.cpp22
-rw-r--r--indra/newview/llvopartgroup.h3
3 files changed, 17 insertions, 11 deletions
diff --git a/indra/newview/llviewerpartsim.cpp b/indra/newview/llviewerpartsim.cpp
index b4617566ac..2c81e2835c 100644
--- a/indra/newview/llviewerpartsim.cpp
+++ b/indra/newview/llviewerpartsim.cpp
@@ -661,9 +661,6 @@ void LLViewerPartSim::updateSimulation()
{
static LLFrameTimer update_timer;
- //reset VBO cursor
- LLVOPartGroup::sVBSlotCursor = 0;
-
const F32 dt = llmin(update_timer.getElapsedTimeAndResetF32(), 0.1f);
if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_PARTICLES)))
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index f006ad2867..b31afca61d 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -47,11 +47,17 @@
extern U64MicrosecondsImplicit gFrameTime;
LLPointer<LLVertexBuffer> LLVOPartGroup::sVB = NULL;
-S32 LLVOPartGroup::sVBSlotCursor = 0;
+S32 LLVOPartGroup::sVBSlotFree[];
+S32* LLVOPartGroup::sVBSlotCursor = NULL;
void LLVOPartGroup::initClass()
{
+ for (S32 i = 0; i < LL_MAX_PARTICLE_COUNT; ++i)
+ {
+ sVBSlotFree[i] = i;
+ }
+ sVBSlotCursor = sVBSlotFree;
}
//static
@@ -124,12 +130,14 @@ void LLVOPartGroup::destroyGL()
//static
S32 LLVOPartGroup::findAvailableVBSlot()
{
- if (sVBSlotCursor >= LL_MAX_PARTICLE_COUNT)
+ if (sVBSlotCursor >= sVBSlotFree + LL_MAX_PARTICLE_COUNT)
{ //no more available slots
return -1;
}
- return sVBSlotCursor++;
+ S32 ret = *sVBSlotCursor;
+ sVBSlotCursor++;
+ return ret;
}
bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
@@ -150,7 +158,7 @@ bool ll_is_part_idx_allocated(S32 idx, S32* start, S32* end)
//static
void LLVOPartGroup::freeVBSlot(S32 idx)
{
- /*llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
+ llassert(idx < LL_MAX_PARTICLE_COUNT && idx >= 0);
//llassert(sVBSlotCursor > sVBSlotFree);
//llassert(ll_is_part_idx_allocated(idx, sVBSlotCursor, sVBSlotFree+LL_MAX_PARTICLE_COUNT));
@@ -158,7 +166,7 @@ void LLVOPartGroup::freeVBSlot(S32 idx)
{
sVBSlotCursor--;
*sVBSlotCursor = idx;
- }*/
+ }
}
LLVOPartGroup::LLVOPartGroup(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
@@ -870,7 +878,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
LLFace* facep = *i;
LLAlphaObject* object = (LLAlphaObject*) facep->getViewerObject();
- //if (!facep->isState(LLFace::PARTICLE))
+ if (!facep->isState(LLFace::PARTICLE))
{ //set the indices of this face
S32 idx = LLVOPartGroup::findAvailableVBSlot();
if (idx >= 0)
@@ -879,7 +887,7 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
facep->setIndicesIndex(idx*6);
facep->setVertexBuffer(LLVOPartGroup::sVB);
facep->setPoolType(LLDrawPool::POOL_ALPHA);
- //facep->setState(LLFace::PARTICLE);
+ facep->setState(LLFace::PARTICLE);
}
else
{
diff --git a/indra/newview/llvopartgroup.h b/indra/newview/llvopartgroup.h
index 2ef8b1c848..4e4d6e609d 100644
--- a/indra/newview/llvopartgroup.h
+++ b/indra/newview/llvopartgroup.h
@@ -42,7 +42,8 @@ public:
//vertex buffer for holding all particles
static LLPointer<LLVertexBuffer> sVB;
- static S32 sVBSlotCursor;
+ static S32 sVBSlotFree[LL_MAX_PARTICLE_COUNT];
+ static S32 *sVBSlotCursor;
static void initClass();
static void restoreGL();