From d02cad1e6526e66eca74cbc150edbc67d53f3612 Mon Sep 17 00:00:00 2001 From: George ElKoura Date: Tue, 9 Apr 2019 21:06:06 -0700 Subject: [PATCH] Use the new common ArgOptions in dxViewer --- examples/dxViewer/dxviewer.cpp | 58 ++++++++------------------------- examples/dxViewer/init_shapes.h | 12 +------ 2 files changed, 14 insertions(+), 56 deletions(-) diff --git a/examples/dxViewer/dxviewer.cpp b/examples/dxViewer/dxviewer.cpp index bd50055d..8d771a58 100644 --- a/examples/dxViewer/dxviewer.cpp +++ b/examples/dxViewer/dxviewer.cpp @@ -61,12 +61,14 @@ OpenSubdiv::Osd::D3D11MeshInterface *g_mesh = NULL; OpenSubdiv::Osd::D3D11LegacyGregoryPatchTable *g_legacyGregoryPatchTable = NULL; #include "../../regression/common/far_utils.h" +#include "../common/argOptions.h" #include "../common/stopwatch.h" #include "../common/simple_math.h" #include "../common/d3d11ControlMeshDisplay.h" #include "../common/d3d11Hud.h" #include "../common/d3d11Utils.h" #include "../common/d3d11ShaderCache.h" +#include "../common/viewerArgsUtils.h" #include static const char *shaderSource = @@ -1513,22 +1515,10 @@ msgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { return DefWindowProc(hWnd, msg, wParam, lParam); } -static std::vector -tokenize(std::string const & src) { - - std::vector result; - - std::stringstream input(src); - std::copy(std::istream_iterator(input), - std::istream_iterator(), - std::back_inserter< std::vector >(result)); - - return result; -} - int WINAPI -WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { - +WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, + int nCmdShow) +{ // register window class TCHAR szWindowClass[] = "OPENSUBDIV_EXAMPLE"; WNDCLASS wcex; @@ -1548,7 +1538,8 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd RECT rect = { 0, 0, g_width, g_height }; AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE); - static const char windowTitle[] = "OpenSubdiv dxViewer " OPENSUBDIV_VERSION_STRING; + static const char windowTitle[] = + "OpenSubdiv dxViewer " OPENSUBDIV_VERSION_STRING; HWND hWnd = CreateWindow(szWindowClass, windowTitle, @@ -1562,35 +1553,12 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd hInstance, NULL); - std::vector args = tokenize(lpCmdLine); - for (size_t i=0; i g_defaultShapes;