本文整理汇总了C++中ogre::Camera::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Camera::setPosition方法的具体用法?C++ Camera::setPosition怎么用?C++ Camera::setPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::Camera
的用法示例。
在下文中一共展示了Camera::setPosition方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMesh
//-------------------------------------------------------------------------------------------
void MagickWidget::loadMesh(Ogre::MeshPtr pMesh)
{
QString directory(OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir.c_str());
if(directory.isEmpty())
directory = "./";
QDir(directory).mkpath("entitycache");
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual( "MeshMagickTex",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
512, 512, 0, Ogre::PF_R8G8B8A8 , Ogre::TU_RENDERTARGET );
Ogre::RenderTexture *rttTex = texture->getBuffer()->getRenderTarget();
Ogre::SceneManager *mSceneMgr = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "MeshMagickTexMgr");
Ogre::Light *dirl = mSceneMgr->createLight("DisplayLight");
dirl->setDirection(-1,-1,-1);
dirl->setDiffuseColour(1,1,1);
dirl->setType(Ogre::Light::LT_DIRECTIONAL);
Ogre::Camera* RTTCam = mSceneMgr->createCamera("MeshMagickCam");
RTTCam->setNearClipDistance(0.01F);
RTTCam->setFarClipDistance(0);
RTTCam->setAspectRatio(1);
RTTCam->setFOVy(Ogre::Degree(90));
RTTCam->setPosition(0,0,1);
RTTCam->lookAt(0,0,0);
Ogre::Viewport *v = rttTex->addViewport( RTTCam );
v->setClearEveryFrame( true );
v->setBackgroundColour(Ogre::ColourValue(0,0,0));
Ogre::Entity *mEntity;
mEntity = mSceneMgr->createEntity("scbDisplay", pMesh->getName());
mSceneMgr->getRootSceneNode()->attachObject(mEntity);
Ogre::Vector3 vSize = mEntity->getBoundingBox().getHalfSize();
Ogre::Vector3 vCenter = mEntity->getBoundingBox().getCenter();
vSize += Ogre::Vector3(vSize.z, vSize.z, vSize.z);
float maxsize = std::max(std::max(vSize.x,vSize.y),vSize.z);
vSize = Ogre::Vector3(0, 0, maxsize * 1.15f) + vCenter;
RTTCam->setPosition(vSize.x,vSize.y,vSize.z);
RTTCam->lookAt(vCenter.x,vCenter.y,vCenter.z);
rttTex->update();
Ogre::String imagefile = OgitorsUtils::QualifyPath(directory.toStdString() + "/entitycache/meshmagick.png");
rttTex->writeContentsToFile(imagefile);
mEntity->detachFromParent();
mSceneMgr->destroyEntity(mEntity);
rttTex->removeAllViewports();
Ogre::Root::getSingletonPtr()->destroySceneManager(mSceneMgr);
mDisplayWidget->setImage(QString(imagefile.c_str()));
}
示例2: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
if(!_root->showConfigDialog()){
return -1;
}
Ogre::RenderWindow* window = _root->initialise(true, "Ventana Ogre");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(500,100,500));
camera->lookAt(Ogre::Vector3(0,0,0));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth()/viewport->getActualHeight()));
_listener = new FrameListenerProyectos(window,camera);
_root->addFrameListener(_listener);
loadResources();
createScene();
_root->startRendering();
return 0;
}
示例3: start
int Hundir::start() {
_root = new Ogre::Root();
if(!_root->restoreConfig()) {
_root->showConfigDialog();
_root->saveConfig();
}
Ogre::RenderWindow* window = _root->initialise(true,"Hundir Example");
_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);
Ogre::Camera* cam = _sceneManager->createCamera("MainCamera");
cam->setPosition(Ogre::Vector3(-10,30,35));
cam->lookAt(Ogre::Vector3(0,0,0));
cam->setNearClipDistance(5);
cam->setFarClipDistance(10000);
Ogre::Viewport* viewport = window->addViewport(cam);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
double width = viewport->getActualWidth();
double height = viewport->getActualHeight();
cam->setAspectRatio(width / height);
loadResources();
createScene();
_framelistener = new MyFrameListener(window, cam, _sceneManager);
_root->addFrameListener(_framelistener);
_root->startRendering();
return 0;
}
示例4: createScene
void SingleplayerGame::createScene(std::vector<std::string> partyNames){
auto scnMgr = mRenderer->mSceneManager;
auto root = scnMgr->getRootSceneNode();
Ogre::Camera* camera = mRenderer->mCamera;
mRoomRoot = root->createChildSceneNode();
scnMgr->setSkyBox(true, "Examples/MorningSkyBox", 5000, true);
// Set ambient light
scnMgr->setAmbientLight(Ogre::ColourValue(0.3, 0.3, 0.3));
scnMgr->setShadowTechnique(Ogre::SHADOWTYPE_STENCIL_ADDITIVE);
// Create a light
mMainLight = scnMgr->createLight(BaseGame::mainLightName);
mMainLight->setPosition(0, 500, 0);
mMainLight->setType(Ogre::Light::LT_POINT);
mMainLight->setDiffuseColour(.5, .5, .5);
// Create ground plane
ground = new Plane(scnMgr, mRoomRoot);
// Add test objects
Player* p = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo(partyNames[0]),
Ogre::Vector3(500, 0, 200), mSoundBank);
myParty.push_back(p);
Player* p2 = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo(partyNames[1]),
Ogre::Vector3(500, 0, 0), mSoundBank);
myParty.push_back(p2);
Player* p3 = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo(partyNames[2]),
Ogre::Vector3(500, 0, -200), mSoundBank);
myParty.push_back(p3);
Player* p4 = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo("Mecha-Scoot"),
Ogre::Vector3(-500, 0, 200), mSoundBank);
enemyParty.push_back(p4);
Player* p5 = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo("SSJVirginia"),
Ogre::Vector3(-500, 0, 0), mSoundBank);
enemyParty.push_back(p5);
Player* p6 = new Player(scnMgr, mRoomRoot,
mPlayerBank->getPlayerInfo("Metal Scoot"),
Ogre::Vector3(-500, 0, -200), mSoundBank);
enemyParty.push_back(p6);
// Set Camera Position
cameraInitialPosition = Ogre::Vector3(1100, 250, 700);
cameraInitialLookAt = Ogre::Vector3(0, 0, 0);
camera->setPosition(cameraInitialPosition);
camera->lookAt(cameraInitialLookAt);
}
示例5:
void Player::_handleCamera()
{
Ogre::Camera *cam = indie::GameManager::getCamera();
cam->setPosition(gameObject->getPosition().x,
cam->getPosition().y,
gameObject->getPosition().z + 300);
}
示例6: main
int main(int argc, char* argv[]){
cout << "Test Ogre Program blaha" << 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");
//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::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;
}
示例7: 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);
}
示例8: 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);
}
示例9: 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));
}
}
示例10: createCamera
// funcion que configura la camara
void createCamera(Ogre::RenderWindow* window){
camera = _sceneManager->createCamera("Camera");
camera->setPosition(Ogre::Vector3(0,60,-100));
camera->lookAt(Ogre::Vector3(0,0,50));
camera->setNearClipDistance(5);
Ogre::Viewport* viewport = window->addViewport(camera);
viewport->setBackgroundColour(Ogre::ColourValue(0.0,0.0,0.0));
camera->setAspectRatio(Ogre::Real(viewport->getActualWidth())/Ogre::Real(viewport->getActualHeight()));
}
示例11: createCamera
void BaseApp::createCamera()
{
Ogre::Camera* cam = mSceneMgr->createCamera("PlayerCam");
cam->setPosition(0,0,0);
cam->lookAt(0,0,0);
//cam->setAutoAspectRatio(true);
cam->setNearClipDistance(1);
cam->setFarClipDistance(10000);
mCameraMan = new OgreBites::SdkCameraMan(cam);
mCameraMan->setTopSpeed(1000);
}
示例12:
// 设置眼睛的位置, 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));
}
}
示例13: WorkFromThread_Ogre
//------------------------------------------------------------------------
void TApplySetup_CameraUp::WorkFromThread_Ogre()
{
Ogre::Camera* pCamera = TModuleLogic::Get()->GetC()->pGraphicEngine->GetGE()->GetCamera();
nsMathTools::TVector3 point(0,0,0);
pCamera->setPosition(point.x, point.y, point.z);
pCamera->lookAt(mVCameraUp.x, mVCameraUp.y, mVCameraUp.z);
Ogre::Degree degree;
degree = 90;
Ogre::Radian rad;
rad = degree.valueRadians();
pCamera->pitch(rad);
}
示例14: GenerateRelief
void ReliefApp::GenerateRelief()
{
//Get depth data
Ogre::TexturePtr depthTex = Ogre::TextureManager::getSingleton().createManual(
"DepthTexture", // name
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D, // type
512, // width
512, // height
0, // number of mipmaps
//Ogre::PF_B8G8R8A8, // pixel format
Ogre::PF_FLOAT32_R,
Ogre::TU_RENDERTARGET
);
Ogre::RenderTarget* pTarget = depthTex->getBuffer()->getRenderTarget();
Ogre::Camera* pOrthCam = MagicCore::RenderSystem::GetSingleton()->GetMainCamera();
pOrthCam->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
pOrthCam->setOrthoWindow(3, 3);
pOrthCam->setPosition(0, 0, 3);
pOrthCam->lookAt(0, 0, 0);
pOrthCam->setAspectRatio(1.0);
pOrthCam->setNearClipDistance(0.5);
pOrthCam->setFarClipDistance(5);
Ogre::Viewport* pViewport = pTarget->addViewport(pOrthCam);
pViewport->setDimensions(0, 0, 1, 1);
MagicCore::RenderSystem::GetSingleton()->RenderLightMesh3D("RenderMesh", "Depth", mpLightMesh);
MagicCore::RenderSystem::GetSingleton()->Update();
Ogre::Image img;
depthTex->convertToImage(img);
std::vector<double> heightField(512 * 512);
for(int x = 0; x < 512; x++)
{
for(int y = 0; y < 512; y++)
{
heightField.at(x * 512 + y) = (img.getColourAt(x, 511 - y, 0))[1];
}
}
Ogre::TextureManager::getSingleton().remove("DepthTexture");
//
MagicDGP::LightMesh3D* pReliefMesh = MagicDGP::ReliefGeneration::PlaneReliefFromHeightField(heightField, 511, 511);
//MagicDGP::LightMesh3D* pReliefMesh = MagicDGP::ReliefGeneration::CylinderReliefFromHeightField(heightField, 511, 511);
if (pReliefMesh != NULL)
{
delete mpLightMesh;
mpLightMesh = pReliefMesh;
mpLightMesh->UnifyPosition(2);
mpLightMesh->UpdateNormal();
}
MagicCore::RenderSystem::GetSingleton()->SetupCameraDefaultParameter();
MagicCore::RenderSystem::GetSingleton()->RenderLightMesh3D("RenderMesh", "MyCookTorrance", mpLightMesh);
}
示例15: EnableFreeCamera
void World::EnableFreeCamera( bool bEnable )
{
assert(m_pRenderSystem->m_pMainCamera && m_cameraMan);
if(!bEnable)
{
Ogre::Camera* cam = m_pRenderSystem->m_pMainCamera;
const Ogre::Vector3 pos = cam->getPosition();
cam->setPosition(0, 24, 0);
cam->lookAt(0, 0, 8);
}
m_bFreeCamMode = bEnable;
}