本文整理汇总了C++中ogre::LogManager::getDefaultLog方法的典型用法代码示例。如果您正苦于以下问题:C++ LogManager::getDefaultLog方法的具体用法?C++ LogManager::getDefaultLog怎么用?C++ LogManager::getDefaultLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::LogManager
的用法示例。
在下文中一共展示了LogManager::getDefaultLog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例2: 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;
}