Main.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include <windows.h>
  4. // Engine includes
  5. #include "BsApplication.h"
  6. #include "BsImporter.h"
  7. #include "BsResources.h"
  8. #include "BsTextureImportOptions.h"
  9. #include "BsMeshImportOptions.h"
  10. #include "BsMaterial.h"
  11. #include "BsShader.h"
  12. #include "BsVirtualInput.h"
  13. #include "BsCCamera.h"
  14. #include "BsCRenderable.h"
  15. #include "BsCGUIWidget.h"
  16. #include "BsGUILayoutX.h"
  17. #include "BsGUILayoutY.h"
  18. #include "BsGUIPanel.h"
  19. #include "BsGUISpace.h"
  20. #include "BsGUILabel.h"
  21. #include "BsGUIButton.h"
  22. #include "BsRenderAPI.h"
  23. #include "BsGUIListBox.h"
  24. #include "BsBuiltinResources.h"
  25. #include "BsRTTIType.h"
  26. #include "BsHString.h"
  27. #include "BsRenderWindow.h"
  28. #include "BsSceneObject.h"
  29. #include "BsCoreThread.h"
  30. #include "BsProfilerOverlay.h"
  31. // Example includes
  32. #include "CameraFlyer.h"
  33. namespace BansheeEngine
  34. {
  35. UINT32 windowResWidth = 1280;
  36. UINT32 windowResHeight = 720;
  37. /** Imports all of our assets and prepares GameObject that handle the example logic. */
  38. void setUpExample();
  39. /** Import mesh/texture/GPU programs used by the example. */
  40. void loadAssets(HMesh& model, HTexture& texture, HShader& shader);
  41. /** Create a material used by our example model. */
  42. HMaterial createMaterial(const HTexture& texture, const HShader& shader);
  43. /** Set up example scene objects. */
  44. void setUp3DScene(const HMesh& mesh, const HMaterial& material);
  45. /** Set up example GUI. */
  46. void setUpGUI();
  47. /** Set up input configuration and callbacks. */
  48. void setUpInput();
  49. /** Toggles the primary window between full-screen and windowed mode. */
  50. void toggleFullscreen();
  51. /** Called whenever the main render window is resized. */
  52. void renderWindowResized();
  53. /** Called when the selected video mode changes in the video mode list box. */
  54. void videoModeChanged(UINT32 idx, bool enabled);
  55. /** Triggered whenever a virtual button is released. */
  56. void buttonUp(const VirtualButton& button, UINT32 deviceIdx);
  57. }
  58. using namespace BansheeEngine;
  59. /** Main entry point into the application. */
  60. int CALLBACK WinMain(
  61. _In_ HINSTANCE hInstance,
  62. _In_ HINSTANCE hPrevInstance,
  63. _In_ LPSTR lpCmdLine,
  64. _In_ int nCmdShow
  65. )
  66. {
  67. // Descriptor used for initializing the engine
  68. START_UP_DESC startUpDesc;
  69. // Use default values as specified by the build system
  70. startUpDesc.renderAPI = BS_RENDER_API_MODULE;
  71. startUpDesc.renderer = BS_RENDERER_MODULE;
  72. startUpDesc.audio = BS_AUDIO_MODULE;
  73. startUpDesc.physics = BS_PHYSICS_MODULE;
  74. startUpDesc.input = BS_INPUT_MODULE;
  75. // Descriptor used for initializing the primary application window.
  76. startUpDesc.primaryWindowDesc.videoMode = VideoMode(windowResWidth, windowResHeight);
  77. startUpDesc.primaryWindowDesc.title = "Banshee Example App";
  78. startUpDesc.primaryWindowDesc.fullscreen = false;
  79. startUpDesc.primaryWindowDesc.depthBuffer = false;
  80. // List of importer plugins we plan on using for importing various resources
  81. startUpDesc.importers.push_back("BansheeFreeImgImporter"); // For importing textures
  82. startUpDesc.importers.push_back("BansheeFBXImporter"); // For importing meshes
  83. startUpDesc.importers.push_back("BansheeFontImporter"); // For importing fonts
  84. startUpDesc.importers.push_back("BansheeSL"); // For importing shaders
  85. // Initializes the application with systems and primary window as defined above
  86. Application::startUp(startUpDesc);
  87. // Imports all of ours assets and prepares GameObjects that handle the example logic.
  88. setUpExample();
  89. // Runs the main loop that does most of the work. This method will exit when user closes the main
  90. // window or exits in some other way.
  91. Application::instance().runMainLoop();
  92. Application::shutDown();
  93. return 0;
  94. }
  95. namespace BansheeEngine
  96. {
  97. Path dataPath = Paths::getRuntimeDataPath();
  98. Path exampleModelPath = dataPath + "Examples\\Dragon.fbx";
  99. Path exampleTexturePath = dataPath + "Examples\\Dragon.tga";
  100. Path exampleShaderPath = dataPath + "Examples\\Example.bsl";
  101. GUIButton* toggleFullscreenButton = nullptr;
  102. bool fullscreen = false;
  103. const VideoMode* selectedVideoMode = nullptr;
  104. Vector<const VideoMode*> videoModes;
  105. HCamera sceneCamera;
  106. HProfilerOverlay profilerOverlay;
  107. VirtualButton toggleCPUProfilerBtn;
  108. VirtualButton toggleGPUProfilerBtn;
  109. bool cpuProfilerActive = false;
  110. bool gpuProfilerActive = false;
  111. void setUpExample()
  112. {
  113. HMesh exampleModel;
  114. HTexture exampleTexture;
  115. HShader exampleShader;
  116. loadAssets(exampleModel, exampleTexture, exampleShader);
  117. HMaterial exampleMaterial = createMaterial(exampleTexture, exampleShader);
  118. setUp3DScene(exampleModel, exampleMaterial);
  119. setUpGUI();
  120. setUpInput();
  121. }
  122. /**
  123. * Load the required resources. First try to load a pre-processed version of the resources. If they don't exist import
  124. * resources from the source formats into engine format, and save them for next time.
  125. */
  126. void loadAssets(HMesh& model, HTexture& texture, HShader& shader)
  127. {
  128. // Set up paths to pre-processed versions of example resources.
  129. Path exampleModelAssetPath = exampleModelPath;
  130. Path exampleTextureAssetPath = exampleTexturePath;
  131. Path exampleShaderAssetPath = exampleShaderPath;
  132. exampleModelAssetPath.setExtension(exampleModelAssetPath.getExtension() + ".asset");
  133. exampleTextureAssetPath.setExtension(exampleTextureAssetPath.getExtension() + ".asset");
  134. exampleShaderAssetPath.setExtension(exampleShaderAssetPath.getExtension() + ".asset");
  135. // Load an FBX mesh.
  136. model = gResources().load<Mesh>(exampleModelAssetPath);
  137. if(model == nullptr) // Mesh file doesn't exist, import from the source file.
  138. {
  139. // When importing you may specify optional import options that control how is the asset imported.
  140. SPtr<ImportOptions> meshImportOptions = Importer::instance().createImportOptions(exampleModelPath);
  141. // rtti_is_of_type checks if the import options are of valid type, in case the provided path is pointing to a
  142. // non-mesh resource. This is similar to dynamic_cast but uses Banshee internal RTTI system for type checking.
  143. if (rtti_is_of_type<MeshImportOptions>(meshImportOptions))
  144. {
  145. MeshImportOptions* importOptions = static_cast<MeshImportOptions*>(meshImportOptions.get());
  146. // Ensures we can save the mesh contents
  147. importOptions->setCPUCached(true);
  148. }
  149. model = gImporter().import<Mesh>(exampleModelPath);
  150. // Save for later use, so we don't have to import on the next run.
  151. gResources().save(model, exampleModelAssetPath, true);
  152. }
  153. // Load an TGA texture.
  154. texture = gResources().load<Texture>(exampleTextureAssetPath);
  155. if (texture == nullptr) // Texture file doesn't exist, import from the source file.
  156. {
  157. // When importing you may specify optional import options that control how is the asset imported.
  158. SPtr<ImportOptions> textureImportOptions = Importer::instance().createImportOptions(exampleTexturePath);
  159. // rtti_is_of_type checks if the import options are of valid type, in case the provided path is pointing to a
  160. // non-texture resource. This is similar to dynamic_cast but uses Banshee internal RTTI system for type checking.
  161. if (rtti_is_of_type<TextureImportOptions>(textureImportOptions))
  162. {
  163. TextureImportOptions* importOptions = static_cast<TextureImportOptions*>(textureImportOptions.get());
  164. // We want maximum number of mipmaps to be generated
  165. importOptions->setGenerateMipmaps(true);
  166. // The texture is in sRGB space
  167. importOptions->setSRGB(true);
  168. // Ensures we can save the texture contents
  169. importOptions->setCPUCached(true);
  170. }
  171. // Import texture with specified import options
  172. texture = gImporter().import<Texture>(exampleTexturePath, textureImportOptions);
  173. // Save for later use, so we don't have to import on the next run.
  174. gResources().save(texture, exampleTextureAssetPath, true);
  175. }
  176. // Load a shader.
  177. shader = gResources().load<Shader>(exampleShaderAssetPath);
  178. if (shader == nullptr) // Mesh file doesn't exist, import from the source file.
  179. {
  180. shader = gImporter().import<Shader>(exampleShaderPath);
  181. // Save for later use, so we don't have to import on the next run.
  182. gResources().save(shader, exampleShaderAssetPath, true);
  183. }
  184. }
  185. /** Create a material using the provided shader, and assign the provided texture to it. */
  186. HMaterial createMaterial(const HTexture& texture, const HShader& shader)
  187. {
  188. // Create a material with the provided shader.
  189. HMaterial exampleMaterial = Material::create(shader);
  190. // And set the texture to be used by the "tex" shader parameter. We leave the "samp"
  191. // parameter at its defaults. These parameters are defined in the shader (.bsl) file.
  192. exampleMaterial->setTexture("tex", texture);
  193. return exampleMaterial;
  194. }
  195. /** Set up the 3D object used by the example, and the camera to view the world through. */
  196. void setUp3DScene(const HMesh& mesh, const HMaterial& material)
  197. {
  198. /************************************************************************/
  199. /* SCENE OBJECT */
  200. /************************************************************************/
  201. // Now we create a scene object that has a position, orientation, scale and optionally
  202. // components to govern its logic. In this particular case we are creating a SceneObject
  203. // with a Renderable component which will render a mesh at the position of the scene object
  204. // with the provided material.
  205. // Create new scene object at (0, 0, 0)
  206. HSceneObject dragonSO = SceneObject::create("Dragon");
  207. // Attach the Renderable component and hook up the mesh we imported earlier,
  208. // and the material we created in the previous section.
  209. HRenderable renderable = dragonSO->addComponent<CRenderable>();
  210. renderable->setMesh(mesh);
  211. renderable->setMaterial(material);
  212. /************************************************************************/
  213. /* CAMERA */
  214. /************************************************************************/
  215. // In order something to render on screen we need at least one camera.
  216. // Like before, we create a new scene object at (0, 0, 0).
  217. HSceneObject sceneCameraSO = SceneObject::create("SceneCamera");
  218. // Get the primary render window we need for creating the camera. Additionally
  219. // hook up a callback so we are notified when user resizes the window.
  220. SPtr<RenderWindow> window = gApplication().getPrimaryWindow();
  221. window->onResized.connect(&renderWindowResized);
  222. // Add a Camera component that will output whatever it sees into that window
  223. // (You could also use a render texture or another window you created).
  224. sceneCamera = sceneCameraSO->addComponent<CCamera>(window);
  225. // Set up camera component properties
  226. // Priority determines in what order are cameras rendered in case multiple cameras render to the same render target.
  227. // We raise the priority slightly because later in code we have defined a GUI camera that we want to render second.
  228. sceneCamera->setPriority(1);
  229. // Set closest distance that is visible. Anything below that is clipped.
  230. sceneCamera->setNearClipDistance(5);
  231. // Set farthest distance that is visible. Anything above that is clipped.
  232. sceneCamera->setFarClipDistance(10000);
  233. // Set aspect ratio depending on the current resolution
  234. sceneCamera->setAspectRatio(windowResWidth / (float)windowResHeight);
  235. // Add a CameraFlyer component that allows us to move the camera. See CameraFlyer for more information.
  236. sceneCameraSO->addComponent<CameraFlyer>();
  237. // Position and orient the camera scene object
  238. sceneCameraSO->setPosition(Vector3(-130.0f, 140.0f, 650.0f));
  239. sceneCameraSO->lookAt(Vector3(0, 0, 0));
  240. }
  241. /** Register mouse and keyboard inputs that will be used for controlling the camera. */
  242. void setUpInput()
  243. {
  244. // Register input configuration
  245. // Banshee allows you to use VirtualInput system which will map input device buttons
  246. // and axes to arbitrary names, which allows you to change input buttons without affecting
  247. // the code that uses it, since the code is only aware of the virtual names.
  248. // If you want more direct input, see Input class.
  249. auto inputConfig = VirtualInput::instance().getConfiguration();
  250. // Camera controls for buttons (digital 0-1 input, e.g. keyboard or gamepad button)
  251. inputConfig->registerButton("Forward", BC_W);
  252. inputConfig->registerButton("Back", BC_S);
  253. inputConfig->registerButton("Left", BC_A);
  254. inputConfig->registerButton("Right", BC_D);
  255. inputConfig->registerButton("Forward", BC_UP);
  256. inputConfig->registerButton("Back", BC_BACK);
  257. inputConfig->registerButton("Left", BC_LEFT);
  258. inputConfig->registerButton("Right", BC_RIGHT);
  259. inputConfig->registerButton("FastMove", BC_LSHIFT);
  260. inputConfig->registerButton("RotateCam", BC_MOUSE_RIGHT);
  261. // Camera controls for axes (analog input, e.g. mouse or gamepad thumbstick)
  262. // These return values in [-1.0, 1.0] range.
  263. inputConfig->registerAxis("Horizontal", VIRTUAL_AXIS_DESC((UINT32)InputAxis::MouseX));
  264. inputConfig->registerAxis("Vertical", VIRTUAL_AXIS_DESC((UINT32)InputAxis::MouseY));
  265. // Controls that toggle the profiler overlays
  266. inputConfig->registerButton("CPUProfilerOverlay", BC_F1);
  267. inputConfig->registerButton("GPUProfilerOverlay", BC_F2);
  268. // Cache the profiler overlay buttons so when a button is pressed we can quickly
  269. // use these to determine its the one we want
  270. toggleCPUProfilerBtn = VirtualButton("CPUProfilerOverlay");
  271. toggleGPUProfilerBtn = VirtualButton("GPUProfilerOverlay");
  272. // Hook up a callback that gets triggered whenever a virtual button is released
  273. VirtualInput::instance().onButtonUp.connect(&buttonUp);
  274. }
  275. /** Set up graphical user interface used by the example. */
  276. void setUpGUI()
  277. {
  278. // Create a scene object that will contain GUI components
  279. HSceneObject guiSO = SceneObject::create("Example");
  280. // Get the primary render window we need for creating the camera.
  281. SPtr<RenderWindow> window = gApplication().getPrimaryWindow();
  282. // First we want another camera that is responsible for rendering GUI
  283. HCamera guiCamera = guiSO->addComponent<CCamera>(window);
  284. // Notify the renderer that the camera will only be used for overlays (e.g. GUI) so it can optimize its usage
  285. guiCamera->setFlag(CameraFlag::Overlay, true);
  286. // Set up GUI camera properties.
  287. // We don't care about aspect ratio for GUI camera.
  288. guiCamera->setAspectRatio(1.0f);
  289. // This camera should ignore any Renderable objects in the scene
  290. guiCamera->setLayers(0);
  291. // Don't clear this camera as that would clear anything the main camera has rendered.
  292. guiCamera->getViewport()->setRequiresClear(false, false, false);
  293. // Add a GUIWidget, the top-level GUI component, parent to all GUI elements. GUI widgets
  294. // require you to specify a viewport that they will output rendered GUI elements to.
  295. HGUIWidget gui = guiSO->addComponent<CGUIWidget>(guiCamera);
  296. // Depth allows you to control how is a GUI widget rendered in relation to other widgets
  297. // Lower depth means the widget will be rendered in front of those with higher. In this case we just
  298. // make the depth mid-range as there are no other widgets.
  299. gui->setDepth(128);
  300. // GUI skin defines how are all child elements of the GUI widget renderered. It contains all their styles
  301. // and default layout properties. We use the default skin that comes built into Banshee.
  302. gui->setSkin(BuiltinResources::instance().getGUISkin());
  303. // Get the primary GUI panel that stretches over the entire window and add to it a vertical layout
  304. // that will be using for vertically positioning messages about toggling profiler overlay.
  305. GUILayout* bottomLayout = gui->getPanel()->addNewElement<GUILayoutY>();
  306. // Add a flexible space that fills up any remaining area in the layout, making the two labels above be aligned
  307. // to the bottom of the GUI widget (and the screen).
  308. bottomLayout->addNewElement<GUIFlexibleSpace>();
  309. // Add a couple of labels to the layout with the needed messages. Labels expect a HString object that
  310. // maps into a string table and allows for easily localization.
  311. bottomLayout->addElement(GUILabel::create(HString(L"Press F1 to toggle CPU profiler overlay")));
  312. bottomLayout->addElement(GUILabel::create(HString(L"Press F2 to toggle GPU profiler overlay")));
  313. // Create a GUI panel that is used for displaying resolution and fullscreen options.
  314. GUILayout* rightLayout = gui->getPanel()->addNewElement<GUILayoutX>();
  315. // We want all the GUI elements be right aligned, so we add a flexible space first.
  316. rightLayout->addNewElement<GUIFlexibleSpace>();
  317. // And we want the elements to be vertically placed, top to bottom
  318. GUILayout* elemLayout = rightLayout->addNewElement<GUILayoutY>();
  319. // Leave 30 pixels to the right free
  320. rightLayout->addNewElement<GUIFixedSpace>(30);
  321. // Add a button that will trigger a callback when clicked
  322. toggleFullscreenButton = GUIButton::create(HString(L"Toggle fullscreen"));
  323. toggleFullscreenButton->onClick.connect(&toggleFullscreen);
  324. elemLayout->addElement(toggleFullscreenButton);
  325. // Add a profiler overlay object that is responsible for displaying CPU and GPU profiling GUI
  326. profilerOverlay = guiSO->addComponent<ProfilerOverlay>(guiCamera->_getCamera());
  327. // Set up video mode list box
  328. // First get a list of output devices
  329. const VideoModeInfo& videoModeInfo = RenderAPI::getVideoModeInfo();
  330. // Get video mode info for the primary monitor
  331. const VideoOutputInfo& primaryMonitorInfo = videoModeInfo.getOutputInfo(0);
  332. // Make the current desktop mode the default video mode
  333. selectedVideoMode = &primaryMonitorInfo.getDesktopVideoMode();
  334. // Create list box elements for each available video mode
  335. UINT32 numVideoModes = primaryMonitorInfo.getNumVideoModes();
  336. Vector<HString> videoModeLabels(numVideoModes);
  337. UINT32 selectedVideoModeIdx = 0;
  338. for (UINT32 i = 0; i < numVideoModes; i++)
  339. {
  340. const VideoMode& curVideoMode = primaryMonitorInfo.getVideoMode(i);
  341. HString videoModeLabel(L"{0} x {1} at {2}Hz");
  342. videoModeLabel.setParameter(0, toWString(curVideoMode.getWidth()));
  343. videoModeLabel.setParameter(1, toWString(curVideoMode.getHeight()));
  344. videoModeLabel.setParameter(2, toWString(Math::roundToInt(curVideoMode.getRefreshRate())));
  345. videoModeLabels[i] = videoModeLabel;
  346. videoModes.push_back(&curVideoMode);
  347. if (curVideoMode == *selectedVideoMode)
  348. selectedVideoModeIdx = i;
  349. }
  350. // Create the list box
  351. GUIListBox* videoModeListBox = GUIListBox::create(videoModeLabels);
  352. elemLayout->addElement(videoModeListBox);
  353. // Select the default (desktop) video mode
  354. videoModeListBox->selectElement(selectedVideoModeIdx);
  355. // Set up a callback to be notified when video mode changes
  356. videoModeListBox->onSelectionToggled.connect(&videoModeChanged);
  357. }
  358. /** Callback method that toggles between fullscreen and windowed modes. */
  359. void toggleFullscreen()
  360. {
  361. SPtr<RenderWindow> window = gApplication().getPrimaryWindow();
  362. // In order to toggle between full-screen and windowed mode we need to use a CoreAccessor.
  363. // Banshee is a multi-threaded engine and when you need to communicate between simulation and
  364. // core thread you will use a CoreAccessor. Calling a core accessor method will essentially
  365. // queue the method to be executed later. Since RenderWindow is a core object you need to use
  366. // CoreAccessor to modify and access it from simulation thread, except where noted otherwise.
  367. // Classes where it is not clear if they are to be used on the core or simulation thread have
  368. // it noted in their documentation. e.g. RenderWindow::setWindowed method is marked as "Core only".
  369. // Additional asserts are normally in place for debug builds which make it harder for you to accidentally
  370. // call something from the wrong thread.
  371. if (fullscreen)
  372. {
  373. window->setWindowed(gCoreAccessor(), windowResWidth, windowResHeight);
  374. }
  375. else
  376. {
  377. window->setFullscreen(gCoreAccessor(), *selectedVideoMode);
  378. }
  379. fullscreen = !fullscreen;
  380. }
  381. /** Callback triggered wheneve the user resizes the example window. */
  382. void renderWindowResized()
  383. {
  384. SPtr<RenderWindow> window = gApplication().getPrimaryWindow();
  385. const RenderWindowProperties& rwProps = window->getProperties();
  386. if (!fullscreen)
  387. {
  388. windowResWidth = rwProps.getWidth();
  389. windowResHeight = rwProps.getHeight();
  390. }
  391. sceneCamera->setAspectRatio(rwProps.getWidth() / (float)rwProps.getHeight());
  392. }
  393. /** Callback triggered when the user selects a new video mode from the GUI drop down element. */
  394. void videoModeChanged(UINT32 idx, bool enabled)
  395. {
  396. if (!enabled)
  397. return;
  398. selectedVideoMode = videoModes[idx];
  399. if (fullscreen)
  400. {
  401. SPtr<RenderWindow> window = gApplication().getPrimaryWindow();
  402. window->setFullscreen(gCoreAccessor(), *selectedVideoMode);
  403. }
  404. }
  405. /** Callback triggered when a user hits a button. */
  406. void buttonUp(const VirtualButton& button, UINT32 deviceIdx)
  407. {
  408. // Check if the pressed button is one of the either buttons we defined in "setUpExample", and toggle profiler
  409. // overlays accordingly. Device index is ignored for now, as it is assumed the user is using a single keyboard,
  410. // but if you wanted support for multiple gamepads you would check deviceIdx.
  411. if (button == toggleCPUProfilerBtn)
  412. {
  413. if (cpuProfilerActive)
  414. {
  415. profilerOverlay->hide();
  416. cpuProfilerActive = false;
  417. }
  418. else
  419. {
  420. profilerOverlay->show(ProfilerOverlayType::CPUSamples);
  421. cpuProfilerActive = true;
  422. gpuProfilerActive = false;
  423. }
  424. }
  425. else if (button == toggleGPUProfilerBtn)
  426. {
  427. if (gpuProfilerActive)
  428. {
  429. profilerOverlay->hide();
  430. gpuProfilerActive = false;
  431. }
  432. else
  433. {
  434. profilerOverlay->show(ProfilerOverlayType::GPUSamples);
  435. gpuProfilerActive = true;
  436. cpuProfilerActive = false;
  437. }
  438. }
  439. }
  440. }