本文整理汇总了C++中ogre::LogManager类的典型用法代码示例。如果您正苦于以下问题:C++ LogManager类的具体用法?C++ LogManager怎么用?C++ LogManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
//---------------------------------------------------------------------
int MilkshapePlugin::Execute (msModel* pModel)
{
// Do nothing if no model selected
if (!pModel)
return -1;
Ogre::LogManager logMgr;
logMgr.createLog("msOgreExporter.log", true);
logMgr.logMessage("OGRE Milkshape Exporter Log");
logMgr.logMessage("---------------------------");
Ogre::ResourceGroupManager resGrpMgr;
//
// check, if we have something to export
//
if (msModel_GetMeshCount (pModel) == 0)
{
::MessageBox (NULL, "The model is empty! Nothing exported!", "OGRE Export", MB_OK | MB_ICONWARNING);
return 0;
}
if (!showOptions()) return 0;
if (exportMesh)
{
doExportMesh(pModel);
}
return 0;
}
示例2: loadImpl
void SoundFX::loadImpl() {
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
// Ruta al archivo.
Ogre::FileInfoListPtr info;
info = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, mName);
for (Ogre::FileInfoList::iterator i = info->begin(); i != info->end(); ++i) {
_path = i->archive->getName() + "/" + i->filename;
}
// Archivo no encontrado...
if (_path == "") {
pLogManager->logMessage("SoundFX::loadImpl() Imposible encontrar el recurso.");
throw (Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Imposible encontrar el recurso", "SoundFX::loadImpl()"));
}
// Cargar el efecto de sonido.
if ((_pSound = Mix_LoadWAV(_path.c_str())) == NULL) {
pLogManager->logMessage("SoundFX::loadImpl() Imposible cargar el efecto.");
throw (Ogre::Exception(Ogre::Exception::ERR_INTERNAL_ERROR,
"Imposible cargar el efecto", "SoundFX::loadImpl()"));
}
// Cálculo del tamaño del recurso de sonido.
std::ifstream stream;
char byteBuffer;
stream.open(_path.c_str(), std::ios_base::binary);
while (stream >> byteBuffer) {
++_size;
}
stream.close();
}
示例3: setup
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
Ogre::LogManager * lm = new Ogre::LogManager();
lm->createLog("Ogre.log", true, false, false);
mRoot = new Ogre::Root(mPluginsCfg);
setupResources();
bool carryOn = configure();
if (!carryOn) return false;
chooseSceneManager();
createCamera();
createViewports();
// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
// Create any resource listeners (for loading screens)
createResourceListener();
// Load resources
loadResources();
// Create the scene
createScene();
createFrameListener();
return true;
};
示例4: cameraTrackNode
void wxOgre::cameraTrackNode(Ogre::SceneNode* target)
{
static const wxString camCalcPosCaption(wxT("CalcCamPos:X:%08.4f, Y:%08.4f, Z:%08.4f"));
static const wxString camRealPosCaption(wxT("CalcCamPos:X:%08.4f, Y:%08.4f, Z:%08.4f"));
// TODO: Position camera somwehere sensible relative to object
if (target)
{
Ogre::LogManager* logMgr = Ogre::LogManager::getSingletonPtr();
Ogre::Log* log(logMgr->getDefaultLog());
mTarget = target;
Ogre::Vector3 size( target->getAttachedObject(0)->getBoundingBox().getSize() );
Ogre::Vector3 camPos(target->getPosition() + size * 1.2f);
setZoomScale(size.length() / 30.0f);
mCameraNode->setPosition(camPos);
mCamera->lookAt(target->getPosition());
mDebugPanelOverlay->show();
wxString msg(wxString::Format(camCalcPosCaption, camPos.x, camPos.y, camPos.x));
log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
Ogre::Vector3 camRealPos(mCamera->getRealPosition());
msg = wxString(wxString::Format(camCalcPosCaption, camRealPos.x, camRealPos.y, camRealPos.x));
log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
} else {
mTarget = NULL;
}
}
示例5: fadeOut
// Fachada de MixFadeOutMusic()
void Track::fadeOut (int ms) {
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
if (Mix_FadeOutMusic(ms) == -1) {
pLogManager->logMessage("Track::fadeIn() Error al aplicar efecto de sonido.");
throw (Ogre::Exception(Ogre::Exception::ERR_INTERNAL_ERROR,
"Imposible aplicar suavizado de sonido", "Track::fadeIn()"));
}
}
示例6: writeOgreData
/********************************************************************************************************
* Method to write data to OGRE format *
********************************************************************************************************/
MStatus OgreExporter::writeOgreData()
{
// Create singletons
Ogre::LogManager logMgr;
Ogre::ResourceGroupManager rgm;
Ogre::MeshManager meshMgr;
Ogre::SkeletonManager skelMgr;
Ogre::MaterialManager matMgr;
Ogre::DefaultHardwareBufferManager hardwareBufMgr;
// Create a log
logMgr.createLog("ogreMayaExporter.log", true);
// Write mesh binary
if (m_params.exportMesh)
{
std::cout << "Writing mesh binary...\n";
std::cout.flush();
stat = m_pMesh->writeOgreBinary(m_params);
if (stat != MS::kSuccess)
{
std::cout << "Error writing mesh binary file\n";
std::cout.flush();
}
}
// Write skeleton binary
if (m_params.exportSkeleton)
{
if (m_pMesh->getSkeleton())
{
std::cout << "Writing skeleton binary...\n";
std::cout.flush();
stat = m_pMesh->getSkeleton()->writeOgreBinary(m_params);
if (stat != MS::kSuccess)
{
std::cout << "Error writing mesh binary file\n";
std::cout.flush();
}
}
}
// Write materials data
if (m_params.exportMaterial)
{
std::cout << "Writing materials data...\n";
std::cout.flush();
stat = m_pMaterialSet->writeOgreScript(m_params);
if (stat != MS::kSuccess)
{
std::cout << "Error writing materials file\n";
std::cout.flush();
}
}
return MS::kSuccess;
}
示例7:
ClientLog::ClientLog () : ::Log ("screamers.log"), Ogre::LogListener ()
{
Ogre::LogManager *manager;
if (Ogre::LogManager::getSingletonPtr () == NULL)
manager = new Ogre::LogManager ();
else
manager = Ogre::LogManager::getSingletonPtr ();
manager->addListener (this);
manager->setLogDetail (Ogre::LL_BOREME);
}
示例8: SilentLogListener
/** Setup a minimal ogre renderer
*
* \param custom_log Should we create a custom log
* \param base_dir The path to the config and data files
* (plugins.cfg and ogre.cfg
*
* \warning Incorrect base_dir could lead to a 'memory access violation' when
* launched.
*
* \note The \c custom_log parameter is used to avoid an Ogre3D assertion
* that occurs when creating our custom log.
*
*/
void
OgreMinimalSetup::setupOgre(const Ogre::String& base_dir, bool custom_log)
{
Ogre::Root *root; // The Ogre root singleton
mListener = new SilentLogListener();
string dir= base_dir + "config/";
if (!dirExists(dir)){
throw "config directory '" + dir + "' does not exist.";
}
try{
if (custom_log == true)
{
Ogre::LogManager* logger = new Ogre::LogManager();
assert(logger && "Failed to create an Ogre Logger");
logger->createLog("log.log", true, false, true);
Ogre::LogManager::getSingleton().getDefaultLog()
->addListener(mListener);
}
}
catch(Ogre::Exception e){
cout << "setupOgre failed to initialize LogManager: "<< e.what() << endl;
exit(1);
}
try
{
root = new Ogre::Root(dir + "plugins-unittests.cfg",
dir + "ogre.cfg", dir + "ogre.log");
}
catch(Ogre::Exception e){
cout << "setupOgre failed to initialize Ogre::Root : "<< e.what() << endl;
exit(1);
}
assert(root && "Cannot initialize Ogre::Root");
assert(Ogre::Root::getSingletonPtr() && "Cannot initialize Ogre::Root");
// Select rendersystem
Ogre::RenderSystemList list=Ogre::Root::getSingleton().getAvailableRenderers();
this->debugRenderList( list );
Ogre::Root::getSingleton().setRenderSystem(list[0]);
Ogre::Root::getSingleton().initialise(false, "RainbruRPG blah");
Ogre::Root::getSingleton().addResourceLocation(base_dir + "data/", "FileSystem");
Ogre::Root::getSingleton().addResourceLocation(base_dir + "data/gui/fonts", "FileSystem");
mRenderWindow = Ogre::Root::getSingleton().getRenderSystem()
->_createRenderWindow(RW_NAME, 20, 20, false);
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
}
示例9: play
int SoundFX::play(int loop) {
int channel;
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
// Si el primer parámetro es un -1, maneja nuevos canales para efectos simultáneos
if ((channel = Mix_PlayChannel(1, _pSound, loop)) == -1) {
pLogManager->logMessage("SoundFX::play() Imposible reproducir el efecto de sonido.");
throw (Ogre::Exception(Ogre::Exception::ERR_INTERNAL_ERROR,
"Imposible reproducir el efecto de sonido", "SoundFX::play()"));
}
return channel;
}
示例10: initStart
bool OgreApplication::initStart(void)
{
mPluginsCfg = "../configs/plugins.cfg";
mResourcesCfg = "../configs/resources.cfg";
Ogre::LogManager * lm = new Ogre::LogManager();
lm->createLog("OgreLogfile.log", true, false, false);
// construct Ogre::Root
mRoot = new Ogre::Root(mPluginsCfg, "", "");
Ogre::ConfigFile cf;
cf.load(mResourcesCfg);
// Go through all sections & settings in the file
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
Ogre::String secName, typeName, archName;
while (seci.hasMoreElements())
{
secName = seci.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for (i = settings->begin(); i != settings->end(); ++i)
{
typeName = i->first;
archName = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../assets/", "FileSystem");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("../assets/particles", "FileSystem");
// Do not add this to the application
Ogre::RenderSystem *rs = mRoot->getRenderSystemByName("OpenGL Rendering Subsystem");
mRoot->setRenderSystem(rs);
rs->setConfigOption("Full Screen", "No");
rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
rs->setStencilCheckEnabled(true);
mRoot->initialise(false);
running = true;
return true;
}
示例11: play
void Track::play(int loop) {
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
// Estaba pausada?
if(Mix_PausedMusic()) {
Mix_ResumeMusic(); // Reanudación.
}
// Si no, se reproduce desde el principio.
else {
if (Mix_PlayMusic(_pTrack, loop) == -1) {
pLogManager->logMessage("Track::play() Error al reproducir el recurso de sonido.");
throw (Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Imposible reproducir el recurso de sonido", "Track::play()"));
}
}
}
示例12: StartupOgre
void Client::StartupOgre() {
Ogre::LogManager* logMgr = OGRE_NEW Ogre::LogManager;
logMgr->createLog("DefaultLog", true, false, false);
mOgreRoot = new Ogre::Root("../data/config/plugins.cfg");
// setup resources
// Load resource paths from config file
Ogre::ConfigFile cf;
cf.load("../data/config/resources.cfg");
// Go through all sections & settings in the file
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
Ogre::String secName, typeName, archName;
while(seci.hasMoreElements()) {
secName = seci.peekNextKey();
Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
Ogre::ConfigFile::SettingsMultiMap::iterator i;
for(i = settings->begin(); i != settings->end(); ++i) {
typeName = i->first;
archName = i->second;
Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
archName, typeName, secName);
}
}
// configure
// Show the configuration dialog and initialise the system
if(!(mOgreRoot->restoreConfig() || mOgreRoot->showConfigDialog())) {
exit(0);
}
mWindow = mOgreRoot->initialise(true, "Client Window");
// Set default mipmap level (NB some APIs ignore this)
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
// initialise all resource groups
// Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Basics");
Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("GUI");
InitializeWindow();
// ogre loaded
}
示例13: SetupLogging
void Entresol::SetupLogging(const String& LogFileName)
{
/// @todo Allow the FrameScheduler Log target to be inspected and changed here
Ogre::LogManager* OgreLogs = Ogre::LogManager::getSingletonPtr();
if( NULL == OgreLogs )
{ OgreLogs = new Ogre::LogManager(); }
if(!LogFileName.empty())
{
OgreLogs->createLog(String("Graphics")+LogFileName,true,true);
}
else
{
OgreLogs->createLog("GraphicsMezzanine.log",true,true);
}
this->Aggregator = new Threading::LogAggregator();
Aggregator->SetAggregationTarget(&WorkScheduler);
this->WorkScheduler.AddWorkUnitMain(Aggregator, "LogAggregator");
}
示例14: initOgreRoot
bool initOgreRoot(){
try{
// Create logs that funnel to android logs
Ogre::LogManager *lm = OGRE_NEW Ogre::LogManager();
Ogre::Log *l = lm->createLog("AndroidLog", true, true, true);
g_ll = OGRE_NEW AndroidLogListener();
l->addListener(g_ll);
// Create a root object
g_root = OGRE_NEW Ogre::Root("", "", "");
// Register the ES2 plugin
g_gles2Plugin = OGRE_NEW Ogre::GLES2Plugin();
Ogre::Root::getSingleton().installPlugin(g_gles2Plugin);
// Register particle plugin
g_pfxPlugin = OGRE_NEW Ogre::ParticleFXPlugin();
Ogre::Root::getSingleton().installPlugin(g_pfxPlugin);
// Grab the available render systems
const Ogre::RenderSystemList &renderSystemList = g_root->getAvailableRenderers();
if(renderSystemList.empty())
{
return false;
}
// Set the render system and init
Ogre::RenderSystem *system = renderSystemList.front();
g_root->setRenderSystem(system);
g_root->initialise(false);
g_lastTime = g_timer.getMilliseconds();
return true;
}catch(Ogre::Exception &e){
}
return false;
}
示例15: loadImpl
// Carga del recurso.
void Track::loadImpl() {
Ogre::LogManager* pLogManager = Ogre::LogManager::getSingletonPtr();
// Ruta al archivo.
Ogre::FileInfoListPtr info;
info = Ogre::ResourceGroupManager::getSingleton().findResourceFileInfo(mGroup, mName);
for (Ogre::FileInfoList::const_iterator i = info->begin(); i != info->end(); ++i) {
_path = i->archive->getName() + "/" + i->filename;
}
// Archivo no encontrado...
if (_path == "") {
pLogManager->logMessage("Track::loadImpl() Imposible cargar el recurso de sonido.");
throw (Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Archivo no encontrado", "Track::loadImpl()"));
}
cout << "\n\nPath: " << _path << "\n\n" << endl;
// Cargar el recurso de sonido.
if ((_pTrack = Mix_LoadMUS(_path.c_str())) == NULL) {
pLogManager->logMessage("Track::loadI() Imposible cargar el recurso de sonido.");
throw (Ogre::Exception(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Archivo no encontrado", "Track::loadI()"));
}
// Cálculo del tamaño del recurso de sonido.
std::ifstream stream;
char byteBuffer;
stream.open(_path.c_str(), std::ios_base::binary);
while (stream >> byteBuffer) {
_size++;
}
stream.close();
}