| 92 | } |
| 93 | |
| 94 | void Initialize(HWND hWnd) |
| 95 | { |
| 96 | runtime = std::make_unique<Babylon::AppRuntime>(); |
| 97 | // Initialize console plugin. |
| 98 | runtime->Dispatch([hWnd](Napi::Env env) |
| 99 | { |
| 100 | const int width = TEST_WIDTH; |
| 101 | const int height = TEST_HEIGHT; |
| 102 | |
| 103 | Babylon::Polyfills::Console::Initialize(env, [](const char* message, auto) { |
| 104 | OutputDebugStringA(message); |
| 105 | printf("%s", message); |
| 106 | }); |
| 107 | |
| 108 | Babylon::Polyfills::Window::Initialize(env); |
| 109 | Babylon::Polyfills::XMLHttpRequest::Initialize(env); |
| 110 | |
| 111 | Babylon::Polyfills::Window::Initialize(env); |
| 112 | // Initialize NativeWindow plugin to the test size. |
| 113 | // TODO: TestUtils::UpdateSize should do it properly but the client size |
| 114 | // is not forwarded correctly to the rendering. Find why. |
| 115 | Babylon::Plugins::NativeWindow::Initialize(env, hWnd, width, height); |
| 116 | |
| 117 | // Initialize NativeEngine plugin. |
| 118 | Babylon::Plugins::NativeEngine::InitializeGraphics(hWnd, width, height); |
| 119 | Babylon::Plugins::NativeEngine::Initialize(env); |
| 120 | |
| 121 | Babylon::TestUtils::CreateInstance(env, hWnd); |
| 122 | Babylon::Plugins::NativeWindow::UpdateSize(env, width, height); |
| 123 | }); |
| 124 | |
| 125 | // Scripts are copied to the parent of the executable due to CMake issues. |
| 126 | // See the CMakeLists.txt comments for more details. |
| 127 | std::string scriptsRootUrl = GetUrlFromPath(GetModulePath().parent_path().parent_path() / "Scripts"); |
| 128 | |
| 129 | Babylon::ScriptLoader loader{ *runtime }; |
| 130 | loader.LoadScript(scriptsRootUrl + "/babylon.max.js"); |
| 131 | loader.LoadScript(scriptsRootUrl + "/babylon.glTF2FileLoader.js"); |
| 132 | loader.LoadScript(scriptsRootUrl + "/babylonjs.materials.js"); |
| 133 | loader.LoadScript(scriptsRootUrl + "/validation_native.js"); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | int APIENTRY wWinMain(_In_ HINSTANCE hInstance, |
no test coverage detected