Ejemplo n.º 1
0
void cOSG::InitOSG(std::string modelname)
{
    // Store the name of the model to load
    m_ModelName = modelname;

    // Init different parts of OSG
    InitManipulators();
    InitSceneGraph();
    InitCameraConfig();
}
Ejemplo n.º 2
0
bool cOSG::InitOSG(std::string modelname)
{
	bErrModel = false;
    // Store the name of the model to load
    m_ModelName = modelname;

    // Init different parts of OSG
    InitManipulators();
   if(!InitSceneGraph()) 
	   return false;
    InitCameraConfig();

	return true;
}
Ejemplo n.º 3
0
void GuardianSystemDemo::Start(HINSTANCE hinst)
{
    ovrResult result;
    result = ovr_Initialize(nullptr);
    if (!OVR_SUCCESS(result)) {
        printf("ovr_Initialize failed"); exit(-1);
    }

    ovrGraphicsLuid luid;
    result = ovr_Create(&mSession, &luid);
    if (!OVR_SUCCESS(result)) {
        printf("ovr_Create failed"); exit(-1);
    }

    if (!DIRECTX.InitWindow(hinst, L"GuardianSystemDemo")) {
        printf("DIRECTX.InitWindow failed"); exit(-1);
    }

    // Use HMD desc to initialize device
    ovrHmdDesc hmdDesc = ovr_GetHmdDesc(mSession);
    if (!DIRECTX.InitDevice(hmdDesc.Resolution.w / 2, hmdDesc.Resolution.h / 2, reinterpret_cast<LUID*>(&luid))) {
        printf("DIRECTX.InitDevice failed"); exit(-1);
    }

    // Use FloorLevel tracking origin
    ovr_SetTrackingOriginType(mSession, ovrTrackingOrigin_FloorLevel);
    
    InitRenderTargets(hmdDesc);
    InitSceneGraph();
    mLastUpdateClock = std::chrono::high_resolution_clock::now();

    // Main Loop
    while (DIRECTX.HandleMessages() && !mShouldQuit)
    {
        ovrSessionStatus sessionStatus;
        ovr_GetSessionStatus(mSession, &sessionStatus);
        if (sessionStatus.ShouldQuit)
            break;

        float elapsedTimeSec = UpdateTimeWithBoundaryTest();
        UpdateBoundaryLookAndFeel();
        UpdateObjectsCollisionWithBoundary(elapsedTimeSec);
        Render();
    }

    ovr_Shutdown();
}