| 76 | using namespace physx; |
| 77 | |
| 78 | int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) |
| 79 | { |
| 80 | PX_UNUSED(hInstance); |
| 81 | PX_UNUSED(hPrevInstance); |
| 82 | PX_UNUSED(lpCmdLine); |
| 83 | PX_UNUSED(nCmdShow); |
| 84 | |
| 85 | // Enable run-time memory check for debug builds. |
| 86 | #if defined(DEBUG) | defined(_DEBUG) |
| 87 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); |
| 88 | AllocConsole(); |
| 89 | #endif |
| 90 | |
| 91 | |
| 92 | LPWSTR* argv; |
| 93 | int argc; |
| 94 | argv = CommandLineToArgvW(GetCommandLineW(), &argc); |
| 95 | TCLAP::CmdLine cmd("Blast Sample: Asset Viewer", ' ', "0.1"); |
| 96 | TCLAP::ValueArg<std::string> inpXmlArg("x", "xml", "Asset list to load", false, DEFAULT_ASSET_LIST, "inassetlist"); |
| 97 | cmd.add(inpXmlArg); |
| 98 | TCLAP::ValueArg<std::string> alternatePathArg("t", "path", "Alternate path", false, "", "altPath"); |
| 99 | cmd.add(alternatePathArg); |
| 100 | |
| 101 | TCLAP::ValueArg<std::string> addAssetArg("n", "nAsset", "Additional asset to load", false, "", "additionalAsset"); |
| 102 | cmd.add(addAssetArg); |
| 103 | |
| 104 | TCLAP::ValueArg<TCLAPvec4> rotationArg("r", "rot", "Additional asset rotation", false, TCLAPvec4(), "rotation"); |
| 105 | cmd.add(rotationArg); |
| 106 | TCLAP::ValueArg<TCLAPvec3> positionArg("p", "pos", "Additional asset position", false, TCLAPvec3(), "position"); |
| 107 | cmd.add(positionArg); |
| 108 | |
| 109 | |
| 110 | PxVec3 transform; |
| 111 | bool addedExternalAsset = false; |
| 112 | |
| 113 | std::vector<string> argsVect; |
| 114 | if (argc > 1) |
| 115 | { |
| 116 | for (size_t i = 0; i < (size_t)argc; ++i) |
| 117 | { |
| 118 | argsVect.push_back(string()); |
| 119 | argsVect.back().resize(wcslen(argv[i]), 0); |
| 120 | wcstombs(&argsVect.back()[0], argv[i], 255); |
| 121 | } |
| 122 | cmd.parse(argsVect); |
| 123 | } |
| 124 | LocalFree(argv); |
| 125 | |
| 126 | SampleConfig config; |
| 127 | config.assetsFile = inpXmlArg.getValue(); |
| 128 | config.sampleName = L"Blast Sample: Asset Viewer"; |
| 129 | |
| 130 | config.assetsFile = inpXmlArg.getValue(); |
| 131 | if (alternatePathArg.isSet()) |
| 132 | { |
| 133 | config.additionalResourcesDir.push_back(alternatePathArg.getValue().c_str()); |
| 134 | } |
| 135 | if (addAssetArg.isSet()) |