- bugfixes for g3d viewer showing particles

This commit is contained in:
Mark Vejvoda
2011-10-07 07:53:06 +00:00
parent c1eedabf84
commit e2ff585fab
2 changed files with 19 additions and 4 deletions

View File

@@ -214,6 +214,8 @@ vector<string> autoScreenShotParams;
const string MainWindow::winHeader= "G3D viewer " + g3dviewerVersionString; const string MainWindow::winHeader= "G3D viewer " + g3dviewerVersionString;
const float defaultspeed = 0.025f;
MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad, MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
const string modelPath, const string modelPath,
const string particlePath, const string particlePath,
@@ -246,6 +248,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
glCanvas->SetCurrent(); glCanvas->SetCurrent();
#endif #endif
lastanim = 0;
model= NULL; model= NULL;
unitPath = unitToLoad; unitPath = unitToLoad;
@@ -273,7 +276,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
zoom= defaultZoom; zoom= defaultZoom;
playerColor= Renderer::pcRed; playerColor= Renderer::pcRed;
speed= 0.025f; speed= defaultspeed;
//getGlPlatformExtensions(); //getGlPlatformExtensions();
menu= new wxMenuBar(); menu= new wxMenuBar();
@@ -545,8 +548,12 @@ void MainWindow::onPaint(wxPaintEvent &event) {
int updateLoops = particleLoopStart; int updateLoops = particleLoopStart;
particleLoopStart = 1; particleLoopStart = 1;
for(int i=0; i< updateLoops; ++i) { if(resetAnimation == true || ((anim - lastanim) >= defaultspeed*2)) {
renderer->updateParticleManager(); printf("anim [%f] [%f] [%f]\n",anim,lastanim,speed);
for(int i=0; i< updateLoops; ++i) {
renderer->updateParticleManager();
}
} }
renderer->renderParticleManager(); renderer->renderParticleManager();
@@ -602,6 +609,8 @@ void MainWindow::onPaint(wxPaintEvent &event) {
onMenuRestart(event); onMenuRestart(event);
} }
} }
lastanim = anim;
} }
void MainWindow::onClose(wxCloseEvent &event){ void MainWindow::onClose(wxCloseEvent &event){
@@ -1274,6 +1283,8 @@ void MainWindow::loadProjectileParticle(string path) {
try { try {
if(this->particleProjectilePathList.empty() == false) { if(this->particleProjectilePathList.empty() == false) {
printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size());
string titlestring=winHeader; string titlestring=winHeader;
for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) { for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
string particlePath = this->particleProjectilePathList[idx]; string particlePath = this->particleProjectilePathList[idx];
@@ -1305,11 +1316,13 @@ void MainWindow::loadProjectileParticle(string path) {
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl; // std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
{
XmlTree xmlTree; XmlTree xmlTree;
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues()); xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
//const XmlNode *particleSystemNode= xmlTree.getRootNode(); //const XmlNode *particleSystemNode= xmlTree.getRootNode();
// std::cout << "Loaded successfully, loading values..." << std::endl; // std::cout << "Loaded successfully, loading values..." << std::endl;
}
std::map<string,vector<pair<string, string> > > loadedFileList; std::map<string,vector<pair<string, string> > > loadedFileList;
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile(); ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
@@ -1321,7 +1334,8 @@ void MainWindow::loadProjectileParticle(string path) {
projectileParticleSystemTypes.push_back(projectileParticleSystemType); projectileParticleSystemTypes.push_back(projectileParticleSystemType);
for(std::vector<ParticleSystemTypeProjectile *>::const_iterator it= projectileParticleSystemTypes.begin(); it != projectileParticleSystemTypes.end(); ++it) { for(std::vector<ParticleSystemTypeProjectile *>::const_iterator it= projectileParticleSystemTypes.begin();
it != projectileParticleSystemTypes.end(); ++it) {
ProjectileParticleSystem *ps = (*it)->create(); ProjectileParticleSystem *ps = (*it)->create();

View File

@@ -86,6 +86,7 @@ private:
float speed; float speed;
float anim; float anim;
float lastanim;
int particleLoopStart; int particleLoopStart;
float rotX, rotY, zoom; float rotX, rotY, zoom;
float backBrightness, gridBrightness, lightBrightness; float backBrightness, gridBrightness, lightBrightness;