From e5345fd32a97ac6e0f42fce96f96b931abe028b1 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 4 Dec 2025 20:42:45 +0900 Subject: [PATCH 1/4] [add] RigidBodyModifier --- .../Engine/Private/RigidBody_Dynamic.cpp | 48 +++++++++++++++++++ .../Engine/Public/RigidBody_Dynamic.h | 1 + 2 files changed, 49 insertions(+) diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index 1e3b68340..e53d98f68 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -48,7 +48,48 @@ HRESULT CRigidBody_Dynamic::Render() } return S_OK; } +#endif +void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) +{ + m_vhalfGeometryInfo = vhalfGeometryInfo; + PSX::PxShape* pShape = { nullptr }; + m_pRigidBody->getShapes(&pShape, m_pRigidBody->getNbShapes()); + + switch (m_eActorType) + { + case ACTOR::BOX: + { + PSX::PxBoxGeometry Geometry((const PSX::PxBoxGeometry&)pShape->getGeometry()); + Geometry.halfExtents = { vhalfGeometryInfo.x, vhalfGeometryInfo.y, vhalfGeometryInfo.z }; + pShape->setGeometry(Geometry); + } break; + case ACTOR::CAPSULE: + { + PSX::PxCapsuleGeometry Geometry((const PSX::PxCapsuleGeometry&)pShape->getGeometry()); + Geometry.halfHeight = { vhalfGeometryInfo.y }; + Geometry.radius = { vhalfGeometryInfo.x }; + pShape->setGeometry(Geometry); + } break; + case ACTOR::SPHERE: + { + PSX::PxSphereGeometry Geometry((const PSX::PxSphereGeometry&)pShape->getGeometry()); + Geometry.radius = { vhalfGeometryInfo.x }; + pShape->setGeometry(Geometry); + } break; + default: + break; + } +#ifdef _DEBUG + if (nullptr != m_pMainShape) { + m_pMainShape.release(); + } + if (nullptr != m_pSubShape) { + m_pSubShape.release(); + } + Add_DebugShape(); #endif // _DEBUG +} +// _DEBUG void CRigidBody_Dynamic::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType) { PSX::PxVec3 vPxForce = {}; @@ -121,6 +162,7 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg) m_pRigidBody->setRigidDynamicLockFlags(m_eLockFlag); m_pRigidBody->setLinearDamping(m_vDamping.x); m_pRigidBody->setAngularDamping(m_vDamping.y); + //m_pRigidBody->joint; //PSX::PxRevol @@ -184,5 +226,11 @@ void CRigidBody_Dynamic::Free() void CRigidBody_Dynamic::Describe_Entity() { + GUI::BeginChild(("Child ID: " + to_string((size_t)(this))).c_str()); + GUI::Text("ReSize"); GUI::SameLine(); + if (GUI::DragFloat3("##Size", (_float*)&m_vhalfGeometryInfo, 0.01f, 0.01f, 10.f, "%.3f")) { + Set_HalfGeometryInfo(m_vhalfGeometryInfo); + } + GUI::EndChild(); } #endif // _DEBUG diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h index 35b210392..30dcb0a92 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h @@ -34,6 +34,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody virtual PSX::PxRigidDynamic* Get_Actor() override { return m_pRigidBody; }; _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; } + void Set_HalfGeometryInfo(_float3 vhalfGeometryInfo); _float Get_Density() const { return m_fDensity; } virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향 From b0648bc5c917b4bafea34d6957140ed3417fd2fa Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 4 Dec 2025 22:19:51 +0900 Subject: [PATCH 2/4] [add] RigidBodt Offset --- Jusin154_Team3D/Client/Private/Loader.cpp | 2 + Jusin154_Team3D/Editor/Private/Loader.cpp | 16 ++++++++ Jusin154_Team3D/Engine/Private/RigidBody.cpp | 4 +- .../Engine/Private/RigidBody_Dynamic.cpp | 40 +++++++++++++++++++ .../Engine/Private/RigidBody_Static.cpp | 2 + .../Engine/Public/PhysX/PxPhysics.h | 2 +- Jusin154_Team3D/Engine/Public/RigidBody.h | 5 ++- .../Engine/Public/RigidBody_Dynamic.h | 1 + 8 files changed, 69 insertions(+), 3 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 0128c3aee..796005487 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -1167,6 +1167,8 @@ HRESULT CLoader::Loading_For_GamePlay() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { 100.f, 100.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index a6db4d38e..245cc0ba2 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -1021,6 +1021,8 @@ HRESULT CLoader::Loading_For_Effect() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1039,6 +1041,8 @@ HRESULT CLoader::Loading_For_Effect() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { 100.f, 100.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1365,6 +1369,8 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1384,6 +1390,8 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { 100.f, 100.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1403,6 +1411,8 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = { PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_X | PSX::PxRigidDynamicLockFlag::eLOCK_ANGULAR_Z | PSX::PxRigidDynamicLockFlag::eLOCK_LINEAR_Y }; Desc.vAutoDamping = { 10.f, 10.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_PLATFORM"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1420,6 +1430,8 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.vhalfGeometryInfo = { 3.5f, 1.5f, 0.25f }; Desc.fDensity = 10.f; PSX::PxTransform pxPivotTransform = PSX::PxTransform(PSX::PxVec3(3.5f, 1.5f, 0.f)); + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; Desc.pxMassCenter = pxPivotTransform; Desc.eLockFlag = { @@ -1452,6 +1464,8 @@ HRESULT CLoader::Loading_For_PhysXLevel() Desc.pxMassCenter = pxPivotTransform; Desc.eLockFlag = { }; Desc.vAutoDamping = { 10.f, 10.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_DOOR"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { return E_FAIL; @@ -1859,6 +1873,8 @@ HRESULT CLoader::Loading_For_ObjectViewer() Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); Desc.eLockFlag = {}; Desc.vAutoDamping = { 100.f, 100.f }; + Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + Desc.vLocalTranslation = { 0.f, 0.f, 0.f }; } if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { diff --git a/Jusin154_Team3D/Engine/Private/RigidBody.cpp b/Jusin154_Team3D/Engine/Private/RigidBody.cpp index 754d92893..210fdac13 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody.cpp @@ -14,7 +14,9 @@ CRigidBody::CRigidBody(const CRigidBody& rhs) : m_ePxRigidBodyFlags(rhs.m_ePxRigidBodyFlags), m_ePxShapeFlags(rhs.m_ePxShapeFlags), m_eMatType(rhs.m_eMatType), - m_fContactOffset(rhs.m_fContactOffset) + m_fContactOffset(rhs.m_fContactOffset), + m_vLocalRotQ(rhs.m_vLocalRotQ), + m_vLocalTranslation(rhs.m_vLocalTranslation) { } diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index e53d98f68..3fbe950dd 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -61,6 +61,9 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) { PSX::PxBoxGeometry Geometry((const PSX::PxBoxGeometry&)pShape->getGeometry()); Geometry.halfExtents = { vhalfGeometryInfo.x, vhalfGeometryInfo.y, vhalfGeometryInfo.z }; + if (false == Geometry.isValid()) { + assert(false); + } pShape->setGeometry(Geometry); } break; case ACTOR::CAPSULE: @@ -68,12 +71,18 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) PSX::PxCapsuleGeometry Geometry((const PSX::PxCapsuleGeometry&)pShape->getGeometry()); Geometry.halfHeight = { vhalfGeometryInfo.y }; Geometry.radius = { vhalfGeometryInfo.x }; + if (false == Geometry.isValid()) { + assert(false); + } pShape->setGeometry(Geometry); } break; case ACTOR::SPHERE: { PSX::PxSphereGeometry Geometry((const PSX::PxSphereGeometry&)pShape->getGeometry()); Geometry.radius = { vhalfGeometryInfo.x }; + if (false == Geometry.isValid()) { + assert(false); + } pShape->setGeometry(Geometry); } break; default: @@ -82,13 +91,23 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo) #ifdef _DEBUG if (nullptr != m_pMainShape) { m_pMainShape.release(); + m_pMainShape = nullptr; } if (nullptr != m_pSubShape) { m_pSubShape.release(); + m_pSubShape = nullptr; } Add_DebugShape(); #endif // _DEBUG } +void CRigidBody_Dynamic::Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation) +{ + m_vLocalRotQ = vNewRotQ; + m_vLocalTranslation = vNewTranslation; + PSX::PxShape* pShape = { nullptr }; + m_pRigidBody->getShapes(&pShape, m_pRigidBody->getNbShapes()); + pShape->setLocalPose(PSX::PxTransform(vNewTranslation.x, vNewTranslation.y, vNewTranslation.z, PSX::PxQuat(vNewRotQ.x, vNewRotQ.y, vNewRotQ.z, vNewRotQ.w))); +} // _DEBUG void CRigidBody_Dynamic::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType) { @@ -137,6 +156,8 @@ HRESULT CRigidBody_Dynamic::Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DES m_eLockFlag = Desc.eLockFlag; m_PxMassCenter = Desc.pxMassCenter; m_vDamping = Desc.vAutoDamping; + m_vLocalRotQ = Desc.vLocalRotQ; + m_vLocalTranslation = Desc.vLocalTranslation; return S_OK; } @@ -163,6 +184,7 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg) m_pRigidBody->setLinearDamping(m_vDamping.x); m_pRigidBody->setAngularDamping(m_vDamping.y); + Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); //m_pRigidBody->joint; //PSX::PxRevol @@ -231,6 +253,24 @@ void CRigidBody_Dynamic::Describe_Entity() if (GUI::DragFloat3("##Size", (_float*)&m_vhalfGeometryInfo, 0.01f, 0.01f, 10.f, "%.3f")) { Set_HalfGeometryInfo(m_vhalfGeometryInfo); } + GUI::Text("Translation"); GUI::SameLine(); + if (GUI::DragFloat3("##LocalPos", (_float*)&m_vLocalTranslation, 0.125f, -10.f, 10.f, "%.4f")) { + Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); + } + _vector forward = XMVector3Rotate(XMVectorSet(0, 0, 1, 0), XMLoadFloat4(&m_vLocalRotQ)); + _vector up = XMVector3Rotate(XMVectorSet(0, 1, 0, 0), XMLoadFloat4(&m_vLocalRotQ)); + + _float fYaw = atan2f(XMVectorGetX(forward), XMVectorGetZ(forward)); + _float fPitch = asinf(-XMVectorGetY(forward)); + _float fRoll = atan2f(XMVectorGetY(up), XMVectorGetY(forward)); + _float3 vRPY = { fPitch, fYaw, fRoll }; + + GUI::Text("Rotation Roll Pitch Yaw"); GUI::SameLine(); + if (GUI::DragFloat3("##LocalRotq", (_float*)&vRPY, XMConvertToRadians(0.5f), -XM_2PI, XM_2PI, "%.5f")) { + _vector vRotq = XMQuaternionRotationRollPitchYaw(vRPY.x, vRPY.y, vRPY.z); + XMStoreFloat4(&m_vLocalRotQ, vRotq); + Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); + } GUI::EndChild(); } #endif // _DEBUG diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp index 0e88a2aed..acc9bdd48 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Static.cpp @@ -20,6 +20,8 @@ HRESULT CRigidBody_Static::Initialize_Prototype(RIGIDBODY_STATIC_PROTOTYPEDESC& m_ePxShapeFlags = Desc.ePxShapeFlags; m_eMatType = Desc.ePxMaterialTypes; m_fContactOffset = Desc.fContactOffset; + m_vLocalRotQ = Desc.vLocalRotQ; + m_vLocalTranslation = Desc.vLocalTranslation; return S_OK; } diff --git a/Jusin154_Team3D/Engine/Public/PhysX/PxPhysics.h b/Jusin154_Team3D/Engine/Public/PhysX/PxPhysics.h index 07162f349..525f0eb8b 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/PxPhysics.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/PxPhysics.h @@ -1,4 +1,4 @@ -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must retain the above copyright diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h index 7a37d795d..54c5fc3d2 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody.h @@ -16,7 +16,8 @@ class ENGINE_DLL CRigidBody abstract : public CComponent PXMATERIAL ePxMaterialTypes = { PXMATERIAL::DEFAULT }; _float3 vMatInfo = { 0.5f, 0.5f, 0.6f }; // 피직스 객체의 속성 등 _float fContactOffset = { 0.05f }; // 접촉 유격 오프셋 - + _float4 vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + _float3 vLocalTranslation = { 0.f, 0.f, 0.f }; }RIGIDBODY_PROTOTYPEDESC; typedef struct tagRigidBody_Desc @@ -44,6 +45,8 @@ class ENGINE_DLL CRigidBody abstract : public CComponent PSX::PxShapeFlags m_ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; PXMATERIAL m_eMatType = { PXMATERIAL::END }; _float m_fContactOffset = { 0.05f }; + _float4 m_vLocalRotQ = { 0.f, 0.f, 0.f, 1.f }; + _float3 m_vLocalTranslation = { 0.f, 0.f, 0.f }; CTransform* m_pTransform = { nullptr }; PhsXUserData m_tagData = {}; diff --git a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h index 30dcb0a92..a0107d097 100644 --- a/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h +++ b/Jusin154_Team3D/Engine/Public/RigidBody_Dynamic.h @@ -35,6 +35,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody virtual PSX::PxRigidDynamic* Get_Actor() override { return m_pRigidBody; }; _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; } void Set_HalfGeometryInfo(_float3 vhalfGeometryInfo); + void Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation); _float Get_Density() const { return m_fDensity; } virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향 From f42bef50ffa8bac9764431a65a4ca977fd3cf3b3 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Thu, 4 Dec 2025 22:21:32 +0900 Subject: [PATCH 3/4] [add] rotq rigidBody --- .../Engine/Private/RigidBody_Dynamic.cpp | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp index 3fbe950dd..ecd0a4a35 100644 --- a/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp +++ b/Jusin154_Team3D/Engine/Private/RigidBody_Dynamic.cpp @@ -257,17 +257,28 @@ void CRigidBody_Dynamic::Describe_Entity() if (GUI::DragFloat3("##LocalPos", (_float*)&m_vLocalTranslation, 0.125f, -10.f, 10.f, "%.4f")) { Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); } - _vector forward = XMVector3Rotate(XMVectorSet(0, 0, 1, 0), XMLoadFloat4(&m_vLocalRotQ)); - _vector up = XMVector3Rotate(XMVectorSet(0, 1, 0, 0), XMLoadFloat4(&m_vLocalRotQ)); + _vector q = XMLoadFloat4(&m_vLocalRotQ); - _float fYaw = atan2f(XMVectorGetX(forward), XMVectorGetZ(forward)); - _float fPitch = asinf(-XMVectorGetY(forward)); - _float fRoll = atan2f(XMVectorGetY(up), XMVectorGetY(forward)); - _float3 vRPY = { fPitch, fYaw, fRoll }; + // 기본 방향벡터 (엔진 기준) + _vector forward = XMVector3Rotate(XMVectorSet(0, 0, 1, 0), q); + _vector right = XMVector3Rotate(XMVectorSet(1, 0, 0, 0), q); + _vector up = XMVector3Rotate(XMVectorSet(0, 1, 0, 0), q); - GUI::Text("Rotation Roll Pitch Yaw"); GUI::SameLine(); - if (GUI::DragFloat3("##LocalRotq", (_float*)&vRPY, XMConvertToRadians(0.5f), -XM_2PI, XM_2PI, "%.5f")) { - _vector vRotq = XMQuaternionRotationRollPitchYaw(vRPY.x, vRPY.y, vRPY.z); + // --- RPY 계산 --- + _float fYaw = atan2f(XMVectorGetX(forward), XMVectorGetZ(forward)); + _float fPitch = asinf(-XMVectorGetY(forward)); + _float fRoll = atan2f(XMVectorGetY(right), XMVectorGetY(up)); // 수정된 Roll 계산 + + _float3 vRPY = { fRoll, fPitch, fYaw }; // Roll-Pitch-Yaw 순서 정렬 + + // --- GUI 편집 --- + GUI::Text("Rotation (Roll Pitch Yaw)"); + GUI::SameLine(); + if (GUI::DragFloat3("##LocalRotq", (_float*)&vRPY, + XMConvertToRadians(0.5f), -XM_2PI, XM_2PI, "%.5f")) + { + // XMQuaternionRotationRollPitchYaw는 (Yaw→Pitch→Roll) 순서 + _vector vRotq = XMQuaternionRotationRollPitchYaw(vRPY.z, vRPY.y, vRPY.x); XMStoreFloat4(&m_vLocalRotQ, vRotq); Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation); } From 395f6a8c0e7f4c6c40c9b4be614289cc27225b7b Mon Sep 17 00:00:00 2001 From: Chanbin Kim <127280695+JinhoBa@users.noreply.github.com> Date: Fri, 5 Dec 2025 15:07:35 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[add]=20=EA=B3=84=EB=8B=A8=20=EB=AA=A8?= =?UTF-8?q?=EB=8D=B8=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=B6=94=EA=B0=80=20?= =?UTF-8?q?[Update]=20Terrain=20=EB=B0=94=EC=9D=B4=EB=84=88=EB=A6=AC=20?= =?UTF-8?q?=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Client/Default/Client.vcxproj.filters | 3 - .../Client/Private/InstancedProp.cpp | 3 +- .../Client/Private/Level_GamePlay.cpp | 2 +- Jusin154_Team3D/Client/Private/Light_Main.cpp | 3 + Jusin154_Team3D/Client/Private/Loader.cpp | 10 + Jusin154_Team3D/Client/Private/MapInfo.cpp | 5 +- Jusin154_Team3D/Client/Private/Terrain.cpp | 4 +- .../Bin/Resources/Data/Map/ContainerTest.xml | 216 ++++++++++++++++++ .../Data/Map/Hogsmeade_HeightMap.bin | 2 +- .../Meshes/SM_HM_TeaShop_Windows.bin | 2 +- Jusin154_Team3D/Editor/Private/Loader.cpp | 32 ++- .../Private/MapElement_Interactable.cpp | 166 ++++++++++++-- .../Editor/Private/MapObject_Collision.cpp | 27 ++- .../Editor/Private/MapObject_Manager.cpp | 126 ++++++++-- Jusin154_Team3D/Editor/Private/Terrain.cpp | 6 +- .../Editor/Public/Dummy_PhysXPlayable.h | 2 +- Jusin154_Team3D/Editor/Public/Editor_Define.h | 2 + .../Editor/Public/MapElement_Interactable.h | 28 ++- .../Editor/Public/MapObject_Manager.h | 3 + .../Engine/Private/GameInstance.cpp | 2 +- Jusin154_Team3D/Engine/Private/Material.cpp | 28 +-- .../Engine/Private/Resource_Manager.cpp | 4 +- Jusin154_Team3D/Engine/Private/Texture.cpp | 8 +- Jusin154_Team3D/Engine/Public/GameInstance.h | 3 +- Jusin154_Team3D/Engine/Public/Material.h | 15 +- .../Engine/Public/Resource_Manager.h | 3 + Jusin154_Team3D/Engine/Public/Texture.h | 2 + 27 files changed, 602 insertions(+), 105 deletions(-) diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 63bd5807c..160e6532e 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -937,9 +937,6 @@ 02.GameObjects\Monster - - 02.GameObjects\Environment\00.MapContainer - 02.GameObjects\Environment\00.MapContainer\BuildingContainer diff --git a/Jusin154_Team3D/Client/Private/InstancedProp.cpp b/Jusin154_Team3D/Client/Private/InstancedProp.cpp index 6a283284f..29f7ea3e8 100644 --- a/Jusin154_Team3D/Client/Private/InstancedProp.cpp +++ b/Jusin154_Team3D/Client/Private/InstancedProp.cpp @@ -124,9 +124,8 @@ HRESULT CInstancedProp::Load_InstancedProp(const _char* pFilePath) WorldMatrices.reserve(iNumWorldMatrix); _float4x4 WorldMatrix = {}; - FileIn.read(reinterpret_cast(&WorldMatrix), sizeof(_float4x4)); - for (_uint i = 1; i < iNumWorldMatrix; ++i) + for (_uint i = 0; i < iNumWorldMatrix; ++i) { FileIn.read(reinterpret_cast(&WorldMatrix), sizeof(_float4x4)); diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 60fe7b1ef..b669575bb 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -163,7 +163,7 @@ HRESULT CLevel_GamePlay::Ready_Background() CInfoInstance::GetInstance()->Load_MapObjects("ClientTest"); /* 전체 맵 */ - //CInfoInstance::GetInstance()->Load_MapObjects("Map1129"); + CInfoInstance::GetInstance()->Load_MapObjects("Hogsmeade_MapContainer_Data"); /* 조명 오브젝트 */ CInfoInstance::GetInstance()->Load_LightElements("LightElement"); diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index c3964fb26..0f747880e 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -38,11 +38,14 @@ void CLight_Main::Priority_Update(_float fTimeDelta) void CLight_Main::Update(_float fTimeDelta) { +#ifdef _DEBUG GUI::Begin("Main_Light"); #ifdef _DEBUG m_pLightCom->Describe_Entity(); #endif // _DEBUG GUI::End(); +#endif // _DEBUG + } void CLight_Main::Late_Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index efd8cdf28..319634a25 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -483,6 +483,16 @@ HRESULT CLoader::Loading_For_GamePlay() ".bin", false )); } + {/* Step and Stair */ + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Meshes/GroundSurfaces", + ".bin", false + )); + jobMapModels.emplace_back(Deferred_FolderLoad( + "../Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/Common/Collision/GroundSurfaces", + ".bin", false + )); + } } #pragma endregion diff --git a/Jusin154_Team3D/Client/Private/MapInfo.cpp b/Jusin154_Team3D/Client/Private/MapInfo.cpp index 470c89dbb..013927b3b 100644 --- a/Jusin154_Team3D/Client/Private/MapInfo.cpp +++ b/Jusin154_Team3D/Client/Private/MapInfo.cpp @@ -79,8 +79,9 @@ HRESULT CMapInfo::Load_MapObjects(const _char* pFileName) { const _char* pName = {}; _uint iMapContainerType = {}; - Container->QueryStringAttribute("Name", &pName); - Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType); + //Container->QueryUnsignedAttribute("MapContainerType", &iMapContainerType); + + Container->FirstChildElement("MapContainerType")->QueryUnsignedAttribute("type", &iMapContainerType); CMapContainer* pContainerObject = nullptr; diff --git a/Jusin154_Team3D/Client/Private/Terrain.cpp b/Jusin154_Team3D/Client/Private/Terrain.cpp index f4391d732..317a14d6e 100644 --- a/Jusin154_Team3D/Client/Private/Terrain.cpp +++ b/Jusin154_Team3D/Client/Private/Terrain.cpp @@ -59,9 +59,7 @@ void CTerrain::Update(_float fTimeDelta) { #ifdef _DEBUG Describe_Entity(); -#endif // _DEBUG - - +#endif // DEBUG } void CTerrain::Late_Update(_float fTimeDelta) diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml index 543dc2c0d..386f62b61 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/ContainerTest.xml @@ -3686,4 +3686,220 @@ + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod2 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod2 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_C_Lod2 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_01_A_COL + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_01_A_COL + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_01_A_COL + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_01_A_COL + + + + + + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod1 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod2 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod1 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod2 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod1 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod2 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod1 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod2 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod1 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod2 + Prototype_GameObject_SM_HM_PlazaSteps_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A_Small_COL + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A_Small_COL + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A_Small_COL + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A_Small_COL + + + + + + Prototype_GameObject_SM_HM_PlazaSteps_A_Small_COL + + + + + + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod1 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod2 + Prototype_GameObject_SM_HM_Stone_Steps_High_Street_A_Lod3 + + + + + + Prototype_GameObject_SM_HM_High_Street_Stairs_A_COL + + + + + + Prototype_GameObject_SM_HM_High_Street_Stairs_B_COL + + + + + + Prototype_GameObject_SM_HM_High_Street_Stairs_A_COL + + + + + + Prototype_GameObject_SM_HM_High_Street_Stairs_B_COL + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap.bin index 5ec6b1988..624d8db9d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Hogsmeade_HeightMap.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b2b804eb5741b33d1c0d6a48f186ebf616ed95ac5ae61555ef7cb1ee6c88ab08 +oid sha256:70a00e80f048ff149ec44044d738d5bbbbbc7e3d6adf4877de62ab209bc4dea2 size 1052676 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes/SM_HM_TeaShop_Windows.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes/SM_HM_TeaShop_Windows.bin index 445d37d7a..de3e06751 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes/SM_HM_TeaShop_Windows.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/MapMesh/Game/Environment/Hogsmeade/BLDG_TeaShop/Meshes/SM_HM_TeaShop_Windows.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:540a2b31d15161825316d4010fc11f0b79878525bbebe3f18816661963effb61 +oid sha256:6a62e09c2098fd51f218caa7000b1e7b36050314d910efe79e9723f4bd218080 size 1822737 diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 57b727dec..b0f57bd92 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2316,7 +2316,7 @@ HRESULT CLoader::Loading_For_MapViewer() ///* BLDG_TeaShop */ /*if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Meshes", - ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + ".fbx", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Collision", ".bin", false, ModelPrototypeTags, ModelPrototypePath))) @@ -2433,10 +2433,21 @@ HRESULT CLoader::Loading_For_MapViewer() /* Doors */ if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Doors", - ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; + /* Barrel */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Objects\\Meshes", + ".bin", false, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + /* Step */ + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\GroundSurfaces", + ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\GroundSurfaces", + ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; #pragma endregion @@ -2773,6 +2784,23 @@ vector*> Contents(iLoadCount); m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); + CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{}; + { + Desc.eType = ACTOR::BOX; + Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC }; + Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE }; + Desc.ePxMaterialTypes = { PXMATERIAL::DEFAULT }; + Desc.vMatInfo = { 0.5f, 0.5f, 0.6f }; + Desc.fContactOffset = { 0.05f }; + Desc.vhalfGeometryInfo = { 0.5f, 0.5f, 0.5f }; + Desc.fDensity = 10.f; + Desc.pxMassCenter = PSX::PxTransform(PSX::PxIDENTITY()); + Desc.eLockFlag = {}; + Desc.vAutoDamping = { }; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) { + return E_FAIL; + } /* For.Prototype_Component_Collider */ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_Collider"), diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp index 6ba73587b..32621886f 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp @@ -50,6 +50,9 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg) m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); #endif // _DEBUG + m_vBoxSize = _float3(1.f, 1.f, 1.f); + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + return S_OK; } @@ -62,20 +65,21 @@ void CMapElement_Interactable::Priority_Update(_float fTimeDelta) void CMapElement_Interactable::Update(_float fTimeDelta) { -} - -void CMapElement_Interactable::Late_Update(_float fTimeDelta) -{ -#ifdef _DEBUG if (m_bSelected) { m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f)); m_pTransformCom->Set_Scale(m_vScale); m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z)); } +} + +void CMapElement_Interactable::Late_Update(_float fTimeDelta) +{ +#ifdef _DEBUG + #endif - if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); } } @@ -92,7 +96,7 @@ HRESULT CMapElement_Interactable::Render() if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } - if (m_bSelected) + if (m_bSelected && m_bUseSelectColor) { if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) { return E_FAIL; @@ -111,6 +115,12 @@ HRESULT CMapElement_Interactable::Render() } } +#ifdef _DEBUG + if (FAILED(m_pRigidBody->Render())) { + return E_FAIL; + } +#endif // _DEBUG + return S_OK; } @@ -137,6 +147,17 @@ HRESULT CMapElement_Interactable::Ready_Components(void* pArg) reinterpret_cast(&m_pShaderCom)))) return E_FAIL; + + ELEMENT_INTERACTABLE_DESC* pPhysXDummyDesc = static_cast(pArg); + + // RIGID_BODY + CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{}; + Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind; + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) { + return E_FAIL; + } + + return S_OK; } @@ -187,9 +208,14 @@ CGameObject* CMapElement_Interactable::Clone(void* pArg, CGameObject* pOwner) void CMapElement_Interactable::Free() { + if (nullptr != m_pRigidBody) { + m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor()); + } __super::Free(); + SAFE_RELEASE(m_pRigidBody); SAFE_RELEASE(m_pShaderCom); + for (auto& pModel : m_pModelComs) SAFE_RELEASE(pModel); } @@ -201,34 +227,82 @@ void CMapElement_Interactable::Describe_Entity() if (nullptr == m_pGameInstance) return; + PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f); + + if (GUI::CollapsingHeader("Rigid Body")) + { + GUI::InputFloat("Power", &m_fPower); + + if (GUI::Button("Move Test")) + { + + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if(nullptr != m_pActor) + { + m_pActor->wakeUp(); + m_pActor->addForce(vDir * m_fPower * 100000.f, PSX::PxForceMode::eFORCE); + } + } + if (GUI::Button("OFF_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false); + } + if (GUI::Button("ON_Kinematic")) + { + m_pActor = static_cast(m_pRigidBody->Get_Actor()); + if (nullptr != m_pActor) + m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true); + } + + if(GUI::InputFloat("Mass", &m_fMass)) + m_pActor->setMass(m_fMass); + + m_pRigidBody->Describe_Entity(); + + + } + + GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str()); GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex)); m_iLodIndex = max(0, m_iLodIndex); m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex); + + GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor); + GUI::Text("----- Transfrom ----"); - GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); - GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); - GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + _float3 vMove = {}; + GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f); + GUI::InputFloat("Up", &vMove.y, 0.05f, 0.1f); + GUI::InputFloat("Look", &vMove.z, 0.05f, 0.1f); + + //m_pTransformCom->Move_Right(vMove.x); + //m_pTransformCom->Move_Up(vMove.y); + //m_pTransformCom->Move_Look(vMove.z); + + //XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) { - CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); - if (nullptr != pTerrain) + _float3 vPosition = {}; + if (m_pGameInstance->isPicking(&vPosition)) { - pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition); + memcpy(&m_vPosition, &vPosition, sizeof(_float3)); + m_pTransformCom->Set_State(STATE::POSITION, XMLoadFloat3(&m_vPosition)); } - } GUI::Text("----- Rotation ----"); - GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); - GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); - GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f); + GUI::InputFloat("X##Rotation", &m_vRotation.x, 1.f, 15.f); + GUI::InputFloat("Y##Rotation", &m_vRotation.y, 1.f, 15.f); + GUI::InputFloat("Z##Rotation", &m_vRotation.z, 1.f, 15.f); GUI::Text("----- Scale ----"); - GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f); - GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f); - GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f); + GUI::InputFloat("X##Scale", &m_vScale.x, 0.05f, 0.1f); + GUI::InputFloat("Y##Scale", &m_vScale.y, 0.05f, 0.1f); + GUI::InputFloat("Z##Scale", &m_vScale.z, 0.05f, 0.1f); m_vScale.x = max(0.01f, m_vScale.x); m_vScale.y = max(0.01f, m_vScale.y); @@ -239,3 +313,55 @@ void CMapElement_Interactable::Describe_Entity() m_bSelected = true; } + +HRESULT CMapElement_Interactable::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + tinyxml2::XMLElement* object = doc.NewElement("Object"); + object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_INTERACT)); + object->SetAttribute("ID", ENUM_CLASS(m_eInteractableID)); + object->SetAttribute("Lod_Level", m_iLodIndex); + root->InsertEndChild(object); + +#pragma region PROTOTYPETAG + for (_uint i = 0; i < m_iLodIndex + 1; ++i) + { + tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); + prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); + object->InsertEndChild(prototype); + } +#pragma endregion + +#pragma region TRANSFORM + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + _float3 vScale = m_pTransformCom->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + object->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + object->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + object->InsertEndChild(Rotation); +#pragma endregion + + + return S_OK; +} diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp index a78565a65..f1ca463d7 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp @@ -42,7 +42,7 @@ void CMapObject_Collision::Late_Update(_float fTimeDelta) #endif XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); - if (m_pGameInstance->Key_Pressing(DIK_V)){ + if (m_bVisible){ if (m_pGameInstance->isIn_WorldFrustum(XMLoadFloat4(reinterpret_cast<_float4*>(m_CombinedWorldMatrix.m[3])), m_pTransformCom->Get_Radius())) { m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); } @@ -96,7 +96,7 @@ HRESULT CMapObject_Collision::Initialize_Prototype() HRESULT CMapObject_Collision::Initialize(void* pArg) { m_iMaxLodLevel = 0; - + m_bVisible = true; MAPOBJECT_LOD_DESC* pDesc = static_cast(pArg); m_iMaxLodLevel = pDesc->iMaxLodLevel; @@ -115,6 +115,7 @@ HRESULT CMapObject_Collision::Initialize(void* pArg) #ifdef _DEBUG m_bSelected = false; + m_bVisible = false; m_vPosition = pDesc->vPosition; m_vScale = pDesc->vScale; m_vRotation = pDesc->vRotation; @@ -233,20 +234,28 @@ void CMapObject_Collision::Describe_Entity() //ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str()); GUI::Checkbox("Visible", &m_bVisible); + _float3 vMove = {}; + ImGui::Text("----- Transfrom ----"); - ImGui::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f); - ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f); - ImGui::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f); + ImGui::InputFloat("Right", &vMove.x, 0.05f, 0.1f); + ImGui::InputFloat("Up", &vMove.y, 0.05f, 0.1f); + ImGui::InputFloat("Look", &vMove.z, 0.05f, 0.1f); + + m_pTransformCom->Move_Right(vMove.x); + m_pTransformCom->Move_Up(vMove.y); + m_pTransformCom->Move_Look(vMove.z); + + XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION)); if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT)) { - CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object(); - if (nullptr != pTerrain) + _float3 vPosition = {}; + if (m_pGameInstance->isPicking(&vPosition)) { - pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition); + memcpy(&m_vPosition, &vPosition, sizeof(_float3)); + m_pTransformCom->Set_State(STATE::POSITION, XMLoadFloat3(&m_vPosition)); } } - ImGui::Text("----- Rotation ----"); ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f); ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f); diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 55431bee6..996723a33 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -58,7 +58,10 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) m_iContainerObjectIndex = 99; //m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); - if (FAILED(Load_MapData("Map1129"))) + if (FAILED(Load_MapData("Map1205"))) + return E_FAIL; + + if (FAILED(Load_LightObject("LightElement"))) return E_FAIL; /*if (FAILED(Load_LightObject("LightElement"))) return E_FAIL; @@ -409,7 +412,7 @@ HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) prototype->SetText(CMyTools::ToString(pElement->Get_PrototypeTag(i)).c_str()); object->InsertEndChild(prototype); } -#pragma endregion +#pragma endregion // PROTOTYPETAG #pragma region TRANSFORM _float3 vPosition = {}; @@ -440,11 +443,11 @@ HRESULT CMapObject_Manager::Save_MapData(const _char* pFileName) Rotation->SetAttribute("y", vRotation.y); Rotation->SetAttribute("z", vRotation.z); object->InsertEndChild(Rotation); -#pragma endregion +#pragma endregion // TRANSFORM } } -#pragma endregion +#pragma endregion // ELEMENT_INTERACTABEL // ?ú?å @@ -1184,8 +1187,6 @@ HRESULT CMapObject_Manager::Save_LightObject(const _char* pFileName) tinyxml2::XMLElement* root = doc.NewElement("MapLightObjects"); doc.InsertEndChild(root); - - if (nullptr != pLayer) { const list* pList = pLayer->Get_Objects(); @@ -1200,7 +1201,6 @@ HRESULT CMapObject_Manager::Save_LightObject(const _char* pFileName) if (FAILED(pElement->Save_XML(doc, root))) return E_FAIL; } -#pragma endregion } if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { @@ -1302,6 +1302,101 @@ HRESULT CMapObject_Manager::Load_LightObject(const _char* pFileName) return S_OK; } +HRESULT CMapObject_Manager::Save_InteractObject(const _char* pFileName) +{ + CLayer* pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Interactable")); + + if (nullptr != pLayer) + return S_OK; + + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + doc.Clear(); + doc.InsertFirstChild(doc.NewDeclaration()); + + tinyxml2::XMLElement* Element_Interactable = doc.NewElement("Element_Interactable"); + doc.InsertEndChild(Element_Interactable); + +#pragma region ELEMENT_INTERACTABEL + + if (nullptr != pLayer) + { + const list* pList = pLayer->Get_Objects(); + + for (auto pGamObject : *pList) + { + CMapElement* pElement = dynamic_cast(pGamObject); + + if (nullptr == pElement) + return E_FAIL; + + if (FAILED(pElement->Save_XML(doc, Element_Interactable))) + return E_FAIL; + } + } +#pragma endregion // ELEMENT_INTERACTABEL + + return S_OK; +} +HRESULT CMapObject_Manager::Load_InteractObject(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Interactable::ELEMENT_INTERACTABLE_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iInteractableID); + + string strTag = {}; + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + /* Transform */ + auto* Position = Object->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + auto* Scale = Object->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + auto* Rotation = Object->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interactable"), &Desc))) + return E_FAIL; + } + MSG_BOX("Successed to Create Interactalbe Element"); + + return S_OK; +} void CMapObject_Manager::Update_PrototypeList() { GUI::Begin("Model Prototype List"); @@ -1594,6 +1689,7 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag) { MAPOBJECT_LOD_DESC Desc = {}; CMapElement_Light::MAPELEMENT_LIGHT_DESC Light_Desc = {}; + CMapElement_Interactable::ELEMENT_INTERACTABLE_DESC Interactable_Desc = {}; vector<_wstring> PrototypeTags; vector<_uint> LodModelIndices; @@ -1607,13 +1703,13 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag) PrototypeTags.push_back(strLodTag); } - Light_Desc.iMaxLodLevel = Desc.iMaxLodLevel = (_uint)LodModelIndices.size() - 1; - Light_Desc.ModelPrototypeTags = Desc.ModelPrototypeTags = PrototypeTags; - Light_Desc.pParentTransform = Desc.pParentTransform = m_pTransformCom; - Light_Desc.vPosition = Desc.vPosition = _float3(0.f, 0.f, 0.f); - Light_Desc.vRotation = Desc.vRotation = _float3(0.f, 0.f, 0.f); - Light_Desc.vScale = Desc.vScale = _float3(1.f, 1.f, 1.f); - Light_Desc.pModelPathIndices =Desc.pModelPathIndices = &LodModelIndices; + Interactable_Desc.iMaxLodLevel = Light_Desc.iMaxLodLevel = Desc.iMaxLodLevel = (_uint)LodModelIndices.size() - 1; + Interactable_Desc.ModelPrototypeTags = Light_Desc.ModelPrototypeTags = Desc.ModelPrototypeTags = PrototypeTags; + Interactable_Desc.pParentTransform = Light_Desc.pParentTransform = Desc.pParentTransform = m_pTransformCom; + Interactable_Desc.vPosition = Light_Desc.vPosition = Desc.vPosition = _float3(0.f, 0.f, 0.f); + Interactable_Desc.vRotation = Light_Desc.vRotation = Desc.vRotation = _float3(0.f, 0.f, 0.f); + Interactable_Desc.vScale = Light_Desc.vScale = Desc.vScale = _float3(1.f, 1.f, 1.f); + Interactable_Desc.pModelPathIndices = Light_Desc.pModelPathIndices =Desc.pModelPathIndices = &LodModelIndices; if (ADD_TYPE::ELEMENT_STATIC == m_eType) { @@ -1621,6 +1717,8 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag) } else if (ADD_TYPE::ELEMENT_INTERACT == m_eType) { + Interactable_Desc.iInteractableID = 0; + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Interact"), &Desc); } else if (ADD_TYPE::ELEMENT_LIGHT == m_eType) diff --git a/Jusin154_Team3D/Editor/Private/Terrain.cpp b/Jusin154_Team3D/Editor/Private/Terrain.cpp index 9cb5a4222..a869ffdb1 100644 --- a/Jusin154_Team3D/Editor/Private/Terrain.cpp +++ b/Jusin154_Team3D/Editor/Private/Terrain.cpp @@ -86,9 +86,9 @@ void CTerrain::Priority_Update(_float fTimeDelta) #pragma endregion #pragma region HEIGHT MAP - //HRESULT hr = {}; - //if(GUI::Button("Save HeightMap")) - // hr = m_pVIBufferCom->Save_HeightMap("Hogsmeade_HeightMap.bin"); + HRESULT hr = {}; + if(GUI::Button("Save HeightMap")) + hr = m_pVIBufferCom->Save_HeightMap("Hogsmeade_HeightMap2.bin"); //if(GUI::Button("Load HeightMap")) // hr = m_pVIBufferCom->Load_HeightMap("Hogsmeade_HeightMap.bin"); #pragma endregion diff --git a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h index 8bb90775e..753024292 100644 --- a/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h +++ b/Jusin154_Team3D/Editor/Public/Dummy_PhysXPlayable.h @@ -1,4 +1,4 @@ -#pragma once + #pragma once #include "Editor_Define.h" #include "GameObject.h" diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 6e637b091..23c900d92 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -45,6 +45,8 @@ namespace Editor }; enum class BLOOM_TYPE { NONE , BASIC , MULTIPLY , END}; + + enum class ELEMENT_INTERACTABLE_ID {BARREL, END}; } using namespace Editor; diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h index fea0da680..9fe03d66e 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Interactable.h @@ -1,12 +1,19 @@ -#pragma once +#pragma once #include "Editor_Define.h" #include "MapElement.h" NS_BEGIN(Editor) -class CMapElement_Interactable : public CMapElement +class CMapElement_Interactable final : public CMapElement { +public: + typedef struct tagElement_Interactable_Desc : MAPOBJECT_LOD_DESC + { + _uint iInteractableID = {}; + _uint iSubKind = {}; + }ELEMENT_INTERACTABLE_DESC; + private: CMapElement_Interactable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CMapElement_Interactable(const CMapElement_Interactable& rhs); @@ -19,7 +26,19 @@ class CMapElement_Interactable : public CMapElement virtual HRESULT Render() override; private: - _uint m_iSaveIndex = {}; // ¿ø·¡ À§ġ ¹޾ƿö§ ÇʿäÇÑ À妽º + ELEMENT_INTERACTABLE_ID m_eInteractableID = { ELEMENT_INTERACTABLE_ID::END}; + + CRigidBody* m_pRigidBody = { nullptr }; + PSX::PxRigidDynamic* m_pActor = { nullptr }; + +#ifdef _DEBUG + _bool m_bUseSelectColor = { true }; + + _float m_fPower = {}; + _float m_fMass = {}; + _float3 m_vBoxSize = {}; +#endif // _DEBUG + private: virtual HRESULT Initialize_Prototype() override; @@ -32,6 +51,7 @@ class CMapElement_Interactable : public CMapElement virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index 586779c86..9f48ed6e1 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -64,6 +64,9 @@ class CMapObject_Manager final : public CGameObject HRESULT Save_LightObject(const _char* pFileName); HRESULT Load_LightObject(const _char* pFileName); + + HRESULT Save_InteractObject(const _char* pFileName); + HRESULT Load_InteractObject(const _char* pFileName); #pragma endregion void Update_PrototypeList(); diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 4f0f2accf..a9bc1ea18 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -114,7 +114,7 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De return E_FAIL; } - m_pResource_Manager = CResource_Manager::Create(*ppDevice, 500); + m_pResource_Manager = CResource_Manager::Create(*ppDevice, 1000); if (nullptr == m_pResource_Manager) { return E_FAIL; } diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp index 205ec83cb..a07fd6f60 100644 --- a/Jusin154_Team3D/Engine/Private/Material.cpp +++ b/Jusin154_Team3D/Engine/Private/Material.cpp @@ -83,7 +83,7 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const aiMaterial* pAI if (FAILED(hr)) { return E_FAIL; } - m_strPath[i].push_back(szSaveDir); + //m_strPath[i].push_back(szSaveDir); m_SRVs[i].push_back(pSRV); } } @@ -353,32 +353,6 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType strTexturePath = CMyTools::ToString(szTextureFilePath); } - //_string strPrefix = "C:"; - //_string strSearchString = "MeshTable"; - //_string strResultPath = {}; - - //size_t mapRePos = strTexturePath.find(strSearchString); - - //if (mapRePos != std::string::npos) - //{ - // size_t startPos = mapRePos + strSearchString.length(); - - // // 'MapRe' 뒤에 오는 경로 건너뛰기 - // if (startPos < strTexturePath.length() && - // (strTexturePath[startPos] == '\\' || strTexturePath[startPos] == '/')) { - // startPos++; - // } - - // // 'MapRe' 이후의 나머지 경로를 추출 - // strResultPath = strTexturePath;//.substr(startPos); - //} - //else - //{ - // MSG_BOX("FAILED to Find Path"); - //} - - //replace(strResultPath.begin(), strResultPath.end(), '\\', '/'); - m_SaveMaterial.Path[ENUM_CLASS(eTexture)].push_back(strTexturePath); m_SRVs[ENUM_CLASS(eTexture)].push_back(pSRV); diff --git a/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp index cab730328..29a6760f8 100644 --- a/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/Resource_Manager.cpp @@ -68,7 +68,7 @@ ID3D11ShaderResourceView* CResource_Manager::Load_SRV(const _char* pFilePath) HRESULT hr = {}; - hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV, 1024); // 일단 dds로 시도하고 + hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고 if (FAILED(hr)) { memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도 strcat_s(szTextureFilePath, szTextureFileName); @@ -87,7 +87,9 @@ ID3D11ShaderResourceView* CResource_Manager::Load_SRV(const _char* pFilePath) return nullptr; m_Resources.emplace(CMyTools::ToWstring(szFileName), pSRV); +#ifdef _DEBUG ++m_iCount; +#endif // _DEBUG return pSRV; } diff --git a/Jusin154_Team3D/Engine/Private/Texture.cpp b/Jusin154_Team3D/Engine/Private/Texture.cpp index f6070ff79..611e7278c 100644 --- a/Jusin154_Team3D/Engine/Private/Texture.cpp +++ b/Jusin154_Team3D/Engine/Private/Texture.cpp @@ -40,11 +40,13 @@ _uint CTexture::Get_Size() { return (_uint)m_SRVs.size(); } - +#ifdef EDITOR_PROJECT _bool CTexture::Compare_GroupName(_wstring wstrGroupName) { return m_wstrPrototypeName == wstrGroupName; } +#endif // EDITOR_PROJECT + #ifdef _DEBUG void CTexture::HoverName() @@ -78,8 +80,10 @@ HRESULT CTexture::Initialize_Prototype(TEXTURE_LOAD_TYPE eType, const _tchar* pT default: break; } - +#ifdef EDITOR_PROJECT m_wstrPrototypeName = wstrPrototypeName; +#endif // EDITOR_PROJECT + return S_OK; } diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 21b640eb4..a9d125084 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -278,11 +278,10 @@ class ENGINE_DLL CGameInstance final : public CBase class CThreadHolder* m_pThreadHolder = { nullptr }; class CFog* m_pFog = { nullptr }; class CResource_Manager* m_pResource_Manager = { nullptr }; + mt19937 m_Rng{ random_device{}() }; - #ifdef _DEBUG private: - _float m_fTimer_PriorityUpdate = { 0.f }; _float m_fTimer_Update = { 0.f }; _float m_fTimer_LateUpdate = { 0.f }; diff --git a/Jusin154_Team3D/Engine/Public/Material.h b/Jusin154_Team3D/Engine/Public/Material.h index ab0c0678b..34b76519b 100644 --- a/Jusin154_Team3D/Engine/Public/Material.h +++ b/Jusin154_Team3D/Engine/Public/Material.h @@ -12,21 +12,24 @@ class ENGINE_DLL CMaterial final : public CBase public: HRESULT Bind_SRV(class CShader* pShader); - SaveMaterial Get_SaveMaterial() { return m_SaveMaterial; } + private: - class CGameInstance* m_pGameInstance = { nullptr }; - ID3D11Device* m_pDevice = { nullptr }; - ID3D11DeviceContext* m_pContext = { nullptr }; + class CGameInstance* m_pGameInstance = { nullptr }; + ID3D11Device* m_pDevice = { nullptr }; + ID3D11DeviceContext* m_pContext = { nullptr }; vector m_SRVs[AI_TEXTURE_TYPE_MAX]; - SaveMaterial m_SaveMaterial; + #ifdef EDITOR_PROJECT public: + SaveMaterial Get_SaveMaterial() { return m_SaveMaterial; } + static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, const aiMaterial* pAIMaterial); static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pMaterialFilePath, const _char* pTextureFilePath); private: - vector m_strPath[AI_TEXTURE_TYPE_MAX]; + SaveMaterial m_SaveMaterial; + HRESULT Initialize(const _char* pModelFilePath, const aiMaterial* pAIMaterial); HRESULT Initialize(const _char* pMaterialFilePath, const _char* pTextureFilePath); HRESULT Read_MaterialFile(const _char* pMaterialFilePath, const _char* pTextureFolderPath); diff --git a/Jusin154_Team3D/Engine/Public/Resource_Manager.h b/Jusin154_Team3D/Engine/Public/Resource_Manager.h index 485d71ce3..3b27f4892 100644 --- a/Jusin154_Team3D/Engine/Public/Resource_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Resource_Manager.h @@ -20,7 +20,10 @@ class CResource_Manager final : public CBase ID3D11ShaderResourceView* Load_SRV(const _char* pFilePath); private: +#ifdef _DEBUG _uint m_iCount = {}; +#endif // DEBUG + ID3D11Device* m_pDevice = { nullptr }; unordered_map<_wstring, ID3D11ShaderResourceView*> m_Resources; diff --git a/Jusin154_Team3D/Engine/Public/Texture.h b/Jusin154_Team3D/Engine/Public/Texture.h index 07a5d1569..eb512a2b6 100644 --- a/Jusin154_Team3D/Engine/Public/Texture.h +++ b/Jusin154_Team3D/Engine/Public/Texture.h @@ -18,7 +18,9 @@ class ENGINE_DLL CTexture final : vector* Get_Texture() { return &m_SRVs; } ID3D11ShaderResourceView* Get_SRV(_uint iTextureIndex); _uint Get_Size(); +#ifdef EDITOR_PROJECT _bool Compare_GroupName(_wstring wstrGroupName); +#endif // #ifdef _DEBUG void HoverName();