diff options
author | Brad Davis <[email protected]> | 2013-10-10 23:31:48 -0700 |
---|---|---|
committer | Brad Davis <[email protected]> | 2013-10-10 23:31:48 -0700 |
commit | cf0441a1dc790d6fdca7400a7db7a939c2fa6000 (patch) | |
tree | edaf4e78195d789b1e3b724328951324db085324 /Samples/CommonSrc | |
parent | abfcde20cd83aa36e83186a0745425bcdead6144 (diff) |
Adding Linux 0.2.5 changes
Diffstat (limited to 'Samples/CommonSrc')
-rw-r--r-- | Samples/CommonSrc/Platform/Win32_Platform.cpp | 13 | ||||
-rw-r--r-- | Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp | 22 |
2 files changed, 23 insertions, 12 deletions
diff --git a/Samples/CommonSrc/Platform/Win32_Platform.cpp b/Samples/CommonSrc/Platform/Win32_Platform.cpp index 9be7196..eeab429 100644 --- a/Samples/CommonSrc/Platform/Win32_Platform.cpp +++ b/Samples/CommonSrc/Platform/Win32_Platform.cpp @@ -543,6 +543,7 @@ Render::DisplayId PlatformCore::GetDisplay(int screen) }}} +OVR::Platform::Application* g_app; int WINAPI WinMain(HINSTANCE hinst, HINSTANCE prevInst, LPSTR inArgs, int show) { @@ -552,10 +553,10 @@ int WINAPI WinMain(HINSTANCE hinst, HINSTANCE prevInst, LPSTR inArgs, int show) OVR_UNUSED2(prevInst, show); // CreateApplication must be the first call since it does OVR::System::Initialize. - Application* app = Application::CreateApplication(); - Win32::PlatformCore* platform = new Win32::PlatformCore(app, hinst); + g_app = Application::CreateApplication(); + Win32::PlatformCore* platform = new Win32::PlatformCore(g_app, hinst); // The platform attached to an app will be deleted by DestroyApplication. - app->SetPlatformCore(platform); + g_app->SetPlatformCore(platform); int exitCode = 0; @@ -586,14 +587,14 @@ int WINAPI WinMain(HINSTANCE hinst, HINSTANCE prevInst, LPSTR inArgs, int show) for (UPInt i = 0; i < args.GetSize(); i++) argv.PushBack(args[i].ToCStr()); - exitCode = app->OnStartup((int)argv.GetSize(), &argv[0]); + exitCode = g_app->OnStartup((int)argv.GetSize(), &argv[0]); if (!exitCode) exitCode = platform->Run(); } // No OVR functions involving memory are allowed after this. - Application::DestroyApplication(app); - app = 0; + Application::DestroyApplication(g_app); + g_app = 0; OVR_DEBUG_STATEMENT(_CrtDumpMemoryLeaks()); return exitCode; diff --git a/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp b/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp index a871f35..b2b1ac1 100644 --- a/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp +++ b/Samples/CommonSrc/Render/Render_XmlSceneLoader.cpp @@ -239,15 +239,13 @@ bool XmlHandler::ReadFile(const char* fileName, OVR::Render::RenderDevice* pRend FirstChild()->ToText()->Value(); UPInt stringLength = strlen(indexStr); - for(UPInt j = 0; j < stringLength;) + for(UPInt j = 0; j < stringLength; ) { UPInt k = j + 1; for(; k < stringLength; ++k) { - if(indexStr[k] == ' ') - { - break; - } + if (indexStr[k] == ' ') + break; } char text[20]; for(UPInt l = 0; l < k - j; ++l) @@ -255,10 +253,22 @@ bool XmlHandler::ReadFile(const char* fileName, OVR::Render::RenderDevice* pRend text[l] = indexStr[j + l]; } text[k - j] = '\0'; - Models[i]->Indices.InsertAt(0, (unsigned short)atoi(text)); + + Models[i]->Indices.PushBack((unsigned short)atoi(text)); j = k + 1; } + // Reverse index order to match original expected orientation + Array<UInt16>& indices = Models[i]->Indices; + UPInt indexCount = indices.GetSize(); + + for (UPInt revIndex = 0; revIndex < indexCount/2; revIndex++) + { + unsigned short itemp = indices[revIndex]; + indices[revIndex] = indices[indexCount - revIndex - 1]; + indices[indexCount - revIndex - 1] = itemp; + } + delete vertices; delete normals; delete diffuseUVs; |