- Fixed bug related to particles not updating smoothly

This commit is contained in:
Mark Vejvoda
2010-08-26 01:25:27 +00:00
parent 5a796444b8
commit 5fb040c9f1
3 changed files with 7 additions and 23 deletions

View File

@@ -475,9 +475,7 @@ void Renderer::manageParticleSystem(ParticleSystem *particleSystem, ResourceScop
} }
void Renderer::updateParticleManager(ResourceScope rs, int renderFps) { void Renderer::updateParticleManager(ResourceScope rs, int renderFps) {
//if(renderFps < 0 || renderFps >= MIN_FPS_NORMAL_RENDERING) { particleManager[rs]->update(renderFps);
particleManager[rs]->update(renderFps);
//}
} }
void Renderer::renderParticleManager(ResourceScope rs){ void Renderer::renderParticleManager(ResourceScope rs){
@@ -490,7 +488,7 @@ void Renderer::renderParticleManager(ResourceScope rs){
void Renderer::swapBuffers(){ void Renderer::swapBuffers(){
//glFlush(); // should not be required - http://www.opengl.org/wiki/Common_Mistakes //glFlush(); // should not be required - http://www.opengl.org/wiki/Common_Mistakes
//glFlush(); glFlush();
GraphicsInterface::getInstance().getCurrentContext()->swapBuffers(); GraphicsInterface::getInstance().getCurrentContext()->swapBuffers();
} }
@@ -1340,7 +1338,7 @@ void Renderer::renderSurface(const int renderFps, const int worldFrameCount) {
glEnd(); glEnd();
} }
} }
//glEnd(); glEnd();
//Restore //Restore
static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(false); static_cast<ModelRendererGl*>(modelRenderer)->setDuplicateTexCoords(false);

View File

@@ -243,23 +243,10 @@ void World::loadScenario(const string &path, Checksum *checksum){
// ==================== misc ==================== // ==================== misc ====================
void World::updateAllFactionUnits() { void World::updateAllFactionUnits() {
int factionIdxToTick = -1;
//if(staggeredFactionUpdates == true) {
// factionIdxToTick = tickFactionIndex();
// if(factionIdxToTick < 0) {
// return;
// }
//}
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] factionIdxToTick = %d\n",__FILE__,__FUNCTION__,__LINE__,factionIdxToTick);
//units //units
for(int i=0; i<getFactionCount(); ++i) { for(int i=0; i<getFactionCount(); ++i) {
if(factionIdxToTick == -1 || factionIdxToTick == i) { for(int j=0; j<getFaction(i)->getUnitCount(); ++j) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] factionIdxToTick = %d, i = %d\n",__FILE__,__FUNCTION__,__LINE__,factionIdxToTick,i); unitUpdater.updateUnit(getFaction(i)->getUnit(j));
for(int j=0; j<getFaction(i)->getUnitCount(); ++j) {
unitUpdater.updateUnit(getFaction(i)->getUnit(j));
}
} }
} }
} }
@@ -358,7 +345,6 @@ void World::update(){
//tick //tick
bool needToTick = canTickWorld(); bool needToTick = canTickWorld();
if(needToTick == true) { if(needToTick == true) {
//if(frameCount % (GameConstants::updateFps / GameConstants::maxPlayers) == 0) {
tick(); tick();
} }
if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [world tick]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis()); if(chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [world tick]\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis());

View File

@@ -37,8 +37,8 @@ ParticleSystem::ParticleSystem(int particleCount) {
blendMode = bmOne; blendMode = bmOne;
//particles= new Particle[particleCount]; //particles= new Particle[particleCount];
particles.clear(); particles.clear();
particles.reserve(300); //particles.reserve(particleCount);
particles.resize(1); particles.resize(particleCount);
state= sPlay; state= sPlay;
aliveParticleCount=0; aliveParticleCount=0;