本文整理汇总了C++中ogre::Camera::getOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::getOrientation方法的具体用法?C++ Camera::getOrientation怎么用?C++ Camera::getOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::getOrientation方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: camera_get_orientation
//Ogre::Camera::getOrientation() const
void camera_get_orientation(CameraHandle handle, coiQuaternion* orientation)
{
Ogre::Camera* camera = static_cast<Ogre::Camera*>(handle);
const Ogre::Quaternion& getter = camera->getOrientation();
orientation->w = getter.w;
orientation->x = getter.x;
orientation->y = getter.y;
orientation->z = getter.z;
}
示例2: processCamera
void DotSceneLoader::processCamera(rapidxml::xml_node<>* XMLNode,
Ogre::SceneNode *pParent) {
// Process attributes
Ogre::String name = getAttrib(XMLNode, "name");
Ogre::String id = getAttrib(XMLNode, "id");
// Ogre::Real fov = getAttribReal(XMLNode, "fov", 45);
// Ogre::Real aspectRatio = getAttribReal(XMLNode, "aspectRatio", 1.3333);
Ogre::String projectionType = getAttrib(XMLNode, "projectionType",
"perspective");
// Create the camera
Ogre::Camera *pCamera = mSceneMgr->createCamera(name);
// Set the projection type
if (projectionType == "perspective")
pCamera->setProjectionType(Ogre::PT_PERSPECTIVE);
else if (projectionType == "orthographic")
pCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
rapidxml::xml_node<>* pElement;
// Process clipping (?)
pElement = XMLNode->first_node("clipping");
if (pElement) {
Ogre::Real nearDist = getAttribReal(pElement, "near");
if (nearDist > 0)
pCamera->setNearClipDistance(nearDist);
Ogre::Real farDist = getAttribReal(pElement, "far");
pCamera->setFarClipDistance(farDist);
}
// Process position (?)
pElement = XMLNode->first_node("position");
if (pElement)
pCamera->setPosition(parseVector3(pElement));
// Process rotation (?)
pElement = XMLNode->first_node("rotation");
if (pElement)
pCamera->setOrientation(parseQuaternion(pElement));
// construct a scenenode is no parent
if (!pParent) {
Ogre::SceneNode* pNode = mAttachNode->createChildSceneNode(name);
pNode->setPosition(pCamera->getPosition());
pNode->setOrientation(pCamera->getOrientation());
pNode->scale(1, 1, 1);
}
}
示例3: SaveSettingCamera
//---------------------------------------------------------------------------------------------
void TEditorMapLogic::SaveSettingCamera()
{
Ogre::Camera* pCamera = TModuleLogic::Get()->GetC()->pGraphicEngine->GetGE()->GetCamera();
const Ogre::Vector3& pos = pCamera->getPosition();
const Ogre::Quaternion& dir = pCamera->getOrientation();
GetSettings()->BeginGroup( "SettingCamera" );
GetSettings()->WriteEntry( "pos_x", pos.x );
GetSettings()->WriteEntry( "pos_y", pos.y );
GetSettings()->WriteEntry( "pos_z", pos.z );
GetSettings()->WriteEntry( "dir_x", dir.x );
GetSettings()->WriteEntry( "dir_y", dir.y );
GetSettings()->WriteEntry( "dir_z", dir.z );
GetSettings()->WriteEntry( "dir_w", dir.w );
}
示例4: updateReflectionCamera
void OgrePlanarReflectionMaterial::updateReflectionCamera(const Ogre::MovablePlane& plane)
{
Ogre::Camera* sofaCamera = mSceneMgr->getCamera("sofaCamera");
assert(sofaCamera);
//mCamera->setNearClipDistance(sofaCamera->getNearClipDistance());
mCamera->setFarClipDistance(sofaCamera->getFarClipDistance());
mCamera->setAspectRatio(sofaCamera->getViewport()->getActualWidth() /
sofaCamera->getViewport()->getActualHeight());
mCamera->setFOVy(sofaCamera->getFOVy());
mCamera->setOrientation(sofaCamera->getOrientation());
mCamera->setPosition(sofaCamera->getPosition());
mCamera->enableReflection(&plane);
mCamera->enableCustomNearClipPlane(&plane);
}
示例5: processCamera
void DotSceneLoader::processCamera(rapidxml::xml_node<>* XMLNode, Ogre::SceneNode *pParent)
{
// Process attributes
Ogre::String name = getAttrib(XMLNode, "name");
Ogre::String id = getAttrib(XMLNode, "id");
Ogre::Real fov = getAttribReal(XMLNode, "fov", 45);
Ogre::Real aspectRatio = getAttribReal(XMLNode, "aspectRatio", 1.3333);
Ogre::String projectionType = getAttrib(XMLNode, "projectionType", "perspective");
// Create the camera
Ogre::Camera *pCamera = mSceneMgr->createCamera(name);
//TODO: make a flag or attribute indicating whether or not the camera should be attached to any parent node.
//if(pParent)
// pParent->attachObject(pCamera);
// Set the field-of-view
//! @todo Is this always in degrees?
//pCamera->setFOVy(Ogre::Degree(fov));
// Set the aspect ratio
//pCamera->setAspectRatio(aspectRatio);
// Set the projection type
if (projectionType == "perspective")
pCamera->setProjectionType(Ogre::PT_PERSPECTIVE);
else if (projectionType == "orthographic")
pCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
rapidxml::xml_node<>* pElement;
// Process clipping (?)
pElement = XMLNode->first_node("clipping");
if (pElement)
{
Ogre::Real nearDist = getAttribReal(pElement, "near");
pCamera->setNearClipDistance(nearDist);
Ogre::Real farDist = getAttribReal(pElement, "far");
pCamera->setFarClipDistance(farDist);
}
// Process position (?)
pElement = XMLNode->first_node("position");
if (pElement)
pCamera->setPosition(parseVector3(pElement));
// Process rotation (?)
pElement = XMLNode->first_node("rotation");
if (pElement)
pCamera->setOrientation(parseQuaternion(pElement));
// Process normal (?)
pElement = XMLNode->first_node("normal");
if (pElement)
;//!< @todo What to do with this element?
// Process lookTarget (?)
pElement = XMLNode->first_node("lookTarget");
if (pElement)
;//!< @todo Implement the camera look target
// Process trackTarget (?)
pElement = XMLNode->first_node("trackTarget");
if (pElement)
;//!< @todo Implement the camera track target
// Process userDataReference (?)
pElement = XMLNode->first_node("userDataReference");
if (pElement)
;//!< @todo Implement the camera user data reference
// construct a scenenode is no parent
if (!pParent)
{
Ogre::SceneNode* pNode = mAttachNode->createChildSceneNode(name);
pNode->setPosition(pCamera->getPosition());
pNode->setOrientation(pCamera->getOrientation());
pNode->scale(1, 1, 1);
}
}
示例6: while
//.........这里部分代码省略.........
lightCopy->setSpecularColour(light->getSpecularColour());
lightCopy->setAttenuation(light->getAttenuationRange(), light->getAttenuationConstant(), light->getAttenuationLinear(), light->getAttenuationQuadric());
lightCopy->setPosition(light->getPosition());
lightCopy->setDirection(light->getDirection());
if (lightCopy->getType() == Ogre::Light::LT_SPOTLIGHT)
lightCopy->setSpotlightRange(light->getSpotlightInnerAngle(), light->getSpotlightOuterAngle(), light->getSpotlightFalloff());
lightCopy->setPowerScale(light->getPowerScale());
lightCopy->setCastShadows(light->getCastShadows());
// create a new container for the cloned light
OgreContainer *lightCopyContainer = new OgreContainer(lightCopy);
lightCopy->setUserAny(Ogre::Any(lightCopyContainer));
if (!light->getUserAny().isEmpty()) {
OgreContainer *lightContainer = Ogre::any_cast<OgreContainer *>(light->getUserAny());
if (lightContainer)
QObject::connect(lightContainer, SIGNAL(sceneNodeUpdated()), lightCopyContainer, SLOT(updateLight()));
}
result = dynamic_cast<Ogre::MovableObject *>(lightCopy);
} else if (typeName == "Camera") {
// clone camera
Ogre::Camera *camera = dynamic_cast<Ogre::Camera *>(movableObject);
Ogre::Camera *cameraCopy = sceneManager->createCamera(name.toStdString());
//cameraCopy->setCustomParameter(0, camera->getCustomParameter(0));
cameraCopy->setAspectRatio(camera->getAspectRatio());
cameraCopy->setAutoAspectRatio(camera->getAutoAspectRatio());
//cameraCopy->setAutoTracking(...);
cameraCopy->setCastShadows(camera->getCastsShadows());
//cameraCopy->setCullingFrustum(camera->getCullingFrustum());
//cameraCopy->setCustomParameter(...);
//cameraCopy->setCustomProjectionMatrix(..);
//cameraCopy->setCustomViewMatrix(..);
//cameraCopy->setDebugDisplayEnabled(...);
//cameraCopy->setDefaultQueryFlags(...);
//cameraCopy->setDefaultVisibilityFlags(...);
cameraCopy->setDirection(camera->getDirection());
//cameraCopy->setFixedYawAxis(...);
cameraCopy->setFocalLength(camera->getFocalLength());
cameraCopy->setFOVy(camera->getFOVy());
//Ogre::Real left;
//Ogre::Real right;
//Ogre::Real top;
//Ogre::Real bottom;
//camera->getFrustumExtents(left, right, top, bottom);
//cameraCopy->setFrustumExtents(left, right, top, bottom);
//cameraCopy->setFrustumOffset(camera->getFrustumOffset());
//cameraCopy->setListener(camera->getListener());
cameraCopy->setLodBias(camera->getLodBias());
//cameraCopy->setLodCamera(camera->getLodCamera());
cameraCopy->setNearClipDistance(camera->getNearClipDistance());
cameraCopy->setFarClipDistance(camera->getFarClipDistance());
cameraCopy->setOrientation(camera->getOrientation());
//cameraCopy->setOrthoWindow(...);
//cameraCopy->setOrthoWindowHeight(...);
//cameraCopy->setOrthoWindowWidth(...);
cameraCopy->setPolygonMode(camera->getPolygonMode());
cameraCopy->setPolygonModeOverrideable(camera->getPolygonModeOverrideable());
cameraCopy->setPosition(camera->getPosition());
cameraCopy->setProjectionType(camera->getProjectionType());
cameraCopy->setQueryFlags(camera->getQueryFlags());
cameraCopy->setRenderingDistance(camera->getRenderingDistance());
cameraCopy->setRenderQueueGroup(camera->getRenderQueueGroup());
//cameraCopy->setRenderSystemData(camera->getRenderSystemData());
cameraCopy->setUseIdentityProjection(camera->getUseIdentityProjection());
cameraCopy->setUseIdentityView(camera->getUseIdentityView());
//cameraCopy->setUserAny(camera->getUserAny());
cameraCopy->setUseRenderingDistance(camera->getUseRenderingDistance());
//cameraCopy->setUserObject(camera->getUserObject());
cameraCopy->setVisibilityFlags(camera->getVisibilityFlags());
cameraCopy->setVisible(camera->getVisible());
//cameraCopy->setWindow(...);
if (!movableObject->getUserAny().isEmpty()) {
CameraInfo *sourceCameraInfo = Ogre::any_cast<CameraInfo *>(movableObject->getUserAny());
if (sourceCameraInfo) {
CameraInfo *targetCameraInfo = new CameraInfo();
targetCameraInfo->width = sourceCameraInfo->width;
targetCameraInfo->height = sourceCameraInfo->height;
dynamic_cast<Ogre::MovableObject *>(cameraCopy)->setUserAny(Ogre::Any(targetCameraInfo));
}
}
//// Setup connections for instances
//SceneNode *targetSceneNode = new SceneNode(cameraCopy);
//((Ogre::MovableObject *)cameraCopy)->setUserAny(Ogre::Any(targetSceneNode));
//if (!((Ogre::MovableObject *)camera)->getUserAny().isEmpty()) {
// SceneNode *sourceSceneNode = Ogre::any_cast<SceneNode *>(((Ogre::MovableObject *)camera)->getUserAny());
// if (sourceSceneNode) {
// QObject::connect(sourceSceneNode, SIGNAL(sceneNodeUpdated()), targetSceneNode, SLOT(updateSceneNode()));
// }
//}
result = dynamic_cast<Ogre::MovableObject *>(cameraCopy);
}
if (!result)
Log::error(QString("Could not clone movable object \"%1\" of type \"%2\".").arg(movableObject->getName().c_str()).arg(typeName.c_str()), "OgreTools::cloneMovableObject");
return result;
}
示例7: createScene
//-------------------------------------------------------------------------------------
void SampleApp::createScene(void)
{
mImpulse = btVector3(0,0,0);
mLoader = new DotSceneLoader();
mLoader->parseDotScene(mSceneFile, "General", mSceneMgr,0,"",Globals::phyWorld);
// Get rid of the initial camera
mSceneMgr->destroyCamera(mCamera);
//ENTITY DECLARATIONS
Ogre::SceneNode* headNode;
Ogre::Entity* head;
head = mSceneMgr->createEntity("Ex1.mesh");
headNode = mSceneMgr->createSceneNode();
mSceneMgr->getRootSceneNode()->addChild(headNode);
headNode->attachObject(head);
//headNode->scale(0.1,0.1,0.1);
//headNode->setPosition(0,25,0);
//Create shape.
BtOgre::StaticMeshToShapeConverter converter(head);
mCharacterShape = converter.createBox(); // Declare this btCollisionShape * pointer in SampleApp.h
//Calculate inertia tensor.
btScalar mass = 5;
btVector3 inertia;
mCharacterShape -> calculateLocalInertia(mass, inertia);
//Create BtOgre MotionState (connects Ogre and Bullet).
BtOgre::RigidBodyState *characterState = new BtOgre::RigidBodyState(headNode);
//Create the Body.
mCharacterBody = new btRigidBody(mass, characterState, mCharacterShape, inertia);
mCharacterBody ->setActivationState(DISABLE_DEACTIVATION);
//mCharacterBody->setCollisionFlags(mCharacterBody->getCollisionFlags() | btCollisionObject::CF_STATIC_OBJECT);
// Get bullet debug lines to show using F3
Globals::dbgdraw = new BtOgre::DebugDrawer(mSceneMgr -> getRootSceneNode(), Globals::phyWorld);
Globals::phyWorld->setDebugDrawer(Globals::dbgdraw);
Globals::phyWorld->addRigidBody(mCharacterBody);
//END OF ENTITY DECLARATIONS
// Loop through all cameras and grab their name and set their debug representation
Ogre::SceneManager::CameraIterator cameras = mSceneMgr->getCameraIterator();
while (cameras.hasMoreElements())
{
Ogre::Camera* camera = cameras.getNext();
mCamNames.push_back(camera->getName());
Ogre::Entity* debugEnt = mSceneMgr->createEntity(camera->getName() + Ogre::String("_debug"), "scbCamera.mesh");
try{
Ogre::SceneNode* sNode = mSceneMgr->getSceneNode(camera->getName());
sNode->attachObject(debugEnt);
sNode->scale(0.5, 0.5, 0.5);
}catch (...){
Ogre::SceneNode* pNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(camera->getName());
pNode->setPosition(camera->getPosition());
pNode->setOrientation(camera->getOrientation());
pNode->attachObject(debugEnt);
pNode->scale(0.5, 0.5, 0.5);
}
}
// Grab the first available camera, for now
Ogre::String cameraName = mCamNames[0];
try
{
mActiveCamera = mSceneMgr->getCamera(cameraName);
mWindow->getViewport(0)->setCamera(mActiveCamera);
mCameraMan->setCamera(mActiveCamera);
mSceneMgr->getEntity(mActiveCamera->getName() + Ogre::String("_debug"))->setVisible(false);
//for(unsigned int ij = 0;ij < mLoader->mPGHandles.size();ij++)
//{
// mLoader->mPGHandles[ij]->setCamera(mActiveCamera);
//}
}
catch (Ogre::Exception& e)
{
Ogre::LogManager::getSingleton().logMessage("SampleApp::createScene : setting the active camera to (\"" +
cameraName + ") failed: " + e.getFullDescription());
}
}