add physX colliders ,add trigger, colliders now can visible, some rotation for cs and native cpp connection
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
|
||||
#include "glm/gtx/matrix_decompose.hpp"
|
||||
#include "Prism/Core/Input.h"
|
||||
#include "Prism/Physics/Physics3D.h"
|
||||
#include "Prism/Renderer/Renderer2D.h"
|
||||
#include "Prism/Script/ScriptEngine.h"
|
||||
|
||||
@ -172,7 +173,7 @@ namespace Prism
|
||||
m_CheckerboardTex = Texture2D::Create("assets/editor/Checkerboard.tga");
|
||||
m_PlayButtonTex = Texture2D::Create("assets/editor/PlayButton.png");
|
||||
|
||||
m_EditorScene = Ref<Scene>::Create();
|
||||
m_EditorScene = Ref<Scene>::Create("untitled Scene", true);
|
||||
ScriptEngine::SetSceneContext(m_EditorScene);
|
||||
m_SceneHierarchyPanel = CreateScope<SceneHierarchyPanel>(m_EditorScene);
|
||||
m_SceneHierarchyPanel->SetSelectionChangedCallback(std::bind(&EditorLayer::SelectEntity, this, std::placeholders::_1));
|
||||
@ -199,7 +200,7 @@ namespace Prism
|
||||
if (m_DrawOnTopBoundingBoxes)
|
||||
{
|
||||
Renderer::BeginRenderPass(SceneRenderer::GetFinalRenderPass(), false);
|
||||
auto viewProj = m_EditorCamera.GetViewProjection();
|
||||
const auto viewProj = m_EditorCamera.GetViewProjection();
|
||||
Renderer2D::BeginScene(viewProj, false);
|
||||
// TODO: Renderer::DrawAABB(m_MeshEntity.GetComponent<MeshComponent>(), m_MeshEntity.GetComponent<TransformComponent>());
|
||||
Renderer2D::EndScene();
|
||||
@ -233,7 +234,7 @@ namespace Prism
|
||||
const glm::vec3 rotation = glm::eulerAngles(rotationQuat);
|
||||
|
||||
Renderer::BeginRenderPass(SceneRenderer::GetFinalRenderPass(), false);
|
||||
auto viewProj = m_EditorCamera.GetViewProjection();
|
||||
const auto viewProj = m_EditorCamera.GetViewProjection();
|
||||
Renderer2D::BeginScene(viewProj, false);
|
||||
Renderer2D::DrawRotatedQuad({ translation.x, translation.y }, size * 2.0f, glm::degrees(rotation.z), { 1.0f, 0.0f, 1.0f, 1.0f });
|
||||
Renderer2D::EndScene();
|
||||
@ -360,6 +361,21 @@ namespace Prism
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Tools"))
|
||||
{
|
||||
// PhysX Debugger
|
||||
if (ImGui::MenuItem("Connect to PVD"))
|
||||
{
|
||||
Physics3D::ConnectPVD();
|
||||
}
|
||||
if (ImGui::MenuItem("Disconnect from PVD", nullptr, nullptr, Physics3D::IsPVDConnected()))
|
||||
{
|
||||
Physics3D::DisconnectPVD();
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
@ -914,8 +930,8 @@ namespace Prism
|
||||
glm::inverse(glm::mat3(entity.Transform()) * glm::mat3(submesh.Transform)) * direction
|
||||
};
|
||||
|
||||
float t;
|
||||
if (bool intersects = ray.IntersectsAABB(submesh.BoundingBox, t))
|
||||
float t = 0;
|
||||
if (ray.IntersectsAABB(submesh.BoundingBox, t))
|
||||
{
|
||||
const auto& triangleCache = mesh->GetTriangleCache(i);
|
||||
for (const auto& triangle : triangleCache)
|
||||
@ -1029,10 +1045,10 @@ namespace Prism
|
||||
void EditorLayer::OpenScene()
|
||||
{
|
||||
const auto& app = Application::Get();
|
||||
const std::string filepath = app.OpenFile("Hazel Scene (*.hsc)\0*.hsc\0");
|
||||
const std::string filepath = app.OpenFile("Prism Scene (*.hsc)\0*.hsc\0");
|
||||
if (!filepath.empty())
|
||||
{
|
||||
const Ref<Scene> newScene = Ref<Scene>::Create();
|
||||
const Ref<Scene> newScene = Ref<Scene>::Create("EditorScene", true);
|
||||
SceneSerializer serializer(newScene);
|
||||
serializer.Deserialize(filepath);
|
||||
m_EditorScene = newScene;
|
||||
@ -1057,7 +1073,7 @@ namespace Prism
|
||||
void EditorLayer::SaveSceneAs()
|
||||
{
|
||||
auto& app = Application::Get();
|
||||
std::string filepath = app.SaveFile("Hazel Scene (*.hsc)\0*.hsc\0");
|
||||
std::string filepath = app.SaveFile("Prism Scene (*.hsc)\0*.hsc\0");
|
||||
if (!filepath.empty())
|
||||
{
|
||||
SceneSerializer serializer(m_EditorScene);
|
||||
|
||||
Reference in New Issue
Block a user