- more bugfixes related to g3d viewer commandline options
This commit is contained in:
parent
be8627dc0a
commit
95daf86ce2
|
@ -131,7 +131,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
||||||
|
|
||||||
printf("\n%s=x\t\t\tAuto load the unit / skill information specified in path/filename x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_UNIT]));
|
printf("\n%s=x\t\t\tAuto load the unit / skill information specified in path/filename x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_UNIT]));
|
||||||
printf("\n \t\tWhere x is a g3d filename to load seperated with a comma and one or more skill names to try loading:");
|
printf("\n \t\tWhere x is a g3d filename to load seperated with a comma and one or more skill names to try loading:");
|
||||||
printf("\n \t\texample: %s %s=techs/megapack/factions/tech/units/battle_machine,attack_skill,stop_skill",argv0,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]));
|
printf("\n \t\texample: %s %s=techs/megapack/factions/tech/units/battle_machine,attack_skill,stop_skill",argv0,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_UNIT]));
|
||||||
|
|
||||||
printf("\n%s=x\t\t\tAuto load the model specified in path/filename x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]));
|
printf("\n%s=x\t\t\tAuto load the model specified in path/filename x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]));
|
||||||
printf("\n \t\tWhere x is a g3d filename to load:");
|
printf("\n \t\tWhere x is a g3d filename to load:");
|
||||||
|
@ -187,16 +187,19 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
float defaultAnimation,
|
float defaultAnimation,
|
||||||
int defaultParticleLoopStart,
|
int defaultParticleLoopStart,
|
||||||
float defaultZoom,float defaultXRot, float defaultYRot)
|
float defaultZoom,float defaultXRot, float defaultYRot)
|
||||||
: wxFrame(NULL, -1, ToUnicode(winHeader),wxPoint(Renderer::windowX, Renderer::windowY),
|
: wxFrame(NULL, -1, ToUnicode(winHeader),
|
||||||
wxSize(Renderer::windowW, Renderer::windowH))
|
wxPoint(Renderer::windowX, Renderer::windowY),
|
||||||
|
wxSize(Renderer::windowW, Renderer::windowH))
|
||||||
{
|
{
|
||||||
//getGlPlatformExtensions();
|
//getGlPlatformExtensions();
|
||||||
renderer= Renderer::getInstance();
|
renderer= Renderer::getInstance();
|
||||||
|
|
||||||
|
model= NULL;
|
||||||
unitPath = unitToLoad;
|
unitPath = unitToLoad;
|
||||||
|
|
||||||
if(modelPath != "") {
|
if(modelPath != "") {
|
||||||
this->modelPathList.push_back(modelPath);
|
this->modelPathList.push_back(modelPath);
|
||||||
|
printf("Startup Adding model [%s] list size %d\n",modelPath.c_str(),this->modelPathList.size());
|
||||||
}
|
}
|
||||||
if(particlePath != "") {
|
if(particlePath != "") {
|
||||||
this->particlePathList.push_back(particlePath);
|
this->particlePathList.push_back(particlePath);
|
||||||
|
@ -216,8 +219,6 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
rotX= defaultXRot;
|
rotX= defaultXRot;
|
||||||
rotY= defaultYRot;
|
rotY= defaultYRot;
|
||||||
zoom= defaultZoom;
|
zoom= defaultZoom;
|
||||||
|
|
||||||
model= NULL;
|
|
||||||
playerColor= Renderer::pcRed;
|
playerColor= Renderer::pcRed;
|
||||||
|
|
||||||
speed= 0.025f;
|
speed= 0.025f;
|
||||||
|
@ -326,7 +327,6 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
SetMenuBar(menu);
|
SetMenuBar(menu);
|
||||||
|
|
||||||
//misc
|
//misc
|
||||||
model= NULL;
|
|
||||||
backBrightness= 0.3f;
|
backBrightness= 0.3f;
|
||||||
gridBrightness= 1.0f;
|
gridBrightness= 1.0f;
|
||||||
lightBrightness= 0.3f;
|
lightBrightness= 0.3f;
|
||||||
|
@ -368,9 +368,13 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
||||||
|
|
||||||
MainWindow::~MainWindow(){
|
MainWindow::~MainWindow(){
|
||||||
delete renderer;
|
delete renderer;
|
||||||
|
renderer = NULL;
|
||||||
delete model;
|
delete model;
|
||||||
|
model = NULL;
|
||||||
delete timer;
|
delete timer;
|
||||||
|
timer = NULL;
|
||||||
delete glCanvas;
|
delete glCanvas;
|
||||||
|
glCanvas = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,6 +387,9 @@ void MainWindow::init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::onPaint(wxPaintEvent &event){
|
void MainWindow::onPaint(wxPaintEvent &event){
|
||||||
|
//printf("Start onPaint\n");
|
||||||
|
//fflush(stdout);
|
||||||
|
|
||||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
||||||
|
|
||||||
renderer->transform(rotX, rotY, zoom);
|
renderer->transform(rotX, rotY, zoom);
|
||||||
|
@ -392,7 +399,6 @@ void MainWindow::onPaint(wxPaintEvent &event){
|
||||||
|
|
||||||
renderer->renderTheModel(model, anim);
|
renderer->renderTheModel(model, anim);
|
||||||
|
|
||||||
//int updateLoops = 100;
|
|
||||||
int updateLoops = particleLoopStart;
|
int updateLoops = particleLoopStart;
|
||||||
particleLoopStart = 1;
|
particleLoopStart = 1;
|
||||||
|
|
||||||
|
@ -403,25 +409,54 @@ void MainWindow::onPaint(wxPaintEvent &event){
|
||||||
renderer->renderParticleManager();
|
renderer->renderParticleManager();
|
||||||
glCanvas->SwapBuffers();
|
glCanvas->SwapBuffers();
|
||||||
|
|
||||||
|
bool haveLoadedParticles = (particleProjectilePathList.size() > 0 || particleSplashPathList.size() > 0);
|
||||||
|
|
||||||
if(autoScreenShotAndExit == true) {
|
if(autoScreenShotAndExit == true) {
|
||||||
|
printf("Auto exiting app...\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
autoScreenShotAndExit = false;
|
autoScreenShotAndExit = false;
|
||||||
saveScreenshot();
|
saveScreenshot();
|
||||||
Close();
|
Close();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if(resetAnimation) {
|
else if((modelPathList.size() > 0) && resetAnimation && haveLoadedParticles) {
|
||||||
bool haveLoadedParticles = (particleProjectilePathList.size() > 0 || particleSplashPathList.size() > 0);
|
if(anim >= resetAnim && resetAnim > 0) {
|
||||||
if(haveLoadedParticles) {
|
printf("RESETTING EVERYTHING [%f][%f]...\n",anim,resetAnim);
|
||||||
// renderer->hasActiveParticleSystem(ParticleSystem::pst_ProjectileParticleSystem) == false &&
|
fflush(stdout);
|
||||||
// renderer->hasActiveParticleSystem(ParticleSystem::pst_SplashParticleSystem) == false) {
|
|
||||||
|
|
||||||
if(anim >= resetAnim) {
|
resetAnimation = false;
|
||||||
resetAnimation = false;
|
particleLoopStart = resetParticleLoopStart;
|
||||||
//anim = resetAnim;
|
|
||||||
particleLoopStart = resetParticleLoopStart;
|
wxCommandEvent event;
|
||||||
|
if(unitPath.first != "") {
|
||||||
|
//onMenuFileClearAll(event);
|
||||||
|
|
||||||
|
modelPathList.clear();
|
||||||
|
particlePathList.clear();
|
||||||
|
particleProjectilePathList.clear();
|
||||||
|
particleSplashPathList.clear(); // as above
|
||||||
|
|
||||||
wxCommandEvent event;
|
|
||||||
onMenuRestart(event);
|
onMenuRestart(event);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
onMenuRestart(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(modelPathList.size() == 0 && haveLoadedParticles) {
|
||||||
|
if(renderer->hasActiveParticleSystem(ParticleSystem::pst_ProjectileParticleSystem) == false &&
|
||||||
|
renderer->hasActiveParticleSystem(ParticleSystem::pst_SplashParticleSystem) == false) {
|
||||||
|
|
||||||
|
printf("RESETTING PARTICLES...\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
resetAnimation = false;
|
||||||
|
anim = 0.f;
|
||||||
|
particleLoopStart = resetParticleLoopStart;
|
||||||
|
|
||||||
|
wxCommandEvent event;
|
||||||
|
onMenuRestart(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -429,6 +464,9 @@ void MainWindow::onPaint(wxPaintEvent &event){
|
||||||
void MainWindow::onClose(wxCloseEvent &event){
|
void MainWindow::onClose(wxCloseEvent &event){
|
||||||
// release memory first (from onMenuFileClearAll)
|
// release memory first (from onMenuFileClearAll)
|
||||||
|
|
||||||
|
printf("OnClose START\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
modelPathList.clear();
|
modelPathList.clear();
|
||||||
particlePathList.clear();
|
particlePathList.clear();
|
||||||
particleProjectilePathList.clear();
|
particleProjectilePathList.clear();
|
||||||
|
@ -448,6 +486,9 @@ void MainWindow::onClose(wxCloseEvent &event){
|
||||||
delete model;
|
delete model;
|
||||||
model = NULL;
|
model = NULL;
|
||||||
|
|
||||||
|
printf("OnClose about to END\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -703,6 +744,9 @@ void MainWindow::onMenuFileSaveScreenshot(wxCommandEvent &event) {
|
||||||
|
|
||||||
void MainWindow::onMenuFileClearAll(wxCommandEvent &event) {
|
void MainWindow::onMenuFileClearAll(wxCommandEvent &event) {
|
||||||
try {
|
try {
|
||||||
|
printf("Start onMenuFileClearAll\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
modelPathList.clear();
|
modelPathList.clear();
|
||||||
particlePathList.clear();
|
particlePathList.clear();
|
||||||
particleProjectilePathList.clear();
|
particleProjectilePathList.clear();
|
||||||
|
@ -722,14 +766,19 @@ void MainWindow::onMenuFileClearAll(wxCommandEvent &event) {
|
||||||
delete model;
|
delete model;
|
||||||
model = NULL;
|
model = NULL;
|
||||||
|
|
||||||
|
loadUnit("","");
|
||||||
loadModel("");
|
loadModel("");
|
||||||
loadParticle("");
|
loadParticle("");
|
||||||
loadProjectileParticle("");
|
loadProjectileParticle("");
|
||||||
loadSplashParticle(""); // as above
|
loadSplashParticle(""); // as above
|
||||||
|
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusbarText.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusbarText.c_str()));
|
||||||
timer->Start(100);
|
|
||||||
isControlKeyPressed = false;
|
isControlKeyPressed = false;
|
||||||
|
|
||||||
|
printf("END onMenuFileClearAll\n");
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
|
timer->Start(100);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
|
@ -742,10 +791,6 @@ void MainWindow::onMenuFileExit(wxCommandEvent &event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadUnit(string path, string skillName) {
|
void MainWindow::loadUnit(string path, string skillName) {
|
||||||
timer->Stop();
|
|
||||||
wxCommandEvent event;
|
|
||||||
onMenuFileClearAll(event);
|
|
||||||
|
|
||||||
if(path != "" && fileExists(path) == true) {
|
if(path != "" && fileExists(path) == true) {
|
||||||
// std::cout << "Clearing list..." << std::endl;
|
// std::cout << "Clearing list..." << std::endl;
|
||||||
this->unitPath.first = path;
|
this->unitPath.first = path;
|
||||||
|
@ -754,7 +799,10 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(this->unitPath.first != "") {
|
if(this->unitPath.first != "") {
|
||||||
string titlestring = winHeader;
|
timer->Stop();
|
||||||
|
renderer->end();
|
||||||
|
|
||||||
|
string titlestring = winHeader;
|
||||||
|
|
||||||
string unitPath = this->unitPath.first;
|
string unitPath = this->unitPath.first;
|
||||||
string dir = unitPath;
|
string dir = unitPath;
|
||||||
|
@ -782,15 +830,18 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
string lookipForSkillName = this->unitPath.second[skillIdx];
|
string lookipForSkillName = this->unitPath.second[skillIdx];
|
||||||
|
|
||||||
const XmlNode *skillsNode= unitNode->getChild("skills");
|
const XmlNode *skillsNode= unitNode->getChild("skills");
|
||||||
for(int i = 0; i < skillsNode->getChildCount(); ++i) {
|
for(int i = 0; foundSkillName == false && i < skillsNode->getChildCount(); ++i) {
|
||||||
const XmlNode *sn= skillsNode->getChild("skill", i);
|
const XmlNode *sn= skillsNode->getChild("skill", i);
|
||||||
const XmlNode *typeNode= sn->getChild("type");
|
const XmlNode *typeNode= sn->getChild("type");
|
||||||
const XmlNode *nameNode= sn->getChild("name");
|
const XmlNode *nameNode= sn->getChild("name");
|
||||||
string skillXmlName = nameNode->getAttribute("value")->getRestrictedValue();
|
string skillXmlName = nameNode->getAttribute("value")->getRestrictedValue();
|
||||||
if(skillXmlName == lookipForSkillName) {
|
if(skillXmlName == lookipForSkillName) {
|
||||||
|
printf("Found skill [%s]\n",lookipForSkillName.c_str());
|
||||||
foundSkillName = true;
|
foundSkillName = true;
|
||||||
|
|
||||||
if(sn->getChild("animation") != NULL) {
|
if(sn->getChild("animation") != NULL) {
|
||||||
skillModelFile = unitPath + '/' + sn->getChild("animation")->getAttribute("path")->getRestrictedValue();
|
skillModelFile = unitPath + '/' + sn->getChild("animation")->getAttribute("path")->getRestrictedValue();
|
||||||
|
printf("Found skill model [%s]\n",skillModelFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(sn->hasChild("particles") == true) {
|
if(sn->hasChild("particles") == true) {
|
||||||
|
@ -802,7 +853,7 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
const XmlNode *pf= particlesNode->getChild("particle-file");
|
const XmlNode *pf= particlesNode->getChild("particle-file");
|
||||||
if(pf != NULL) {
|
if(pf != NULL) {
|
||||||
skillParticleFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
skillParticleFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
||||||
break;
|
printf("Found skill skill particle [%s]\n",skillParticleFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -815,6 +866,7 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
const XmlNode *pf= particlesProjectileNode->getChild("particle");
|
const XmlNode *pf= particlesProjectileNode->getChild("particle");
|
||||||
if(pf != NULL && pf->getAttribute("value")->getRestrictedValue() == "true") {
|
if(pf != NULL && pf->getAttribute("value")->getRestrictedValue() == "true") {
|
||||||
skillParticleProjectileFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
skillParticleProjectileFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
||||||
|
printf("Found skill skill projectile particle [%s]\n",skillParticleProjectileFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -827,29 +879,33 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
const XmlNode *pf= particlesSplashNode->getChild("particle");
|
const XmlNode *pf= particlesSplashNode->getChild("particle");
|
||||||
if(pf != NULL && pf->getAttribute("value")->getRestrictedValue() == "true") {
|
if(pf != NULL && pf->getAttribute("value")->getRestrictedValue() == "true") {
|
||||||
skillParticleSplashFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
skillParticleSplashFile = unitPath + '/' + pf->getAttribute("path")->getRestrictedValue();
|
||||||
|
printf("Found skill skill splash particle [%s]\n",skillParticleSplashFile.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(skillModelFile != "") {
|
if(skillModelFile != "") {
|
||||||
this->modelPathList.push_back(skillModelFile);
|
this->modelPathList.push_back(skillModelFile);
|
||||||
|
printf("Added skill model [%s]\n",skillModelFile.c_str());
|
||||||
}
|
}
|
||||||
if(skillParticleFile != "") {
|
if(skillParticleFile != "") {
|
||||||
this->particlePathList.push_back(skillParticleFile);
|
this->particlePathList.push_back(skillParticleFile);
|
||||||
|
printf("Added skill particle [%s]\n",skillParticleFile.c_str());
|
||||||
}
|
}
|
||||||
if(skillParticleProjectileFile != "") {
|
if(skillParticleProjectileFile != "") {
|
||||||
this->particleProjectilePathList.push_back(skillParticleProjectileFile);
|
this->particleProjectilePathList.push_back(skillParticleProjectileFile);
|
||||||
|
printf("Added skill projectile particle [%s]\n",skillParticleProjectileFile.c_str());
|
||||||
}
|
}
|
||||||
if(skillParticleSplashFile != "") {
|
if(skillParticleSplashFile != "") {
|
||||||
this->particleSplashPathList.push_back(skillParticleSplashFile);
|
this->particleSplashPathList.push_back(skillParticleSplashFile);
|
||||||
|
printf("Added skill splash particle [%s]\n",skillParticleSplashFile.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
glCanvas->SetCurrent();
|
//glCanvas->SetCurrent();
|
||||||
renderer->init();
|
//renderer->init();
|
||||||
|
|
||||||
//wxCommandEvent event;
|
//wxCommandEvent event;
|
||||||
//onMenuRestart(event);
|
//onMenuRestart(event);
|
||||||
|
@ -861,19 +917,22 @@ void MainWindow::loadUnit(string path, string skillName) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
||||||
}
|
}
|
||||||
timer->Start(100);
|
//timer->Start(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::loadModel(string path) {
|
void MainWindow::loadModel(string path) {
|
||||||
try {
|
try {
|
||||||
if(path != "" && fileExists(path) == true) {
|
if(path != "" && fileExists(path) == true) {
|
||||||
this->modelPathList.push_back(path);
|
this->modelPathList.push_back(path);
|
||||||
|
printf("Adding model [%s] list size %d\n",path.c_str(),this->modelPathList.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
string titlestring=winHeader;
|
string titlestring=winHeader;
|
||||||
for(unsigned int idx =0; idx < this->modelPathList.size(); idx++) {
|
for(unsigned int idx =0; idx < this->modelPathList.size(); idx++) {
|
||||||
string modelPath = this->modelPathList[idx];
|
string modelPath = this->modelPathList[idx];
|
||||||
|
|
||||||
|
printf("Loading model [%s] %d of %d\n",modelPath.c_str(),idx, this->modelPathList.size());
|
||||||
|
|
||||||
timer->Stop();
|
timer->Stop();
|
||||||
delete model;
|
delete model;
|
||||||
Model *tmpModel= new ModelGl();
|
Model *tmpModel= new ModelGl();
|
||||||
|
@ -920,7 +979,7 @@ void MainWindow::loadParticle(string path) {
|
||||||
string dir= extractDirectoryPathFromFile(particlePath);
|
string dir= extractDirectoryPathFromFile(particlePath);
|
||||||
|
|
||||||
size_t pos = dir.find_last_of(folderDelimiter);
|
size_t pos = dir.find_last_of(folderDelimiter);
|
||||||
if(pos == dir.length()-1) {
|
if(pos == dir.length() - 1 && dir.length() > 0) {
|
||||||
dir.erase(dir.length() -1);
|
dir.erase(dir.length() -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -941,33 +1000,34 @@ void MainWindow::loadParticle(string path) {
|
||||||
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||||
//height
|
//height
|
||||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||||
}
|
|
||||||
|
|
||||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
|
||||||
|
|
||||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||||
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath, renderer);
|
|
||||||
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
|
||||||
|
|
||||||
for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) {
|
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||||
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath, renderer);
|
||||||
(*it)->setValues(ups);
|
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
||||||
if(size > 0) {
|
|
||||||
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
|
||||||
Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
|
||||||
ups->setPos(vec);
|
|
||||||
}
|
|
||||||
//ups->setFactionColor(getFaction()->getTexture()->getPixmap()->getPixel3f(0,0));
|
|
||||||
ups->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
|
||||||
unitParticleSystems.push_back(ups);
|
|
||||||
renderer->manageParticleSystem(ups);
|
|
||||||
|
|
||||||
ups->setVisible(true);
|
for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) {
|
||||||
}
|
UnitParticleSystem *ups= new UnitParticleSystem(200);
|
||||||
|
(*it)->setValues(ups);
|
||||||
|
if(size > 0) {
|
||||||
|
//getCurrVectorFlat() + Vec3f(0.f, type->getHeight()/2.f, 0.f);
|
||||||
|
Vec3f vec = Vec3f(0.f, height / 2.f, 0.f);
|
||||||
|
ups->setPos(vec);
|
||||||
|
}
|
||||||
|
//ups->setFactionColor(getFaction()->getTexture()->getPixmap()->getPixel3f(0,0));
|
||||||
|
ups->setFactionColor(renderer->getPlayerColorTexture(playerColor)->getPixmap()->getPixel3f(0,0));
|
||||||
|
unitParticleSystems.push_back(ups);
|
||||||
|
renderer->manageParticleSystem(ups);
|
||||||
|
|
||||||
if(path != "" && fileExists(path) == true) {
|
ups->setVisible(true);
|
||||||
renderer->initModelManager();
|
}
|
||||||
renderer->initTextureManager();
|
|
||||||
|
if(path != "" && fileExists(path) == true) {
|
||||||
|
renderer->initModelManager();
|
||||||
|
renderer->initTextureManager();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetTitle(ToUnicode(titlestring));
|
SetTitle(ToUnicode(titlestring));
|
||||||
|
@ -1416,7 +1476,7 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
try {
|
try {
|
||||||
// std::cout << "e.ControlDown() = " << e.ControlDown() << " e.GetKeyCode() = " << e.GetKeyCode() << " isCtrl = " << (e.GetKeyCode() == WXK_CONTROL) << std::endl;
|
// std::cout << "e.ControlDown() = " << e.ControlDown() << " e.GetKeyCode() = " << e.GetKeyCode() << " isCtrl = " << (e.GetKeyCode() == WXK_CONTROL) << std::endl;
|
||||||
|
|
||||||
// Note: This ctrl-key handling is buggy since it never resests when ctrl is released later, so I reset it at end of loadcommands for now.
|
// Note: This ctrl-key handling is buggy since it never resets when ctrl is released later, so I reset it at end of loadcommands for now.
|
||||||
if(e.ControlDown() == true || e.GetKeyCode() == WXK_CONTROL) {
|
if(e.ControlDown() == true || e.GetKeyCode() == WXK_CONTROL) {
|
||||||
isControlKeyPressed = true;
|
isControlKeyPressed = true;
|
||||||
}
|
}
|
||||||
|
@ -1446,7 +1506,7 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
string statusTextValue = statusbarText + " animation speed: " + floatToStr(speed * 1000.0) + " zoom: " + floatToStr(zoom) + " rotX: " + floatToStr(rotX) + " rotY: " + floatToStr(rotY);
|
||||||
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
GetStatusBar()->SetStatusText(ToUnicode(statusTextValue.c_str()));
|
||||||
}
|
}
|
||||||
else if (e.GetKeyCode() == 87) {
|
else if (e.GetKeyCode() == 'W') {
|
||||||
glClearColor(0.6f, 0.6f, 0.6f, 1.0f); //w key //backgroundcolor constant 0.3 -> 0.6
|
glClearColor(0.6f, 0.6f, 0.6f, 1.0f); //w key //backgroundcolor constant 0.3 -> 0.6
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1478,6 +1538,8 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
Vec4f ambientNEW= Vec4f(lightBrightness, lightBrightness, lightBrightness, 1.0f);
|
Vec4f ambientNEW= Vec4f(lightBrightness, lightBrightness, lightBrightness, 1.0f);
|
||||||
glLightfv(GL_LIGHT0,GL_AMBIENT, ambientNEW.ptr());
|
glLightfv(GL_LIGHT0,GL_AMBIENT, ambientNEW.ptr());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::cout << "pressed " << e.GetKeyCode() << std::endl;
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
|
@ -1488,6 +1550,7 @@ void MainWindow::onKeyDown(wxKeyEvent &e) {
|
||||||
void MainWindow::onMenuRestart(wxCommandEvent &event) {
|
void MainWindow::onMenuRestart(wxCommandEvent &event) {
|
||||||
try {
|
try {
|
||||||
// std::cout << "pressed R (restart particle animation)" << std::endl;
|
// std::cout << "pressed R (restart particle animation)" << std::endl;
|
||||||
|
timer->Stop();
|
||||||
renderer->end();
|
renderer->end();
|
||||||
|
|
||||||
unitParticleSystems.clear();
|
unitParticleSystems.clear();
|
||||||
|
@ -1505,6 +1568,7 @@ void MainWindow::onMenuRestart(wxCommandEvent &event) {
|
||||||
|
|
||||||
renderer->initModelManager();
|
renderer->initModelManager();
|
||||||
renderer->initTextureManager();
|
renderer->initTextureManager();
|
||||||
|
timer->Start(100);
|
||||||
}
|
}
|
||||||
catch(std::runtime_error e) {
|
catch(std::runtime_error e) {
|
||||||
std::cout << e.what() << std::endl;
|
std::cout << e.what() << std::endl;
|
||||||
|
@ -1689,7 +1753,8 @@ bool App::OnInit(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL])) == true) {
|
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL])) == true &&
|
||||||
|
hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL_ANIMATION_VALUE])) == false) {
|
||||||
const wxWX2MBbuf param = (const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]);
|
const wxWX2MBbuf param = (const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]);
|
||||||
//printf("param = [%s]\n",(const char*)param);
|
//printf("param = [%s]\n",(const char*)param);
|
||||||
|
|
||||||
|
@ -1713,7 +1778,8 @@ bool App::OnInit(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE])) == true) {
|
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE])) == true &&
|
||||||
|
hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE_LOOP_VALUE])) == false) {
|
||||||
const wxWX2MBbuf param = (const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE]);
|
const wxWX2MBbuf param = (const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE]);
|
||||||
//printf("param = [%s]\n",(const char*)param);
|
//printf("param = [%s]\n",(const char*)param);
|
||||||
|
|
||||||
|
@ -1800,7 +1866,7 @@ bool App::OnInit(){
|
||||||
Tokenize(value,paramPartTokens,"=");
|
Tokenize(value,paramPartTokens,"=");
|
||||||
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
|
||||||
newAnimValue = strToFloat(paramPartTokens[1]);
|
newAnimValue = strToFloat(paramPartTokens[1]);
|
||||||
//printf("newAnimValue = %f\n",newAnimValue);
|
printf("newAnimValue = %f\n",newAnimValue);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
printf("\nInvalid path specified on commandline [%s] value [%s]\n\n",(const char *)wxConvCurrent->cWX2MB(argv[foundParamIndIndex]),(paramPartTokens.size() >= 2 ? paramPartTokens[1].c_str() : NULL));
|
||||||
|
|
Loading…
Reference in New Issue