本文整理汇总了C++中ogre::LogManager类的典型用法代码示例。如果您正苦于以下问题:C++ LogManager类的具体用法?C++ LogManager怎么用?C++ LogManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LogManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:MrLobo,项目名称:El-Rayo-de-Zeus,代码行数:32,代码来源:MilkshapePlugin.cpp
示例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();
}
开发者ID:RiballoJose,项目名称:Get-the-Cup,代码行数:35,代码来源:SoundFX.cpp
示例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;
};
开发者ID:fiedukow,项目名称:SimCity2013,代码行数:31,代码来源:BaseApplication.cpp
示例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;
}
}
开发者ID:johnfredcee,项目名称:meshmixer,代码行数:27,代码来源:wxOgre.cpp
示例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()"));
}
}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:10,代码来源:Track.cpp
示例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;
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:60,代码来源:ogreExporter.cpp
示例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);
}
开发者ID:mvanderkolff,项目名称:navi-misc,代码行数:10,代码来源:Log.cpp
示例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);
}
开发者ID:dreamsxin,项目名称:rainbrurpg,代码行数:66,代码来源:OgreMinimalSetup.cpp
示例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;
}
开发者ID:RiballoJose,项目名称:Get-the-Cup,代码行数:13,代码来源:SoundFX.cpp
示例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;
}
开发者ID:AlexeyBelezeko,项目名称:eqOgre,代码行数:49,代码来源:ogreapplication.cpp
示例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()"));
}
}
}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:17,代码来源:Track.cpp
示例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
}
开发者ID:opatut,项目名称:chars,代码行数:45,代码来源:Client.cpp
示例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");
}
开发者ID:zester,项目名称:Mezzanine,代码行数:19,代码来源:entresol.cpp
示例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;
}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:38,代码来源:ogrewrapper.cpp
示例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();
}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:37,代码来源:Track.cpp
示例16: ExportLevel
void OgreExporter_c::ExportLevel(const WadLevel_c &level, const WadFile_c &file)
{
this->ExportLevelMaterials(level, file);
Ogre::DefaultHardwareBufferManager hardwareBufferManager;
Ogre::ManualObject manualMesh(level.GetName());
const LineDef_s *lineDefs = level.GetLineDefs();
const size_t numLineDefs = level.GetNumLineDefs();
const SideDef_s *sideDefs = level.GetSideDefs();
const Sector_s *sectors = level.GetSectors();
const Vertex_s *vertices = level.GetVertices();
for(size_t i = 0;i < numLineDefs; ++i)
{
if(lineDefs[i].iLeftSideDef >= 0)
{
const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
const Sector_s &leftSideSector = sectors[leftSide.iSector];
const SideDef_s &rightSide = sideDefs[lineDefs[i].iRightSideDef];
const Sector_s &rightSideSector = sectors[rightSide.iSector];
if(leftSide.uMiddleTexture.uName != '-')
{
this->ExportWallMesh(manualMesh, leftSideSector.iFloorHeight, leftSideSector.iCeilHeight, leftSide.uMiddleTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);
}
if(leftSide.uLowerTexture.uName != '-')
{
this->ExportWallMesh(manualMesh, leftSideSector.iFloorHeight, leftSideSector.iFloorHeight, leftSide.uLowerTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);
}
if(leftSide.uUpperTexture.uName != '-')
{
this->ExportWallMesh(manualMesh, rightSideSector.iCeilHeight, leftSideSector.iCeilHeight, leftSide.uUpperTexture, leftSide.iOffsetX, leftSide.iOffsety, vertices, lineDefs[i], file);
}
}
if(lineDefs[i].iRightSideDef >= 0)
{
const SideDef_s &rightSide = sideDefs[lineDefs[i].iRightSideDef];
const Sector_s &rightSideSector = sectors[rightSide.iSector];
if(rightSide.uLowerTexture.uName != '-')
{
const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
const Sector_s &leftSideSector = sectors[leftSide.iSector];
this->ExportWallMesh(manualMesh, rightSideSector.iFloorHeight, leftSideSector.iFloorHeight, rightSide.uLowerTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);
}
if(rightSide.uMiddleTexture.uName != '-')
{
this->ExportWallMesh(manualMesh, rightSideSector.iFloorHeight, rightSideSector.iCeilHeight, rightSide.uMiddleTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);
}
if(rightSide.uUpperTexture.uName != '-')
{
const SideDef_s &leftSide = sideDefs[lineDefs[i].iLeftSideDef];
const Sector_s &leftSideSector = sectors[leftSide.iSector];
this->ExportWallMesh(manualMesh, leftSideSector.iCeilHeight, rightSideSector.iCeilHeight, rightSide.uUpperTexture, rightSide.iOffsetX, rightSide.iOffsety, vertices, lineDefs[i], file);
}
}
}
namespace fs = boost::filesystem;
fs::path path(strLevelDirectory);
std::string levelName = level.GetName();
levelName += ".mesh";
path /= levelName;
Ogre::LogManager logManager;
logManager.createLog("ogre.log", true, true, false);
Ogre::ResourceGroupManager resourceGroupManager;
Ogre::MeshManager meshManager;
Ogre::LodStrategyManager logStrategyManager;
Ogre::MeshPtr mesh = manualMesh.convertToMesh(level.GetName());
Ogre::MeshSerializer serializer;
serializer.exportMesh(mesh.get(), path.string());
mesh.setNull();
resourceGroupManager.shutdownAll();
this->CreateResourcesCfg();
}
开发者ID:jlsandell,项目名称:wadlib,代码行数:95,代码来源:OgreExporter.cpp
示例17: OnMouseMotion
void wxOgre::OnMouseMotion(wxMouseEvent& event)
{
static float speed = 0.0f;
static bool dragStart = true;
static const wxString posInfo(wxT("Pos:X:%03d, Y:%03d Change X:%03d Y:%03d"));
static Ogre::Quaternion startRot(Ogre::Quaternion::IDENTITY);
Ogre::LogManager* logMgr = Ogre::LogManager::getSingletonPtr();
Ogre::Log* log(logMgr->getDefaultLog());
int left, top, width, height;
mCamera->getViewport()->getActualDimensions(left, top, width, height);
wxPoint pos = event.GetPosition();
wxPoint change = pos - mPrevPos;
Ogre::Vector2 changeNorm((Ogre::Real) change.x / (Ogre::Real) width,
(Ogre::Real) -change.y / (Ogre::Real) height);
if ((!dragStart) && ((!event.Dragging()) || (!event.LeftIsDown()))) {
wxString msg(wxT("Drag End"));
log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
dragStart = true;
}
if(event.Dragging())
{
if (event.LeftIsDown())
{
if (mTarget) {
Ogre::Vector3 objectCentre(mTarget == NULL ? Ogre::Vector3::ZERO : mTarget->getPosition());
if (dragStart) {
Ogre::Vector3 cam2Object(mCameraNode->getPosition() - objectCentre);
mDirection = cam2Object.normalisedCopy();
mRadius = cam2Object.length();
mChangePos = Ogre::Vector2::ZERO;
dragStart = false;
wxString msg(wxT("Drag Start"));
log->logMessage(Ogre::String(msg.mb_str(wxConvUTF8)));
} else {
Ogre::Vector3 across;
Ogre::Vector3 up;
Ogre::Vector3 forward;
mCamera->getRealOrientation().ToAxes(across, up, forward);
mChangePos += changeNorm;
Ogre::Quaternion roty(Ogre::Radian(mChangePos.y * Ogre::Math::PI / 12.0f), across);
Ogre::Quaternion rotx(Ogre::Radian(mChangePos.x * Ogre::Math::PI / 12.0f), up);
Ogre::Quaternion rot(roty * rotx);
rot.normalise();
mCameraNode->setPosition(objectCentre + ((rot * mDirection) * mRadius));
mCamera->lookAt(objectCentre);
}
}
}
else if(event.MiddleIsDown())
{
int left, top, width, height;
mCamera->getViewport()->getActualDimensions(left, top, width, height);
float speed = 1.0f;
if (event.ShiftDown())
speed = 0.1f;
if (event.ControlDown())
speed = 10.0f;
float moveX = ((float)-change.x / (float)width) * mZoomScale * speed;
float moveY = ((float)change.y / (float)height) * mZoomScale * speed;
Ogre::Vector3 delta(mCamera->getRealOrientation().xAxis() * moveX);
delta += mCamera->getRealOrientation().yAxis() * moveY;
mCamera->setPosition(mCamera->getRealPosition() + delta);
}
}
mPrevPos = pos;
}
开发者ID:johnfredcee,项目名称:meshmixer,代码行数:73,代码来源:wxOgre.cpp
示例18: OnOgreMeshExportMenu
/** Callback event when clicking the export menu option. Adds an instance of the
options dialog as a property, then uses the InspectObj XSI command to pop it up
in a modal dialog. If it wasn't cancelled, performs an export.
*/
XSI::CStatus OnOgreMeshExportMenu( XSI::CRef& in_ref )
{
Ogre::LogManager logMgr;
logMgr.createLog("OgreXSIExporter.log", true);
CString msg(L"OGRE Exporter Version ");
msg += OGRE_XSI_EXPORTER_VERSION;
LogOgreAndXSI(msg);
Application app;
CStatus st(CStatus::OK);
Property prop = app.GetActiveSceneRoot().GetProperties().GetItem(exportPropertyDialogName);
if (prop.IsValid())
{
// Check version number
CString currVersion(prop.GetParameterValue(L"version"));
if (!currVersion.IsEqualNoCase(OGRE_XSI_EXPORTER_VERSION))
{
DeleteObj(exportPropertyDialogName);
prop.ResetObject();
}
}
if (!prop.IsValid())
{
prop = app.GetActiveSceneRoot().AddProperty(exportPropertyDialogName);
prop.PutParameterValue(L"version", CString(OGRE_XSI_EXPORTER_VERSION));
}
try
{
// Popup Returns true if the command was cancelled otherwise it returns false.
CStatus ret = Popup(exportPropertyDialogName,CValue(),L"OGRE Mesh / Skeleton Export",((LONG)siModal),true);
if (ret == CStatus::OK)
{
Ogre::XsiMeshExporter meshExporter;
Ogre::XsiSkeletonExporter skelExporter;
// retrieve the parameters
Parameter param = prop.GetParameters().GetItem(L"objectName");
CString objectName = param.GetValue();
param = prop.GetParameters().GetItem( L"targetMeshFileName" );
Ogre::String meshFileName = XSItoOgre(XSI::CString(param.GetValue()));
if (meshFileName.empty())
{
OGRE_EXCEPT(Ogre::Exception::ERR_INVALIDPARAMS,
"You must supply a mesh file name",
"OGRE Exporter");
}
// fix any omission of '.mesh'
if (!Ogre::StringUtil::endsWith(meshFileName, ".mesh"))
{
meshFileName += ".mesh";
}
param = prop.GetParameters().GetItem( L"mergeSubmeshes" );
bool mergeSubmeshes = param.GetValue();
param = prop.GetParameters().GetItem( L"exportChildren" );
bool exportChildren = param.GetValue();
param = prop.GetParameters().GetItem( L"calculateEdgeLists" );
bool edgeLists = param.GetValue();
param = prop.GetParameters().GetItem( L"calculateTangents" );
bool tangents = param.GetValue();
param = prop.GetParameters().GetItem( L"tangentSemantic" );
CString tangentSemStr = param.GetValue();
Ogre::VertexElementSemantic tangentSemantic = (tangentSemStr == L"t")?
Ogre::VES_TANGENT : Ogre::VES_TEXTURE_COORDINATES;
param = prop.GetParameters().GetItem( L"tangentsSplitMirrored" );
bool tangentsSplitMirrored = param.GetValue();
param = prop.GetParameters().GetItem( L"tangentsSplitRotated" );
bool tangentsSplitRotated = param.GetValue();
param = prop.GetParameters().GetItem( L"tangentsUseParity" );
bool tangentsUseParity = param.GetValue();
param = prop.GetParameters().GetItem( L"numLodLevels" );
long numlods = (LONG)param.GetValue();
Ogre::XsiMeshExporter::LodData* lodData = 0;
if (numlods > 0)
{
param = prop.GetParameters().GetItem( L"lodDistanceIncrement" );
float distanceInc = param.GetValue();
param = prop.GetParameters().GetItem(L"lodQuota");
CString quota = param.GetValue();
param = prop.GetParameters().GetItem(L"lodReduction");
float reduction = param.GetValue();
lodData = new Ogre::XsiMeshExporter::LodData;
float currentInc = distanceInc;
for (int l = 0; l < numlods; ++l)
{
lodData->distances.push_back(currentInc);
currentInc += distanceInc;
}
lodData->quota = (quota == L"p") ?
Ogre::ProgressiveMesh::VRQ_PROPORTIONAL : Ogre::ProgressiveMesh::VRQ_CONSTANT;
if (lodData->quota == Ogre::ProgressiveMesh::VRQ_PROPORTIONAL)
lodData->reductionValue = reduction * 0.01;
else
//.........这里部分代码省略.........
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:101,代码来源:OgreXSIExport.cpp
示例19: SetupOgre
// This function will set up everything required by Ogre
// and it will ask the user for display settings
// At the end of this function Ogre is ready to render.
// This function is mostly taken from tutorials and sample programs.
int CUIMain::SetupOgre(void)
{
//=================
//Ogre defaultly logs to console
// To prevent this the LogManager has to be created
// before the Root object.
//=================
Ogre::LogManager* logMgr = OGRE_NEW Ogre::LogManager;
logMgr->createLog("Ogre.log", true, false, false);
//=================
//Create the Ogre root object
// It's possible to specify as parameters the paths to the:
// plugin file (what render systems it has to load), config file (screen resolution etc) and log file
//=================
if( !mRoot ) mRoot = OGRE_NEW Ogre::Root();
//=================
// Tell Ogre where all the needed resources are (rendersystems and so on)
//=================
Ogre::ConfigFile cf;
cf.load("resources.cfg");
Ogre::String secName, typeName, archName;
Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
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);
}
}
//=================
// Set up the render system.
// Ogre will ask the user for display settings
//=================
if( !mRoot->showConfigDialog() )
return 0; //The user probably clicked cancel
mWindow = mRoot->initialise(true, "NNYv3");
//=================
// Load all the resources. For now, just load all resources at once. The following is from a tutorial:
// In a very large game or application, we may have hundreds or even thousands of resources
// that our game uses - everything from meshes to textures to scripts. At any given time though,
// we probably will only be using a small subset of these resources. To keep down memory requirements,
// we can load only the resources that our application is using. We do this by dividing the resources
// into sections and only initializing them as we go.
//=================
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//=================
// Preparing the scene
//=================
mSceneMgr = mRoot->createSceneManager(Ogre::ST_EXTERIOR_CLOSE); //ST_EXTERIOR_CLOSE allows rendering terrain
mCamera.Initialize(mSceneMgr);
Ogre::Viewport* vp = mWindow->addViewport(mCamera.GetCamera());
vp->setBackgroundColour(Ogre::ColourValue(0.9,0.9,0.9));
//Fog will not work with sky ;)
//mSceneMgr->setFog(Ogre::FOG_LINEAR, Ogre::ColourValue(0.9,0.9,0.9), 0.0, 50, 500);
mCamera.GetCamera()->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
//Set a moving cloud texture as background
mSceneMgr->setSkyDome(true, "CloudySky", 5, 8);
//Get a RaySceneQuery object. A SceneQuery object is a class that can query all
//objects in a region or scene. RaySceneQuery has it as a base class. RaySceneQuery
//can get all objects that intersect a ray.
mQueryMouseMovement = mSceneMgr->createRayQuery(Ogre::Ray(), QUERY_MASK_MOUSE_MOVEMENT);
mQueryMouseSelection = mSceneMgr->createRayQuery(Ogre::Ray(), QUERY_MASK_MOUSE_SELECTING);
LoadWorld();
//=================
// Set up the CEGUI system
//=================
mGUIHandler = new CGUIHandler(mWindow, mSceneMgr);
//=================
// Create the input handler
//=================
mInputHandler = new CInputHandler(mWorld, mCamera, mWindow, mSceneMgr);
mRoot->addFrameListener(mInputHandler);
mRoot->addFrameListener(this);
//=================
//.........这里部分代码省略.........
开发者ID:Tombana,项目名称:NNYv3,代码行数:101,代码来源:OgreSetup.cpp
示例20: initialize
//does all the initial setup of the window, camera, etc.
void OgreDisplay::initialize()
{
//This code is used to stop ogre from spamming it's log to the command line.
//It works by creating a dummy loglistener that doesn't output anything
Ogre::LogManager* logger = new Ogre::LogManager();
QuietLog qlog;
logger->createLog("ogre/ogre.log", true, false, true);
if (!verbose)
{
Ogre::LogManager::getSingleton().getDefaultLog()->addListener(&qlog);
}
//use the files given
root = new Root("ogre/plugins.cfg", "ogre/ogre.cfg", "ogre/ogre.log");
//this code chooses the renderer to use. without plugins.cfg, this won't work
RenderSystemList* renderers = root->getAvailableRenderers();
assert( !renderers->empty() );
RenderSystem* renderSystems = renderers->at(0);
root->setRenderSystem(renderSystems);
//set up some options for our window
root->getRenderSystem()->setConfigOption( "Full Screen", "No" );
root->getRenderSystem()->setConfigOption( "Video Mode", "1920x1000" );
root->getRenderSystem()->setConfigOption( "VSync", "Yes" );
root->saveConfig();
//FIXME: how can I get it to read this from resources.cfg instead of manually specifying it here?
root->addResourceLocation("./content/", "FileSystem");
//if (root->showConfigDialog())
//FIXME: make it a command line thing to not show this?
{
renderWindow = root->initialise(true);
}
//choose scene manager, make camera and do clear colour
sceneMgr = root->createSceneManager( ST_GENERIC, "PrototypeSceneManager");
camera = sceneMgr->createCamera("ViewCamera");
camera->setNearClipDistance(0.1);
camera->setFarClipDistance(1000.0);
viewport = renderWindow->addViewport(camera);
viewport->setBackgroundColour(ColourValue(1, 1, 1));
camera->setAspectRatio( Real(viewport->getActualWidth()) / Real(viewport->getActualHeight()) );
//make a texture manager and resource groups
TextureManager::getSingleton().setDefaultNumMipmaps(5);
//ResourceGroupManager::getSingleton().createResourceGroup("procgen");
//root->addResourceLocation("../content", "FileSystem", "procgen", true);
ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//some ambient light
sceneMgr->setAmbientLight(ColourValue(0.0, 0.0, 0.0));
//set the shadow type we'll be using - commented out because it was causing a crash
//sceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
//put the camera looking at the origins
camera->setPosition(0,0,0);
camera->lookAt(Vector3(64,64,64));
//create a static geometry group for doing the voxels
sceneMgr->createStaticGeometry("voxel_grid");
//make a billboard group.
sceneMgr->createBillboardSet("voxel_grid");
sceneMgr->getRootSceneNode()->attachObject(sceneMgr->getBillboardSet("voxel_grid"));
sceneMgr->getBillboardSet("voxel_grid")->setDefaultDimensions(1.0, 1.0);
//enable this to rendering the voxels as points
sceneMgr->getBillboardSet("voxel_grid")->setPointRenderingEnabled(true);
sceneMgr->getBillboardSet("voxel_grid")->setMaterialName("basic/cube_default");
//do mesh setup stuff
cubeCount = 0;
cylinderCount = 0;
this->createCubeMesh(); //use default arguments to make the default cube
this->createCylinderMesh(); //use default arguments to make the default cylinder
}
开发者ID:zacharia,项目名称:masters-implementation,代码行数:81,代码来源:OgreDisplay.cpp
注:本文中的ogre::LogManager类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论