diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp
index 9856316b2..418e8082c 100644
--- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp
+++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Level_GamePlay.h"
#include "GameInstance.h"
#include "Level_Loading.h"
@@ -46,7 +46,7 @@ void CLevel_GamePlay::Update(_float fTimeDelta)
HRESULT CLevel_GamePlay::Render()
{
- SetWindowText(g_hWnd, TEXT("°ÔÀÓÇ÷¹À̷¹º§ÀԴϴÙ"));
+ SetWindowText(g_hWnd, TEXT("게임플레이레벨입니다"));
return S_OK;
}
@@ -58,11 +58,12 @@ HRESULT CLevel_GamePlay::Ready_Lights()
LightDesc.vDiffuse = _float4(0.8f, 0.8f, 0.8f, 0.f);
LightDesc.vAmbient = _float4(0.2f, 0.2f, 0.2f, 0.f);
LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 0.f);
- LightDesc.vDirection = _float4(1.f, -1.f, 1.f, 0.f);
+ //LightDesc.vDirection = _float4(1.f, -1.f, 1.f, 0.f);
- if (FAILED(m_pGameInstance->On_Light(NEXT_LEVEL, TEXT("Main_Light"), LightDesc, nullptr))) {
- return E_FAIL;
- }
+ //if (FAILED(m_pGameInstance->On_Light(NEXT_LEVEL, TEXT("Main_Light"), LightDesc, nullptr))) {
+ // return E_FAIL;
+ //}
+ assert(false);
return S_OK;
diff --git a/Jusin154_Team3D/Editor/Private/Body.cpp b/Jusin154_Team3D/Editor/Private/Body.cpp
index b4e5fd68b..8bbe045ff 100644
--- a/Jusin154_Team3D/Editor/Private/Body.cpp
+++ b/Jusin154_Team3D/Editor/Private/Body.cpp
@@ -75,7 +75,7 @@ CBody* CBody::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CBody");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -88,7 +88,7 @@ CGameObject* CBody::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CBody");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Editor/Private/DummyObject.cpp b/Jusin154_Team3D/Editor/Private/DummyObject.cpp
index 10e6d0ea1..a133c2c29 100644
--- a/Jusin154_Team3D/Editor/Private/DummyObject.cpp
+++ b/Jusin154_Team3D/Editor/Private/DummyObject.cpp
@@ -129,7 +129,7 @@ CDummyObject* CDummyObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* p
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CDummyObject");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -142,7 +142,7 @@ CGameObject* CDummyObject::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CDummyObject");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -154,8 +154,8 @@ void CDummyObject::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CDummyObject::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
index af1558f2d..92f3e2ea9 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
@@ -155,8 +155,8 @@ void CDummy_PhysXBox::Free()
__super::Free();
SAFE_RELEASE(m_pRigidBody);
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CDummy_PhysXBox::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
index 395149e83..91a44dfff 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp
@@ -117,9 +117,9 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
Desc.fMaterial = { 0.5f, 0.5f, 0.6f };
Desc.bAutoStepping = { false };
Desc.fStepOffset = { 0.05f };
- Desc.tCapsuleInfo.fRadius = 0.5f;
- Desc.tCapsuleInfo.fHeight = 1.0f;
- Desc.tCapsuleInfo.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
+ Desc.fRadius = 0.5f;
+ Desc.fHeight = 1.0f;
+ Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) {
return E_FAIL;
}
@@ -188,8 +188,8 @@ void CDummy_PhysXPlayable::Free()
__super::Free();
SAFE_RELEASE(m_pCharacter_Controller);
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CDummy_PhysXPlayable::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp b/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp
index 1d379de00..ee746e3a3 100644
--- a/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp
+++ b/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp
@@ -469,11 +469,11 @@ void CEffect_Editor::Describe_Entity()
- Safe_Release(m_pEditEffect);
+ SAFE_RELEASE(m_pEditEffect);
m_pEditEffect = pSelectedEffectObject;
- Safe_AddRef(pSelectedEffectObject);
+ SAFE_ADDREF(pSelectedEffectObject);
m_strCurrentEffectName = strName;
diff --git a/Jusin154_Team3D/Editor/Private/Hair.cpp b/Jusin154_Team3D/Editor/Private/Hair.cpp
index 5950c84d4..309fd1207 100644
--- a/Jusin154_Team3D/Editor/Private/Hair.cpp
+++ b/Jusin154_Team3D/Editor/Private/Hair.cpp
@@ -136,7 +136,7 @@ CHair* CHair::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CHair");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -149,7 +149,7 @@ CGameObject* CHair::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CHair");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Editor/Private/Head.cpp b/Jusin154_Team3D/Editor/Private/Head.cpp
index 58813aed7..e7c43d420 100644
--- a/Jusin154_Team3D/Editor/Private/Head.cpp
+++ b/Jusin154_Team3D/Editor/Private/Head.cpp
@@ -75,7 +75,7 @@ CHead* CHead::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CHead");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -88,7 +88,7 @@ CGameObject* CHead::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CHead");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
index 0f9956dc8..1199726dd 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "MapObject_LOD.h"
#include "GameInstance.h"
@@ -222,10 +222,10 @@ void CMapObject_LOD::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
+ SAFE_RELEASE(m_pShaderCom);
for(auto& pModel : m_pModelComs)
- Safe_Release(pModel);
+ SAFE_RELEASE(pModel);
m_pModelComs.clear();
}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
index 4f23de5b2..8d50b328e 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp
@@ -1084,7 +1084,7 @@ CMapObject_Manager* CMapObject_Manager::Create(ID3D11Device* pDevice, ID3D11Devi
if (FAILED(pInstance->Initialize_Prototype(ModelPrototypeTags, ModelPrototypePaths)))
{
MSG_BOX("Failed to Created : CMapObject_Manager");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -1097,7 +1097,7 @@ CGameObject* CMapObject_Manager::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMapObject_Manager");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
index 69b4f1871..392f83091 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_Static.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "MapObject_Static.h"
#include "GameInstance.h"
@@ -192,8 +192,8 @@ void CMapObject_Static::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CMapObject_Static::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/ModelParts.cpp b/Jusin154_Team3D/Editor/Private/ModelParts.cpp
index c85302a2a..29c049335 100644
--- a/Jusin154_Team3D/Editor/Private/ModelParts.cpp
+++ b/Jusin154_Team3D/Editor/Private/ModelParts.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Body.h"
#include "GameInstance.h"
@@ -138,8 +138,8 @@ void CModelParts::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CModelParts::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Monster.cpp b/Jusin154_Team3D/Editor/Private/Monster.cpp
index a4f7e1b02..728a58183 100644
--- a/Jusin154_Team3D/Editor/Private/Monster.cpp
+++ b/Jusin154_Team3D/Editor/Private/Monster.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Monster.h"
#include "GameInstance.h"
@@ -129,7 +129,7 @@ CMonster* CMonster::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CMonster");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -142,7 +142,7 @@ CGameObject* CMonster::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMonster");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -154,8 +154,8 @@ void CMonster::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
}
void CMonster::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/RootModelPart.cpp b/Jusin154_Team3D/Editor/Private/RootModelPart.cpp
index dee210e73..4bc9d1713 100644
--- a/Jusin154_Team3D/Editor/Private/RootModelPart.cpp
+++ b/Jusin154_Team3D/Editor/Private/RootModelPart.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "RootModelPart.h"
#include "GameInstance.h"
@@ -171,7 +171,7 @@ CRootModelPart* CRootModelPart::Create(ID3D11Device* pDevice, ID3D11DeviceContex
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CRootModelPart");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -184,7 +184,7 @@ CGameObject* CRootModelPart::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CRootModelPart");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Editor/Private/Terrain.cpp b/Jusin154_Team3D/Editor/Private/Terrain.cpp
index 2f5b73f20..693105460 100644
--- a/Jusin154_Team3D/Editor/Private/Terrain.cpp
+++ b/Jusin154_Team3D/Editor/Private/Terrain.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Terrain.h"
#include "GameInstance.h"
@@ -126,7 +126,7 @@ CTerrain* CTerrain::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CTerrain");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -139,7 +139,7 @@ CGameObject* CTerrain::Clone(void* pArg, CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CTerrain");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -149,9 +149,9 @@ void CTerrain::Free()
{
__super::Free();
- Safe_Release(m_pShaderCom);
- Safe_Release(m_pVIBufferCom);
- Safe_Release(m_pTextureCom);
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pVIBufferCom);
+ SAFE_RELEASE(m_pTextureCom);
}
void CTerrain::Describe_Entity()
diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj
index 082db658d..4ece1fa21 100644
--- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj
+++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj
@@ -203,6 +203,7 @@ call Update_Lib.bat
+
@@ -418,6 +419,7 @@ call Update_Lib.bat
+
diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
index 3f754fab2..86210937d 100644
--- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
+++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
@@ -244,6 +244,18 @@
{a60a7ba5-a937-41d7-baac-db67f86f3ba1}
+
+ {05865481-fa20-4432-a5a7-945d4f8c7f3c}
+
+
+ {bed0de44-4e62-4b5f-9767-65cfc8a933a3}
+
+
+ {33ac85a2-be8e-4ad9-a179-1239d818dc9c}
+
+
+ {fda41884-634b-4dd4-8bd2-f6f7ad68ab1f}
+
{7c82051e-19af-4284-8156-16f504db30b6}
@@ -465,6 +477,9 @@
03.Management\03.Light_Manager
+
+ 02.Element\02.Component\08.Character_Controller\Collision_Callback
+
@@ -1046,6 +1061,9 @@
03.Management\03.Light_Manager
+
+ 02.Element\02.Component\08.Character_Controller\Collision_Callback
+
diff --git a/Jusin154_Team3D/Engine/Private/Animation.cpp b/Jusin154_Team3D/Engine/Private/Animation.cpp
index 57c058fec..8fd22f941 100644
--- a/Jusin154_Team3D/Engine/Private/Animation.cpp
+++ b/Jusin154_Team3D/Engine/Private/Animation.cpp
@@ -244,7 +244,7 @@ CAnimation* CAnimation::Create(const CModel* pModel, SaveAnimation* pSaveAnimati
if (FAILED(pInstance->Initialize(pModel, pSaveAnimation)))
{
MSG_BOX("Failed to Created : CAnimation");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/Bone.cpp b/Jusin154_Team3D/Engine/Private/Bone.cpp
index d6c2f9892..3a621f426 100644
--- a/Jusin154_Team3D/Engine/Private/Bone.cpp
+++ b/Jusin154_Team3D/Engine/Private/Bone.cpp
@@ -76,7 +76,7 @@ CBone* CBone::Create(const SaveNode& _SaveNode, _int iParentIndex)
if (FAILED(pInstance->Initialize(_SaveNode, iParentIndex)))
{
MSG_BOX("Failed to Created : CBone");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/Channel.cpp b/Jusin154_Team3D/Engine/Private/Channel.cpp
index 84533dcf4..c1d31901f 100644
--- a/Jusin154_Team3D/Engine/Private/Channel.cpp
+++ b/Jusin154_Team3D/Engine/Private/Channel.cpp
@@ -267,7 +267,7 @@ CChannel* CChannel::Create(const CModel* pModel, SaveChannel* pSaveChannel)
if (FAILED(pInstance->Initialize(pModel, pSaveChannel)))
{
MSG_BOX("Failed to Created : CChannel");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp
index 9dc306cea..ab1f4eacc 100644
--- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp
+++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp
@@ -1,6 +1,7 @@
#include "pch.h"
#include "Character_Controller.h"
#include "GameInstance.h"
+#include "Collision_Callback.h"
CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CComponent{ pDevice, pContext }
@@ -62,6 +63,11 @@ HRESULT CCharacter_Controller::Render()
#endif // _DEBUG
+void CCharacter_Controller::Resize_Volume(_float fHeight)
+{
+ m_pController->resize(fHeight);
+}
+
void CCharacter_Controller::Modify_Volume(_float3 fVolume)
{
switch (m_eBodyType)
@@ -129,18 +135,13 @@ _float3 CCharacter_Controller::Get_Volume()
void CCharacter_Controller::Move(_float fTimeDelta)
{
- PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
- _float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
- _vector vMomentum = m_pTransform->Get_CurrentMomentum();
- XMStoreFloat3((_float3*)&pxVecMomentum, vMomentum);
-
- PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
- const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
+ PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
+ _float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
+ PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
+ const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
+ XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum());
- // eCOLLISION_SIDES = (1 << 0), //!< Character is colliding to the sides.
- // eCOLLISION_UP = (1 << 1), //!< Character has collision above.
- // eCOLLISION_DOWN = (1 << 2) //!< Character has collision below.
m_eBeforeCollisionFlags = m_pController->move(pxVecMomentum, fMinimumDistant, fTimeDelta, pxFilter, pPxObstacles);
@@ -171,11 +172,6 @@ _float3 CCharacter_Controller::Get_FootPosition()
return { (_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z };
}
-void CCharacter_Controller::Resize_Volume(_float fHeight)
-{
- m_pController->resize(fHeight);
-}
-
HRESULT CCharacter_Controller::Initialize_Prototype()
{
return S_OK;
@@ -184,55 +180,90 @@ HRESULT CCharacter_Controller::Initialize_Prototype()
HRESULT CCharacter_Controller::Initialize(void* pArg)
{
Character_Controller_DESC* pDesc = static_cast(pArg);
- m_eBodyType = pDesc->eBodyType;
- m_bAutoStepping = pDesc->bAutoStepping;
- m_pTransform = pDesc->pTransform;
+ { // Character_Controller_DESC
+ m_eBodyType = pDesc->eBodyType;
+ m_bAutoStepping = pDesc->bAutoStepping;
+ m_pTransform = pDesc->pTransform;
+
+ }
+ { // PhsXUserData
+ m_tagData.eKind = PHYSX_KIND::CCTActor;
+ m_tagData.pOwner = m_pOwner;
+ XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
+ m_tagData.pCharacter = this;
+ }
switch (m_eBodyType)
{
case Engine::ACTOR::BOX:
{
PSX::PxBoxControllerDesc Desc{};
- Desc.halfHeight = {};
- Desc.halfSideExtent = {};
- Desc.halfForwardExtent = {};
- Desc.contactOffset = pDesc->fContactOffset;
- Desc.material = m_pGameInstance->Get_Material(&pDesc->fMaterial);
- m_pController = m_pGameInstance->Add_BoxController(Desc);
-#ifdef _DEBUG
- _float3 vVolume = Get_Volume();
- m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vVolume, false, false));
-#endif // _DEBUG
+ Desc.halfHeight = pDesc->vBoxSize.y;
+ Desc.halfSideExtent = pDesc->vBoxSize.x;
+ Desc.halfForwardExtent = pDesc->vBoxSize.z;
+ Desc.contactOffset = pDesc->fContactOffset;
+ Desc.reportCallback = static_cast(pDesc->pCallback);
+ Desc.behaviorCallback = static_cast(pDesc->pCallback);
+ Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
+ m_pController = m_pGameInstance->Add_BoxController(Desc);
+ m_pController->setUserData(&m_tagData);
} break;
case Engine::ACTOR::CAPSULE:
{
PSX::PxCapsuleControllerDesc Desc{};
- Desc.radius = pDesc->tCapsuleInfo.fRadius;
- Desc.height = pDesc->tCapsuleInfo.fHeight;
- Desc.climbingMode = pDesc->tCapsuleInfo.eClimbingMode; // 기본 eEASY
- Desc.contactOffset = pDesc->fContactOffset;
- Desc.material = m_pGameInstance->Get_Material(&pDesc->fMaterial);
- m_pController = m_pGameInstance->Add_CapsuleController(Desc);
-#ifdef _DEBUG
- _float3 vVolume = Get_Volume();
- m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, vVolume.x, 10, false, false));
- m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, vVolume.y, vVolume.x, 10, false));
-#endif // _DEBUG
+ Desc.radius = pDesc->fRadius;
+ Desc.height = pDesc->fHeight;
+ Desc.climbingMode = pDesc->eClimbingMode; // 기본 eEASY
+ Desc.contactOffset = pDesc->fContactOffset;
+ Desc.reportCallback = static_cast(pDesc->pCallback);
+ Desc.behaviorCallback = static_cast(pDesc->pCallback);
+ Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
+ m_pController = m_pGameInstance->Add_CapsuleController(Desc);
+ m_pController->setUserData(&m_tagData);
} break;
default:
assert(false); // PhysX에서 불가능
return E_FAIL;
break;
}
+
if (nullptr == m_pController) {
assert(false);
return E_FAIL;
}
+
m_pController->setSlopeLimit(m_fSlopeLimit);
+#ifdef _DEBUG
+ if (FAILED(Debug_Initialize())) {
+ return E_FAIL;
+ }
+#endif // _DEBUG
+
return S_OK;
}
+#ifdef _DEBUG
+HRESULT CCharacter_Controller::Debug_Initialize()
+{
+ _float3 vVolume = Get_Volume();
+ switch (m_eBodyType)
+ {
+ case ACTOR::BOX:
+ m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, vVolume, false, false));
+ break;
+ case ACTOR::CAPSULE:
+ m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, vVolume.y, vVolume.x, 10, false));
+ m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, vVolume.x, 10, false, false));
+ break;
+ default:
+ break;
+ }
+ return S_OK;
+}
+#endif // _DEBUG
+
+
_bool CCharacter_Controller::Check_Overlap()
{
return _bool();
@@ -295,6 +326,7 @@ void CCharacter_Controller::Describe_Entity()
if (GUI::SliderFloat("StepOffset", &fStepOffset, 0.f, 3.f, "%.2f")) {
m_pController->setStepOffset(fStepOffset);
} GUIHelpMarker("In stepped regions, the tolerance height the controller can climb.\n Capsule behaves slightly differently.");
+
if (ACTOR::CAPSULE == m_eBodyType) {
PSX::PxCapsuleController* pController = (PSX::PxCapsuleController*)m_pController;
@@ -317,6 +349,7 @@ void CCharacter_Controller::Describe_Entity()
GUIHelpMarker("A capsule is affected by its lower sphere and tends to generate an up vector on steps.\nIn eEASY, the up vector is combined with the step offset, allowing easier climbing; in eCONSTRAINED, the up vector is removed during step detection and only the step offset is used.");
}
}
+
if (GUI::SliderFloat3("Volume", (_float*)&vVolume, 0.1f, 10.f, "%.2f")) {
Modify_Volume(vVolume);
}GUIHelpMarker("Box uses vSize; Capsule uses x->fRadius, y->fHeight.\nThe capsule's fHeight is likely the distance from the lower sphere center to the upper sphere center.");
diff --git a/Jusin154_Team3D/Engine/Private/Collision_Callback.cpp b/Jusin154_Team3D/Engine/Private/Collision_Callback.cpp
new file mode 100644
index 000000000..92b8c75bd
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Private/Collision_Callback.cpp
@@ -0,0 +1,116 @@
+#include "pch.h"
+#include "Collision_Callback.h"
+#include "GameInstance.h"
+
+CCollision_Callback::CCollision_Callback()
+{
+}
+
+void CCollision_Callback::onShapeHit(const PSX::PxControllerShapeHit& hit)
+{
+ PSX::PxController* pController = hit.controller;
+ PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
+ PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
+ PSX::PxVec3 vDir = hit.dir; // move 방향
+ _float fLength = hit.length; // move 길이
+
+ PSX::PxShape* pShape = hit.shape;
+ PSX::PxRigidActor* pActor = hit.actor;
+
+
+ if (nullptr != pController && nullptr != pActor) {
+ PhsXUserData* pActorData = static_cast(pActor->userData);
+ assert(nullptr != pActor); // missing user data
+ switch (pActorData->eKind)
+ {
+ case PHYSX_KIND::BODY_STATIC:
+ // action
+ break;
+ case PHYSX_KIND::BODY_DYNAMIC:
+ // action
+ break;
+ case PHYSX_KIND::CCTActor:
+ assert(false);
+ break;
+ case PHYSX_KIND::OBSTACLEActor:
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void CCollision_Callback::onControllerHit(const PSX::PxControllersHit& hit)
+{
+ PSX::PxController* pController = hit.controller;
+ PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
+ PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
+ PSX::PxVec3 vDir = hit.dir; // move 방향
+ _float fLength = hit.length; // move 길이
+
+ PSX::PxController* pOtherController= hit.other; // 다른 컨트롤러
+
+ if (nullptr != pController && nullptr != pOtherController) {
+ PhsXUserData* pActorData = static_cast(pOtherController->getActor()->userData);
+ assert(nullptr != pOtherController); // missing user data
+
+ switch (pActorData->eKind)
+ {
+ case PHYSX_KIND::BODY_STATIC:
+ assert(false);
+ break;
+ case PHYSX_KIND::BODY_DYNAMIC:
+ assert(false);
+ break;
+ case PHYSX_KIND::CCTActor:
+ // Action
+ break;
+ case PHYSX_KIND::OBSTACLEActor:
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void CCollision_Callback::onObstacleHit(const PSX::PxControllerObstacleHit& hit)
+{
+ PSX::PxController* pController = hit.controller;
+ PSX::PxExtendedVec3 vWorldPos = hit.worldPos; // 접촉지점
+ PSX::PxVec3 vWorldNormal = hit.worldNormal; // 접촉노말
+ PSX::PxVec3 vDir = hit.dir; // move 방향
+ _float fLength = hit.length; // move 길이
+
+ const void* pOtherController= hit.userData; // 장애물
+
+ //switch (pOtherController.member)
+ //{
+ //default:
+ // break;
+ //}
+}
+
+PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor)
+{
+ //if (actor.userData.subKind == kMovingPlatformTag)
+ // return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT
+ // | PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
+
+ // 나머지는 아무 특별 동작 없음
+ return PSX::PxControllerBehaviorFlags(0);
+}
+
+PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxController& controller)
+{
+ // CCT끼리 부딪힐 때를 굳이 안 쓰면 0 리턴
+ return PSX::PxControllerBehaviorFlags(0);
+}
+
+PSX::PxControllerBehaviorFlags CCollision_Callback::getBehaviorFlags(const PSX::PxObstacle& obstacle)
+{
+ // Obstacle이 움직이는 발판이다?
+ // 여기서 ride/slide 세팅
+ //return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT;
+
+ return PSX::PxControllerBehaviorFlags();
+}
diff --git a/Jusin154_Team3D/Engine/Private/ComputeShader.cpp b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp
index a2a440903..e1660bda6 100644
--- a/Jusin154_Team3D/Engine/Private/ComputeShader.cpp
+++ b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp
@@ -8,9 +8,9 @@ CComputeShader::CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
, m_pContext{ pContext }
, m_pGameInstance{ CGameInstance::GetInstance() }
{
- Safe_AddRef(m_pDevice);
- Safe_AddRef(m_pContext);
- Safe_AddRef(m_pGameInstance);
+ SAFE_ADDREF(m_pDevice);
+ SAFE_ADDREF(m_pContext);
+ SAFE_ADDREF(m_pGameInstance);
}
HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
@@ -323,7 +323,7 @@ CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContex
if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName, iNumElement, iNumInputBuffer, iNumOutputBuffer, iOutputStructStride, iInputStructStride)))
{
MSG_BOX("Failed to Created : CComputeShader Prototype");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -335,22 +335,22 @@ void CComputeShader::Free()
for (_uint i = 0; i < m_iNumInputBuffer; i++)
{
- Safe_Release(m_pInputSRV[i]);
- Safe_Release(m_pInputBuffer[i]);
- Safe_Release(m_pInputStagingBuffer[i]);
+ SAFE_RELEASE(m_pInputSRV[i]);
+ SAFE_RELEASE(m_pInputBuffer[i]);
+ SAFE_RELEASE(m_pInputStagingBuffer[i]);
}
for (_uint i = 0; i < m_iNumOutputBuffer; i++)
{
- Safe_Release(m_pOutputUAV[i]);
- Safe_Release(m_pOutputBuffer[i]);
- Safe_Release(m_pOutputSRV[i]);
- Safe_Release(m_pOutputStagingBuffer[i]);
+ SAFE_RELEASE(m_pOutputUAV[i]);
+ SAFE_RELEASE(m_pOutputBuffer[i]);
+ SAFE_RELEASE(m_pOutputSRV[i]);
+ SAFE_RELEASE(m_pOutputStagingBuffer[i]);
}
- Safe_Release(m_pComputeShader);
- Safe_Release(m_pDevice);
- Safe_Release(m_pContext);
- Safe_Release(m_pGameInstance);
+ SAFE_RELEASE(m_pComputeShader);
+ SAFE_RELEASE(m_pDevice);
+ SAFE_RELEASE(m_pContext);
+ SAFE_RELEASE(m_pGameInstance);
}
diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp
index 002cfec6d..97d4e7c0f 100644
--- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp
+++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp
@@ -571,7 +571,7 @@ SaveModel* CGameInstance::Load_SaveModel(const _char* filePath)
}
#pragma region PhysX_Manager
-PSX::PxMaterial* CGameInstance::Get_Material(_float3* vMatInfo)
+PSX::PxMaterial* CGameInstance::Create_Material(_float3* vMatInfo)
{
return m_pPhysX_Manager->Create_Material(vMatInfo);
}
@@ -581,11 +581,11 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
}
-const PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
+PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
{
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
}
-const PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
+PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
{
return m_pPhysX_Manager->Add_StaticActor(RigidBody);
}
@@ -605,6 +605,14 @@ void CGameInstance::ReleaseController(_uint iControllerIndex)
{
m_pPhysX_Manager->ReleaseController(iControllerIndex);
}
+void CGameInstance::Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor)
+{
+ m_pPhysX_Manager->Attach_Actor(RigidBody, Actor);
+}
+void CGameInstance::Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor)
+{
+ m_pPhysX_Manager->Detach_Actor(RigidBody, pActor);
+}
HRESULT CGameInstance::ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix)
{
return m_pPhysX_Manager->ConvertToTriMeshes(Meshes, pxTriMeshes, WorldMatrix);
@@ -726,7 +734,6 @@ void CGameInstance::Release_Engine()
{
DestroyInstance();
- SAFE_RELEASE(m_pPhysX_Manager);
SAFE_RELEASE(m_pPicking);
SAFE_RELEASE(m_pCollider_Manager);
SAFE_RELEASE(m_pShadow);
@@ -738,6 +745,7 @@ void CGameInstance::Release_Engine()
SAFE_RELEASE(m_pTimer_Manager);
SAFE_RELEASE(m_pRenderer);
SAFE_RELEASE(m_pObject_Manager);
+ SAFE_RELEASE(m_pPhysX_Manager);
SAFE_RELEASE(m_pLevel_Manager);
SAFE_RELEASE(m_pPrototype_Manager);
SAFE_RELEASE(m_pLight_Manager); // Light Manager�� m_pObject_Manager ���� ���� �ҷ�����
diff --git a/Jusin154_Team3D/Engine/Private/Instance_Model.cpp b/Jusin154_Team3D/Engine/Private/Instance_Model.cpp
index 4a965c17c..1c4321113 100644
--- a/Jusin154_Team3D/Engine/Private/Instance_Model.cpp
+++ b/Jusin154_Team3D/Engine/Private/Instance_Model.cpp
@@ -23,7 +23,7 @@ CInstance_Model::CInstance_Model(const CInstance_Model& rhs)
SAFE_ADDREF(pMesh);
}
- Safe_AddRef(m_pVBInstance);
+ SAFE_ADDREF(m_pVBInstance);
}
#ifdef EDITOR_PROJECT
HRESULT CInstance_Model::Initialize_Prototype(const _char* pModelFilePath, MODEL eType, _fmatrix& PreTransformMatrix, _uint iRootBoneIndex)
@@ -115,10 +115,10 @@ HRESULT CInstance_Model::Load_InstanceModel(HANDLE hFile)
HRESULT CInstance_Model::Change_NumInstance()
{
- Safe_Release(m_pVBInstance);
- Safe_Release(m_pComputeShader);
- Safe_Release(m_pConstantBuffer);
- Safe_Release(m_pParticleValueBuffer);
+ SAFE_RELEASE(m_pVBInstance);
+ SAFE_RELEASE(m_pComputeShader);
+ SAFE_RELEASE(m_pConstantBuffer);
+ SAFE_RELEASE(m_pParticleValueBuffer);
//모든 버퍼를 지우고 재 생성 해야함
@@ -128,12 +128,14 @@ HRESULT CInstance_Model::Change_NumInstance()
if (FAILED(Create_SubResource_Buffer()))
return E_FAIL;
+
+ //시작 시에 인스턴트 버퍼를 구성 해줌
Instane_Buffer_ReStruct();
if (FAILED(Create_CS()))
return E_FAIL;
- //시작 시에 인스턴트 버퍼를 구성 해줌
+
@@ -447,17 +449,17 @@ void CInstance_Model::Free()
{
__super::Free();
- Safe_Release(m_pVBInstance);
+ SAFE_RELEASE(m_pVBInstance);
for (auto& pMesh : m_Meshes)
- Safe_Release(pMesh);
+ SAFE_RELEASE(pMesh);
for (auto& pBone : m_Bones)
- Safe_Release(pBone);
+ SAFE_RELEASE(pBone);
- Safe_Release(m_pComputeShader);
- Safe_Release(m_pConstantBuffer);
- Safe_Release(m_pParticleValueBuffer);
+ SAFE_RELEASE(m_pComputeShader);
+ SAFE_RELEASE(m_pConstantBuffer);
+ SAFE_RELEASE(m_pParticleValueBuffer);
}
void CInstance_Model::Describe_Entity()
diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp
index 0ad54a6c9..40a7335b4 100644
--- a/Jusin154_Team3D/Engine/Private/Material.cpp
+++ b/Jusin154_Team3D/Engine/Private/Material.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Material.h"
#include "GameInstance.h"
#include "Shader.h"
@@ -60,9 +60,9 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const aiMaterial* pAI
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, ".dds");
- hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // ÀϴÜ dds·Î ½õµÇϰí
+ hr = CreateDDSTextureFromFile(m_pDevice, CMyTools::ToWstring(szTextureFilePath).c_str(), nullptr, &pSRV); // 일단 dds로 시도하고
if (FAILED(hr)) {
- memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // ½ÇÆÐÇϸé ¿ø·¡ ȮÀåÀڷÎ ´ٽà ½õµ
+ memset(szTextureFilePath, 0, sizeof(_char) * MAX_PATH); // 실패하면 원래 확장자로 다시 시도
strcat_s(szTextureFilePath, szTextureFileName);
strcat_s(szTextureFilePath, szEXT);
@@ -327,13 +327,13 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
{
size_t startPos = mapRePos + strSearchString.length();
- // 'MapRe' µڿ¡ ¿À´Â °æ·Î °dzʶٱâ
+ // 'MapRe' 뒤에 오는 경로 건너뛰기
if (startPos < strTexturePath.length() &&
(strTexturePath[startPos] == '\\' || strTexturePath[startPos] == '/')) {
startPos++;
}
- // 'MapRe' ÀÌÈÄÀÇ ³ª¸ÓÁö °æ·θ¦ ÃßÃâ
+ // 'MapRe' 이후의 나머지 경로를 추출
strResultPath = strPrefix + strTexturePath.substr(startPos);
}
else
@@ -350,19 +350,19 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
}
HRESULT CMaterial::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
{
- // ½ÇÁ¦ °ªÀ» ÀúÀåÇÏÁö ¾ʰí ÆÄÀÏÀ̸§.ȮÀåÀڸíÀÇ ¹®ÀڿÀ» ÀúÀåÇؼ ¼öÁ¤Çϱâ ÆíÇϰÔ ¸¸µé±â
- // ´ë½Å ¸®¼ҽº¸¦ °øÀ¯ÇؾßÇÔ
- // ÅؽºÃĸ¦ ÀúÀåÇÏÁö ¾ʰí
- // ÅؽºÃÄ °æ·θ¸ ( "À̸§.ȮÀåÀÚ" ) ¸¸ ÀúÀåÇÔ
+ // 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
+ // 대신 리소스를 공유해야함
+ // 텍스쳐를 저장하지 않고
+ // 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
for (int i = 0; i < AI_TEXTURE_TYPE_MAX; ++i) {
_uint iNumSrv = (_uint)m_strPath[i].size();
- WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // Á¾·ù ÀúÀå
- WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // Á¾·ùÀÇ °¹¼ö ÀúÀå
+ WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
+ WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
for (_uint j = 0; j < iNumSrv; ++j) {
m_strPath[i][j].shrink_to_fit();
_uint strLength = (_uint)(sizeof(_char) * m_strPath[i][j].length());
- WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // »çÀÌÁî ÀúÀå
- WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // ½ÇÁ¦ °ª ÀúÀå
+ WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
+ WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
}
}
return S_OK;
@@ -452,7 +452,7 @@ CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
if (FAILED(pInstance->Initialize(pModelFilePath, _SaveMaterial)))
{
MSG_BOX("Failed to Created : CMaterial");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/Mesh.cpp b/Jusin154_Team3D/Engine/Private/Mesh.cpp
index 4305bda17..6861970b3 100644
--- a/Jusin154_Team3D/Engine/Private/Mesh.cpp
+++ b/Jusin154_Team3D/Engine/Private/Mesh.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Mesh.h"
#include "Model.h"
#include "Bone.h"
@@ -154,7 +154,7 @@ HRESULT CMesh::Render_Instance(_uint iNumInstance)
HRESULT CMesh::Initialize_Prototype(HANDLE hFile, DWORD& dwByte)
{
- { // ¸â¹öº¯¼ö
+ { // 멤버변수
if (!ReadFile(hFile, &m_iMaterialIndex, sizeof(_uint), &dwByte, nullptr)) {
return E_FAIL;
}
@@ -535,7 +535,7 @@ CMesh* CMesh::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL
HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
{
- { // ¸â¹öº¯¼ö
+ { // 멤버변수
WriteFile(hFile, &m_iMaterialIndex, sizeof(_uint), &dwByte, nullptr);
WriteFile(hFile, &m_iNumVertexBuffers, sizeof(_uint), &dwByte, nullptr);
WriteFile(hFile, &m_iNumVertices, sizeof(_uint), &dwByte, nullptr);
@@ -556,7 +556,7 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
}
{ // Vertex Buffer
D3D11_BUFFER_DESC VBDesc{};
- m_pVB->GetDesc(&VBDesc); // ¹öÆÛ µð½ºũ¸³¼Ç ÀúÀå
+ m_pVB->GetDesc(&VBDesc); // 버퍼 디스크립션 저장
WriteFile(hFile, &VBDesc, sizeof(D3D11_BUFFER_DESC), &dwByte, nullptr);
D3D11_BUFFER_DESC StagingDesc{};
@@ -570,7 +570,7 @@ HRESULT CMesh::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
if (FAILED(m_pDevice->CreateBuffer(&StagingDesc, nullptr, &pStaging)) || nullptr == pStaging) {
return E_FAIL;
}
- m_pContext->CopyResource(pStaging, m_pVB); // ¹öÆÛ º¹»ç
+ m_pContext->CopyResource(pStaging, m_pVB); // 버퍼 복사
D3D11_MAPPED_SUBRESOURCE mapped{};
m_pContext->Map(pStaging, 0, D3D11_MAP_READ, 0, &mapped);
@@ -799,7 +799,7 @@ CMesh* CMesh::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL
if (FAILED(pInstance->Initialize_Prototype(eType, pModel, _SaveMesh, PreTransformMatrix)))
{
MSG_BOX("Failed to Created : CMesh");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp
index cd5c2f967..2758b0339 100644
--- a/Jusin154_Team3D/Engine/Private/Model.cpp
+++ b/Jusin154_Team3D/Engine/Private/Model.cpp
@@ -1113,7 +1113,7 @@ CModel* CModel::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MOD
if (FAILED(pInstance->Initialize_Prototype(eType, pModelFilePath, PreTransformMatrix)))
{
MSG_BOX("Failed to Created : CModel");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
index 7ffca330b..c62c73e1f 100644
--- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
+++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
@@ -5,19 +5,6 @@
#include "RigidBody.h"
#include "Mesh.h"
-static PSX::PxTransform XMWorldToPx_NoScale(const _matrix& WorldMatrix)
-{
- _vector vPos, vRotq, vScale;
- XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
-
- vRotq = XMQuaternionNormalize(vRotq);
-
- PSX::PxTransform out;
- XMStoreFloat3((_float3*)&out.p, vPos);
- XMStoreFloat4((_float4*)&out.q, vRotq);
- return out;
-}
-
CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :
m_pDevice(pDevice),
m_pContext(pContext),
@@ -28,15 +15,13 @@ CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
SAFE_ADDREF(m_pGameInstance);
}
-const PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
+PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
{
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
// PxRigidDynamic 씬의 동적 바디 인터페이스
PSX::PxRigidDynamic* pActorDynamic = m_pPhysics->createRigidDynamic(pxWorldMatrix);
- pActorDynamic->userData = &RigidBody;
-
PSX::PxShape* pShape = nullptr;
PSX::PxGeometryHolder geoHolder = {};
@@ -78,21 +63,18 @@ const PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBod
PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density());
}
- m_RigidBodys.emplace_back(&RigidBody, pActorDynamic);
- m_pScene->addActor(*pActorDynamic);
+ Attach_Actor(RigidBody, *pActorDynamic);
return pActorDynamic;
}
-const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
+PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
{
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
// PxRigidStatic 씬의 정적 바디 인터페이스
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
- pActor->userData = &RigidBody;
-
PSX::PxShape* pShape = { nullptr };
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey());
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
@@ -136,8 +118,8 @@ const PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
pShape->setContactOffset(RigidBody.Get_ContactOffset());
pShape->setRestOffset(0.f);
- m_RigidBodys.emplace_back(&RigidBody, pActor);
- m_pScene->addActor(*pActor);
+
+ Attach_Actor(RigidBody, *pActor);
return pActor;
}
@@ -330,15 +312,18 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
PSX::PxActor** ppActiveActors = m_pScene->getActiveActors(iNumActiveActor);
for (PSX::PxU32 i = 0; i < iNumActiveActor; ++i) {
+ PhsXUserData* pUserData = (PhsXUserData*)ppActiveActors[i]->userData;
PSX::PxRigidDynamic* pActorDynamic = ppActiveActors[i]->is();
-
if (nullptr != pActorDynamic) {
if (nullptr == ppActiveActors[i]->userData) {
continue;
}
- CTransform* pTransform = ((CRigidBody*)ppActiveActors[i]->userData)->Get_TransformPtr();
+ CTransform* pTransform = pUserData->pOwner->Get_Component();
+
+
+ // PSX::PxTransform pPrevPxTransform = pUserData->m_BeforeMatrix;
+ // XMMatrixDecompose(nullptr, (_vector*)&pPrevPxTransform.q, (_vector*)&pPrevPxTransform.p, XMLoadFloat4x4(&pUserData->m_BeforeMatrix));
- PSX::PxTransform pPrevPxTransform;
PSX::PxTransform pPxTransform = pActorDynamic->getGlobalPose();
_float3 vOriginalScale = pTransform->Get_Scale();
_matrix WorldMatrix = {};
@@ -354,21 +339,21 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
//}
}
-void CPhysX_Manager::Update_Dynamic_AllActors()
-{
- for (pair& pairActors : m_RigidBodys) {
- PSX::PxRigidDynamic* pActorDynamic = pairActors.second->is();
- if (nullptr != pActorDynamic) {
- CTransform* pTransform = ((CRigidBody*)(pActorDynamic->userData))->Get_TransformPtr();
-
- PSX::PxTransform pxTransform = pActorDynamic->getGlobalPose();
- _float3 vOriginalScale = pTransform->Get_Scale();
- _matrix WorldMatrix = {};
- WorldMatrix = XMMatrixAffineTransformation(XMLoadFloat3(&vOriginalScale), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMLoadFloat3((_float3*)&pxTransform.p));
- pTransform->Set_WorldMatrix(WorldMatrix);
- }
- }
-}
+//void CPhysX_Manager::Update_Dynamic_AllActors()
+//{
+// for (pair& pairActors : m_RigidBodys) {
+// PSX::PxRigidDynamic* pActorDynamic = pairActors.second->is();
+// if (nullptr != pActorDynamic) {
+// CTransform* pTransform = ((CRigidBody*)(pActorDynamic->userData))->Get_TransformPtr();
+//
+// PSX::PxTransform pxTransform = pActorDynamic->getGlobalPose();
+// _float3 vOriginalScale = pTransform->Get_Scale();
+// _matrix WorldMatrix = {};
+// WorldMatrix = XMMatrixAffineTransformation(XMLoadFloat3(&vOriginalScale), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMLoadFloat3((_float3*)&pxTransform.p));
+// pTransform->Set_WorldMatrix(WorldMatrix);
+// }
+// }
+//}
void CPhysX_Manager::ClearScene()
{
@@ -376,6 +361,32 @@ void CPhysX_Manager::ClearScene()
pObject.second->release();
} m_RigidBodys.clear();
}
+void CPhysX_Manager::Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor)
+{
+ if (m_pScene == nullptr){
+ return;
+ }
+
+ m_RigidBodys.emplace_back(&RigidBody, &Actor);
+ m_pScene->addActor(Actor);
+}
+
+void CPhysX_Manager::Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor)
+{
+ if (m_pScene == nullptr){
+ return;
+ }
+
+ list>::iterator iter = m_RigidBodys.begin();
+ for (; iter != m_RigidBodys.end(); ++iter){
+ if ((*iter).second == pActor) {
+ m_RigidBodys.erase(iter);
+ break;
+ }
+ }
+
+ m_pScene->removeActor(*pActor);
+}
PSX::PxController* CPhysX_Manager::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc)
{
@@ -433,7 +444,6 @@ HRESULT CPhysX_Manager::Initialize()
assert(false);
}
-
{ // 씬 세팅
m_ToleranceScale.length = 1.f; // 1 meter
m_ToleranceScale.speed = GRAVITY; //
@@ -453,17 +463,42 @@ HRESULT CPhysX_Manager::Initialize()
return E_FAIL;
}
sceneDesc.cpuDispatcher = m_pDispatcher;
+ //sceneDesc.simulationEventCallback = ; // fetchResults 때 불림. 아래 필터랑, pair랑 같이 짝꿍임. 좀 더 공부해야 쓸 수 있을듯;;
+ sceneDesc.filterShader = PSX::PxDefaultSimulationFilterShader; // 레이어 충돌, 오브젝트에 속성을 주고 복잡한 필터링 충돌 식
+ sceneDesc.flags =
+ PSX::PxSceneFlag::eENABLE_PCM // 기본 true, 현대적인 충돌시스템 적용
+ | PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS // 현재 움직임이 있는 액터만 가져옴
+ | PSX::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS // 그중에 키네틱은 뺌
+ | PSX::PxSceneFlag::eENABLE_CCD // CCD 기본플래그, 키면 비쌈. 단일오브젝트만 켤 수 있으니 선택적으로 고려
+ | PSX::PxSceneFlag::eDISABLE_CCD_RESWEEP // CCD 옵션플래그, 정확도 낮추고 비용 아낌
+ //| PSX::PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE // 접촉 리포트버퍼 리사이즈 금지 -> 보통 끔
+ //| PSX::PxSceneFlag::eDISABLE_CONTACT_CACHE // 접촉 캐시를 금지 -> 그냥 켜두자, 캐시 있는게 보통 더 낫다
+ //| PSX::PxSceneFlag::eREQUIRE_RW_LOCK // 멀티스레딩 환경에서 혹시라도 락 걸고 접근하지 않아 발생할 일을 제거,
+ //| PSX::PxSceneFlag::eENABLE_STABILIZATION // 물체가 얽힌 상황에서 불안정한걸 방지. 추가비용인듯
+ //| PSX::PxSceneFlag::eENABLE_AVERAGE_POINT // 이해 못하겠음
+ //| PSX::PxSceneFlag::eEnable_GPU_Dynamics // 피직스 그래픽가속 설정. 여기선 세팅 안돼서 비활성화ㅏ
+ //| PSX::PxSceneFlag::eEnable_Direct_GPU_API // 직접 그래픽버퍼를 다루게끔 설정
+ //| PSX::PxSceneFlag::eEnable_Enhanced_Determinism // 중간에 액터 추가해도 결과가 바뀌지 않는 결정론 수준 향상, 리플레이기능 ㅇㅇ
+ //| PSX::PxSceneFlag::eENABLE_FRICTION_EVERY_ITERATION // 마찰 꼐산 추가
+ //| PSX::PxSceneFlag::eENABLE_EXTERNAL_FORCES_EVERY_ITERATION_TGS // 중력 나눠서 여러번 적용
+ //| PSX::PxSceneFlag::eENABLE_PCM // 기본 true
+ //| PSX::PxSceneFlag::eENABLE_BODY_ACCELERATIONS // 선형 각가속도 값을 쿼리가능하도록 설정
+ //| PSX::PxSceneFlag::eEnable_solver_residual_reporting // 고급 디버깅, 연구 용
+ //| PSX::PxSceneFlag::eSOLVE_ARTICULATION_CONTACT_LAST 물리 관절 처리 시나리오 순서 변경
+ ;
- sceneDesc.filterShader = PSX::PxDefaultSimulationFilterShader;
-
- sceneDesc.flags = PSX::PxSceneFlag::eENABLE_PCM | PSX::PxSceneFlag::eENABLE_CCD| PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS | PSX::PxSceneFlag::eEXCLUDE_KINEMATICS_FROM_ACTIVE_ACTORS;
if (false == sceneDesc.isValid()) {
assert(false);
return E_FAIL;
}
+
m_pScene = m_pPhysics->createScene(sceneDesc);
+
+ // CCT
m_pCCTManager = PxCreateControllerManager(*m_pScene);
- m_pCCTManager->setOverlapRecoveryModule(false);
+ m_pCCTManager->setOverlapRecoveryModule(true); // 복구모듈은 하이트필드에는 적용되지 않음, 오직 스태틱만 대상
+ m_pCCTManager->setPreciseSweeps(true); // 정밀 스윕
+ m_pCCTManager->setPreventVerticalSlidingAgainstCeiling(false); // 천장타고 슬라이딩 허용 비허용
}
// 디버그서버의 클라 세팅
diff --git a/Jusin154_Team3D/Engine/Private/Picking.cpp b/Jusin154_Team3D/Engine/Private/Picking.cpp
index 9d4ab103a..316c3fafb 100644
--- a/Jusin154_Team3D/Engine/Private/Picking.cpp
+++ b/Jusin154_Team3D/Engine/Private/Picking.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Picking.h"
#include "GameInstance.h"
@@ -7,9 +7,9 @@ CPicking::CPicking(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
, m_pContext{ pContext }
, m_pGameInstance{ CGameInstance::GetInstance() }
{
- Safe_AddRef(m_pDevice);
- Safe_AddRef(m_pContext);
- Safe_AddRef(m_pGameInstance);
+ SAFE_ADDREF(m_pDevice);
+ SAFE_ADDREF(m_pContext);
+ SAFE_ADDREF(m_pGameInstance);
}
HRESULT CPicking::Initialize(HWND hWnd, _uint iSizeX, _uint iSizeY)
@@ -90,7 +90,7 @@ CPicking* CPicking::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext,
if (FAILED(pInstance->Initialize(hWnd, iSizeX, iSizeY)))
{
MSG_BOX("Failed to Created : CPicking");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -100,9 +100,9 @@ void CPicking::Free()
{
__super::Free();
- Safe_Release(m_pDevice);
- Safe_Release(m_pContext);
- Safe_Release(m_pTexture2D);
- Safe_Release(m_pGameInstance);
+ SAFE_RELEASE(m_pDevice);
+ SAFE_RELEASE(m_pContext);
+ SAFE_RELEASE(m_pTexture2D);
+ SAFE_RELEASE(m_pGameInstance);
Safe_Delete_Array(m_pPixels);
}
diff --git a/Jusin154_Team3D/Engine/Private/RigidBody.cpp b/Jusin154_Team3D/Engine/Private/RigidBody.cpp
index 803097118..be78ff429 100644
--- a/Jusin154_Team3D/Engine/Private/RigidBody.cpp
+++ b/Jusin154_Team3D/Engine/Private/RigidBody.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "RigidBody.h"
#include "GameInstance.h"
#include "GameObject.h"
@@ -53,6 +53,25 @@ HRESULT CRigidBody::Render()
}
#endif // _DEBUG
+void CRigidBody::Set_Kinematic(_bool bKinematic)
+{
+ static_cast(m_pRigidBody)->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic);
+}
+
+void CRigidBody::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType)
+{
+ PSX::PxVec3 vPxForce = {};
+ XMStoreFloat3((_float3*)&vPxForce, vForce);
+ static_cast(m_pRigidBody)->addForce(vPxForce, eType);
+}
+
+void CRigidBody::Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType)
+{
+ PSX::PxVec3 vPxTorque = {};
+ XMStoreFloat3((_float3*)&vPxTorque, vDirection);
+ static_cast(m_pRigidBody)->addForce(vPxTorque, eType);
+}
+
HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
{
m_eActorType = Desc.eType;
@@ -63,11 +82,6 @@ HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
m_fContactOffset = Desc.fContactOffset;
m_vhalfGeometryInfo = Desc.vhalfGeometryInfo;
m_fDensity = Desc.fDensity;
-#ifdef _DEBUG
- if (FAILED(Add_DebugShape())) {
- return E_FAIL;
- }
-#endif // _DEBUG
return S_OK;
}
@@ -102,13 +116,62 @@ HRESULT CRigidBody::Initialize(void* pArg)
default:
break;
}
+
+ Initialize_UserData();
+ m_pRigidBody->userData = &m_tagData;
+
+
+
#ifdef _DEBUG
- Add_DebugShape();
+ if (FAILED(Add_DebugShape())) {
+ return E_FAIL;
+ }
#endif // _DEBUG
return S_OK;
}
+HRESULT CRigidBody::Initialize_UserData()
+{
+ switch (m_eActorType)
+ {
+ case Engine::ACTOR::BOX:
+ m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
+ m_tagData.pOwner = m_pOwner;
+ XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
+ m_tagData.pBody = this;
+ break;
+ case Engine::ACTOR::CAPSULE:
+ m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
+ m_tagData.pOwner = m_pOwner;
+ XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
+ m_tagData.pBody = this;
+ break;
+ case Engine::ACTOR::SPHERE:
+ m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
+ m_tagData.pOwner = m_pOwner;
+ XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
+ m_tagData.pBody = this;
+ break;
+ case Engine::ACTOR::PLANE:
+ break;
+ case Engine::ACTOR::TRIANGLEMESH:
+ m_tagData.eKind = PHYSX_KIND::BODY_STATIC;
+ m_tagData.pOwner = m_pOwner;
+ XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
+ m_tagData.pBody = this;
+ break;
+ case Engine::ACTOR::HEIGHTFIELD:
+ break;
+ case Engine::ACTOR::END:
+ break;
+ default:
+ break;
+ }
+
+ return S_OK;
+}
+
#ifdef _DEBUG
HRESULT CRigidBody::Add_DebugShape()
{
@@ -161,6 +224,9 @@ CComponent* CRigidBody::Clone(void* pArg, CGameObject* pOwner)
void CRigidBody::Free()
{
+ if (nullptr != m_pRigidBody) {
+ m_pRigidBody = nullptr;
+ }
__super::Free();
SAFE_RELEASE(m_pTransform);
diff --git a/Jusin154_Team3D/Engine/Private/Shader.cpp b/Jusin154_Team3D/Engine/Private/Shader.cpp
index 925ffeeb5..b10c8276f 100644
--- a/Jusin154_Team3D/Engine/Private/Shader.cpp
+++ b/Jusin154_Team3D/Engine/Private/Shader.cpp
@@ -19,10 +19,10 @@ CShader::CShader(const CShader& rhs)
, m_iNumElements{ rhs.m_iNumElements }
#endif
{
- Safe_AddRef(m_pEffect);
+ SAFE_ADDREF(m_pEffect);
for (auto& pInputLayout : m_InputLayouts)
- Safe_AddRef(pInputLayout);
+ SAFE_ADDREF(pInputLayout);
}
HRESULT CShader::Initialize_Prototype(const _tchar* pShaderFilePath, const D3D11_INPUT_ELEMENT_DESC* pElements, _uint iNumElements)
@@ -155,6 +155,7 @@ HRESULT CShader::CreateShader(const _tchar* pShaderFilePath, const D3D11_INPUT_E
iNumElements,
PassDesc.pIAInputSignature/*쉐이더에서 받아줄수 있는 정점의 정보*/,
PassDesc.IAInputSignatureSize/*쉐이더에서 받아줄수 있는 정점의 멤버변수갯수*/,
+
&pInputLayout)))
return E_FAIL;
@@ -168,6 +169,7 @@ HRESULT CShader::CreateShader(const _tchar* pShaderFilePath, const D3D11_INPUT_E
HRESULT CShader::Shader_Refresh()
{
// 내 인풋 레이아웃 이펙트 소멸시키고
+
Safe_Release(m_pEffect);
for (auto& pInputLayout : m_InputLayouts)
@@ -175,8 +177,8 @@ HRESULT CShader::Shader_Refresh()
m_InputLayouts.clear();
-
//그 경로로 재 생성한다.
+
if (FAILED(CreateShader(m_strShaderPath.c_str(), m_pElements, m_iNumElements)))
{
MessageBox(NULL, L"쉐이더 변경 실패", L"System Message", MB_OK);
@@ -201,6 +203,7 @@ HRESULT CShader::Begin(_uint iPassIndex)
/* Apply를 반드시 호출해야만 쉐이더로 그려진다. */
/* Apply이전에 쉐이더에 전달할 모든 데이터들을 다 던져놓아야한다. */
+
m_pEffect->GetTechniqueByIndex(0)->GetPassByIndex(iPassIndex)->Apply(0, m_pContext);
return S_OK;
@@ -213,7 +216,7 @@ CShader* CShader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, c
if (FAILED(pInstance->Initialize_Prototype(pShaderFilePath, pElements, iNumElements)))
{
MSG_BOX("Failed to Created : CShader");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -226,7 +229,7 @@ CComponent* CShader::Clone(void* pArg, class CGameObject* pOwner)
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CShader");
- Safe_Release(pInstance);
+ SAFE_RELEASE(pInstance);
}
return pInstance;
@@ -236,10 +239,10 @@ void CShader::Free()
{
__super::Free();
- Safe_Release(m_pEffect);
+ SAFE_RELEASE(m_pEffect);
for (auto& pInputLayout : m_InputLayouts)
- Safe_Release(pInputLayout);
+ SAFE_RELEASE(pInputLayout);
m_InputLayouts.clear();
}
diff --git a/Jusin154_Team3D/Engine/Public/Character_Controller.h b/Jusin154_Team3D/Engine/Public/Character_Controller.h
index c633c6a49..baf5c7826 100644
--- a/Jusin154_Team3D/Engine/Public/Character_Controller.h
+++ b/Jusin154_Team3D/Engine/Public/Character_Controller.h
@@ -8,55 +8,57 @@ class ENGINE_DLL CCharacter_Controller final :
{
/* dev-treadmill.tistory.com/158 */
/* dev-treadmill.tistory.com/159 */
+ // 기본적으로 아무 힘도 받지 않는, 주지 않는 놈임
+ // kinematic 기반임
public:
#pragma region STRUCT
struct CapsuleInfo
{
- _float fRadius;
- _float fHeight;
- PSX::PxCapsuleClimbingMode::Enum eClimbingMode; // 기본 (eEASY, stepOffset 값이 무제한), (eCONSTRAINED, stepOffset 값이 제대로 먹음)
};
typedef struct tagCharacter_ControllerDesc
{
- CTransform* pTransform = { nullptr };
- ACTOR eBodyType = { ACTOR::END };
- _float fContactOffset = { 0.f };
- _float3 fMaterial = { 0.5f, 0.5f, 0.6f };
- _bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
- _float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
+ CTransform* pTransform = { nullptr };
+ ACTOR eBodyType = { ACTOR::END };
+ _float fContactOffset = { 0.f };
+ _float3 fMaterial = { 0.5f, 0.5f, 0.6f };
+ _bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
+ _float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
- function funcHitCallback = { nullptr };
- function funcBehaviorCallback = { nullptr };
+ void* pCallback = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 CCollision_Callback 을 구현해야함
// 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨
// _float fSlopeLimit = { 코사인각도 };
- union
- {
- _float3 vBoxSize; // 박스는 AABB임
- CapsuleInfo tCapsuleInfo;
- };
+
+
+ // Box인 경우 채워넣기
+ _float3 vBoxSize = { 0.5f, 0.5f, 0.5f }; // CCT박스는 회전없는 AABB임
+
+ // Capsule인 경우 채워넣기
+ _float fRadius;
+ _float fHeight;
+ PSX::PxCapsuleClimbingMode::Enum eClimbingMode; // 기본 (eEASY, stepOffset 값이 무제한), (eCONSTRAINED, stepOffset 값이 제대로 먹음)
}Character_Controller_DESC;
#pragma endregion
private:
CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CCharacter_Controller(const CCharacter_Controller& rhs);
virtual ~CCharacter_Controller() = default;
+
public:
#ifdef _DEBUG
virtual HRESULT Render() override;
#endif
_float Get_ContactOffset() const { return m_pController->getContactOffset(); }
- void Set_ContactOffset(_float fValue) const { return m_pController->setContactOffset((PSX::PxF32)fValue); }
+ void Set_ContactOffset(_float fValue) { return m_pController->setContactOffset((PSX::PxF32)fValue); }
- void Move(_float fTimeDelta); // 이동
+ void Move(_float fTimeDelta); // 이동 // 충돌보정만 있음,
void Set_Position(_fvector vNewPos); // 순간이동
_vector Get_Position();
- _float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 더 아래에 위치한다는 뜻 )
+ _float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
-
- void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
+ void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
void Modify_Volume(_float3 fVolume);
_float3 Get_Volume();
@@ -65,12 +67,10 @@ class ENGINE_DLL CCharacter_Controller final :
PSX::PxController* m_pController = { nullptr };
CTransform* m_pTransform = { nullptr };
_bool m_bAutoStepping = { false };
- _float m_fSlopeLimit = { 0.f }; // cosf
+ _float m_fSlopeLimit = { 0.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
+ PhsXUserData m_tagData = {};
-
- function m_funcHitCallback = { nullptr };
- function m_funcBehaviorCallback = { nullptr };
- PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};;
+ PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
#ifdef _DEBUG
unique_ptr m_pMainShape = { nullptr };
unique_ptr m_pSubShape = { nullptr };
@@ -79,6 +79,10 @@ class ENGINE_DLL CCharacter_Controller final :
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
+#ifdef _DEBUG
+ virtual HRESULT Debug_Initialize();
+#endif // _DEBUG
+
_bool Check_Overlap();
diff --git a/Jusin154_Team3D/Engine/Public/Collision_Callback.h b/Jusin154_Team3D/Engine/Public/Collision_Callback.h
new file mode 100644
index 000000000..d413812ce
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Public/Collision_Callback.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "Base.h"
+
+class CCollision_Callback final : public PSX::PxUserControllerHitReport, PSX::PxControllerBehaviorCallback
+{
+ // 구현 예시
+ // CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
+ //
+ // PxUserControllerHitReport = "무엇과 부딪혔는지 알려줌(이벤트 알림)"
+ // PxControllerBehaviorCallback = "부딪힌 것에 대해 어떤 행동 정책을 쓸지 물어봄(질의)"
+ // PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
+
+public:
+ NO_COPY(CCollision_Callback)
+ CCollision_Callback();
+ ~CCollision_Callback()=default;
+
+public:
+ // PxUserControllerHitReport을(를) 통해 상속됨
+ // 충돌알림!!
+ // 주인이 되는 CCT가 이 물체에 대해 어떻게 반응해야 할까?
+ virtual void onShapeHit(const PSX::PxControllerShapeHit& hit) override; // statc, rigid 등과 부딪힌 경우
+
+ virtual void onControllerHit(const PSX::PxControllersHit& hit) override; // 다른 CCT와 부딪힌 경우
+
+ virtual void onObstacleHit(const PSX::PxControllerObstacleHit& hit) override; // 사용자 정의 장애물과 부딪힌 경우
+
+
+ // PxControllerBehaviorCallback을(를) 통해 상속됨
+ // 충돌알림이 아닌, 행동정책 정해주기. CCT vs CCT는 지원안함
+ // slopeLimit로 미끄러져 갈 수 있는지 없는지 이분법적인 계산 대신, 원하는 물체에 대해서만 미끄러운 표면으로 정의해줌
+ // 주인이 되는 CCT가 이 물체에 대해 이 물체를 어떻게 해야 할까? -> (타고 올라갈까? Ride?) (미끄러져갈까? Slide?) ( 직접 내가 구현할까? user defined ride? )
+ virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor) override;
+
+ virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxController& controller) override;
+
+ virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxObstacle& obstacle) override;
+};
+
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
index 639e278be..32fb7e138 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
@@ -73,11 +73,11 @@ enum aiTextureType {
#endif // !EDITOR_PROJECT
enum class PHYSX_KIND {
- NOT_DEFINED = 0,
- CCTActor = 1,
- OBSTACLEActor = 2,
- BODY_STATIC = 3,
- BODY_DYNAMIC = 4,
+ NOT_DEFINED,
+ BODY_STATIC,
+ BODY_DYNAMIC,
+ CCTActor,
+ OBSTACLEActor,
};
NS_END
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Function.h b/Jusin154_Team3D/Engine/Public/Engine_Function.h
index 2937e7b56..6ce4121da 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Function.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Function.h
@@ -24,7 +24,7 @@ void Safe_Delete_Array(T& Pointer)
}
template
-unsigned long Safe_AddRef(T& pInstance)
+unsigned long SAFE_ADDREF(T& pInstance)
{
unsigned long dwRefCnt = 0;
@@ -47,6 +47,19 @@ unsigned long Safe_Release(T& pInstance)
return dwRefCnt;
}
+static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix)
+{
+ _vector vPos, vRotq, vScale;
+ XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
+
+ vRotq = XMQuaternionNormalize(vRotq);
+
+ PSX::PxTransform out;
+ XMStoreFloat3((_float3*)&out.p, vPos);
+ XMStoreFloat4((_float4*)&out.q, vRotq);
+ return out;
+}
+
static void GUIHelpMarker(const char* desc)
{
GUI::SameLine();
@@ -60,4 +73,4 @@ static void GUIHelpMarker(const char* desc)
}
}
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h
index e6fb9b42c..00bf5e20e 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h
@@ -140,4 +140,4 @@ constexpr unsigned int g_iMaxShadowHeight = 9216;
s_pInstance = nullptr; \
} \
return iRefCnt; \
- }
\ No newline at end of file
+ }
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
index 1bb9e44e8..aa8a0f72a 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
@@ -317,14 +317,18 @@ typedef struct tagVertexModelInstanceParticleDesc
typedef struct tagPhsXUserData {
- PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
+
+ PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
+ _uint iSubKind = UINT_MAX;
class CGameObject* pOwner = { nullptr };
_float4x4 m_BeforeMatrix = { };
+
union {
class CRigidBody* pBody;
class CCharacter_Controller* pCharacter;
class CObstacle_Controller* pObstacle = { nullptr };
};
+
}PhsXUserData;
NS_END
diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h
index c6b33219e..7b2e7446e 100644
--- a/Jusin154_Team3D/Engine/Public/GameInstance.h
+++ b/Jusin154_Team3D/Engine/Public/GameInstance.h
@@ -180,16 +180,18 @@ class ENGINE_DLL CGameInstance final : public CBase
_bool isPicking(_float3* pOut);
#pragma endregion
#pragma region PhysX_Manager
- PSX::PxMaterial* Get_Material(_float3* vMatInfo);
+ PSX::PxMaterial* Create_Material(_float3* vMatInfo);
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
- const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
- const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
+ PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
+ PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc);
PSX::PxController* Get_Controller(_uint iControllerIndex);
void ReleaseController(_uint iControllerIndex);
+ void Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor);
+ void Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor);
HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes);
diff --git a/Jusin154_Team3D/Engine/Public/PhysX/PxActor.h b/Jusin154_Team3D/Engine/Public/PhysX/PxActor.h
index aeb490a4a..b0785c2fe 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX/PxActor.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX/PxActor.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/PhysX/PxSceneDesc.h b/Jusin154_Team3D/Engine/Public/PhysX/PxSceneDesc.h
index f72edc4a3..c2edf3161 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX/PxSceneDesc.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX/PxSceneDesc.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/PhysX/characterkinematic/PxController.h b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxController.h
index 6eb2e45d4..c9db9be66 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxController.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxController.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/PhysX/characterkinematic/PxControllerBehavior.h b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerBehavior.h
index 0bb3cd593..91cee88f9 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerBehavior.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerBehavior.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/PhysX/characterkinematic/PxControllerObstacles.h b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerObstacles.h
index 1095725fb..b3239011e 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerObstacles.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX/characterkinematic/PxControllerObstacles.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/PhysX_Manager.h b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
index 281e67edc..ae18d5506 100644
--- a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
+++ b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h
@@ -20,8 +20,8 @@ class CPhysX_Manager final : public CBase
// HRESULT Update_RegionOfInterest(); ( 충돌 컬링, 필터링도 검색해야함 )
// Aggregate ( 충돌 그룹, 이 그룹끼리는 서로 충돌검사를 하지 않음, 지형, 레그돌 등 )
- const PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
- const PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
+ PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
+ PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
@@ -34,7 +34,8 @@ class CPhysX_Manager final : public CBase
void Update(_float fTimeDelta);
void ClearScene();
-
+ void Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor);
+ void Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor);
#pragma endregion
#pragma region CHARACTER_CONTROLLER
@@ -54,8 +55,8 @@ class CPhysX_Manager final : public CBase
private:
class CGameInstance* m_pGameInstance = { nullptr };
- ID3D11Device* m_pDevice = { nullptr };
ID3D11DeviceContext* m_pContext = { nullptr };
+ ID3D11Device* m_pDevice = { nullptr };
PSX::PxDefaultAllocator m_AllocatorCallBack = { }; // 피직스 동적할당자
PSX::PxDefaultErrorCallback m_ErrorCallBack = { }; // 피직스 오류처리자
@@ -83,7 +84,7 @@ class CPhysX_Manager final : public CBase
HRESULT Connect_DebugServer();
void Update_Kinematic();
void Update_Dynamic_ActiveActors();
- void Update_Dynamic_AllActors();
+ //void Update_Dynamic_AllActors();
public:
static CPhysX_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
diff --git a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h
index d2f6e01e1..2d0692764 100644
--- a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h
+++ b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h
@@ -114,7 +114,7 @@ class CPrototype_Manager final : public CBase
if (GUI::ImageButton(strName.c_str(), pTexture->Get_SRV(0), ImVec2(48, 48)))
{
if (*ppOut != nullptr)
- Safe_Release(*ppOut);
+ SAFE_RELEASE(*ppOut);
*ppOut = iter->second->Clone(pDesc, pOwner);
@@ -188,7 +188,7 @@ class CPrototype_Manager final : public CBase
}
if (*ppOut != nullptr)
- Safe_Release(*ppOut);
+ SAFE_RELEASE(*ppOut);
*ppOut = iter->second->Clone(pDesc, pOwner);
diff --git a/Jusin154_Team3D/Engine/Public/RigidBody.h b/Jusin154_Team3D/Engine/Public/RigidBody.h
index d04ccf0e7..6b6620497 100644
--- a/Jusin154_Team3D/Engine/Public/RigidBody.h
+++ b/Jusin154_Team3D/Engine/Public/RigidBody.h
@@ -21,9 +21,11 @@ class ENGINE_DLL CRigidBody final : public CComponent
PXMATERIAL ePxMaterialTypes = { PXMATERIAL::DEFAULT };
_float3 vMatInfo = { 0.5f, 0.5f, 0.6f }; // 피직스 객체의 속성 등
_float fContactOffset = { 0.05f }; // 접촉 유격 오프셋
+
#pragma region DYNAMIC
_float3 vhalfGeometryInfo; // 박스는 vSize, 캡슐은 radius, height로 씀
_float fDensity = { 1000.f }; // 밀도, 실제 무게는 부피에 따라 달라짐
+
#pragma endregion
#pragma region STATIC
#pragma endregion
@@ -34,7 +36,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
#pragma region DYNAMIC
#pragma endregion
#pragma region STATIC
- const _char* szMeshName = { };
+ const _char* szMeshName = { };
#pragma endregion
}RIGIDBODY_DESC;
@@ -42,6 +44,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
CRigidBody(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CRigidBody(const CRigidBody& rhs);
virtual ~CRigidBody() = default;
+
public:
#ifdef _DEBUG
virtual HRESULT Render()override;
@@ -49,6 +52,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
ACTOR Get_Type() const { return m_eActorType; }
+ PSX::PxActor* Get_Actor() const { return m_pRigidBody; }
CTransform* Get_TransformPtr() const { return m_pTransform; }
const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
PXMATERIAL Get_MaterialType() const { return m_eMatType; }
@@ -56,28 +60,37 @@ class ENGINE_DLL CRigidBody final : public CComponent
_float Get_Density() const { return m_fDensity; }
PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; }
PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; }
- _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
+ _float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
+
+
+ // 키네마틱은 transform으로 이동 ( simulate 전에 이동함 )
+ // 키네마틱이 아닌 dynamic은 토크와 포스로 이동 ( simulate 후에 이동함 )
+ void Set_Kinematic(_bool bKinematic);
+
+
+ void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향
+ void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향
private:
ACTOR m_eActorType = ACTOR::END;
PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = {};
PXMATERIAL m_eMatType = { PXMATERIAL::END };
_float m_fContactOffset = { 0.05f };
- const PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
+ PSX::PxActor* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
CTransform* m_pTransform = { nullptr };
+ PhsXUserData m_tagData = {};
#pragma region DYNAMIC
PSX::PxShapeFlags m_ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
_float3 m_vMatInfo = {};
_float3 m_vhalfGeometryInfo = {};
+ _float3 m_vCenterOfMess = {}; // 회전축
_float m_fDensity = { 1000.f };
#pragma endregion
#pragma region STATIC
- _wstring m_wstrMeshKey = { }; // 짝꿍 스태틱 메시의 triangleMesh 키
+ _wstring m_wstrMeshKey = { }; // 짝꿍 스태틱 메시의 triangleMesh 키
#pragma endregion
-
-private:
#ifdef _DEBUG
unique_ptr m_pMainShape = { nullptr };
unique_ptr m_pSubShape = { nullptr };
@@ -86,6 +99,7 @@ class ENGINE_DLL CRigidBody final : public CComponent
private:
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
HRESULT Initialize(void* pArg);
+ HRESULT Initialize_UserData();
#ifdef _DEBUG
HRESULT Add_DebugShape();
#endif