mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 05:10:26 +00:00
File output switch
This commit is contained in:
parent
7fde576dd9
commit
eab69f18ac
5 changed files with 40 additions and 15 deletions
|
@ -19,6 +19,7 @@
|
||||||
#include <components/esm/esm_reader.hpp>
|
#include <components/esm/esm_reader.hpp>
|
||||||
#include <components/files/path.hpp>
|
#include <components/files/path.hpp>
|
||||||
#include <components/nifbullet/bullet_nif_loader.hpp>
|
#include <components/nifbullet/bullet_nif_loader.hpp>
|
||||||
|
#include <components/nifogre/ogre_nif_loader.hpp>
|
||||||
|
|
||||||
#include "mwinput/inputmanager.hpp"
|
#include "mwinput/inputmanager.hpp"
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
|
|
||||||
#include "mwmechanics/mechanicsmanager.hpp"
|
#include "mwmechanics/mechanicsmanager.hpp"
|
||||||
|
|
||||||
|
|
||||||
void OMW::Engine::executeLocalScripts()
|
void OMW::Engine::executeLocalScripts()
|
||||||
{
|
{
|
||||||
MWWorld::LocalScripts& localScripts = mEnvironment.mWorld->getLocalScripts();
|
MWWorld::LocalScripts& localScripts = mEnvironment.mWorld->getLocalScripts();
|
||||||
|
@ -99,6 +101,11 @@ void OMW::Engine::updateFocusReport (float duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OMW::Engine::setAnimationVerbose(bool animverbose){
|
||||||
|
if(animverbose)
|
||||||
|
NifOgre::NIFLoader::getSingletonPtr()->setOutputAnimFiles(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -158,6 +158,8 @@ namespace OMW
|
||||||
/// Font encoding
|
/// Font encoding
|
||||||
void setEncoding(const std::string& encoding);
|
void setEncoding(const std::string& encoding);
|
||||||
|
|
||||||
|
void setAnimationVerbose(bool animverbose);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Cfg::ConfigurationManager& mCfgMgr;
|
Cfg::ConfigurationManager& mCfgMgr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -78,6 +78,9 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Cfg::Configuratio
|
||||||
("fps", boost::program_options::value<bool>()->implicit_value(true)
|
("fps", boost::program_options::value<bool>()->implicit_value(true)
|
||||||
->default_value(false), "show fps counter")
|
->default_value(false), "show fps counter")
|
||||||
|
|
||||||
|
("anim-verbose", boost::program_options::value<bool>()->implicit_value(true)
|
||||||
|
->default_value(false), "output animation indices files")
|
||||||
|
|
||||||
("debug", boost::program_options::value<bool>()->implicit_value(true)
|
("debug", boost::program_options::value<bool>()->implicit_value(true)
|
||||||
->default_value(false), "debug mode")
|
->default_value(false), "debug mode")
|
||||||
|
|
||||||
|
@ -206,6 +209,7 @@ bool parseOptions (int argc, char** argv, OMW::Engine& engine, Cfg::Configuratio
|
||||||
engine.setScriptsVerbosity(variables["script-verbose"].as<bool>());
|
engine.setScriptsVerbosity(variables["script-verbose"].as<bool>());
|
||||||
engine.setCompileAll(variables["script-all"].as<bool>());
|
engine.setCompileAll(variables["script-all"].as<bool>());
|
||||||
engine.setReportFocus(variables["report-focus"].as<bool>());
|
engine.setReportFocus(variables["report-focus"].as<bool>());
|
||||||
|
engine.setAnimationVerbose(variables["anim-verbose"].as<bool>());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,9 @@ static CompareFunction getTestMode(int mode)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void NIFLoader::setOutputAnimFiles(bool output){
|
||||||
|
mOutputAnimFiles = output;
|
||||||
|
}
|
||||||
void NIFLoader::createMaterial(const String &name,
|
void NIFLoader::createMaterial(const String &name,
|
||||||
const Vector &ambient,
|
const Vector &ambient,
|
||||||
const Vector &diffuse,
|
const Vector &diffuse,
|
||||||
|
@ -984,7 +987,9 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||||
if (e->recType == RC_NiTextKeyExtraData){
|
if (e->recType == RC_NiTextKeyExtraData){
|
||||||
Nif::NiTextKeyExtraData* extra = dynamic_cast<Nif::NiTextKeyExtraData*> (e);
|
Nif::NiTextKeyExtraData* extra = dynamic_cast<Nif::NiTextKeyExtraData*> (e);
|
||||||
|
|
||||||
|
std::ofstream file;
|
||||||
|
|
||||||
|
if(mOutputAnimFiles){
|
||||||
std::string cut = "";
|
std::string cut = "";
|
||||||
for(unsigned int i = 0; i < name.length(); i++)
|
for(unsigned int i = 0; i < name.length(); i++)
|
||||||
{
|
{
|
||||||
|
@ -996,7 +1001,8 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||||
|
|
||||||
std::cout << "Outputting " << cut << "\n";
|
std::cout << "Outputting " << cut << "\n";
|
||||||
|
|
||||||
std::ofstream file(("Indices" + cut + ".txt").c_str());
|
file.open(("Indices" + cut + ".txt").c_str());
|
||||||
|
}
|
||||||
|
|
||||||
for(std::vector<Nif::NiTextKeyExtraData::TextKey>::iterator textiter = extra->list.begin(); textiter != extra->list.end(); textiter++)
|
for(std::vector<Nif::NiTextKeyExtraData::TextKey>::iterator textiter = extra->list.begin(); textiter != extra->list.end(); textiter++)
|
||||||
{
|
{
|
||||||
|
@ -1021,6 +1027,7 @@ void NIFLoader::handleNode(Nif::Node *node, int flags,
|
||||||
//length = text.length() - first;
|
//length = text.length() - first;
|
||||||
std::string sub = text.substr(first, length);
|
std::string sub = text.substr(first, length);
|
||||||
|
|
||||||
|
if(mOutputAnimFiles)
|
||||||
file << "Time: " << textiter->time << "|" << sub << "\n";
|
file << "Time: " << textiter->time << "|" << sub << "\n";
|
||||||
|
|
||||||
textmappings[sub] = textiter->time;
|
textmappings[sub] = textiter->time;
|
||||||
|
|
|
@ -117,13 +117,16 @@ class NIFLoader : Ogre::ManualResourceLoader
|
||||||
Ogre::Vector3 convertVector3(const Nif::Vector& vec);
|
Ogre::Vector3 convertVector3(const Nif::Vector& vec);
|
||||||
Ogre::Quaternion convertRotation(const Nif::Matrix& rot);
|
Ogre::Quaternion convertRotation(const Nif::Matrix& rot);
|
||||||
|
|
||||||
|
void setOutputAnimFiles(bool output);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
NIFLoader() : resourceGroup("General"),mNormaliseNormals(false),
|
NIFLoader() : mNormaliseNormals(false), resourceGroup("General"), resourceName(""), flip(false),
|
||||||
mFlipVertexWinding(false), flip(false) {resourceName = "";}
|
mFlipVertexWinding(false), mOutputAnimFiles(false) {}
|
||||||
NIFLoader(NIFLoader& n) {}
|
NIFLoader(NIFLoader& n) {}
|
||||||
|
|
||||||
void calculateTransform();
|
void calculateTransform();
|
||||||
|
|
||||||
|
|
||||||
void warn(std::string msg);
|
void warn(std::string msg);
|
||||||
void fail(std::string msg);
|
void fail(std::string msg);
|
||||||
|
|
||||||
|
@ -168,6 +171,7 @@ class NIFLoader : Ogre::ManualResourceLoader
|
||||||
bool mNormaliseNormals;
|
bool mNormaliseNormals;
|
||||||
bool mFlipVertexWinding;
|
bool mFlipVertexWinding;
|
||||||
bool bNiTri;
|
bool bNiTri;
|
||||||
|
bool mOutputAnimFiles;
|
||||||
std::multimap<std::string,std::string> MaterialMap;
|
std::multimap<std::string,std::string> MaterialMap;
|
||||||
|
|
||||||
// pointer to the ogre mesh which is currently build
|
// pointer to the ogre mesh which is currently build
|
||||||
|
@ -185,6 +189,7 @@ class NIFLoader : Ogre::ManualResourceLoader
|
||||||
std::vector<Ogre::Mesh*> addin;
|
std::vector<Ogre::Mesh*> addin;
|
||||||
std::vector<Nif::NiKeyframeData> mAnim;
|
std::vector<Nif::NiKeyframeData> mAnim;
|
||||||
std::vector<Nif::NiTriShapeCopy> mS;
|
std::vector<Nif::NiTriShapeCopy> mS;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue