Beispiel #1
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();
}
	void CSapphireDeviceStub::createGUIAndScene()
	{
#ifdef _SAPPHIRE_COMPILE_WITH_GUI_
		// create gui environment
		GUIEnvironment = createGUIEnvironment(FileSystem, VideoDriver, Operator);
#endif

		// create Scene manager
		SceneManager = createSceneManager(VideoDriver, FileSystem, CursorControl, GUIEnvironment);

		setEventReceiver(UserReceiver);
	}
Beispiel #3
0
bool Global::create()
{
    createStateManager();
    createFxManager();
    createTextureManager();
    createSceneManager();
    if (!createBrushDecal())
    {
        return false;
    }
    return true;
}
bool OgreApplication::initFinish(std::list<std::shared_ptr<OgreActor>> actors)
{

    // Set default mipmap level (note: some APIs ignore this)
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    // initialise all resource groups
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    createSceneManager();
    createCamera();
    createScene(actors);
//    createViewport();
}
KDvoid SdkSample::_setup ( RenderWindow* pWindow )
{
    // assign mRoot here in case Root was initialised after the Sample's constructor ran.
    m_pRoot = Root::getSingletonPtr ( );
    m_pWindow = pWindow;
    
    locateResources ( );
    createSceneManager ( );
    setupView ( );
    
    m_pTrayMgr = new SdkTrayManager ( "SampleControls", pWindow, this );  // create a tray interface
    
    loadResources ( );
    m_bResourcesLoaded = true;
    
    // show stats and logo and hide the cursor
    m_pTrayMgr->showFrameStats ( TL_BOTTOMLEFT );
    m_pTrayMgr->showLogo ( TL_BOTTOMRIGHT );
    m_pTrayMgr->hideCursor ( );
    
    // create a params panel for displaying sample details
    StringVector  aItems;
    aItems.push_back ( "cam.pX" );
    aItems.push_back ( "cam.pY" );
    aItems.push_back ( "cam.pZ" );
    aItems.push_back ( ""       );
    aItems.push_back ( "cam.oW" );
    aItems.push_back ( "cam.oX" );
    aItems.push_back ( "cam.oY" );
    aItems.push_back ( "cam.oZ" );
    aItems.push_back ( ""       );
    aItems.push_back ( "Filtering" );
    aItems.push_back ( "Poly Mode" );
    
    m_pDetailsPanel = m_pTrayMgr->createParamsPanel ( TL_NONE, "DetailsPanel", 200, aItems );
    m_pDetailsPanel->hide ( );
    
    m_pDetailsPanel->setParamValue (  9, "Bilinear" );
    m_pDetailsPanel->setParamValue ( 10, "Solid" );
    
    setupContent ( );
    m_bContentSetup = true;
    
    m_bDone = false;
}
Beispiel #6
0
	/*-----------------------------------------------------------------------------
	| Extended to setup a default tray interface and camera controller.
	-----------------------------------------------------------------------------*/
	void Framework::_setup(Ogre::RenderWindow* window, OIS::Keyboard* keyboard, OIS::Mouse* mouse, XRENREN::FileSystemLayer* fsLayer)
	{
		// assign mRoot here in case Root was initialised after the Sample's constructor ran.
		mRoot = Ogre::Root::getSingletonPtr();
		mWindow = window;
		mMouse = mouse;
		mFSLayer = fsLayer;

		locateResources();
		createSceneManager();
		setupView();

		mTrayMgr = new SdkTrayManager("SampleControls", window, mouse, this);  // create a tray interface

#ifdef USE_RTSHADER_SYSTEM
		// Initialize shader generator.
		// Must be before resource loading in order to allow parsing extended material attributes.
		bool success = initializeRTShaderSystem(mSceneMgr);
		if (!success) 
		{
			OGRE_EXCEPT(Ogre::Exception::ERR_FILE_NOT_FOUND, 
				"Shader Generator Initialization failed - Core shader libs path not found", 
				"SdkSample::_setup");
		}														
#endif

		loadResources();
		mResourcesLoaded = true;

		// show stats and logo and hide the cursor
		mTrayMgr->showFrameStats(TL_BOTTOMLEFT);
		mTrayMgr->hideLogo();
		mTrayMgr->showCursor();

		setupDetailsPanel();


		setupContent();
		mContentSetup = true;

		mDone = false;
	}
void OgreApp::constructObject()
{
    if(! initializeRoot())
    {
        // user cancelled config, so leave
        return;
    }
    Ogre::LogManager::getSingletonPtr()->logMessage("+++ root configured");

    // initialize Root -- have it create a render window for us
    root->initialise(true);
    Ogre::LogManager::getSingletonPtr()->logMessage("+++ root initialized");
    // get a pointer to the auto-created window
    window = root->getAutoCreatedWindow();
    Ogre::LogManager::getSingletonPtr()->logMessage("+++ render window created");

    if(oisEnabled)
    {
        initializeOIS(window);
        Ogre::LogManager::getSingletonPtr()->logMessage("+++ OIS initialized");
        mouse->setEventCallback(this);
        keyboard->setEventCallback(this);
        mouse->setBuffered(true);
        keyboard->setBuffered(true);
    }


    createSceneManager();
    //Ogre::LogManager::getSingletonPtr()->logMessage("+++ scene manager created");
    setupResources();
    //Ogre::LogManager::getSingletonPtr()->logMessage("+++ resources setup");
    createScene();
    //Ogre::LogManager::getSingletonPtr()->logMessage("+++ scene created");
    createFrameListener();
    //Ogre::LogManager::getSingletonPtr()->logMessage("+++ frameListener created");
    // register our frame listener
    if(frameListener) root->addFrameListener(frameListener);
    //Ogre::LogManager::getSingletonPtr()->logMessage("+++ frameListener registered");

}
Beispiel #8
0
	bool BaseManager::init()
	{
		Ogre::String pluginsPath;

		mFrameCount = 0;
		mPickFrameCount = 0;
		mPickX = 0;
		mPickY = 0;

		#ifndef OGRE_STATIC_LIB
			pluginsPath = mResourcePath + mPluginCfgName;
		#endif

		mFastReset = false;
		mReset = false;
		mExit = false;
		
		mInputFilter = new InputFilter();

		mRoot = new Ogre::Root(pluginsPath, mResourcePath + "ogre.cfg", mResourcePath + "Ogre.log");

		Ogre::Log* plog = Ogre::LogManager::getSingleton().getDefaultLog();
		if( plog ){
			mCoutSource = new CoutSource();
			plog->addListener( mCoutSource );
		}
        
		//恢复Ogre配置,如果第一次配置启动一个Ogre配置对话框
		if (!mRoot->restoreConfig())
		{
			if (!mRoot->showConfigDialog()) return false;
		}

		mWindow = mRoot->initialise(true);

		createSceneManager();

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

		mRoot->addFrameListener(this);
		Ogre::WindowEventUtilities::addWindowEventListener(mWindow, this);

		size_t handle = 0;
		mWindow->getCustomAttribute("WINDOW", &handle);

		mSceneQuery = mSceneManager->createRayQuery( Ogre::Ray() );

		createGui();
        
		createInput(handle);

		createPointerManager(handle);
        
		createScene();

		windowResized(mWindow);

		mRoot->getRenderSystem()->_initRenderTargets();

		setPointerVisible(false);

		return true;
	}
Beispiel #9
0
void createAfterD3DDevice()
{
	createFxManager();
	createSceneManager();
}