Пример #1
0
ViewerWidget::ViewerWidget(osgViewer::ViewerBase::ThreadingModel threadingModel) :
    QWidget() {

    // Create main layout
    //_mainLayout = new QVBoxLayout;
    // No space between window's element and the border
    //_mainLayout->setMargin(0);
    // No space between window's element


    // Create window title bar
    //_windowTitleBar = new WindowTitleBar;
    // Add window title bar to main layout
    //_mainLayout->addWidget(_windowTitleBar);
    // Put the title bar at the top of the window


    _scene = new osg::Group;
    _viewTopLookDir = osg::Y_AXIS;
    _viewTopUp = osg::Z_AXIS;

    _viewLeftLookDir = osg::Z_AXIS;
    _viewLeftUp = -osg::Y_AXIS;

    _viewFrontLookDir = osg::X_AXIS;
    _viewFrontUp = -osg::Y_AXIS;

    _viewMainLookDir = osg::Y_AXIS;
    _viewMainUp = osg::X_AXIS;

    setThreadingModel(threadingModel);

    _widgetTop   = addViewWidget(createCamera(0,0,10,10), Top  );
    _widgetLeft  = addViewWidget(createCamera(0,0,10,10), Left );
    _widgetFront = addViewWidget(createCamera(0,0,10,10), Front);
    _widgetMain  = addViewWidget(createCamera(0,0,10,10), Main );

    _leftVBoxLayout = new QVBoxLayout;
    _rightVBoxLayout = new QVBoxLayout;

    _mainHBoxLayout = new QHBoxLayout;
    _mainHBoxLayout->addLayout(_leftVBoxLayout);
    _mainHBoxLayout->addLayout(_rightVBoxLayout);

    //_mainLayout->addLayout(_mainHBoxLayout);

    changeViews();

    //setLayout(_mainLayout);
    setLayout(_mainHBoxLayout);

    connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
    _timer.start(10);
}
Пример #2
0
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
	char dir[MAX_STRING_NUM];
	GetCurrentDirectory(MAX_STRING_NUM, dir);
	std::string inipath = std::string(dir) + "/SIGVerse.ini";
	TCHAR SettingPath[256];
	sprintf_s(SettingPath, 128, inipath.c_str());
	TCHAR pathText[256];
	GetPrivateProfileString("MODE","OCULUS_MODE",'\0', pathText, 1024, SettingPath);
	if(strcmp(pathText,"true") == 0)  OculusMode = true;
	GetPrivateProfileString("MODE","FULLSCREEN_MODE",'\0', pathText, 1024, SettingPath);
	if(strcmp(pathText,"true") == 0)  FullscreenMode = true;


	mRoot = new Ogre::Root(mPluginsCfg);
	setupResources();
	bool carryOn = configure();
	if (!carryOn) return false;
	chooseSceneManager();

	if(OculusMode){
		Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media","FileSystem");
		// Load resources
		loadResources();
		oculus.setupOculus();
		oculus.setupOgre(mSceneMgr, mWindow);

		createCamera();
	}
	else{
		createCamera();
		createViewports();

		// Load resources
		loadResources();
	}
	// Set default mipmap level (NB some APIs ignore this)
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	// Create any resource listeners (for loading screens)
	createResourceListener();

	// Create the scene
	createScene();

	createFrameListener();

    return true;
};
Пример #3
0
//==============================================================================
//
//------------------------------------------------------------------------------
Camera::Camera()
  :_currentCam(nullptr)
  ,_moveToCamera(nullptr)
  ,_nowFrame(0)
  ,_maxFrame(0)
{
  // デフォルトカメラ
  _defaultCam = createCamera();
  _defaultCam->setPosP(Vec3(0,50,-200));
  _defaultCam->setPosR(Vec3(0,0,0));
  _defaultCam->setVecU(Vec3(0,1,0));

  _destCamera = createCamera();
  setCamera(_defaultCam);
}
void VirtualCamera::init(osg::Group *uwsim_root, std::string name, osg::Node *trackNode, int width, int height, double baseline, std::string frameId, Parameters *params,int range,double fov) {
	this->uwsim_root=uwsim_root;
	this->name=name;

	this->trackNode=trackNode;
	//Add a switchable frame geometry on the camera frame
        osg::ref_ptr<osg::Node> axis=UWSimGeometry::createSwitchableFrame();
	this->trackNode->asGroup()->addChild(axis);	

	this->width=width;
	this->height=height;
	this->baseline = baseline;
	this->frameId = frameId;
	this->fov=fov;
	if(params!=NULL){
	  this->fx=params->fx;
	  this->fy=params->fy;
	  this->far=params->f;
	  this->near=params->n;
	  this->cx=params->x0;
	  this->cy=params->y0;
	  this->k=params->k;
	  this->paramsOn=1;
        }
	else
	  this->paramsOn=0;
	this->range=range;
        
	renderTexture=new osg::Image();
	renderTexture->allocateImage(width, height, 1, GL_RGB, GL_UNSIGNED_BYTE);
	depthTexture=new osg::Image();
	depthTexture->allocateImage(width, height, 1, GL_DEPTH_COMPONENT, GL_FLOAT);

	createCamera();
}
Пример #5
0
//------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
    root = new Ogre::Root(plugins_cfg);

    setupResources();

    bool carryOn = configure();
    if (!carryOn)
        return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens) and load everything
    createResourceListener();
    loadResources();

    // Create the scene
    createScene();

    createFrameListener();

    return true;
};
Пример #6
0
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
    mRoot = new Ogre::Root(Ogre::macBundlePath() + "/Contents/Resources/" + mPluginsCfg);
	
    setupResources();

    bool carryOn = configure();
    if (!carryOn) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens)
    createResourceListener();
    // Load resources
    loadResources();

    // Create the scene
    createScene();

    createFrameListener();

    return true;
};
Пример #7
0
//-------------------------------------------------------------------------------------
bool SystemOgre::ControllerAbstract::setup(void)
{
    mRoot = new Ogre::Root(mPluginsCfg);

    setupResources();

    bool carryOn = configure();
    if (!carryOn) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens)
    createResourceListener();
    // Load resources
    loadResources();

    // Create the scene
    createScene();

    createFrameListener();

    return true;
};
Пример #8
0
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
    mRoot = new Ogre::Root(mPluginsCfg);

    setupResources();

    bool carryOn = configure();
    if (!carryOn) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);


    
    // Create background material
    Ogre::MaterialPtr material = Ogre::MaterialManager::getSingleton().create("Background", "General");
    material->getTechnique(0)->getPass(0)->createTextureUnitState("space.jpg");
    material->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
    material->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);
    material->getTechnique(0)->getPass(0)->setLightingEnabled(false);

    // Create background rectangle covering the whole screen
    rect = new Ogre::Rectangle2D(true);
    rect->setCorners(-1.0, 1.0, 1.0, -1.0);
    rect->setMaterial("Background");
     
    // Render the background before everything else
    rect->setRenderQueueGroup(Ogre::RENDER_QUEUE_BACKGROUND);
     
    // Use infinite AAB to always stay visible
    Ogre::AxisAlignedBox aabInf;
    aabInf.setInfinite();
    rect->setBoundingBox(aabInf);
     
    // Attach background to the scene
    Ogre::SceneNode* node = mSceneMgr->getRootSceneNode()->createChildSceneNode("Background");
    node->attachObject(rect);
     
    // Example of background scrolling
    material->getTechnique(0)->getPass(0)->getTextureUnitState(0)->setScrollAnimation(-0.10, 0.0);
     
    // Don't forget to delete the Rectangle2D in the destructor of your application:

    // Create any resource listeners (for loading screens)
    createResourceListener();
    // Load resources
    loadResources();

    // Create the scene
    createScene();
    

    createFrameListener();

    return true;
};
Пример #9
0
void render()
{
    if (NULL != pd3dDevice)
    {
        pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
                          D3DCOLOR_XRGB(0, 0, 0),
                          1.0f, 0);
		pd3dDevice->BeginScene();

		// create the camera
		createCamera(0.1f, 10.0f);		// near clip plane, far clip plane

        // Position camera so cube is same projected size as in OpenGL version
		moveCamera(D3DXVECTOR3(0.0f, 0.0f, -1.6f));
		pointCamera(D3DXVECTOR3(0.0f, 0.0f, 0.0f));

		// draw the objects
		drawCube();
        drawCursor();
		
		pd3dDevice->EndScene();
        pd3dDevice->Present(NULL, NULL, NULL, NULL);

    }
}
Пример #10
0
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
    Ogre::LogManager * lm = new Ogre::LogManager();
    lm->createLog("Ogre.log", true, false, false);
    mRoot = new Ogre::Root(mPluginsCfg);

    setupResources();

    bool carryOn = configure();
    if (!carryOn) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens)
    createResourceListener();
    // Load resources
    loadResources();

    // Create the scene
    createScene();

    createFrameListener();

    return true;
};
Пример #11
0
void SimpleRenderContext::setupScene(const std::string& prefix)
{
    S_LOG_VERBOSE("Creating new SimpleRenderContext for prefix " << prefix << " with w:" << mWidth << " h:" << mHeight);
    mSceneManager = Ogre::Root::getSingleton().createSceneManager(Ogre::ST_GENERIC, prefix + "_sceneManager");
    //One might wonder why we're not setting the fog to FOG_NONE. The reason is that it seems that due to a bug in either Ogre or OpenGL when doing that, none of the other fog values would be set. Since we use shaders and in the shaders look for the alpha value of the fog colour to determine whether fog is enabled or not, we need to make sure that the fog colour indeed is set.
    mSceneManager->setFog(Ogre::FOG_EXP2, Ogre::ColourValue(0, 0, 0, 0), 0.0f, 0.0f, 0.0f);
// 	mSceneManager->setFog(Ogre::FOG_NONE, Ogre::ColourValue(1,1,1,1), 0.0f, 10000000.0f, 100000001.0f);

    mRootNode = mSceneManager->getRootSceneNode();

    mEntityNode = mRootNode->createChildSceneNode();

    //make the cameranode a child of the main entity node
    mCameraNode = mRootNode->createChildSceneNode();

    mCameraPitchNode = mCameraNode->createChildSceneNode();

    createCamera(prefix);
    //setVisible(false);
    Ogre::ColourValue colour(0.5, 0.5, 0.5);
    mMainLight = mSceneManager->createLight("MainLight");
    mMainLight->setType(Ogre::Light::LT_DIRECTIONAL);
    mMainLight->setDirection(Ogre::Vector3(-1, 0, 0));
    mMainLight->setPowerScale(10); // REALLY bright.
    mMainLight->setDiffuseColour(colour);
    mMainLight->setSpecularColour(colour);
    mMainLight->setVisible(true);

    mSceneManager->setAmbientLight(colour);
    mCameraPitchNode->attachObject(mMainLight);

    resetCameraOrientation();
}
Пример #12
0
bool EUClient::setup(void)
{
	mRoot = new Root();
	setupResources();

	bool carryOn = configure();
	if (!carryOn) return false;

	chooseSceneManager();
	createCamera();
	createViewports();

	// Set default mipmap level (NB some APIs ignore this)
	TextureManager::getSingleton().setDefaultNumMipmaps(5);

	// Create any resource listeners (for loading screens)
	createResourceListener();
	// Load resources
	loadResources();

	// Create the scene
	createGUI();
	createScene();

	createFrameListener();

	return true;
}
Пример #13
0
bool ApplicationBase::setup()
{
	m_Root = OGRE_NEW Ogre::Root(m_PluginsCfg);

	setupResources();

	// RenderSystem setup
	if (!(/*m_Root->restoreConfig() || */m_Root->showConfigDialog()))
	{
		return false;
	}

	// Create a RenderWindow
	m_Window = m_Root->initialise(true, "PhysicsSimulation_Server");

	chooseSceneManager();
	createCamera();
	createViewports();

	// Set default mipmap level, which is related to LOD
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	loadResources();

	createFrameListener();

	return true;
}
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
#ifdef _DEBUG
    mRoot = new Ogre::Root("plugins_debug.cfg");
#else
    mRoot = new Ogre::Root();
#endif
    setupResources();

    if (!configure()) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens)
    createResourceListener();
    // Load resources
    loadResources();

    // Create the scene
    createScene();

    createFrameListener();

    return true;
};
Пример #15
0
void ClientApplication::startGame()
{
	std::cout << "GAME STARTING\n";
	_gameWorld.reset(new World(*_worldMap));
	_vs.reset();
	_vs.reset(new ViewSystem(_device->getSceneManager(), *_gameWorld));
	_physics.reset(new Physics(*_gameWorld, _device->getSceneManager()));
	_animator.setEntityResolver(bind(&World::getEntity, ref(*_gameWorld), placeholders::_1));
	_animator.setSceneManager(_device->getSceneManager());
	_animator.setEntityVelocityGetter([this](ID id)->vec3f {	return _physics->getObjVelocity(id); });
	_gameWorld->addObserver(_animator);
	_gameWorld->addObserver(*_physics);
	_gameWorld->addObserver(*_vs);
	_gui.reset();
	_gui.reset(new GUI(_device.get(), *_gameWorld.get(), _sharedRegistry, _gameRegistry));
	_gameWorld->addObserver(*_gui);
	createCamera();

	if(_controller.getSettings().hasKey("NAME")) {
		Command c;
		c._type = Command::Type::STR;
		c._str = "NAME "+_controller.getSettings().getValue<std::string>("NAME");
		sendCommand(c);
	}
}
Пример #16
0
bool Application::setup(void)
{
    Ogre::String pluginsPath = mResourcePath + "plugins.cfg";
    mRoot = new Ogre::Root(pluginsPath, mConfigPath + "ogre.cfg", mResourcePath + "Ogre.log");
    setupResources();
    if (!configure())
        return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    mPlatform = new MyGUI::OgrePlatform();
    mPlatform->initialise(mWindow, mSceneMgr);
    mGUI = new MyGUI::Gui();
    mGUI->initialise("");
    MyGUI::FactoryManager::getInstance().registerFactory<MyGUI::RTTLayer>("Layer");
    MyGUI::ResourceManager::getInstance().load("core.xml");
    
    GuiListener* guiL = new GuiListener(mGUI);
    mInputManager->regKeyboardListener(guiL);
    mInputManager->regMouseListener(guiL);

    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    createResourceListener();
    loadResources();
    return true;
}
Пример #17
0
//-------------------------------------------------------------------------------------
bool BaseApplication::setup(void)
{
    std::cerr << "mPluginsCfg: " << mPluginsCfg << std::endl;
    mRoot = new Ogre::Root(mPluginsCfg);
    if(mRoot == 0) {
        std::cerr << "Couldn't create root!" << std::endl;
    }

    bool carryOn = configure();
    if (!carryOn) return false;

    chooseSceneManager();
    createCamera();
    createViewports();

    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

    // Create any resource listeners (for loading screens)
    createResourceListener();
    
    // Load resources
    setupResources();
    loadResources();

    // Create the scene
    createScene();

//    createFrameListener();

    return true;
};
Пример #18
0
void Game::run()
{
	if (!ogreRoot)
		return;

	if (!ogreRoot->showConfigDialog())
		return;

	ogreRoot->initialise(true, "OgreWindow");

	createWindow();
	createSceneManager();
	createCamera();
	createViewport();
	createInput();
	setupResourceManager();

	Ogre::Entity *ogreHead = sceneManager->createEntity("OgreHead", "T80_obj.mesh");
	Ogre::SceneNode *ogreHeadNode = sceneManager->getRootSceneNode()
									->createChildSceneNode("Head Node", Ogre::Vector3(-50.0f, 30.0f, 0.0f));
	ogreHeadNode->attachObject(ogreHead);

	Ogre::Light *directionalLight = sceneManager->createLight("DirectionalLight");
	directionalLight->setType(Ogre::Light::LT_DIRECTIONAL);
	directionalLight->setDiffuseColour(Ogre::ColourValue(.4, 0, 0));
	directionalLight->setSpecularColour(Ogre::ColourValue(.4, 0, 0));
	directionalLight->setDirection(Ogre::Vector3(0, -1, 1));

	ogreRoot->addFrameListener(this);
	ogreRoot->startRendering();
}
Пример #19
0
void
TestScene5::runOgre()
{
	// initialize framework & open window
	Ogre::Root* root = new Ogre::Root();
	root->restoreConfig();
	root->initialise(false);
	auto window = root->createRenderWindow("Ogre RenderWindow", 800, 600, false);
	auto sceneMgr = root->createSceneManager(Ogre::ST_GENERIC);
	// adjust camera
	auto cam1 = sceneMgr->createCamera("cam1");
	auto camNode1 = sceneMgr->getRootSceneNode()->createChildSceneNode("camnode1");
	cam1->setNearClipDistance(5);
	camNode1->attachObject(cam1);
	camNode1->setPosition(100, 100, 100);
	camNode1->lookAt(Ogre::Vector3(-1, -1, -1), Ogre::Node::TS_LOCAL);
	window->addViewport(cam1);
	// load & integrate model
	root->addResourceLocation("./resources/Ogre", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	auto model = sceneMgr->createEntity("model", "alexandria.mesh");
	auto modelNode = sceneMgr->getRootSceneNode()->createChildSceneNode();
	modelNode->attachObject(model);
	// position model
	modelNode->setPosition(-100, -100, -100);
	// loop
	runOgreLoop(root);
}
Пример #20
0
 void CameraNode::getRenderingData(SLR::ArenaAllocator &mem, const SLR::Transform* subTF, RenderingData *data) {
     if (!m_ready) {
         createCamera();
         m_ready = true;
     }
     data->camera = m_camera;
     data->camTransform = subTF;
 }
	//------------------------------
	bool CameraImporter::import()
	{
		GenCamera* maxCamera = createCamera(mCamera);

		handleObjectReferences(mCamera, maxCamera);

		return true;
	}
Пример #22
0
bool OgreBaseApp::go(void)
{
#ifdef _DEBUG
	mPluginsCfg = "plugins_d.cfg";
	mResourcesCfg = "resources_d.cfg";
#else
	mPluginsCfg = "plugins.cfg";
	mResourcesCfg = "resources.cfg";
#endif

	if (!setup()) return false;
	
	mRoot->initialise(false); //do NOT create a window
	
	//connect SDL and Ogre here
	Ogre::NameValuePairList misc;
#ifdef WIN32
	SDL_SysWMinfo wmInfo;
	SDL_VERSION(&wmInfo.version);
	SDL_GetWMInfo(&wmInfo);
	
	size_t winHandle = reinterpret_cast<size_t>(wmInfo.window);
	size_t winGlContext = reinterpret_cast<size_t>(wmInfo.hglrc);
	
	misc["externalWindowHandle"] = StringConverter::toString(winHandle);
	misc["externalGLContext"] = StringConverter::toString(winGlContext);
#else
	misc["currentGLContext"] = Ogre::String("True");
#endif
	
	//NOW we make a RenderWindow!
	mWindow = mRoot->createRenderWindow("MainRenderWindow", mWindowWidth, mWindowHeight, false, &misc);
	mWindow->setVisible(true);
	
	//just have Ogre create our window for us
	//mWindow = mRoot->initialise(true, "OgreBaseApp Render Window");
	

	//set the default mipmap level
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
	//initialize the resource groups
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	mSceneMgr = mRoot->createSceneManager("DefaultSceneManager");
	
	createCamera();
	createViewport();
	
	createScene();
	
	setupInput();

	mRoot->addFrameListener(this);

	mRoot->startRendering();

	return true;
}
Пример #23
0
void CameraComponent::init()
{
	mSceneMgr = StateManager::getCurrentState()->getSceneMgr();
    
    currentPos = Ogre::Vector3(0, 10, -20);
    
	createCamera();
	createViewports();
}
Пример #24
0
void GraphicsImpl::threadWillStart()
{
	subscribeToFeed("input_keyboard", boost::bind(&GraphicsImpl::handleKeyEvents, this, _1));
	subscribeToFeed("input_mouse", boost::bind(&GraphicsImpl::handleMouseEvents, this, _1));
	subscribeToFeed("world_dynamic", boost::bind(&GraphicsImpl::handleWorldEvents, this, _1));
	subscribeToFeed("create_object", boost::bind(&GraphicsImpl::handleObjectEvents, this, _1));
	subscribeToFeed("create_terrain", boost::bind(&GraphicsImpl::handleTerrainEvents, this, _1));
	subscribeToFeed("world_removed", boost::bind(&GraphicsImpl::handleRemovedObjects, this, _1));

	Dout <<  "Creating root";
	root = new Ogre::Root("", "", resourcePath + "ogre.log");

	Dout << "Loading plugins" ;
	loadPlugins();

	Dout << "Setting Ressources" ;
	setupResources();

	Dout << "Configuring root" ;

	if (!configure()) {
		Derr << "Failed to configure root";
	}


	Dout << "Create Scenemanager" ;

	chooseSceneManager();

	Dout << "Create Camera" ;
	createCamera();

	Dout << "Create Viewport" ;
	createViewports();

	Dout << "Set default MipMap lvl" ;
	Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);

	Dout << "Create resource listeners" ;
	createResourceListener();

	Dout << "Load resources" ;
	loadResources();

	Dout << "Setup GUI";
	setupGUI();

	Dout << "Create Framelistener" ;
	createFrameListener();

	Dout << "Create Basic Scene" ;
	createScene();

	root->clearEventTimes();

	InformationManager::Instance()->offerData("window", this);
}
Пример #25
0
void Application::initialise()
{
	//m_root = new Ogre::Root( "ogre_plugins.txt", "ogre_configuration.txt", "ogre_log.txt" );
	m_root = new Ogre::Root();

	Ogre::ConfigFile cf;
    cf.load("resources.cfg");

	Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();

	std::string secName, typeName, archName;
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
		Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
		Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
			Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
                archName, typeName, secName);
        }
    }

	// Initialise display options.
	// It shows the ugly dialog at start-up, so if you don't want to see it, it's up to you 
	// to remove this line and initialise display options manually ( e.g. reading them from 
	// a text file ).
	bool configDialogUserContinue = m_root->showConfigDialog();
	if ( ! configDialogUserContinue )
	{
		throw std::exception( "User closed/canceled config dialog" );
	}

	// Create window with chosen display options.
	m_window = m_root->initialise( true, "Ogre Window" );

	m_sceneManager = m_root->createSceneManager( Ogre::ST_GENERIC );

	m_camera = m_sceneManager->createCamera( "DefaultCamera" );

	m_viewport = m_window->addViewport( m_camera );

	m_viewport->setBackgroundColour( Ogre::ColourValue( 0, 0, 0 ) );

	SimpleInputManager::initialise( m_window );

	loadResources();

	createSceneSet1();
	//createSceneSet2();
	//createSceneSet3();

	createCamera();
}
Пример #26
0
bool 
OgreCarRacing::setup(void)
{

    Ogre::String pluginsPath;
	Ogre::String configPath;
    // only use plugins.cfg if not static
#ifndef OGRE_STATIC_LIB

#if OGRE_DEBUG_MODE == 1 && (OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS)
	// add _d suffix to config files
	pluginsPath = mResourcePath + "plugins_d.cfg";
	configPath = mResourcePath + "ogre_d.cfg";
#else
	pluginsPath = mResourcePath + "plugins.cfg";
	configPath = mResourcePath + "ogre.cfg";

#endif


#endif
	
    mRoot = new Ogre::Root(pluginsPath, 
        configPath, mResourcePath + "Ogre.log");

    setupResources();

    bool carryOn = configure();
    if (!carryOn) return false;

    // Create the SceneManager, in this case a generic one
    mSceneMgr = mRoot->createSceneManager(Ogre::ST_GENERIC, "PongSMInstance");
    createCamera();
    createViewports();
	createMiniMapCamera();
	createMiniMapViewports();
    // Set default mipmap level (NB some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);


	mOverlaySystem = new Ogre::OverlaySystem();
	mSceneMgr->addRenderQueueListener(mOverlaySystem);


    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    createScene();


    // When we start the renderer, it will run forever, making callbacks every
    // frame to the frame listeners.  These listeners are where all of the non-
    // rendering work is done.  
    createFrameListener();

    return true;

}
Пример #27
0
void Camera::positionCamera(const Vector3& eye, const Vector3& lookat, const Vector3& up)
{
    m_eye = eye;
    m_cameraForward = lookat - eye;
    cross(m_cameraRight, up, m_cameraForward);
    m_cameraForward.normalize();
    m_cameraRight.normalize();
    cross(m_cameraUp, m_cameraForward, m_cameraRight);
    createCamera();
}
Пример #28
0
void CMenuState::enter(void)
{
	FightClubApp::getSingletonPtr()->mLog->logMessage("正在进入菜单......");
	mRoot=FightClubApp::getSingletonPtr()->mRoot;
	createLight();
	FightClubApp::getSingletonPtr()->mLog->logMessage("创建灯光完毕......");
	createCamera();
	FightClubApp::getSingletonPtr()->mLog->logMessage("创建相机完毕......");
	createScene();
}
Пример #29
0
AaSceneManager::AaSceneManager(AaRenderSystem* rs, AaGuiSystem* guiMgr)
{
	mRenderSystem=rs;
	mGuiMgr=guiMgr;

	mMaterialLoader= new AaMaterialLoader(rs);
	mModelLoader= new AaModelLoader(rs);
	currentCamera= createCamera("main");
	defaultMaterial= new AaMaterial("Default",rs);
	mShadingMgr = new AaShadingManager(mRenderSystem);
}
Пример #30
0
int HOO::Application::startup(){
#ifdef _DEBUG
    mResourcesCfg = "resources_d.cfg";
    mPluginsCfg = "plugins_d.cfg";
#else
    mResourcesCfg = "resources.cfg";
    mPluginsCfg = "plugins.cfg";
#endif

	_root = new Ogre::Root(mPluginsCfg);

// in debug mode, we do not want to click on ogre config dialog every time... ;)
#ifdef _DEBUG
	if(!_root->restoreConfig()){
#endif

	if(!_root->showConfigDialog())
	{
		return -1;
	}
#ifdef _DEBUG
	}
#endif

	// init application window and root object
	 _window = _root->initialise(true,"PiratesAhoy! Hearts Of Oak, Conquest of the Seas");
    // create scenemanager
	_sceneManager = _root->createSceneManager(Ogre::ST_GENERIC);

	// debug drawing facilites
	new DebugDrawer(_sceneManager, 0.5f);
    _debugDrawEntitiesVector=new entityVector;

    // init player camera
    createCamera();

    // load resources
	loadResources();

	// create scene
	createScene();

	// create frame listener
	_listener = new HOO::FrameListener();
	_listener->StartFrameListener(_window,_camera,_viewport,_PlayerNode,_PlayerEnt, _debugDrawEntitiesVector);
    _root->addFrameListener(_listener);

    // add some compositors
	Ogre::CompositorManager::getSingleton().addCompositor(_viewport, "Compositor2");
	Ogre::CompositorManager::getSingleton().addCompositor(_viewport, "Compositor3");
	Ogre::CompositorManager::getSingleton().addCompositor(_viewport, "Compositor7");

	return 0;
}