本文整理汇总了C++中ogre::Camera::getFOVy方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::getFOVy方法的具体用法?C++ Camera::getFOVy怎么用?C++ Camera::getFOVy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::getFOVy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: OnFileOpen
void MaterialEditorFrame::OnFileOpen(wxCommandEvent& event)
{
wxFileDialog * openDialog = new wxFileDialog(this, wxT("Choose a file to open"), wxEmptyString, wxEmptyString,
wxT("All Ogre Files (*.material;*.mesh;*.program;*.cg;*.vert;*.frag)|*.material;*.mesh;*.program;*.cg;*.vert;*.frag|Material Files (*.material)|*.material|Mesh Files (*.mesh)|*.mesh|Program Files (*.program)|*.program|Cg Files (*.cg)|*.cg|GLSL Files(*.vert; *.frag)|*.vert;*.frag|All Files (*.*)|*.*"));
if(openDialog->ShowModal() == wxID_OK)
{
wxString path = openDialog->GetPath();
if(path.EndsWith(wxT(".material")) || path.EndsWith(wxT(".program")))
{
MaterialScriptEditor* editor = new MaterialScriptEditor(EditorManager::getSingletonPtr()->getEditorNotebook());
editor->loadFile(path);
int index = (int)path.find_last_of('\\');
if(index == -1) index = (int)path.find_last_of('/');
editor->setName((index != -1) ? path.substr(index + 1, path.Length()) : path);
EditorManager::getSingletonPtr()->openEditor(editor);
}
else if(path.EndsWith(wxT(".cg")))
{
CgEditor* editor = new CgEditor(EditorManager::getSingletonPtr()->getEditorNotebook());
editor->loadFile(path);
int index = (int)path.find_last_of('\\');
if(index == -1) index = (int)path.find_last_of('/');
editor->setName((index != -1) ? path.substr(index + 1, path.Length()) : path);
EditorManager::getSingletonPtr()->openEditor(editor);
}
else if(path.EndsWith(wxT(".mesh")))
{
Ogre::SceneManager *sceneMgr = wxOgre::getSingleton().getSceneManager();
Ogre::Camera *camera = wxOgre::getSingleton().getCamera();
if(mEntity)
{
sceneMgr->getRootSceneNode()->detachObject(mEntity);
sceneMgr->destroyEntity(mEntity);
mEntity = 0;
}
static int meshNumber = 0;
Ogre::String meshName = Ogre::String("Mesh") + Ogre::StringConverter::toString(meshNumber++);
int index = (int)path.find_last_of('\\');
if(index == -1) index = (int)path.find_last_of('/');
wxString mesh = (index != -1) ? path.substr(index + 1, path.Length()) : path;
mEntity = sceneMgr->createEntity(meshName, mesh.GetData());
sceneMgr->getRootSceneNode()->attachObject(mEntity);
Ogre::AxisAlignedBox box = mEntity->getBoundingBox();
Ogre::Vector3 minPoint = box.getMinimum();
Ogre::Vector3 maxPoint = box.getMaximum();
Ogre::Vector3 size = box.getSize();
wxOgre::getSingleton().setZoomScale(max(size.x, max(size.y, size.z)));
wxOgre::getSingleton().resetCamera();
Ogre::Vector3 camPos;
camPos.x = minPoint.x + (size.x / 2.0);
camPos.y = minPoint.y + (size.y / 2.0);
Ogre::Real width = max(size.x, size.y);
camPos.z = (width / tan(camera->getFOVy().valueRadians())) + size.z / 2;
wxOgre::getSingleton().getCamera()->setPosition(camPos);
wxOgre::getSingleton().getCamera()->lookAt(0,0,0);
wxOgre::getSingleton().getLight()->setPosition(maxPoint * 2);
}
}
}
示例3: 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;
}