本文整理汇总了C++中ogre::SceneManager::createCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneManager::createCamera方法的具体用法?C++ SceneManager::createCamera怎么用?C++ SceneManager::createCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneManager
的用法示例。
在下文中一共展示了SceneManager::createCamera方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: createDummyScene
void AbstractGameCore::createDummyScene()
{
m_pRenderWindow->removeAllViewports();
Ogre::SceneManager* sm = m_pOgreRoot->createSceneManager(Ogre::ST_GENERIC, "DummyScene");
Ogre::Camera* cam = sm->createCamera("DummyCamera");
m_pRenderWindow->addViewport(cam);
}
示例3: 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()));
}
示例4: 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;
}
示例5: 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);
}
示例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: 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()));
}
示例8: setupContent
// Just override the mandatory create scene method
void OgreSample::setupContent(void)
{
mTrayMgr->hideLogo();
//m_pSim = new VTFWSimulation(mSceneMgr, mCamera, mWindow, mViewport);
Ogre::SceneManager *mgr = mRoot->createSceneManager(Ogre::ST_GENERIC, mInfo["Title"]);
Ogre::Camera* cam = mgr->createCamera(mInfo["Title"] + "Camera");
mWindow->removeAllViewports();
mWindow->addViewport(cam);
m_pSim = new StableFluids(mgr, cam);
//m_pSim = new WaterSimulation(mSceneMgr, mCamera);
m_pSim->init();
setupControls();
setDragLook(true);
}
示例9: mMap
MapCamera::MapCamera(Map& map, Ogre::SceneManager& manager)
: mMap(map), mViewport(0), mDistance(400), mLightning(manager)
{
mCamera = manager.createCamera("TerrainMapCamera");
mCamera->setPosition(Ogre::Vector3(0, 0, 0));
//look down
mCamera->pitch(Ogre::Degree(-90));
//we want really low LOD on this camera
mCamera->setLodBias(0.0001f);
setDistance(mDistance);
// mCamera->setFOVy(Ogre::Degree(30));
// mCamera->setProjectionType(Ogre::PT_ORTHOGRAPHIC);
mCamera->addQueryFlags(Ogre::SceneManager::WORLD_GEOMETRY_TYPE_MASK);
}
示例10: create
void Camera::create (int iWindow, Movable *parent)
{
RadXML *ogrGame = RadXML::getSingletonPtr ();
Ogre::SceneManager *mSceneMgr = ogrGame->getSceneManager ();
camCamera = mSceneMgr->createCamera ("cam" + name);
camCamera->setFocalLength (focalLength);
camCamera->setNearClipDistance (nearClipDistance);
camCamera->setFarClipDistance (farClipDistance);
Ogre::TextureManager::getSingleton().setDefaultNumMipmaps (numMipMaps);
if (enabled == true)
{
ogrGame->setupCamera (camCamera, bgColor);
ogrGame->setCurrentCamera (camCamera);
}
setParent (parent);
createSceneNode (camCamera, parent);
}
示例11: createDummyScene
void ApplicationContext::createDummyScene()
{
mWindow->removeAllViewports();
Ogre::SceneManager* sm = mRoot->createSceneManager(Ogre::ST_GENERIC, "DummyScene");
sm->addRenderQueueListener(mOverlaySystem);
Ogre::Camera* cam = sm->createCamera("DummyCamera");
mWindow->addViewport(cam);
#ifdef OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
// Initialize shader generator.
// Must be before resource loading in order to allow parsing extended material attributes.
if (!initialiseRTShaderSystem())
{
OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND,
"Shader Generator Initialization failed - Core shader libs path not found",
"ApplicationContext::createDummyScene");
}
mShaderGenerator->addSceneManager(sm);
#endif // OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
}
示例12: startup
int startup(){
_root = new Ogre::Root("plugins_d.cfg");
/*
if(!_root->showConfigDialog()){
return -1;
}
*/
Ogre::RenderSystem* _rs = _root->getRenderSystemByName("Direct3D9 Rendering Subsystem");
// or use "OpenGL Rendering Subsystem"
_root->setRenderSystem(_rs);
_rs->setConfigOption("Full Screen", "No");
_rs->setConfigOption("Video Mode", "800 x 600 @ 32-bit colour");
_rs->setConfigOption("FSAA", "0");
_rs->setConfigOption("Floating-point mode", "Fastest");
_rs->setConfigOption("Use Multihead", "Auto");
_rs->setConfigOption("VSync", "No");
_rs->setConfigOption("VSync Interval", "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(0.0f,300.0f,-1000.0f));
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;
}
示例13: addFrameGraph
void McsHudGui::addFrameGraph(CEGUI::Window* sheet)
{
Ogre::TexturePtr tex = mOgreRoot->getTextureManager()->createManual(
"FrameGraph", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
TimeGraphMaxFrames, TimeGraphMaxResolution, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);
Ogre::SceneManager* debugSceneMgr = mOgreRoot->createSceneManager(Ogre::ST_GENERIC);
debugSceneMgr->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f));
Ogre::MaterialPtr frameLinesMaterial = Ogre::MaterialManager::getSingleton().create("frameLinesMaterial","Game");
frameLinesMaterial->setReceiveShadows(false);
frameLinesMaterial->getTechnique(0)->setLightingEnabled(false);
frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
mFrameLines = new FrameGraphRenderable(TimeGraphMaxFrames, TimeGraphMaxResolution);
mFrameLines->setMaterial("frameLinesMaterial");
Ogre::SceneNode* frameLinesNode = debugSceneMgr->getRootSceneNode()->createChildSceneNode("frameGraph_node");
frameLinesNode->attachObject(mFrameLines);
Ogre::Camera* dbg_camera = debugSceneMgr->createCamera("item_camera");
dbg_camera->setAspectRatio(static_cast<Ogre::Real>(TimeGraphMaxFrames) / static_cast<Ogre::Real>(TimeGraphMaxResolution));
Ogre::Viewport *v = tex->getBuffer()->getRenderTarget()->addViewport(dbg_camera);
v->setClearEveryFrame( true );
v->setBackgroundColour( Ogre::ColourValue::Black );
CEGUI::Texture& guiTex = mCeRenderer->createTexture(tex);
CEGUI::Imageset& imageSet = CEGUI::ImagesetManager::getSingleton().create("FrameGraphImageset", guiTex);
imageSet.defineImage("FrameGraphImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(guiTex.getSize()), CEGUI::Point(0.0f, 0.0f));
CEGUI::Window* si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "FrameGraphWindow");
si->setSize(CEGUI::UVector2(CEGUI::UDim(0.0f, TimeGraphMaxFrames), CEGUI::UDim(0.0f, TimeGraphMaxResolution)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(1.0f, -TimeGraphMaxResolution)));
si->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet.getImage("FrameGraphImage")));
si->setAlpha(0.6f);
si->setProperty("BackgroundEnabled", "False");
si->setProperty("FrameEnabled", "False");
sheet->addChildWindow(si);
}
示例14: Load
void CameraSceneNode::Load(SceneNodePtr& parent)
{
Ogre::NameValuePairList params;
params["externalWindowHandle"] = "0";//mHWND;
mRenderWindow = Ogre::Root::getSingleton().
createRenderWindow(GetName() , mViewportSize.x, mViewportSize.y, false);
Ogre::SceneManager* mOgreSceneMgr = RenderEngine::GetSingleton()->GetOgreSceneManager();
mCamera = mOgreSceneMgr->createCamera(GetName());
mOgreSceneNode = mOgreSceneMgr->getRootSceneNode()->createChildSceneNode(GetName());
mOgreSceneNode->attachObject(mCamera);
mCamera->setNearClipDistance(0.001);
mCamera->setCullingFrustum(new NoCullFrustum());
// Create one viewport, entire window
mViewport = mRenderWindow->addViewport(mCamera, 1);
mViewport->setBackgroundColour(Ogre::ColourValue(0.2,0.2,0.2));
mViewport->setAutoUpdated( true );
mViewport->setClearEveryFrame( true );
// Alter the camera aspect ratio to match the viewport
mCamera->setAspectRatio(Real(mViewport->getActualWidth())/Real(mViewport->getActualHeight()));
SetLookAtPoint(mLapPoint);
this->SetLoaded(true);
this->SetInitialized(true);
/*Robotarium::graphic::RenderEngine::GetSingleton()->GetOgreRoot()->getRenderSystem()->_initRenderTargets();*/
}
示例15: configureGame
bool GameManager::configureGame() {
// Load config settings from ogre.cfg
if( !mRoot->restoreConfig() ) {
// If there is no config file, show the configuration dialog
if( !mRoot->showConfigDialog() ) {
return false;
}
}
// Initialise and create a default rendering window
mRenderWindow = mRoot->initialise( true, HAX_APP_NAME_STR + " Version " + HAX_APP_VERSION );
// Initialise resources
//ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
// Create needed scenemanagers
Ogre::SceneManager *mSceneMgr = mRoot->createSceneManager( "DefaultSceneManager", "LoadingScene" );
Ogre::Camera *mCamera = mSceneMgr->createCamera("LoadingCamera");
mRenderWindow->addViewport(mCamera, -1);
return true;
}