本文整理汇总了C++中ogre::Camera类的典型用法代码示例。如果您正苦于以下问题:C++ Camera类的具体用法?C++ Camera怎么用?C++ Camera使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Camera类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: camera_get_right
//Ogre::Camera::getRight() const
void camera_get_right(CameraHandle handle, coiVector3* right)
{
Ogre::Camera* camera = static_cast<Ogre::Camera*>(handle);
const Ogre::Vector3& u = camera->getRight();
right->x = u.x;
right->y = u.y;
right->z = u.z;
}
示例2: create_camera
void application::create_camera()
{
cam = scene_mgr->createCamera("PlayerCam");
cam->setPosition(Ogre::Vector3 {0, 0, 80});
cam->lookAt(Ogre::Vector3 {0, 0, -300});
cam->setNearClipDistance(5);
cameraman = new OgreBites::SdkCameraMan(cam);
}
示例3: camera_get_up
// Ogre::Camera::getUp() const
void camera_get_up(CameraHandle handle, coiVector3* up)
{
Ogre::Camera* camera = static_cast<Ogre::Camera*>(handle);
const Ogre::Vector3& u = camera->getUp();
up->x = u.x;
up->y = u.y;
up->z = u.z;
}
示例4: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program" << endl;
//Relative to where its executed from, not binary location
Ogre::Root *mRoot = new Ogre::Root("configs/plugins.cfg","configs/config.cfg","logs/main.log");
if(!(mRoot->restoreConfig() || mRoot->showConfigDialog())){
delete mRoot;
return -1;
}
// setup resources
// Only add the minimally required resource locations to load up the Ogre head mesh
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/programs/GLSL", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/scripts", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/materials/textures", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/OgreSDK/Media/models", "FileSystem", "General");
Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/Users/jgrey/github/Ogre_test/data","FileSystem","General");
//Create the window
Ogre::RenderWindow *mWindow = mRoot->initialise(true, "initial Render Window");
Ogre::SceneManager *sceneManager = mRoot->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera *camera = sceneManager->createCamera("PlayerCam");
camera->setPosition(Ogre::Vector3(0,0,80));
camera->lookAt(Ogre::Vector3(0,0,-300));
camera->setNearClipDistance(5);
Ogre::Viewport* vp = mWindow->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0,0));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
//Ogre::Entity* ogreHead = sceneManager->createEntity("Head","ogreHead.mesh");
Ogre::Entity* ogreHead = sceneManager->createEntity("Head","myTest.obj");
Ogre::SceneNode* headNode = sceneManager->getRootSceneNode()->createChildSceneNode();
headNode->attachObject(ogreHead);
sceneManager->setAmbientLight(Ogre::ColourValue(0.5,0.5,0.5));
//Run the system
bool continueRunning = true;
while(continueRunning){
mRoot->renderOneFrame();
headNode->rotate(Ogre::Vector3(0,1,0),Ogre::Radian(0.005));
if(mWindow->isClosed()){
continueRunning = false;
}
}
delete mRoot;
}
示例5: Camera_SetEyePos
// 设置眼睛的位置, ogre 坐标
VOID CEngineInterface::Camera_SetEyePos(const fVector3& fvPos)
{
if(m_pFairySystem)
{
Ogre::Camera* pOgreCamera = m_pFairySystem->getCamera();
pOgreCamera->setPosition(Ogre::Vector3(fvPos.x, fvPos.y, fvPos.z));
}
}
示例6: createCamera
void GraphicsImpl::createCamera()
{
camera = sceneMgr->createCamera("MainCamera");
// Position it at 500 in Z direction
camera->setPosition(Ogre::Vector3(0, 50, 100));
// Look back along -Z
camera->lookAt(Ogre::Vector3(0, -10, 0));
camera->setNearClipDistance(5);
camera->setFarClipDistance(0);
}
示例7: addViewport
void Window::addViewport()
{
Pipe *pipe = static_cast<Pipe *>(getPipe());
Ogre::Camera *cam = pipe->_ogre->getCamera();
_vp = mWindow->addViewport(cam);
_vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
cam->setAspectRatio(
Ogre::Real(_vp->getActualWidth()) / Ogre::Real(_vp->getActualHeight()));
}
示例8: camera_get_derived_orientation
//Ogre::Camera::getDerivedOrientation() const
void camera_get_derived_orientation(CameraHandle handle, coiQuaternion* orientation)
{
Ogre::Camera* camera = static_cast<Ogre::Camera*>(handle);
const Ogre::Quaternion & getter = camera->getDerivedOrientation();
orientation->w = getter.w;
orientation->x = getter.x;
orientation->y = getter.y;
orientation->z = getter.z;
}
示例9: setupViewport
void MultiMgrSample::setupViewport(Ogre::SceneManager *curr)
{
mWindow->removeAllViewports();
Ogre::Camera *cam = curr->getCamera(CAMERA_NAME);
Ogre::Viewport *vp = mWindow->addViewport(cam);
vp->setBackgroundColour(Ogre::ColourValue(0,0,0));
cam->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
}
示例10:
GameState* StateManager::changeState ( const std::string& state_name, Ogre::RenderWindow* window ){
_prev_state = _current_state;
_current_state = _states[state_name];
window->removeAllViewports();
Ogre::Camera* camera = _current_state->getScene()->getCamera(MainCameraName);
Ogre::Viewport* vp = window->addViewport(camera);
vp->setBackgroundColour(Ogre::ColourValue(0.5,0.5,0.5));
camera->setAspectRatio(Ogre::Real(vp->getActualWidth()) / Ogre::Real(vp->getActualHeight()));
return _current_state;
}
示例11: SetPosition
void Stall::SetPosition(Ogre::Rectangle2D *rect, Ogre::Vector3 pos, float size)
{
Ogre::Camera *camera = CommonDeclarations::GetCamera()->GetOgreCamera();
Ogre::Matrix4 vm = camera->getViewMatrix();
Ogre::Matrix4 pm = camera->getProjectionMatrix();
Ogre::Vector3 vpos = vm*pos;
Ogre::Vector3 ppos = pm*vpos;
rect->setCorners(ppos.x-size, ppos.y+size, ppos.x+size/AspectRatio, ppos.y-size);
}
示例12:
Ogre::Vector2 DemoApp::GetScreenspaceCoords(const Ogre::Vector3& iPoint, const Ogre::Camera& iCamera)
{
Ogre:: Vector3 point = iCamera.getProjectionMatrix() * (iCamera.getViewMatrix() * iPoint);
Ogre::Vector2 screenSpacePoint = Ogre::Vector2::ZERO;
screenSpacePoint.x = (point.x / 2.f) + 0.5f;
screenSpacePoint.y = (point.y / 2.f) + 0.5f;
return screenSpacePoint;
}
示例13: QWidget
// -----------------------------------------------------------------------------
CardEditor::CardEditor(EditorProject* project, DeckEditor* parentEditor, QWidget *parent, Qt::WFlags flags)
: QWidget(parent, flags),
EditorWidget(project, parentEditor),
widget(0),
cards(project->getCards()),
current(0),
hasChanged(false),
notified(false),
currentItem(0),
cardCount(cards.size()),
rsError(false) {
ui.setupUi(this);
// We're trying to create a 3D Render Preview. If this fails, the user
// will still be able to edit stuff, but can't preview changes.
try {
// Create Editor RenderView
widget = new OgreWidget(Util::toQString(EditorSystem::getInstance().getRenderView()), ui.ogreWidget);
widget->setBaseSize(QSize(288,384));
widget->setFixedWidth(288);
widget->setFixedHeight(384);
widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
widget->setFocusPolicy(Qt::NoFocus);
ui.ogreWidget->setAttribute(Qt::WA_PaintOnScreen);
ui.ogreWidget->setAttribute(Qt::WA_NoSystemBackground);
ui.ogreWidget->setAttribute(Qt::WA_NoBackground);
ui.innerLayout->addWidget(widget, 1, 1);
// We need a camera and Viewport in order to display anything
Ogre::Camera* camera = Ogre::Root::getSingletonPtr()->getSceneManager("root")->createCamera("PlayerCam");
Ogre::Viewport* viewport = static_cast<OgreWidget*>(widget)->getRenderWindow()->addViewport(camera);
camera->setAspectRatio(
Ogre::Real(viewport->getActualWidth()) / Ogre::Real(viewport->getActualHeight()));
// Initialize UI & associated Managers
Arcomage::UI::UIManager::getInstance().bootstrap();
// Preload required Editor Fonts
Arcomage::ResourceManager::getInstance().preloadResources(
Arcomage::ConfigurationManager::getInstance().getPath("Fonts")+"/fonts.xml",
/* unused, Music */ "",
/* unused, Sound effects */ "");
} catch (Ogre::Exception& e) {
rsError = true;
widget = new OgreWidget("errorwidget", ui.ogreWidget, true);
ToolkitUtil::getInstance().notifyError(e.what());
}
populateTree();
this->connectUI();
}
示例14: mouseMoved
bool mouseMoved(const OIS::MouseEvent &arg)
{
mCameraAngleH -= Ogre::Degree((Ogre::Real)arg.state.X.rel);
mCameraAngleV -= Ogre::Degree((Ogre::Real)arg.state.Y.rel);
mCamera->setOrientation(Ogre::Quaternion::IDENTITY);
mCamera->yaw(mCameraAngleH*0.1);
mCamera->pitch(mCameraAngleV*0.1);
mGUI->injectMouseMove(arg);
return true;
}
示例15:
// 设置眼睛的位置, ogre 坐标
VOID CRenderSystem::Camera_SetEyePos(const fVector3& fvPos)
{
if(m_pRenderSystem)
{
Ogre::Camera* pOgreCamera = m_pRenderSystem->getCamera();
pOgreCamera->setPosition(Ogre::Vector3(fvPos.x, fvPos.y, fvPos.z));
}
}