Exemplo n.º 1
0
App::App()
{
	std::cout << "Creating Ogre application:" << std::endl;

	mRoot = NULL;
	mKeyboard = NULL;
	mMouse = NULL;	
	mScene = NULL;
	mShutdown = false;
	mWindow = NULL;
	mSmallWindow = NULL;
	mRift = NULL;

	//Ogre engine setup (creates Ogre main rendering window)
	initOgre();

	//Rift Setup (creates Oculus rendering window and Oculus inner scene - user shouldn't care about it)
	initRift();

	//Input/Output setup (associate I/O to Oculus window)
	initOIS();

	// Create Ogre main scene (setup and populate main scene)
	// This class implements App logic!!
	mScene = new Scene(mRoot, mMouse, mKeyboard);
	mScene->setIPD(mRift->getIPD());

	//Viewport setup (link scene cameras to Ogre/Oculus windows)
	createViewports();

	//Ogre::WindowEventUtilities::messagePump();

	// START RENDERING!
	mRoot->startRendering();
}
Exemplo n.º 2
0
App::App(bool showDebugWindow)
	: mKeyboard(nullptr)
	, mRoot(nullptr)
	, mSceneMgr(nullptr)
	, mWindow(nullptr)
	, mSmallWindow(nullptr)
	, mShutdown(false)
	, mScene(nullptr)
	, mRift(nullptr)
	, mTracker(nullptr)
	, mVideoPlayerLeft(nullptr), mVideoPlayerRight(nullptr)
    , mDebugDrawer(nullptr)
    , mDynamicsWorld(nullptr)
{
	std::cout << "Creating Ogre application:" << std::endl;

	showDebugWindow = false; // overrides the command line option

	initARLib(showDebugWindow);
	initOgre(showDebugWindow);
    initBullet(showDebugWindow); // enable debug drawer if we also have a debug window
	initOIS();

    mScene = new Scene(mRift, mTracker, mRoot,
		mWindow, mSmallWindow, mSceneMgr, 
		mDynamicsWorld, mKeyboard,
		mVideoPlayerLeft, mVideoPlayerRight);
	mRoot->startRendering();
}
Exemplo n.º 3
0
/*************************************************************************
 * Application::go()
 *************************************************************************
 * This function starts the program doing it's thing.
 * 
 * Returns: EXIT_SUCCESS if the program finished successfully, or some
 *          error code if it didn't.
 *************************************************************************/
int Application::go()
{
	// Set working directory to executable's directory
	setCurrentWorkingDirectory();

	// Load config.ini.
	loadConfigIni();

	// Initialise Ogre.
	if (!initOgre())
		return EXIT_FAILURE;

	createScene();

	// Create the Input Manager
	InputManager *inputManager = InputManager::getSingletonPtr();
	inputManager->initialise(ogrePtrs.window);

	// Create the Main Menu game state
	states.push_back(new MainMenuState(ogrePtrs, inputManager));

	// Set it as the active state
	activeState = states.back();
	activeState->enter();

	// Start main program loop.
	mainLoop();

	// Program finished successfully.
	return EXIT_SUCCESS;
}
Exemplo n.º 4
0
App::App()
{
    std::cout << "Creating Ogre application:" << std::endl;

    mRoot = NULL;
    mKeyboard = NULL;
    mMouse = NULL;
    mScene = NULL;
    mShutdown = false;
    mWindow = NULL;
    mSmallWindow = NULL;
    mRift = NULL;

    initOgre();
    initOIS();

    mScene = new Scene( mRoot, mMouse, mKeyboard, mRift);

    createViewports();

    initRift();

    Ogre::WindowEventUtilities::messagePump();

    mRoot->startRendering();
}
Exemplo n.º 5
0
	bool CServer::open()
	{
		if( !initOgre() ||
			!initOIS() ||
			!initCEGUI() )
		{
			close();
			return false;
		}
		return true;	

	} // open
NativeEnginePrivate::NativeEnginePrivate(const NativeEngineSettings *settings)
      : glWidget(0), uiView(0), ogreRoot(0), ogreWindow(0), camera(0), viewport(0),
        keyPressCallback(0),keyReleaseCallback(0), mouseDoubleClickCallback(0),
        mousePressCallback(0), mouseReleaseCallback(0), mouseMoveCallback(0), sceneManager(0),
        wheelCallback(0), logCallback(0)
{
    initQApplication(settings);

    logCallback = settings->logCallback;

    /* Initialize OpenGL context format */
    QGLFormat format = QGLFormat::defaultFormat();
    format.setSwapInterval(0);

    /* Initialize OpenGL Widget */
    glWidget = new NativeEngineGLWidget(this, format);
    glWidget->setUpdatesEnabled(false);
    glWidget->installEventFilter(this);
    glWidget->setMouseTracking(true);
    glWidget->show();

    glWidgetPrivate = static_cast<QGLWidgetPrivate*>(QGLWidgetPrivate::get(glWidget));

    /* We will attempt to never change this GL context */
    glWidget->makeCurrent();

    // Paint once to init the OGL extension functions
    QPainter p(glWidget);
    p.end();

    /* Initialize UI View */
    uiView = new QDeclarativeView;
    connect(uiView, SIGNAL(statusChanged(QDeclarativeView::Status)), SLOT(viewStatusChanged()));

    uiView->scene()->setBackgroundBrush(Qt::NoBrush);
    uiView->setMouseTracking(true); // It would otherwise ignore mouse events we forward
    uiView->setViewportUpdateMode(QDeclarativeView::FullViewportUpdate);
    uiView->setOptimizationFlag(QDeclarativeView::DontAdjustForAntialiasing);
    uiView->setResizeMode(QDeclarativeView::SizeRootObjectToView);

    //saveGlState();
    initOgre();
    //restoreGlState();


    /* Set the Ogre Network manager on the view */
    uiView->engine()->setNetworkAccessManagerFactory(new OgreNetworkAccessManagerFactory);

    uiView->setSource(QUrl("qrc:/ui/InterfaceRoot.qml"));
}
Exemplo n.º 7
0
JNIEXPORT void JNICALL Java_com_arvos_arviewer_GL2JNILib_nativeSetSurface(JNIEnv* jenv, jobject obj, jobject surface)
{
	LOGI("------->nativeSetSurface");
	if (surface != 0)
	{
		mRendereWindow = ANativeWindow_fromSurface(jenv, surface);
		LOGI("Got mRendereWindow %p", mRendereWindow);

		initOgre();
		initWindow();
	}
	else
	{
		LOGI("Releasing mRendereWindow");
		ANativeWindow_release(mRendereWindow);
	}
	LOGI("<-------nativeSetSurface");
	return;
}