Adding physx and fixing memory allocation of AssetView
This commit is contained in:
		| @ -20,7 +20,10 @@ public: | ||||
| 		ImGui::StyleColorsDark(); | ||||
|  | ||||
| 		ImGui_ImplGlfw_InitForOpenGL(window.GetGLFWHandle(), true); | ||||
| 		ImGui_ImplOpenGL3_Init("#version 440"); | ||||
| 		ImGui_ImplOpenGL3_Init("#version 450"); | ||||
|  | ||||
| 		ImGuizmo::SetOrthographic(true); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	void Begin () | ||||
| @ -29,20 +32,19 @@ public: | ||||
| 		ImGui_ImplOpenGL3_NewFrame(); | ||||
|  | ||||
| 		ImGui::NewFrame(); | ||||
|  | ||||
| 		ImGuizmo::SetOrthographic(true); | ||||
| 		ImGuizmo::BeginFrame(); | ||||
|  | ||||
| 	} | ||||
|  | ||||
| 	void End() | ||||
| 	{ | ||||
| 	{	 | ||||
|  | ||||
| 		ImGui::EndFrame(); | ||||
|  | ||||
|  | ||||
| 		ImGui::Render(); | ||||
| 		ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); | ||||
|  | ||||
| 		 | ||||
| 		if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_ViewportsEnable) | ||||
| 		{ | ||||
| 			GLFWwindow* last_context = glfwGetCurrentContext(); | ||||
| @ -50,15 +52,19 @@ public: | ||||
| 			ImGui::RenderPlatformWindowsDefault(); | ||||
| 			glfwMakeContextCurrent(last_context); | ||||
| 		} | ||||
| 		 | ||||
| 		 | ||||
|  | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	~GUIRenderer(){ | ||||
| 	 | ||||
|  | ||||
| 		ImGui_ImplOpenGL3_Shutdown(); | ||||
| 		ImGui_ImplGlfw_Shutdown(); | ||||
| 		ImGui::DestroyContext(); | ||||
|  | ||||
|  | ||||
| 	} | ||||
| }; | ||||
|  | ||||
| @ -172,6 +172,8 @@ private: | ||||
| class AssetFinder : EditorWindow { | ||||
| public: | ||||
|     AssetFinder() : EditorWindow("Assets") { | ||||
|  | ||||
|  | ||||
|         ImGui::DragInt("IconSize", &iconSize, 1, 30, 90); | ||||
|  | ||||
|  | ||||
| @ -195,14 +197,14 @@ public: | ||||
|  | ||||
|                 if (asset.isFolder) { | ||||
|                     ImGui::ImageButton( | ||||
|                         (ImTextureID)folderIcon.GetID(), | ||||
|                         (ImTextureID)(Texture("rsc/folderIcon.png")).GetID(), | ||||
|                         ImVec2{ (float)iconSize,(float)iconSize }); | ||||
|                     ImGui::Text(asset.GetName(), row); | ||||
|  | ||||
|                 } | ||||
|                 else { | ||||
|                     ImGui::ImageButton( | ||||
|                         (ImTextureID)AssetIcon.GetID(), | ||||
|                         (ImTextureID)(Texture("rsc/assetIcon.png")).GetID(), | ||||
|                         ImVec2{ (float)iconSize, (float)iconSize }); | ||||
|                     ImGui::Text(asset.GetName(), row); | ||||
|  | ||||
| @ -220,7 +222,7 @@ public: | ||||
|  | ||||
|     } | ||||
| private: | ||||
|     Texture folderIcon = Texture("rsc/folderIcon.png"); | ||||
|     Texture AssetIcon = Texture("rsc/assetIcon.png"); | ||||
|     static Texture folderIcon; | ||||
|     static Texture AssetIcon; | ||||
|     int iconSize = 60; | ||||
| }; | ||||
| @ -66,10 +66,13 @@ public: | ||||
|             } | ||||
|  | ||||
|             // submit DrawCommands for all render3DComponents | ||||
|              | ||||
|             auto group = ActiveScene.getReg().view<TransformComponent, Render3DComponent>(); | ||||
|             group.each([&renderer](auto enity, TransformComponent& t, Render3DComponent& renderComponent) { | ||||
|                 renderer.Submit(renderComponent, t); | ||||
|             }); | ||||
|              | ||||
|              | ||||
|  | ||||
|             renderer.Render(); | ||||
|  | ||||
| @ -127,7 +130,7 @@ public: | ||||
|         } | ||||
|  | ||||
|         { | ||||
|           //  AssetFinder assetsView = AssetFinder(); | ||||
|             AssetFinder assetsView = AssetFinder(); | ||||
|         } | ||||
|          | ||||
|          | ||||
|  | ||||
		Reference in New Issue
	
	Block a user