|
|
|
@ -1,11 +1,15 @@
|
|
|
|
|
#include "ogreinit.hpp"
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <ctime>
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
#include <cstring>
|
|
|
|
|
|
|
|
|
|
#include <OgreRoot.h>
|
|
|
|
|
#include <OgreParticleEmitterFactory.h>
|
|
|
|
|
#include <OgreParticleSystemManager.h>
|
|
|
|
|
#include <OgreLogManager.h>
|
|
|
|
|
#include <OgreLog.h>
|
|
|
|
|
|
|
|
|
|
#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
|
|
|
|
|
#include <OSX/macUtils.h>
|
|
|
|
@ -13,8 +17,47 @@
|
|
|
|
|
|
|
|
|
|
#include <components/nifogre/particles.hpp>
|
|
|
|
|
|
|
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
#include <boost/filesystem/fstream.hpp>
|
|
|
|
|
|
|
|
|
|
#include "ogreplugin.hpp"
|
|
|
|
|
|
|
|
|
|
namespace bfs = boost::filesystem;
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
{
|
|
|
|
|
class LogListener : public Ogre::LogListener
|
|
|
|
|
{
|
|
|
|
|
bfs::ofstream file;
|
|
|
|
|
char buffer[16];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
LogListener(const std::string &path)
|
|
|
|
|
: file((bfs::path(path)))
|
|
|
|
|
{
|
|
|
|
|
memset(buffer, sizeof(buffer), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void timestamp()
|
|
|
|
|
{
|
|
|
|
|
int local = time(0) % 86400;
|
|
|
|
|
int sec = local % 60;
|
|
|
|
|
int min = (local / 60) % 60;
|
|
|
|
|
int hrs = local / 3600;
|
|
|
|
|
sprintf(buffer, "%02d:%02d:%02d: ", hrs, min, sec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
virtual void messageLogged(const std::string &msg, Ogre::LogMessageLevel lvl, bool mask, const std::string &logName, bool &skip)
|
|
|
|
|
{
|
|
|
|
|
timestamp();
|
|
|
|
|
file << buffer << msg << std::endl;
|
|
|
|
|
skip = true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace OgreInit
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
@ -43,6 +86,10 @@ namespace OgreInit
|
|
|
|
|
new Ogre::LogManager;
|
|
|
|
|
Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);
|
|
|
|
|
|
|
|
|
|
#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
|
|
|
|
|
log->addListener(new LogListener(logPath));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
// Disable logging to cout/cerr
|
|
|
|
|
log->setDebugOutputEnabled(false);
|
|
|
|
|
|
|
|
|
|