@@ -165,6 +165,8 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Body.h" />
|
||||
<ClInclude Include="..\public\Active_Icon.h" />
|
||||
<ClInclude Include="..\Public\CallBack_Playable_Behavior.h" />
|
||||
<ClInclude Include="..\Public\CallBack_Playable_HitRepot.h" />
|
||||
<ClInclude Include="..\Public\DummyObject.h" />
|
||||
<ClInclude Include="..\public\DummySkyBox.h" />
|
||||
<ClInclude Include="..\Public\Dummy_Plane.h" />
|
||||
@@ -191,6 +193,7 @@
|
||||
<ClInclude Include="..\public\MapObject_Manager.h" />
|
||||
<ClInclude Include="..\Public\MainLight.h" />
|
||||
<ClInclude Include="..\public\MapObject_Collision.h" />
|
||||
<ClInclude Include="..\Public\Dummy_PhysXDoor.h" />
|
||||
<ClInclude Include="..\public\Terrain.h" />
|
||||
<ClInclude Include="..\Public\Level_PhysXLab.h" />
|
||||
<ClInclude Include="..\Public\TestEffect.h" />
|
||||
@@ -232,6 +235,8 @@
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Body.cpp" />
|
||||
<ClCompile Include="..\private\Active_Icon.cpp" />
|
||||
<ClCompile Include="..\Private\CallBack_Playable_Behavior.cpp" />
|
||||
<ClCompile Include="..\Private\CallBack_Playable_HitRepot.cpp" />
|
||||
<ClCompile Include="..\Private\DummyObject.cpp" />
|
||||
<ClCompile Include="..\private\DummySkyBox.cpp" />
|
||||
<ClCompile Include="..\Private\Dummy_Plane.cpp" />
|
||||
@@ -258,6 +263,7 @@
|
||||
<ClCompile Include="..\private\MapObject_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\MainLight.cpp" />
|
||||
<ClCompile Include="..\private\MapObject_Collision.cpp" />
|
||||
<ClCompile Include="..\Private\Dummy_PhysXDoor.cpp" />
|
||||
<ClCompile Include="..\private\Terrain.cpp" />
|
||||
<ClCompile Include="..\Private\Level_PhysXLab.cpp" />
|
||||
<ClCompile Include="..\Private\TestEffect.cpp" />
|
||||
|
||||
@@ -202,6 +202,24 @@
|
||||
<Filter Include="02.GameObjects\Layer_Effect\Dummy_Plane">
|
||||
<UniqueIdentifier>{6872c5bc-5eac-46a1-b6d8-3ec0f4fb2cd5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\Callback">
|
||||
<UniqueIdentifier>{b6d1496a-c8ef-4b7a-9ed4-f00b0a244313}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\Callback\Playable">
|
||||
<UniqueIdentifier>{a225d78f-7eec-4407-bdfd-9e14452f3338}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Playable">
|
||||
<UniqueIdentifier>{a32d5869-5562-4099-925a-f8c022e9aac7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Behavior">
|
||||
<UniqueIdentifier>{83781d7f-b84d-45a3-8361-b6bed2722b74}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\Callback">
|
||||
<UniqueIdentifier>{b6d1496a-c8ef-4b7a-9ed4-f00b0a244313}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXDoor">
|
||||
<UniqueIdentifier>{3131278b-18f5-4b84-ba85-73104998e9c9}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Editor.h">
|
||||
@@ -405,6 +423,15 @@
|
||||
<ClInclude Include="..\Public\Dummy_Plane.h">
|
||||
<Filter>02.GameObjects\Layer_Effect\Dummy_Plane</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\CallBack_Playable_HitRepot.h">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Playable</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\CallBack_Playable_Behavior.h">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Behavior</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Dummy_PhysXDoor.h">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXDoor</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Editor.ico">
|
||||
@@ -604,6 +631,15 @@
|
||||
<ClCompile Include="..\Private\Dummy_Plane.cpp">
|
||||
<Filter>02.GameObjects\Layer_Effect\Dummy_Plane</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\CallBack_Playable_HitRepot.cpp">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Playable</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\CallBack_Playable_Behavior.cpp">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\Callback\Playable\Behavior</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Dummy_PhysXDoor.cpp">
|
||||
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXDoor</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Editor.rc">
|
||||
|
||||
@@ -102,8 +102,9 @@ void CActive_Icon::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ void CBody::Update(_float fTimeDelta)
|
||||
|
||||
void CBody::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CBody::Render()
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#include "pch.h"
|
||||
#include "CallBack_Playable_Behavior.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
|
||||
CCallBack_Playable_Behavior::CCallBack_Playable_Behavior()
|
||||
{
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor)
|
||||
{
|
||||
if (nullptr == actor.userData) {
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
PhsXUserData* pActorData = static_cast<PhsXUserData*>(actor.userData);
|
||||
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT
|
||||
| PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
return PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
|
||||
break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
// Action
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 나머지는 아무 특별 동작 없음
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxController& controller)
|
||||
{
|
||||
// CCT끼리 부딪힐 때를 굳이 안 쓰면 0 리턴
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxObstacle& obstacle)
|
||||
{
|
||||
// Obstacle이 움직이는 발판이다?
|
||||
// 여기서 ride/slide 세팅
|
||||
//return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT;
|
||||
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "pch.h"
|
||||
#include "CallBack_Playable_HitRepot.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CCallBack_Playable_HitRepot::CCallBack_Playable_HitRepot()
|
||||
{
|
||||
}
|
||||
|
||||
void CCallBack_Playable_HitRepot::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<PhsXUserData*>(pActor->userData);
|
||||
if (nullptr == pActorData) { // missing user data
|
||||
return;
|
||||
}
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
// action
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
{
|
||||
PSX::PxRigidDynamic* pDynamic = static_cast<PSX::PxRigidDynamic*>(pActor);
|
||||
pDynamic->addForce(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE);
|
||||
} break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
assert(false);
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCallBack_Playable_HitRepot::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<PhsXUserData*>(pOtherController->getActor()->userData);
|
||||
assert(nullptr != pActorData); // 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 CCallBack_Playable_HitRepot::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;
|
||||
//}
|
||||
}
|
||||
@@ -49,9 +49,9 @@ void CDummyObject::Update(_float fTimeDelta)
|
||||
|
||||
void CDummyObject::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummyObject::Render()
|
||||
|
||||
@@ -22,9 +22,8 @@ void CDummyRect::Update(_float fTimeDelta)
|
||||
|
||||
void CDummyRect::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,9 @@ void CDummySkyBox::Update(_float fTimeDelta)
|
||||
|
||||
void CDummySkyBox::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::PRIORITY, this, *vPos, 0.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::PRIORITY, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummySkyBox::Render()
|
||||
|
||||
@@ -42,8 +42,9 @@ void CDummy_Cube::Update(_float fTimeDelta)
|
||||
|
||||
void CDummy_Cube::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_Cube::Render()
|
||||
|
||||
@@ -39,31 +39,41 @@ void CDummy_PhysXBox::Priority_Update(_float fTimeDelta)
|
||||
|
||||
void CDummy_PhysXBox::Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_pGameInstance->Key_Pressing(DIK_LCONTROL)) {
|
||||
if (m_pGameInstance->Key_Down(DIK_X)) {
|
||||
m_pGameInstance->Detach_Actor(*m_pRigidBody->Get_Actor());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_pGameInstance->Key_Down(DIK_X)) {
|
||||
m_pGameInstance->Attach_Actor(*m_pRigidBody->Get_Actor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CDummy_PhysXBox::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXBox::Render()
|
||||
{
|
||||
//if (FAILED(Bind_ShaderResources())) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
//if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
//if (FAILED(m_pModelCom->Render(0))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
if (FAILED(m_pModelCom->Render(0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(m_pRigidBody->Render())) {
|
||||
return E_FAIL;
|
||||
@@ -86,7 +96,7 @@ HRESULT CDummy_PhysXBox::Ready_Components(void* pArg)
|
||||
|
||||
|
||||
{ // RIGID_BODY
|
||||
CRigidBody::RIGIDBODY_DESC Desc{};
|
||||
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
|
||||
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
return E_FAIL;
|
||||
@@ -95,8 +105,9 @@ HRESULT CDummy_PhysXBox::Ready_Components(void* pArg)
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom)))){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Box"), (CComponent**)&m_pModelCom))) {
|
||||
return E_FAIL;
|
||||
@@ -152,6 +163,10 @@ CGameObject* CDummy_PhysXBox::Clone(void* pArg, CGameObject* pOwner)
|
||||
|
||||
void CDummy_PhysXBox::Free()
|
||||
{
|
||||
if (nullptr != m_pRigidBody) {
|
||||
m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor());
|
||||
}
|
||||
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pRigidBody);
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
#include "pch.h"
|
||||
#include "Dummy_PhysXDoor.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
|
||||
|
||||
CDummy_PhysXDoor::CDummy_PhysXDoor(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CDummy_PhysXDoor::CDummy_PhysXDoor(const CDummy_PhysXDoor& rhs)
|
||||
: CGameObject(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXDoor::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXDoor::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CDummy_PhysXDoor::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CDummy_PhysXDoor::Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CDummy_PhysXDoor::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXDoor::Render()
|
||||
{
|
||||
//if (FAILED(Bind_ShaderResources())) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
|
||||
//if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
|
||||
//if (FAILED(m_pModelCom->Render(0))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(m_pRigidBody->Render())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXDoor::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
BOXSTARTPOS_DESC* pBox = static_cast<BOXSTARTPOS_DESC*>(pArg);
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pBox->vPos), 1.f));
|
||||
m_pTransformCom->Rotation(pBox->vRotRPY.x, pBox->vRotRPY.y, pBox->vRotRPY.z);
|
||||
|
||||
|
||||
{ // RIGID_BODY
|
||||
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
|
||||
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Box"), (CComponent**)&m_pModelCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXDoor::Bind_ShaderResources()
|
||||
{
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CDummy_PhysXDoor* CDummy_PhysXDoor::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CDummy_PhysXDoor* pInstance = new CDummy_PhysXDoor(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CDummy_PhysXDoor");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CDummy_PhysXDoor::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CDummy_PhysXDoor* pInstance = new CDummy_PhysXDoor(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CDummy_PhysXDoor");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CDummy_PhysXDoor::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pRigidBody);
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
void CDummy_PhysXDoor::Describe_Entity()
|
||||
{
|
||||
}
|
||||
@@ -42,8 +42,9 @@ void CDummy_PhysXMesh::Update(_float fTimeDelta)
|
||||
|
||||
void CDummy_PhysXMesh::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXMesh::Render()
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "pch.h"
|
||||
#include "Dummy_PhysXPlayable.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
|
||||
CDummy_PhysXPlayable::CDummy_PhysXPlayable(ID3D11Device* pDevice, ID3D11DeviceContext* pContext):
|
||||
@@ -40,6 +39,14 @@ void CDummy_PhysXPlayable::Update(_float fTimeDelta)
|
||||
if (m_pGameInstance->Key_Pressing(DIK_C)) {
|
||||
m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -10.f, 0.f, 0.f) * m_pTransformCom->Get_Speed() * fTimeDelta);
|
||||
}
|
||||
if (m_pGameInstance->Key_Down(DIK_V)) {
|
||||
m_pGameInstance->Detach_Actor(*m_pCharacter_Controller->Get_Actor());
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_pGameInstance->Key_Down(DIK_V)) {
|
||||
m_pGameInstance->Attach_Actor(*m_pCharacter_Controller->Get_Actor());
|
||||
}
|
||||
}
|
||||
m_pTransformCom->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f));
|
||||
m_pCharacter_Controller->Move(fTimeDelta);
|
||||
@@ -48,9 +55,9 @@ void CDummy_PhysXPlayable::Update(_float fTimeDelta)
|
||||
void CDummy_PhysXPlayable::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
Describe_Entity();
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_PhysXPlayable::Render()
|
||||
@@ -119,6 +126,8 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg)
|
||||
Desc.fStepOffset = { 0.05f };
|
||||
Desc.fRadius = 0.5f;
|
||||
Desc.fHeight = 1.0f;
|
||||
Desc.pCallback_HitReport = &m_pCallBack_HitReport;
|
||||
Desc.pCallback_Behavior = &m_pCallBack_Behavior;
|
||||
Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY;
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -44,8 +44,9 @@ void CDummy_Plane::Update(_float fTimeDelta)
|
||||
|
||||
void CDummy_Plane::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDummy_Plane::Render()
|
||||
|
||||
@@ -59,12 +59,20 @@ void CEditEffect::Late_Update(_float fTimeDelta)
|
||||
if (m_pInstance_ModelCom == nullptr)
|
||||
return;
|
||||
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
ASSERT_JINWOO(false && "이거 고쳐야됨, 아래꺼를 위에껄로")
|
||||
//{
|
||||
// if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
// m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
// }
|
||||
//}
|
||||
//{
|
||||
// _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
|
||||
if (m_EffectInfo.isBlur == true)
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
// if (m_EffectInfo.isBlur == true)
|
||||
// m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(m_EffectInfo.eRenderOrder, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
// m_pGameInstance->Add_RenderGroup(m_EffectInfo.eRenderOrder, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
//}
|
||||
}
|
||||
|
||||
void CEditEffect::Reference_Mat_For_EditEffect()
|
||||
|
||||
@@ -60,8 +60,9 @@ void CGamePlay_Canvas::Update(_float fTimeDelta)
|
||||
void CGamePlay_Canvas::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ void CHair::Update(_float fTimeDelta)
|
||||
|
||||
void CHair::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CHair::Render()
|
||||
|
||||
@@ -43,9 +43,9 @@ void CHead::Update(_float fTimeDelta)
|
||||
|
||||
void CHead::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CHead::Render()
|
||||
|
||||
@@ -91,7 +91,7 @@ HRESULT CLevel_PhysXLab::Ready_Layer_Terrain(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag)
|
||||
{
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
for (int i = 0; i < 500; ++i) {
|
||||
CDummy_PhysXBox::BOXSTARTPOS_DESC Desc{};
|
||||
Desc.vPos = { m_pGameInstance->Random_Float(0.f, 30.f), m_pGameInstance->Random_Float(3.f, 33.f), m_pGameInstance->Random_Float(0.f, 30.f) };
|
||||
Desc.vRotRPY = { m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI), m_pGameInstance->Random_Float(0.f, XM_2PI) };
|
||||
|
||||
@@ -530,10 +530,10 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
||||
m_strMessage = TEXT("PhysX Bodies Loading..");
|
||||
|
||||
{
|
||||
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
|
||||
CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{};
|
||||
{
|
||||
Desc.eType = ACTOR::BOX;
|
||||
Desc.ePxRigidBodyFlags = {};
|
||||
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 };
|
||||
@@ -541,7 +541,7 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
||||
Desc.vhalfGeometryInfo = { 1.f, 1.f, 1.f };
|
||||
Desc.fDensity = 10.f;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -605,7 +605,7 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
||||
|
||||
_uint iNumMesh = pModel->Get_NumMeshes();
|
||||
|
||||
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
|
||||
CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{};
|
||||
for (_uint i = 0; i < iNumMesh; ++i) {
|
||||
_string strDestName = pModel->Get_MeshName(i) + to_string(i);
|
||||
{ // basic static RIGIDBODY
|
||||
@@ -616,7 +616,7 @@ HRESULT CLoader::Loading_For_PhysXLevel()
|
||||
Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
|
||||
Desc.fContactOffset = 0.f;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody_Static::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
@@ -723,7 +723,7 @@ HRESULT CLoader::MapFolderLoad(const _char* pDirectoryPath, const _char* pFileEx
|
||||
_uint iNumMesh = pModel->Get_NumMeshes();
|
||||
|
||||
|
||||
CRigidBody::RIGIDBODY_PROTOTYPEDESC Desc{};
|
||||
CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{};
|
||||
for (_uint i = 0; i < iNumMesh; ++i) {
|
||||
_string strDestName = pModel->Get_MeshName(i) + to_string(i);
|
||||
{
|
||||
@@ -734,7 +734,7 @@ HRESULT CLoader::MapFolderLoad(const _char* pDirectoryPath, const _char* pFileEx
|
||||
Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
|
||||
Desc.fContactOffset = 0.f;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), CRigidBody_Static::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "LoadingWidget.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -101,8 +101,9 @@ void CLoadingWidget::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "LoadingWidget_Flame.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -119,8 +119,9 @@ void CLoadingWidget_Flame::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MapElement_Interactable.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -75,9 +75,9 @@ void CMapElement_Interactable::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
#endif
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION));
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Interactable::Render()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MapElement_Static.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -76,9 +76,9 @@ void CMapElement_Static::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
#endif
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION));
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMapElement_Static::Render()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -42,9 +42,9 @@ void CMapObject::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
#endif
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMapObject::Render()
|
||||
@@ -101,4 +101,4 @@ void CMapObject::Free()
|
||||
|
||||
void CMapObject::Describe_Entity()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ void CMapObject_Collision::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION));
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,10 +80,9 @@ void CMapObject_LOD::Late_Update(_float fTimeDelta)
|
||||
|
||||
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
_float4 vPos;
|
||||
//XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
XMStoreFloat4(&vPos, m_pTransformCom->Get_State(STATE::POSITION));
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Render()
|
||||
@@ -285,21 +284,21 @@ void CMapObject_LOD::Describe_Entity()
|
||||
GUI::SameLine();
|
||||
if (GUI::Button("Bake!!!")) {
|
||||
CMapObject_Manager* pManager = m_pGameInstance->Get_Layer(CURRENT_LEVEL, LAYER_MAPOBJECTMANAGER)->Get_Object<CMapObject_Manager>();
|
||||
for (_uint i = 0; i < (_uint)m_ModelPathIndices.size(); ++i) {
|
||||
filesystem::path filePath = pManager->Get_PrototypePath(m_ModelPathIndices[i]);
|
||||
for (_uint iModelIndex = 0; iModelIndex < (_uint)m_ModelPathIndices.size(); ++iModelIndex) {
|
||||
filesystem::path filePath = pManager->Get_PrototypePath(m_ModelPathIndices[iModelIndex]);
|
||||
|
||||
CModel* pModel = m_pModelComs[i];
|
||||
CModel* pModel = m_pModelComs[iModelIndex];
|
||||
_uint iNumMesh = pModel->Get_NumMeshes();
|
||||
pModel->Save_PhysXTriMeshes(filePath.string().c_str());
|
||||
|
||||
CRigidBody::RIGIDBODY_DESC Desc{};
|
||||
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
|
||||
|
||||
for (_uint i = 0; i < iNumMesh; ++i)
|
||||
for (_uint iMeshIndex = 0; iMeshIndex < iNumMesh; ++iMeshIndex)
|
||||
{ // RIGID_BODY
|
||||
_string strDestName = pModel->Get_MeshName(i) + to_string(i);
|
||||
Desc.szMeshName = strDestName.c_str();
|
||||
_wstring dest = CMyTools::ToWstring(m_pModelComs[iModelIndex]->Get_MeshName(iMeshIndex) + to_string(iMeshIndex)).c_str();
|
||||
Desc.pMeshName = dest.c_str();
|
||||
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, CMyTools::ToWstring(strDestName).c_str(), nullptr, &Desc))) {
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, Desc.pMeshName, nullptr, &Desc))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MiniMap_Panel.h"
|
||||
#include "GameInstance.h"
|
||||
#include "MiniMap_TrimBorder.h"
|
||||
@@ -68,8 +68,9 @@ void CMiniMap_Panel::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MiniMap_TrimBorder.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -96,8 +96,9 @@ void CMiniMap_TrimBorder::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MissionBanner_Border.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -99,8 +99,9 @@ void CMissionBanner_Border::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "MissionBanner_Key.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -96,8 +96,9 @@ void CMissionBanner_Key::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mission_Icon.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -103,8 +103,9 @@ void CMission_Icon::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mission_Key.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -96,8 +96,9 @@ void CMission_Key::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mission_KeyHold.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -105,8 +105,9 @@ void CMission_KeyHold::Late_Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ void CMonster::Update(_float fTimeDelta)
|
||||
|
||||
void CMonster::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CMonster::Render()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "Mouse_Cursor.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
@@ -37,7 +37,7 @@ HRESULT CMouse_Cursor::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// 메뉴가 실행이 되면 마우스가 나타나고 다른 UI위에 올라가면 살짝 작아진다.
|
||||
// 메뉴가 실행이 되면 마우스가 나타나고 다른 UI위에 올라가면 살짝 작아진다.
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -59,8 +59,9 @@ void CMouse_Cursor::Update(_float fTimeDelta)
|
||||
void CMouse_Cursor::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_bVisible) {
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,9 +48,9 @@ void CTerrain::Update(_float fTimeDelta)
|
||||
|
||||
void CTerrain::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CTerrain::Render()
|
||||
@@ -157,4 +157,4 @@ void CTerrain::Free()
|
||||
void CTerrain::Describe_Entity()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "TestEffect.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
@@ -43,9 +43,9 @@ void CTestEffect::Update(_float fTimeDelta)
|
||||
|
||||
void CTestEffect::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this, *vPos, m_pTransformCom->Get_Radius());
|
||||
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CTestEffect::Ready_Components(void* pArg)
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CCallBack_Playable_Behavior final : public PSX::PxControllerBehaviorCallback
|
||||
{
|
||||
// 구현 예시
|
||||
// CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
|
||||
//
|
||||
// PxUserControllerHitReport = "무엇과 부딪혔는지 알려줌(이벤트 알림)"
|
||||
// PxControllerBehaviorCallback = "부딪힌 것에 대해 어떤 행동 정책을 쓸지 물어봄(질의)"
|
||||
// PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
|
||||
|
||||
public:
|
||||
CCallBack_Playable_Behavior();
|
||||
~CCallBack_Playable_Behavior() = default;
|
||||
|
||||
public:
|
||||
// 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;
|
||||
};
|
||||
NS_END
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CCallBack_Playable_HitRepot final : public PSX::PxUserControllerHitReport
|
||||
{
|
||||
// 구현 예시
|
||||
// CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
|
||||
//
|
||||
// PxUserControllerHitReport = "무엇과 부딪혔는지 알려줌(이벤트 알림)"
|
||||
// PxControllerBehaviorCallback = "부딪힌 것에 대해 어떤 행동 정책을 쓸지 물어봄(질의)"
|
||||
// PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
|
||||
|
||||
public:
|
||||
CCallBack_Playable_HitRepot();
|
||||
~CCallBack_Playable_HitRepot() = 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; // 사용자 정의 장애물과 부딪힌 경우
|
||||
};
|
||||
NS_END
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CModel;
|
||||
class CShader;
|
||||
class CRigidBody;
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CDummy_PhysXDoor final : public CGameObject
|
||||
{
|
||||
public:
|
||||
typedef struct tagBoxStartPos
|
||||
{
|
||||
_float3 vPos = {};
|
||||
_float3 vRotRPY = {};
|
||||
}BOXSTARTPOS_DESC;
|
||||
private:
|
||||
CDummy_PhysXDoor(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CDummy_PhysXDoor(const CDummy_PhysXDoor& rhs);
|
||||
virtual ~CDummy_PhysXDoor() = default;
|
||||
|
||||
public:
|
||||
virtual void Priority_Update(_float fTimeDelta) override;
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
private:
|
||||
CRigidBody* m_pRigidBody = { nullptr };
|
||||
const PSX::PxRigidDynamic* m_pActor = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
virtual HRESULT Bind_ShaderResources() override;
|
||||
|
||||
public:
|
||||
static CDummy_PhysXDoor* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
|
||||
virtual void Free() override;
|
||||
void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "GameObject.h"
|
||||
#include "CallBack_Playable_Behavior.h"
|
||||
#include "CallBack_Playable_HitRepot.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CModel;
|
||||
@@ -34,7 +36,9 @@ class CDummy_PhysXPlayable final : public CGameObject
|
||||
CCharacter_Controller* m_pCharacter_Controller = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
|
||||
|
||||
CCallBack_Playable_Behavior m_pCallBack_Behavior = {};
|
||||
CCallBack_Playable_HitRepot m_pCallBack_HitReport = {};
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
@@ -49,4 +53,4 @@ class CDummy_PhysXPlayable final : public CGameObject
|
||||
void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -203,7 +203,6 @@ call Update_Lib.bat
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Collider.cpp" />
|
||||
<ClCompile Include="..\Private\Collider_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\Collision_Callback.cpp" />
|
||||
<ClCompile Include="..\Private\Component.cpp" />
|
||||
<ClCompile Include="..\Private\ComputeShader.cpp" />
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
@@ -287,6 +286,8 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\RenderTarget.cpp" />
|
||||
<ClCompile Include="..\Private\RenderTarget_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Static.cpp" />
|
||||
<ClCompile Include="..\Private\Shader.cpp" />
|
||||
<ClCompile Include="..\Private\Shadow.cpp" />
|
||||
<ClCompile Include="..\Private\SoundSrc.cpp" />
|
||||
@@ -305,6 +306,14 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\Instance_Model.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Rect.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Terrain.cpp" />
|
||||
<ClCompile Include="..\Public\NCallBack_Playable_Behavior.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Public\NCallBack_Playable_HitRepot.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Animation.h" />
|
||||
@@ -398,6 +407,14 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\Bounding_AABB.h" />
|
||||
<ClInclude Include="..\Public\Bounding_OBB.h" />
|
||||
<ClInclude Include="..\Public\Bounding_Sphere.h" />
|
||||
<ClInclude Include="..\Public\NCallBack_Playable_Behavior.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\NCallBack_Playable_HitRepot.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Camera.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</ExcludedFromBuild>
|
||||
@@ -419,7 +436,6 @@ call Update_Lib.bat
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Collider.h" />
|
||||
<ClInclude Include="..\Public\Collider_Manager.h" />
|
||||
<ClInclude Include="..\Public\Collision_Callback.h" />
|
||||
<ClInclude Include="..\Public\Component.h" />
|
||||
<ClInclude Include="..\Public\ComputeShader.h" />
|
||||
<ClInclude Include="..\Public\ContainerObject.h" />
|
||||
@@ -503,6 +519,8 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\RenderTarget.h" />
|
||||
<ClInclude Include="..\Public\RenderTarget_Manager.h" />
|
||||
<ClInclude Include="..\Public\RigidBody.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Static.h" />
|
||||
<ClInclude Include="..\Public\Shader.h" />
|
||||
<ClInclude Include="..\Public\Shadow.h" />
|
||||
<ClInclude Include="..\Public\SoundSrc.h" />
|
||||
|
||||
@@ -244,15 +244,9 @@
|
||||
<Filter Include="01.Utility\06.Picking">
|
||||
<UniqueIdentifier>{a60a7ba5-a937-41d7-baac-db67f86f3ba1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\08.Character_Controller\Collision_Callback">
|
||||
<UniqueIdentifier>{05865481-fa20-4432-a5a7-945d4f8c7f3c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\10.Dynamic">
|
||||
<UniqueIdentifier>{bed0de44-4e62-4b5f-9767-65cfc8a933a3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\11.Kinematic">
|
||||
<UniqueIdentifier>{33ac85a2-be8e-4ad9-a179-1239d818dc9c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\07.RigidBody\00.Static">
|
||||
<UniqueIdentifier>{fda41884-634b-4dd4-8bd2-f6f7ad68ab1f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -262,6 +256,9 @@
|
||||
<Filter Include="03.Management\03.Light_Manager">
|
||||
<UniqueIdentifier>{8727e975-e9e2-4b59-9a52-27ad3ad79f2f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\08.Character_Controller\CallBack">
|
||||
<UniqueIdentifier>{05865481-fa20-4432-a5a7-945d4f8c7f3c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -438,9 +435,6 @@
|
||||
<ClCompile Include="..\Private\PhysX_Manager.cpp">
|
||||
<Filter>03.Management\21.PhysX_Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\RigidBody.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\UIComponent.cpp">
|
||||
<Filter>02.Element\02.Component\50.UI</Filter>
|
||||
</ClCompile>
|
||||
@@ -477,8 +471,20 @@
|
||||
<ClCompile Include="..\Private\Light_Manager.cpp">
|
||||
<Filter>03.Management\03.Light_Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Collision_Callback.cpp">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\Collision_Callback</Filter>
|
||||
<ClCompile Include="..\Private\RigidBody_Static.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\00.Static</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\10.Dynamic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\RigidBody.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Public\NCallBack_Playable_HitRepot.cpp">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Public\NCallBack_Playable_Behavior.cpp">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -1061,8 +1067,17 @@
|
||||
<ClInclude Include="..\Public\Light_Manager.h">
|
||||
<Filter>03.Management\03.Light_Manager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Collision_Callback.h">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\Collision_Callback</Filter>
|
||||
<ClInclude Include="..\Public\RigidBody_Static.h">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\00.Static</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic.h">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\10.Dynamic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\NCallBack_Playable_HitRepot.h">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\NCallBack_Playable_Behavior.h">
|
||||
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#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 }
|
||||
@@ -61,6 +60,11 @@ HRESULT CCharacter_Controller::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
PSX::PxRigidDynamic* CCharacter_Controller::Get_Actor()
|
||||
{
|
||||
return m_pController->getActor();
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
void CCharacter_Controller::Resize_Volume(_float fHeight)
|
||||
@@ -189,7 +193,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
{ // PhsXUserData
|
||||
m_tagData.eKind = PHYSX_KIND::CCTActor;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.m_BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pCharacter = this;
|
||||
}
|
||||
|
||||
@@ -202,11 +206,12 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.halfSideExtent = pDesc->vBoxSize.x;
|
||||
Desc.halfForwardExtent = pDesc->vBoxSize.z;
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = static_cast<PSX::PxUserControllerHitReport*>(pDesc->pCallback);
|
||||
Desc.behaviorCallback = static_cast<PSX::PxControllerBehaviorCallback*>(pDesc->pCallback);
|
||||
Desc.reportCallback = pDesc->pCallback_HitReport;
|
||||
Desc.behaviorCallback = pDesc->pCallback_Behavior;
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_BoxController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
m_pController->getActor()->userData = &m_tagData;
|
||||
} break;
|
||||
case Engine::ACTOR::CAPSULE:
|
||||
{
|
||||
@@ -215,11 +220,12 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.height = pDesc->fHeight;
|
||||
Desc.climbingMode = pDesc->eClimbingMode; // 기본 eEASY
|
||||
Desc.contactOffset = pDesc->fContactOffset;
|
||||
Desc.reportCallback = static_cast<PSX::PxUserControllerHitReport*>(pDesc->pCallback);
|
||||
Desc.behaviorCallback = static_cast<PSX::PxControllerBehaviorCallback*>(pDesc->pCallback);
|
||||
Desc.reportCallback = pDesc->pCallback_HitReport;
|
||||
Desc.behaviorCallback = pDesc->pCallback_Behavior;
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
m_pController->getActor()->userData = &m_tagData;
|
||||
} break;
|
||||
default:
|
||||
assert(false); // PhysX에서 불가능
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
#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<PhsXUserData*>(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<PhsXUserData*>(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();
|
||||
}
|
||||
@@ -112,7 +112,6 @@ void CGameInstance::Update_Engine(_float fTimeDelta)
|
||||
|
||||
m_pObject_Manager->Update(fTimeDelta);
|
||||
|
||||
m_pRenderer->Refresh_Renderer();
|
||||
m_pObject_Manager->Late_Update(fTimeDelta);
|
||||
|
||||
m_pLevel_Manager->Update(fTimeDelta);
|
||||
@@ -395,14 +394,9 @@ void CGameInstance::Clear_Objects_With_Layers(_uint iLevelIndex)
|
||||
m_pObject_Manager->Clear(iLevelIndex);
|
||||
}
|
||||
|
||||
void CGameInstance::Refresh_Renderer()
|
||||
HRESULT CGameInstance::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObject)
|
||||
{
|
||||
m_pRenderer->Refresh_Renderer();
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObject, _float4& vPos, _float fCullRadius)
|
||||
{
|
||||
return m_pRenderer->Add_RenderGroup(eRenderGroup, pRenderObject, vPos, fCullRadius);
|
||||
return m_pRenderer->Add_RenderGroup(eRenderGroup, pRenderObject);
|
||||
}
|
||||
|
||||
void CGameInstance::Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix)
|
||||
@@ -430,6 +424,21 @@ const _vector CGameInstance::Get_CamXMPosition()
|
||||
return m_pPipeLine->Get_CamXMPosition();
|
||||
}
|
||||
|
||||
void CGameInstance::Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse)
|
||||
{
|
||||
m_pPipeLine->Transform_Frustum_ToLocalSpace(WorldMatrixInverse);
|
||||
}
|
||||
|
||||
_bool CGameInstance::isIn_WorldFrustum(_fvector vWorldPos, _float fRadius)
|
||||
{
|
||||
return m_pPipeLine->isIn_WorldFrustum(vWorldPos, fRadius);
|
||||
}
|
||||
|
||||
_bool CGameInstance::isIn_LocalFrustum(_fvector vLocalPos, _float fRadius)
|
||||
{
|
||||
return m_pPipeLine->isIn_LocalFrustum(vLocalPos, fRadius);
|
||||
}
|
||||
|
||||
void CGameInstance::Add_Light(_uint _iCurrentLevel, CLight* _pLight)
|
||||
{
|
||||
m_pLight_Manager->Add_Light(_iCurrentLevel, _pLight);
|
||||
@@ -581,11 +590,11 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
|
||||
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
|
||||
}
|
||||
|
||||
PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody_Dynamic& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
|
||||
}
|
||||
PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_StaticActor(RigidBody);
|
||||
}
|
||||
@@ -605,13 +614,17 @@ void CGameInstance::ReleaseController(_uint iControllerIndex)
|
||||
{
|
||||
m_pPhysX_Manager->ReleaseController(iControllerIndex);
|
||||
}
|
||||
void CGameInstance::Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor)
|
||||
void CGameInstance::Attach_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Attach_Actor(RigidBody, Actor);
|
||||
m_pPhysX_Manager->Attach_Actor(Actor);
|
||||
}
|
||||
void CGameInstance::Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor)
|
||||
void CGameInstance::Detach_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Detach_Actor(RigidBody, pActor);
|
||||
m_pPhysX_Manager->Detach_Actor(Actor);
|
||||
}
|
||||
void CGameInstance::Release_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Detach_Actor(Actor);
|
||||
}
|
||||
HRESULT CGameInstance::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
#include "PhysX_Manager.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameInstance.h"
|
||||
#include "RigidBody.h"
|
||||
#include "RigidBody_Dynamic.h"
|
||||
#include "RigidBody_Static.h"
|
||||
#include "Mesh.h"
|
||||
|
||||
CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :
|
||||
@@ -15,7 +16,7 @@ CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidBody)
|
||||
{
|
||||
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
|
||||
@@ -54,8 +55,6 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidBodyFlags pxRigidFlags = RigidBody.Get_RigidBodyFlags();
|
||||
pActorDynamic->setRigidBodyFlags(pxRigidFlags);
|
||||
|
||||
|
||||
|
||||
if (pxRigidFlags.isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) {
|
||||
|
||||
}
|
||||
@@ -63,12 +62,12 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density());
|
||||
}
|
||||
|
||||
Attach_Actor(RigidBody, *pActorDynamic);
|
||||
m_pRestBodies.insert(pActorDynamic);
|
||||
|
||||
return pActorDynamic;
|
||||
}
|
||||
|
||||
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
|
||||
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody)
|
||||
{
|
||||
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
|
||||
@@ -118,8 +117,8 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody& RigidBody)
|
||||
pShape->setContactOffset(RigidBody.Get_ContactOffset());
|
||||
pShape->setRestOffset(0.f);
|
||||
|
||||
|
||||
Attach_Actor(RigidBody, *pActor);
|
||||
m_pRestBodies.insert(pActor);
|
||||
Attach_Actor(*pActor);
|
||||
|
||||
return pActor;
|
||||
}
|
||||
@@ -222,47 +221,9 @@ HRESULT CPhysX_Manager::LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangle
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// 바이너리 로드에는 128B 정렬된 메모리 포인터를 넘겨야 함. InputData 그대로 넘기면 안됨
|
||||
// 심지어 바이너리로 불러온 블럭은 피직스의 모든 메시들을 릴리즈 한 뒤에 해제 해야 함
|
||||
//_bool CPhysX_Manager::LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes)
|
||||
//{
|
||||
// filesystem::path pathPhysX = pPath;
|
||||
// pathPhysX.replace_extension(".bmap");
|
||||
//
|
||||
// PSX::PxSerializationRegistry* pSerializationRegistry = PSX::PxSerialization::createSerializationRegistry(*m_pPhysics);
|
||||
//
|
||||
// PSX::PxDefaultFileInputData InputData(pathPhysX.string().c_str());
|
||||
// PSX::PxCollection* extRefs = PxCreateCollection();
|
||||
//
|
||||
// PSX::PxCollection* pCollections = PSX::PxSerialization::createCollectionFromBinary(&InputData, *pSerializationRegistry, extRefs);
|
||||
// if (nullptr == pCollections) {
|
||||
// extRefs->release();
|
||||
// pSerializationRegistry->release();
|
||||
// assert(pCollections);
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// const PSX::PxU32 iNumTriMeshes = pCollections->getNbObjects();
|
||||
// TriMeshes.reserve(iNumTriMeshes);
|
||||
// for (PSX::PxU32 i = 0; i < iNumTriMeshes; ++i) {
|
||||
// PSX::PxBase& pObject = pCollections->getObject(i);
|
||||
//
|
||||
// if (pObject.getConcreteType() == PSX::PxConcreteType::eTRIANGLE_MESH_BVH34) {
|
||||
// PSX::PxTriangleMesh* pTriMesh = static_cast<PSX::PxTriangleMesh*>(&pObject);
|
||||
// pTriMesh->acquireReference();
|
||||
// TriMeshes.push_back(pTriMesh);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// extRefs->release();
|
||||
// pCollections->release();
|
||||
// pSerializationRegistry->release();
|
||||
// return true;
|
||||
//}
|
||||
|
||||
PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _wstring& wstrMeshKey)
|
||||
PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _tchar* pMeshName)
|
||||
{
|
||||
map<_wstring, PSX::PxTriangleMesh*>::iterator iter = m_TriangleMeshes.find(wstrMeshKey);
|
||||
map<_wstring, PSX::PxTriangleMesh*>::iterator iter = m_TriangleMeshes.find(pMeshName);
|
||||
if (iter != m_TriangleMeshes.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
@@ -271,18 +232,16 @@ PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _wstring& wstrMeshK
|
||||
|
||||
void CPhysX_Manager::Update_Kinematic()
|
||||
{
|
||||
for (auto& pairBody : m_RigidBodys) {
|
||||
PSX::PxRigidDynamic* pActor = pairBody.second->is<PSX::PxRigidDynamic>();
|
||||
for (auto& pBody : m_pActiveBodys) {
|
||||
PSX::PxRigidDynamic* pActor = pBody->is<PSX::PxRigidDynamic>();
|
||||
if (nullptr == pActor) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC)
|
||||
{
|
||||
CRigidBody* pBody = pairBody.first;
|
||||
const CTransform* pTransform = pBody->Get_TransformPtr();
|
||||
const CTransform* pTransform = static_cast<PhsXUserData*>(pBody->userData)->pOwner->Get_Component<CTransform>();
|
||||
|
||||
|
||||
pActor->setKinematicTarget(XMWorldToPx_NoScale(pTransform->Get_XMWorldMatrix()));
|
||||
}
|
||||
}
|
||||
@@ -320,10 +279,6 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
|
||||
}
|
||||
CTransform* pTransform = pUserData->pOwner->Get_Component<CTransform>();
|
||||
|
||||
|
||||
// PSX::PxTransform pPrevPxTransform = pUserData->m_BeforeMatrix;
|
||||
// XMMatrixDecompose(nullptr, (_vector*)&pPrevPxTransform.q, (_vector*)&pPrevPxTransform.p, XMLoadFloat4x4(&pUserData->m_BeforeMatrix));
|
||||
|
||||
PSX::PxTransform pPxTransform = pActorDynamic->getGlobalPose();
|
||||
_float3 vOriginalScale = pTransform->Get_Scale();
|
||||
_matrix WorldMatrix = {};
|
||||
@@ -332,60 +287,58 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
|
||||
pTransform->Set_WorldMatrix(WorldMatrix);
|
||||
}
|
||||
}
|
||||
//_uint iNumActor = (_uint)m_RigidBodys.size();
|
||||
//for (_uint i = 0; i < iNumActor; ++i) {
|
||||
//for (auto& pairBody : m_RigidBodys)
|
||||
// pairBody.second->userData
|
||||
//}
|
||||
}
|
||||
|
||||
//void CPhysX_Manager::Update_Dynamic_AllActors()
|
||||
//{
|
||||
// for (pair<CRigidBody*, PSX::PxActor*>& pairActors : m_RigidBodys) {
|
||||
// PSX::PxRigidDynamic* pActorDynamic = pairActors.second->is<PSX::PxRigidDynamic>();
|
||||
// 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()
|
||||
{
|
||||
for (auto& pObject : m_RigidBodys) {
|
||||
pObject.second->release();
|
||||
} m_RigidBodys.clear();
|
||||
for (auto& pBody : m_pActiveBodys) {
|
||||
pBody->release();
|
||||
} m_pActiveBodys.clear();
|
||||
for (auto& pBody : m_pRestBodies) {
|
||||
pBody->release();
|
||||
} m_pRestBodies.clear();
|
||||
}
|
||||
void CPhysX_Manager::Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor)
|
||||
void CPhysX_Manager::Attach_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
if (m_pScene == nullptr){
|
||||
unordered_set<PSX::PxActor*>::iterator iter = m_pRestBodies.find(&Actor);
|
||||
if (m_pRestBodies.end() == iter) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_RigidBodys.emplace_back(&RigidBody, &Actor);
|
||||
m_pScene->addActor(Actor);
|
||||
else {
|
||||
m_pRestBodies.erase(&Actor);
|
||||
}
|
||||
m_pActiveBodys.insert(&Actor);
|
||||
if (m_pScene != nullptr) {
|
||||
m_pScene->addActor(Actor);
|
||||
}
|
||||
}
|
||||
|
||||
void CPhysX_Manager::Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor)
|
||||
unordered_set<PSX::PxActor*>::iterator CPhysX_Manager::Detach_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
if (m_pScene == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
list<pair<CRigidBody*, PSX::PxActor*>>::iterator iter = m_RigidBodys.begin();
|
||||
for (; iter != m_RigidBodys.end(); ++iter){
|
||||
if ((*iter).second == pActor) {
|
||||
m_RigidBodys.erase(iter);
|
||||
break;
|
||||
unordered_set<PSX::PxActor*>::iterator iterOut = m_pRestBodies.end();
|
||||
unordered_set<PSX::PxActor*>::iterator iter = m_pActiveBodys.find(&Actor);
|
||||
if (m_pActiveBodys.end() != iter) {
|
||||
m_pActiveBodys.erase(iter); // 액터를 활성화 맵에서 분리 해주고
|
||||
iterOut = m_pRestBodies.insert(&Actor).first; // 액터를 다시 쓸 수 있기 때문에 따로 보관해줌
|
||||
if (m_pScene != nullptr) {
|
||||
m_pScene->removeActor(Actor);
|
||||
}
|
||||
}
|
||||
|
||||
m_pScene->removeActor(*pActor);
|
||||
return iterOut;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::Release_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
// 혹시 활성화 맵에 들어있을 수도 있으니 검사
|
||||
unordered_set<PSX::PxActor*>::iterator iterResult = Detach_Actor(Actor);
|
||||
if (m_pRestBodies.end() != iterResult) { // 방금 전까지만 해도 활성화 중이었던 액터 라면
|
||||
m_pRestBodies.erase(iterResult); // 바로 지워줌
|
||||
}
|
||||
else {
|
||||
m_pActiveBodys.erase(&Actor);
|
||||
m_pRestBodies.erase(&Actor);
|
||||
}
|
||||
Actor.release();
|
||||
}
|
||||
|
||||
PSX::PxController* CPhysX_Manager::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc)
|
||||
@@ -441,7 +394,7 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
}
|
||||
|
||||
if (FAILED(Connect_DebugServer())) {
|
||||
assert(false);
|
||||
ASSERT_NURI(false);
|
||||
}
|
||||
|
||||
{ // 씬 세팅
|
||||
@@ -512,10 +465,17 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
// m_pScene->overlap();??????
|
||||
|
||||
#ifdef 기무리
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
m_pMaterials.reserve(ENUM_CLASS(PXMATERIAL::END));
|
||||
m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);;
|
||||
|
||||
//{
|
||||
// float halfExtent = .5f;
|
||||
@@ -555,7 +515,9 @@ HRESULT CPhysX_Manager::Connect_DebugServer()
|
||||
assert(false);
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pPvd->connect(*m_pTransport, PSX::PxPvdInstrumentationFlag::eALL);
|
||||
if (false == (m_pPvd->connect(*m_pTransport, PSX::PxPvdInstrumentationFlag::eALL))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -571,9 +533,7 @@ CPhysX_Manager* CPhysX_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContex
|
||||
|
||||
void CPhysX_Manager::Free()
|
||||
{
|
||||
for (auto& pObjects : m_RigidBodys) {
|
||||
pObjects.second->release();
|
||||
} m_RigidBodys.clear();
|
||||
ClearScene();
|
||||
|
||||
for (auto& pMeshes : m_TriangleMeshes) {
|
||||
pMeshes.second->release();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "pch.h"
|
||||
#include "pch.h"
|
||||
#include "PipeLine.h"
|
||||
|
||||
CPipeLine::CPipeLine()
|
||||
@@ -30,6 +30,40 @@ const _vector CPipeLine::Get_CamXMPosition()
|
||||
return XMLoadFloat4(&m_vCamPosition);
|
||||
}
|
||||
|
||||
void CPipeLine::Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse)
|
||||
{
|
||||
_float4 vLocalPoints[8] = {};
|
||||
for (size_t i = 0; i < 8; i++)
|
||||
{
|
||||
XMStoreFloat4(&vLocalPoints[i],
|
||||
XMVector3TransformCoord(XMLoadFloat4(&m_vWorldPoints[i]), WorldMatrixInverse));
|
||||
}
|
||||
|
||||
Make_Planes(vLocalPoints, m_vLocalPlanes);
|
||||
}
|
||||
|
||||
_bool CPipeLine::isIn_WorldFrustum(_fvector vWorldPos, _float fRadius)
|
||||
{
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
if (fRadius < XMVectorGetX(XMPlaneDotCoord(XMLoadFloat4(&m_vWorldPlanes[i]), vWorldPos)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_bool CPipeLine::isIn_LocalFrustum(_fvector vLocalPos, _float fRadius)
|
||||
{
|
||||
for (size_t i = 0; i < 6; i++)
|
||||
{
|
||||
if (fRadius < XMVectorGetX(XMPlaneDotCoord(XMLoadFloat4(&m_vLocalPlanes[i]), vLocalPos)))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPipeLine::Update()
|
||||
{
|
||||
for (_uint i = ENUM_CLASS(D3DTS::VIEW_INV); i < ENUM_CLASS(D3DTS::END); ++i)
|
||||
@@ -38,11 +72,53 @@ void CPipeLine::Update()
|
||||
}
|
||||
|
||||
memcpy(&m_vCamPosition, &m_TransformStateMatrices[ENUM_CLASS(D3DTS::VIEW_INV)].m[3], sizeof(_float4));
|
||||
_matrix ProjInvMatrix = XMLoadFloat4x4(&m_TransformStateMatrices[ENUM_CLASS(D3DTS::PROJ_INV)]);
|
||||
_matrix ViewInvMatrix = XMLoadFloat4x4(&m_TransformStateMatrices[ENUM_CLASS(D3DTS::VIEW_INV)]);
|
||||
for (size_t i = 0; i < 8; i++)
|
||||
{
|
||||
XMStoreFloat4(&m_vWorldPoints[i], XMVector3TransformCoord(XMLoadFloat4(&m_vOriginalPoints[i]), ProjInvMatrix));
|
||||
XMStoreFloat4(&m_vWorldPoints[i], XMVector3TransformCoord(XMLoadFloat4(&m_vWorldPoints[i]), ViewInvMatrix));
|
||||
}
|
||||
|
||||
Make_Planes(m_vWorldPoints, m_vWorldPlanes);
|
||||
}
|
||||
|
||||
HRESULT CPipeLine::Initialize()
|
||||
{
|
||||
m_vOriginalPoints[0] = _float4(-1.f, 1.f, 0.f, 1.f); // LT
|
||||
m_vOriginalPoints[1] = _float4(1.f, 1.f, 0.f, 1.f); // RT
|
||||
m_vOriginalPoints[2] = _float4(1.f, -1.f, 0.f, 1.f); // RB
|
||||
m_vOriginalPoints[3] = _float4(-1.f, -1.f, 0.f, 1.f); // LB
|
||||
|
||||
m_vOriginalPoints[4] = _float4(-1.f, 1.f, 1.f, 1.f); // LT
|
||||
m_vOriginalPoints[5] = _float4(1.f, 1.f, 1.f, 1.f); // RT
|
||||
m_vOriginalPoints[6] = _float4(1.f, -1.f, 1.f, 1.f); // RB
|
||||
m_vOriginalPoints[7] = _float4(-1.f, -1.f, 1.f, 1.f); // LB
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CPipeLine::Make_Planes(const _float4* pPoints, _float4* pPlanes)
|
||||
{
|
||||
XMStoreFloat4(&pPlanes[0], XMPlaneFromPoints(XMLoadFloat4(&pPoints[1]), XMLoadFloat4(&pPoints[5]), XMLoadFloat4(&pPoints[6])));
|
||||
XMStoreFloat4(&pPlanes[1], XMPlaneFromPoints(XMLoadFloat4(&pPoints[4]), XMLoadFloat4(&pPoints[0]), XMLoadFloat4(&pPoints[3])));
|
||||
XMStoreFloat4(&pPlanes[2], XMPlaneFromPoints(XMLoadFloat4(&pPoints[4]), XMLoadFloat4(&pPoints[5]), XMLoadFloat4(&pPoints[1])));
|
||||
XMStoreFloat4(&pPlanes[3], XMPlaneFromPoints(XMLoadFloat4(&pPoints[3]), XMLoadFloat4(&pPoints[2]), XMLoadFloat4(&pPoints[6])));
|
||||
XMStoreFloat4(&pPlanes[4], XMPlaneFromPoints(XMLoadFloat4(&pPoints[5]), XMLoadFloat4(&pPoints[4]), XMLoadFloat4(&pPoints[7])));
|
||||
XMStoreFloat4(&pPlanes[5], XMPlaneFromPoints(XMLoadFloat4(&pPoints[0]), XMLoadFloat4(&pPoints[1]), XMLoadFloat4(&pPoints[2])));
|
||||
}
|
||||
|
||||
CPipeLine* CPipeLine::Create()
|
||||
{
|
||||
return new CPipeLine();
|
||||
CPipeLine* pInstance = new CPipeLine();
|
||||
|
||||
if (FAILED(pInstance->Initialize()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CPipeLine");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
void CPipeLine::Free()
|
||||
{
|
||||
|
||||
@@ -15,71 +15,24 @@ CRenderer::CRenderer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
|
||||
void CRenderer::Refresh_Renderer()
|
||||
HRESULT CRenderer::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObject)
|
||||
{
|
||||
if (nullptr == m_pGameInstance->Get_CamPosition()) {
|
||||
return;
|
||||
}
|
||||
_matrix matViewInv = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
_matrix matProjInv = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
|
||||
matProjInv = XMMatrixInverse(nullptr, matProjInv);
|
||||
matViewInv = XMMatrixInverse(nullptr, matViewInv);
|
||||
|
||||
memcpy_s(&m_CubeViewFrustum, sizeof(_float3) * 8, m_CubeNDC, sizeof(_float3) * 8);
|
||||
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
XMStoreFloat3(&m_CubeViewFrustum[i], XMVector3TransformCoord(XMVectorSet(m_CubeViewFrustum[i].x, m_CubeViewFrustum[i].y, m_CubeViewFrustum[i].z, 1.f), matProjInv));
|
||||
XMStoreFloat3(&m_CubeViewFrustum[i], XMVector3TransformCoord(XMVectorSet(m_CubeViewFrustum[i].x, m_CubeViewFrustum[i].y, m_CubeViewFrustum[i].z, 1.f), matViewInv));
|
||||
}
|
||||
// 0(1, 3, 4), 6(2, 5, 7) ( 법선벡터 후보 )
|
||||
// 0, 6( 한 점 후보)
|
||||
//_float3 m_CubeNDC[8] = {
|
||||
// 근 좌하 우하 우상 좌상
|
||||
// 원 좌하 우하 우상 좌상
|
||||
// 0, 1, 2, 3
|
||||
// 4, 5, 6, 7
|
||||
//{ -1.f, -1.f, 0.f }, { 1.f, -1.f, 0.f }, { 1.f, 1.f, 0.f }, { -1.f, 1.f, 0.f },
|
||||
//{ -1.f, -1.f, 1.f }, { 1.f, -1.f, 1.f }, { 1.f, 1.f, 1.f }, { -1.f, 1.f, 1.f }
|
||||
//};
|
||||
_vector vPlanes[8] = {};
|
||||
XMStoreFloat4(&m_vPlanes[0], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[0]), XMLoadFloat3(&m_CubeViewFrustum[3]), XMLoadFloat3(&m_CubeViewFrustum[4]))));
|
||||
XMStoreFloat4(&m_vPlanes[1], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[5]), XMLoadFloat3(&m_CubeViewFrustum[6]), XMLoadFloat3(&m_CubeViewFrustum[2]))));
|
||||
XMStoreFloat4(&m_vPlanes[2], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[1]), XMLoadFloat3(&m_CubeViewFrustum[2]), XMLoadFloat3(&m_CubeViewFrustum[3]))));
|
||||
XMStoreFloat4(&m_vPlanes[3], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[4]), XMLoadFloat3(&m_CubeViewFrustum[7]), XMLoadFloat3(&m_CubeViewFrustum[6]))));
|
||||
XMStoreFloat4(&m_vPlanes[4], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[0]), XMLoadFloat3(&m_CubeViewFrustum[4]), XMLoadFloat3(&m_CubeViewFrustum[5]))));
|
||||
XMStoreFloat4(&m_vPlanes[5], XMPlaneNormalize(XMPlaneFromPoints(XMLoadFloat3(&m_CubeViewFrustum[3]), XMLoadFloat3(&m_CubeViewFrustum[2]), XMLoadFloat3(&m_CubeViewFrustum[7]))));
|
||||
}
|
||||
|
||||
HRESULT CRenderer::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObject, _float4& vPos, _float fCullRadius)
|
||||
{
|
||||
if (nullptr == pRenderObject)
|
||||
if (nullptr == pRenderObject || pRenderObject->isDead()){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
_bool bPossible = { true };
|
||||
//if (pRenderObject->isDead()) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//// 프러스텀컬링 예외 추가
|
||||
//if (RENDER::UI == eRenderGroup || RENDER::PRIORITY == eRenderGroup /* || RENDER::SHADOW == eRenderGroup*/ || RENDER::BLUR == eRenderGroup) {
|
||||
// m_RenderObjects[ENUM_CLASS(eRenderGroup)].push_back(pRenderObject);
|
||||
// SAFE_ADDREF(pRenderObject);
|
||||
// return S_OK;
|
||||
//}
|
||||
//for (int i = 0; i < 6; ++i) {
|
||||
// if (XMVectorGetX(XMVector4Dot(XMLoadFloat4(&m_vPlanes[i]),
|
||||
// XMLoadFloat4(&vPos))) + fCullRadius < 0) {
|
||||
// bPossible = false;
|
||||
// break;
|
||||
// }
|
||||
//}
|
||||
if (bPossible) {
|
||||
_bool bPossible = { false };
|
||||
// 프러스텀컬링 예외 추가
|
||||
if (RENDER::UI == eRenderGroup || RENDER::PRIORITY == eRenderGroup /* || RENDER::SHADOW == eRenderGroup*/ || RENDER::BLUR == eRenderGroup) {
|
||||
bPossible = true;
|
||||
}
|
||||
bPossible = true;
|
||||
if (true == bPossible) {
|
||||
m_RenderObjects[ENUM_CLASS(eRenderGroup)].push_back(pRenderObject);
|
||||
SAFE_ADDREF(pRenderObject);
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -11,80 +11,12 @@ CRigidBody::CRigidBody(ID3D11Device* pDevice, ID3D11DeviceContext* pContext):
|
||||
CRigidBody::CRigidBody(const CRigidBody& rhs) :
|
||||
CComponent(rhs),
|
||||
m_eActorType(rhs.m_eActorType),
|
||||
m_vhalfGeometryInfo(rhs.m_vhalfGeometryInfo),
|
||||
m_wstrMeshKey(rhs.m_wstrMeshKey),
|
||||
m_vMatInfo(rhs.m_vMatInfo),
|
||||
m_ePxRigidBodyFlags(rhs.m_ePxRigidBodyFlags),
|
||||
m_ePxShapeFlags(rhs.m_ePxShapeFlags),
|
||||
m_eMatType(rhs.m_eMatType),
|
||||
m_fContactOffset(rhs.m_fContactOffset)
|
||||
{
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody::Render()
|
||||
{
|
||||
_matrix WorldMatrix = m_pTransform->Get_XMWorldMatrix();
|
||||
_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f);
|
||||
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
case ACTOR::CAPSULE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
_matrix WorldUp = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * m_vhalfGeometryInfo.y);
|
||||
_matrix WorldDown = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * -m_vhalfGeometryInfo.y);
|
||||
m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
case ACTOR::SPHERE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
void CRigidBody::Set_Kinematic(_bool bKinematic)
|
||||
{
|
||||
static_cast<PSX::PxRigidDynamic*>(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<PSX::PxRigidDynamic*>(m_pRigidBody)->addForce(vPxForce, eType);
|
||||
}
|
||||
|
||||
void CRigidBody::Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType)
|
||||
{
|
||||
PSX::PxVec3 vPxTorque = {};
|
||||
XMStoreFloat3((_float3*)&vPxTorque, vDirection);
|
||||
static_cast<PSX::PxRigidDynamic*>(m_pRigidBody)->addForce(vPxTorque, eType);
|
||||
}
|
||||
|
||||
HRESULT CRigidBody::Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc)
|
||||
{
|
||||
m_eActorType = Desc.eType;
|
||||
m_ePxRigidBodyFlags = Desc.ePxRigidBodyFlags;
|
||||
m_ePxShapeFlags = Desc.ePxShapeFlags;
|
||||
m_eMatType = Desc.ePxMaterialTypes;
|
||||
m_vMatInfo = Desc.vMatInfo;
|
||||
m_fContactOffset = Desc.fContactOffset;
|
||||
m_vhalfGeometryInfo = Desc.vhalfGeometryInfo;
|
||||
m_fDensity = Desc.fDensity;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRigidBody::Initialize(void* pArg)
|
||||
{
|
||||
@@ -97,136 +29,11 @@ HRESULT CRigidBody::Initialize(void* pArg)
|
||||
m_pTransform = m_pOwner->Get_Component<CTransform>();
|
||||
SAFE_ADDREF(m_pTransform);
|
||||
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case Engine::ACTOR::BOX:
|
||||
case Engine::ACTOR::CAPSULE:
|
||||
case Engine::ACTOR::SPHERE:
|
||||
m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this);
|
||||
break;
|
||||
case Engine::ACTOR::PLANE:
|
||||
break;
|
||||
case Engine::ACTOR::TRIANGLEMESH:
|
||||
m_pRigidBody = m_pGameInstance->Add_StaticActor(*this);
|
||||
break;
|
||||
case Engine::ACTOR::HEIGHTFIELD:
|
||||
break;
|
||||
case Engine::ACTOR::END:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Initialize_UserData();
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
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()
|
||||
{
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, m_vhalfGeometryInfo, false, false));
|
||||
break;
|
||||
case ACTOR::CAPSULE:
|
||||
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false));
|
||||
m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, m_vhalfGeometryInfo.y, m_vhalfGeometryInfo.x, 10, false));
|
||||
break;
|
||||
case ACTOR::SPHERE:
|
||||
m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false));
|
||||
break;
|
||||
case ACTOR::PLANE:
|
||||
case ACTOR::TRIANGLEMESH:
|
||||
case ACTOR::HEIGHTFIELD:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
CRigidBody* CRigidBody::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPEDESC& Desc)
|
||||
{
|
||||
CRigidBody* pInstance = new CRigidBody(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(Desc))) {
|
||||
MSG_BOX("CRigidBody Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* CRigidBody::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CRigidBody* pInstance = new CRigidBody(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg))) {
|
||||
MSG_BOX("CRigidBody Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CRigidBody::Free()
|
||||
{
|
||||
if (nullptr != m_pRigidBody) {
|
||||
m_pRigidBody = nullptr;
|
||||
}
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pTransform);
|
||||
|
||||
@@ -0,0 +1,159 @@
|
||||
#include "pch.h"
|
||||
#include "RigidBody_Dynamic.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CRigidBody_Dynamic::CRigidBody_Dynamic(ID3D11Device* pDevice, ID3D11DeviceContext* pContext):
|
||||
CRigidBody(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CRigidBody_Dynamic::CRigidBody_Dynamic(const CRigidBody_Dynamic& rhs) :
|
||||
CRigidBody(rhs),
|
||||
m_vMatInfo(rhs.m_vMatInfo),
|
||||
m_vhalfGeometryInfo(rhs.m_vhalfGeometryInfo)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody_Dynamic::Render()
|
||||
{
|
||||
_matrix WorldMatrix = m_pTransform->Get_XMWorldMatrix();
|
||||
_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f);
|
||||
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
case ACTOR::CAPSULE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
_matrix WorldUp = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * m_vhalfGeometryInfo.y);
|
||||
_matrix WorldDown = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * -m_vhalfGeometryInfo.y);
|
||||
m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
case ACTOR::SPHERE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
void CRigidBody_Dynamic::Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType)
|
||||
{
|
||||
PSX::PxVec3 vPxForce = {};
|
||||
XMStoreFloat3((_float3*)&vPxForce, vForce);
|
||||
m_pRigidBody->addForce(vPxForce, eType);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType)
|
||||
{
|
||||
PSX::PxVec3 vPxTorque = {};
|
||||
XMStoreFloat3((_float3*)&vPxTorque, vDirection);
|
||||
m_pRigidBody->addForce(vPxTorque, eType);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Kinematic(_bool bKinematic)
|
||||
{
|
||||
m_pRigidBody->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic);
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Dynamic::Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc)
|
||||
{
|
||||
m_eActorType = Desc.eType;
|
||||
m_ePxRigidBodyFlags = Desc.ePxRigidBodyFlags;
|
||||
m_ePxShapeFlags = Desc.ePxShapeFlags;
|
||||
m_eMatType = Desc.ePxMaterialTypes;
|
||||
m_vMatInfo = Desc.vMatInfo;
|
||||
m_fContactOffset = Desc.fContactOffset;
|
||||
m_vhalfGeometryInfo = Desc.vhalfGeometryInfo;
|
||||
m_fDensity = Desc.fDensity;
|
||||
m_vMassCenter = Desc.vMassCenter;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Dynamic::Initialize(void* pArg)
|
||||
{
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_DYNAMIC;
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
if (FAILED(Add_DebugShape())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this);
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody_Dynamic::Add_DebugShape()
|
||||
{
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
m_pMainShape = (GeometricPrimitive::CreateBox(m_pContext, m_vhalfGeometryInfo, false, false));
|
||||
break;
|
||||
case ACTOR::CAPSULE:
|
||||
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false));
|
||||
m_pMainShape = (GeometricPrimitive::CreateCylinder(m_pContext, m_vhalfGeometryInfo.y, m_vhalfGeometryInfo.x, 10, false));
|
||||
break;
|
||||
case ACTOR::SPHERE:
|
||||
m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, m_vhalfGeometryInfo.x, 10, false, false));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
CRigidBody_Dynamic* CRigidBody_Dynamic::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc)
|
||||
{
|
||||
CRigidBody_Dynamic* pInstance = new CRigidBody_Dynamic(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(Desc))) {
|
||||
MSG_BOX("CRigidBody_Dynamic Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* CRigidBody_Dynamic::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CRigidBody_Dynamic* pInstance = new CRigidBody_Dynamic(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg))) {
|
||||
MSG_BOX("CRigidBody_Dynamic Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Free()
|
||||
{
|
||||
__super::Free();
|
||||
if (nullptr != m_pRigidBody) {
|
||||
m_pRigidBody = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Describe_Entity()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "pch.h"
|
||||
#include "RigidBody_Static.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CRigidBody_Static::CRigidBody_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :
|
||||
CRigidBody(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CRigidBody_Static::CRigidBody_Static(const CRigidBody_Static& rhs) :
|
||||
CRigidBody(rhs),
|
||||
m_pMeshName(rhs.m_pMeshName)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Static::Initialize_Prototype(RIGIDBODY_STATIC_PROTOTYPEDESC& Desc)
|
||||
{
|
||||
m_eActorType = Desc.eType;
|
||||
m_ePxRigidBodyFlags = Desc.ePxRigidBodyFlags;
|
||||
m_ePxShapeFlags = Desc.ePxShapeFlags;
|
||||
m_eMatType = Desc.ePxMaterialTypes;
|
||||
m_fContactOffset = Desc.fContactOffset;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Static::Initialize(void* pArg)
|
||||
{
|
||||
m_tagData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
m_pRigidBody = m_pGameInstance->Add_StaticActor(*this);
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CRigidBody_Static* CRigidBody_Static::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_STATIC_PROTOTYPEDESC& Desc)
|
||||
{
|
||||
CRigidBody_Static* pInstance = new CRigidBody_Static(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype(Desc))) {
|
||||
MSG_BOX("CRigidBody_Static Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* CRigidBody_Static::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CRigidBody_Static* pInstance = new CRigidBody_Static(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg))) {
|
||||
MSG_BOX("CRigidBody_Static Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CRigidBody_Static::Free()
|
||||
{
|
||||
__super::Free();
|
||||
if (nullptr != m_pRigidBody) {
|
||||
m_pRigidBody = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void CRigidBody_Static::Describe_Entity()
|
||||
{
|
||||
}
|
||||
@@ -24,7 +24,8 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
_bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음
|
||||
_float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음
|
||||
|
||||
void* pCallback = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 CCollision_Callback 을 구현해야함
|
||||
PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함
|
||||
|
||||
// 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨
|
||||
// _float fSlopeLimit = { 코사인각도 };
|
||||
@@ -49,6 +50,7 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render() override;
|
||||
#endif
|
||||
PSX::PxRigidDynamic* Get_Actor();
|
||||
|
||||
_float Get_ContactOffset() const { return m_pController->getContactOffset(); }
|
||||
void Set_ContactOffset(_float fValue) { return m_pController->setContactOffset((PSX::PxF32)fValue); }
|
||||
|
||||
@@ -318,10 +318,10 @@ typedef struct tagVertexModelInstanceParticleDesc
|
||||
|
||||
typedef struct tagPhsXUserData {
|
||||
|
||||
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||
_uint iSubKind = UINT_MAX;
|
||||
class CGameObject* pOwner = { nullptr };
|
||||
_float4x4 m_BeforeMatrix = { };
|
||||
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||
class CGameObject* pOwner = { nullptr };
|
||||
_float4x4 BeforeMatrix = { };
|
||||
_uint iSubKind = UINT_MAX;
|
||||
|
||||
union {
|
||||
class CRigidBody* pBody;
|
||||
|
||||
@@ -94,8 +94,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
|
||||
|
||||
#pragma region RENDERER
|
||||
void Refresh_Renderer();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject, _float4& vPos, _float fCullRadius);
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ASSET_MANAGER
|
||||
@@ -116,7 +115,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
#pragma region MOUSE_MANAGER
|
||||
POINT Get_MouseViewPortPos();
|
||||
_bool Toggle_MouseCenter();
|
||||
_float3 Get_MouseMove();
|
||||
_float3 Get_MouseMove();
|
||||
void Picking();
|
||||
HRESULT Ray_WorldToLocal(_fmatrix* InvWorldMatrix);
|
||||
_bool MousePicking_InLocalSpace(const _float3& vPointA, const _float3& vPointB, const _float3& vPointC, _float3& pOut);
|
||||
@@ -130,6 +129,10 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
_matrix Get_Transform_Matrix(D3DTS eState);
|
||||
const _float4* Get_CamPosition();
|
||||
const _vector Get_CamXMPosition();
|
||||
void Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse);
|
||||
_bool isIn_WorldFrustum(_fvector vWorldPos, _float fRadius);
|
||||
_bool isIn_LocalFrustum(_fvector vLocalPos, _float fRadius);
|
||||
|
||||
#pragma endregion
|
||||
#pragma region LIGHT_MANAGER
|
||||
void Add_Light(_uint _iCurrentLevel, class CLight* _pLight);
|
||||
@@ -182,16 +185,17 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
#pragma region PhysX_Manager
|
||||
PSX::PxMaterial* Create_Material(_float3* vMatInfo);
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& 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);
|
||||
void Attach_Actor(PSX::PxActor& Actor);
|
||||
void Detach_Actor(PSX::PxActor& pActor);
|
||||
void Release_Actor(PSX::PxActor& Actor);
|
||||
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#include "pch.h"
|
||||
#include "CallBack_Playable_Behavior.h"
|
||||
|
||||
|
||||
CCallBack_Playable_Behavior::CCallBack_Playable_Behavior()
|
||||
{
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxShape& shape, const PSX::PxActor& actor)
|
||||
{
|
||||
if (nullptr == actor.userData) {
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
PhsXUserData* pActorData = static_cast<PhsXUserData*>(actor.userData);
|
||||
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT
|
||||
| PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
return PSX::PxControllerBehaviorFlag::eCCT_SLIDE;
|
||||
break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
// Action
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// 나머지는 아무 특별 동작 없음
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxController& controller)
|
||||
{
|
||||
// CCT끼리 부딪힐 때를 굳이 안 쓰면 0 리턴
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
|
||||
PSX::PxControllerBehaviorFlags CCallBack_Playable_Behavior::getBehaviorFlags(const PSX::PxObstacle& obstacle)
|
||||
{
|
||||
// Obstacle이 움직이는 발판이다?
|
||||
// 여기서 ride/slide 세팅
|
||||
//return PSX::PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT;
|
||||
|
||||
return PSX::PxControllerBehaviorFlags(0);
|
||||
}
|
||||
+7
-15
@@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
NS_BEGIN(PSX)
|
||||
class PxControllerBehaviorCallback;
|
||||
class PxUserControllerHitReport;
|
||||
NS_END
|
||||
|
||||
class CCollision_Callback final : public PSX::PxUserControllerHitReport, PSX::PxControllerBehaviorCallback
|
||||
class CCallBack_Playable_Behavior final : public PSX::PxControllerBehaviorCallback
|
||||
{
|
||||
// 구현 예시
|
||||
// CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
|
||||
@@ -12,21 +16,10 @@ class CCollision_Callback final : public PSX::PxUserControllerHitReport, PSX::Px
|
||||
// PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
|
||||
|
||||
public:
|
||||
NO_COPY(CCollision_Callback)
|
||||
CCollision_Callback();
|
||||
~CCollision_Callback()=default;
|
||||
CCallBack_Playable_Behavior();
|
||||
~CCallBack_Playable_Behavior() = 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로 미끄러져 갈 수 있는지 없는지 이분법적인 계산 대신, 원하는 물체에 대해서만 미끄러운 표면으로 정의해줌
|
||||
@@ -37,4 +30,3 @@ class CCollision_Callback final : public PSX::PxUserControllerHitReport, PSX::Px
|
||||
|
||||
virtual PSX::PxControllerBehaviorFlags getBehaviorFlags(const PSX::PxObstacle& obstacle) override;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
#include "pch.h"
|
||||
#include "CallBack_Playable_HitRepot.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CCallBack_Playable_HitRepot::CCallBack_Playable_HitRepot()
|
||||
{
|
||||
}
|
||||
|
||||
void CCallBack_Playable_HitRepot::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<PhsXUserData*>(pActor->userData);
|
||||
if (nullptr == pActorData) { // missing user data
|
||||
return;
|
||||
}
|
||||
switch (pActorData->eKind)
|
||||
{
|
||||
case PHYSX_KIND::BODY_STATIC:
|
||||
// action
|
||||
break;
|
||||
case PHYSX_KIND::BODY_DYNAMIC:
|
||||
{
|
||||
PSX::PxRigidDynamic* pDynamic = static_cast<PSX::PxRigidDynamic*>(pActor);
|
||||
pDynamic->addForce(vDir * fLength, PSX::PxForceMode::eIMPULSE);
|
||||
} break;
|
||||
case PHYSX_KIND::CCTActor:
|
||||
assert(false);
|
||||
break;
|
||||
case PHYSX_KIND::OBSTACLEActor:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCallBack_Playable_HitRepot::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<PhsXUserData*>(pOtherController->getActor()->userData);
|
||||
assert(nullptr != pActorData); // 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 CCallBack_Playable_HitRepot::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;
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
NS_BEGIN(PSX)
|
||||
class PxControllerBehaviorCallback;
|
||||
class PxUserControllerHitReport;
|
||||
NS_END
|
||||
|
||||
class CCallBack_Playable_HitRepot final : public PSX::PxUserControllerHitReport
|
||||
{
|
||||
// 구현 예시
|
||||
// CCT는 RigidBody의 PxSimulationEventCallback에 안걸리고, 이 전용 콜백에서 처리되는 구조임
|
||||
//
|
||||
// PxUserControllerHitReport = "무엇과 부딪혔는지 알려줌(이벤트 알림)"
|
||||
// PxControllerBehaviorCallback = "부딪힌 것에 대해 어떤 행동 정책을 쓸지 물어봄(질의)"
|
||||
// PxSimulationEventCallback = "씬 전체에 대한 글로벌 콜백(일반 물리 이벤트)"
|
||||
|
||||
public:
|
||||
CCallBack_Playable_HitRepot();
|
||||
~CCallBack_Playable_HitRepot() = 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; // 사용자 정의 장애물과 부딪힌 경우
|
||||
};
|
||||
@@ -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
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CRigidBody;
|
||||
class CRigidBody_Dynamic;
|
||||
class CRigidBody_Static;
|
||||
class CTransform;
|
||||
class CMesh;
|
||||
|
||||
@@ -20,8 +22,8 @@ class CPhysX_Manager final : public CBase
|
||||
// HRESULT Update_RegionOfInterest(); ( 충돌 컬링, 필터링도 검색해야함 )
|
||||
// Aggregate ( 충돌 그룹, 이 그룹끼리는 서로 충돌검사를 하지 않음, 지형, 레그돌 등 )
|
||||
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody& RigidBody);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody);
|
||||
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
|
||||
@@ -30,14 +32,14 @@ class CPhysX_Manager final : public CBase
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
PSX::PxTriangleMesh* Find_TriangleMesh(const _wstring& wstrMeshKey);
|
||||
PSX::PxTriangleMesh* Find_TriangleMesh(const _tchar* pMeshName);
|
||||
|
||||
void Update(_float fTimeDelta);
|
||||
void ClearScene();
|
||||
void Attach_Actor(CRigidBody& RigidBody, PSX::PxActor& Actor);
|
||||
void Detach_Actor(CRigidBody& RigidBody, PSX::PxActor*& pActor);
|
||||
void Attach_Actor(PSX::PxActor& Actor);
|
||||
unordered_set<PSX::PxActor*>::iterator Detach_Actor(PSX::PxActor& Actor);
|
||||
void Release_Actor(PSX::PxActor& Actor);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region CHARACTER_CONTROLLER
|
||||
/* dev-treadmill.tistory.com/158 */
|
||||
|
||||
@@ -73,9 +75,15 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
|
||||
|
||||
list<pair<CRigidBody*, PSX::PxActor*>> m_RigidBodys = { };
|
||||
unordered_set<PSX::PxActor*> m_pActiveBodys = { };
|
||||
unordered_set<PSX::PxActor*> m_pRestBodies = { }; // 피직스의 액터로 구별되기 때문에 피직스액터 포인터를 키로 사용함
|
||||
map<_wstring, PSX::PxTriangleMesh*> m_TriangleMeshes = {};
|
||||
map<_wstring, PSX::PxTriangleMeshGeometry*> m_TriangleMeshGeometry = {};
|
||||
#ifdef 기무리
|
||||
PhsXUserData PlaneData = {};
|
||||
|
||||
#endif // 기무리
|
||||
|
||||
|
||||
vector<PSX::PxMaterial*> m_pMaterials = { };
|
||||
_uint m_iNumLevel = {};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
@@ -17,6 +17,11 @@ class CPipeLine final : public CBase
|
||||
const _float4* Get_CamPosition();
|
||||
const _vector Get_CamXMPosition();
|
||||
|
||||
void Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse);
|
||||
_bool isIn_WorldFrustum(_fvector vWorldPos, _float fRadius);
|
||||
_bool isIn_LocalFrustum(_fvector vLocalPos, _float fRadius);
|
||||
|
||||
|
||||
public:
|
||||
void Update();
|
||||
|
||||
@@ -24,10 +29,18 @@ class CPipeLine final : public CBase
|
||||
_float4x4 m_TransformStateMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
_float4 m_vCamPosition = {};
|
||||
|
||||
_float4 m_vOriginalPoints[8] = {};
|
||||
_float4 m_vWorldPoints[8] = {};
|
||||
_float4 m_vWorldPlanes[6] = {};
|
||||
_float4 m_vLocalPlanes[6] = {};
|
||||
|
||||
private:
|
||||
HRESULT Initialize();
|
||||
void Make_Planes(const _float4* pPoints, _float4* pPlanes);
|
||||
public:
|
||||
static CPipeLine* Create();
|
||||
virtual void Free() override;
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include "VIBuffer_Cell.h"
|
||||
#include "Shader.h"
|
||||
#include "Navigation.h"
|
||||
#include "RigidBody.h"
|
||||
#include "RigidBody_Dynamic.h"
|
||||
#include "RigidBody_Static.h"
|
||||
#include "Texture.h"
|
||||
#include "Cell.h"
|
||||
#include "Model.h"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
|
||||
@@ -11,9 +11,8 @@ class CRenderer final : public CBase
|
||||
virtual ~CRenderer() = default;
|
||||
|
||||
public:
|
||||
void Refresh_Renderer();
|
||||
void Render();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject, _float4& vPos, _float fCullRadius);
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
@@ -38,12 +37,6 @@ class CRenderer final : public CBase
|
||||
_float4x4 m_WorldMatrix = {};
|
||||
_float4x4 m_ViewMatrix = {};
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
_float4 m_vPlanes[6] = {};
|
||||
_float3 m_CubeViewFrustum[8] = {};
|
||||
_float3 m_CubeNDC[8] = {
|
||||
{ -1.f, -1.f, 0.f }, { 1.f, -1.f, 0.f }, { 1.f, 1.f, 0.f }, { -1.f, 1.f, 0.f },
|
||||
{ -1.f, -1.f, 1.f }, { 1.f, -1.f, 1.f }, { 1.f, 1.f, 1.f }, { -1.f, 1.f, 1.f }
|
||||
};
|
||||
|
||||
ID3D11DepthStencilView* m_pShadowDSV = { nullptr };
|
||||
|
||||
@@ -82,4 +75,4 @@ class CRenderer final : public CBase
|
||||
virtual void Free();
|
||||
};
|
||||
|
||||
NS_END
|
||||
NS_END
|
||||
|
||||
@@ -10,9 +10,9 @@ NS_BEGIN(Engine)
|
||||
class CTransform;
|
||||
class CMesh;
|
||||
|
||||
class ENGINE_DLL CRigidBody final : public CComponent
|
||||
class ENGINE_DLL CRigidBody abstract : public CComponent
|
||||
{
|
||||
public: // MORE INFO ON ENGINE_ENUM
|
||||
protected: // MORE INFO ON ENGINE_ENUM
|
||||
typedef struct tagRigidBody_PrototypeDesc // 다 채우세요 NONE 빼고, 목적에 안맞는거 빼고
|
||||
{
|
||||
ACTOR eType;
|
||||
@@ -22,91 +22,41 @@ class ENGINE_DLL CRigidBody final : public CComponent
|
||||
_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
|
||||
}RIGIDBODY_PROTOTYPEDESC;
|
||||
|
||||
typedef struct tagRigidBody_Desc
|
||||
{
|
||||
#pragma region DYNAMIC
|
||||
#pragma endregion
|
||||
#pragma region STATIC
|
||||
const _char* szMeshName = { };
|
||||
#pragma endregion
|
||||
|
||||
}RIGIDBODY_DESC;
|
||||
|
||||
private:
|
||||
protected:
|
||||
CRigidBody(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRigidBody(const CRigidBody& rhs);
|
||||
virtual ~CRigidBody() = default;
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render()override;
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
ACTOR Get_Type() const { return m_eActorType; }
|
||||
PSX::PxActor* Get_Actor() const { return m_pRigidBody; }
|
||||
virtual PSX::PxActor* Get_Actor()PURE;
|
||||
CTransform* Get_TransformPtr() const { return m_pTransform; }
|
||||
const _tchar* Get_PxMeshKey() const { return m_wstrMeshKey.c_str(); }
|
||||
PXMATERIAL Get_MaterialType() const { return m_eMatType; }
|
||||
_float Get_ContactOffset() const { return m_fContactOffset; }
|
||||
_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; }
|
||||
|
||||
|
||||
// 키네마틱은 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:
|
||||
protected:
|
||||
ACTOR m_eActorType = ACTOR::END;
|
||||
PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = {};
|
||||
PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = { };
|
||||
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 };
|
||||
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 키
|
||||
#pragma endregion
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
#endif // _DEBUG
|
||||
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPEDESC& Desc);
|
||||
HRESULT Initialize(void* pArg);
|
||||
HRESULT Initialize_UserData();
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
#endif
|
||||
protected:
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
|
||||
public:
|
||||
static CRigidBody* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPEDESC& Desc);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
#pragma once
|
||||
#include "RigidBody.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CTransform;
|
||||
class CMesh;
|
||||
|
||||
class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
{
|
||||
public:
|
||||
typedef struct tagRigidBody_Prototype_DYNAMIC_Desc : public CRigidBody::RIGIDBODY_PROTOTYPEDESC
|
||||
{
|
||||
_float3 vhalfGeometryInfo; // 박스는 vSize, 캡슐은 radius, height로 씀
|
||||
_float fDensity = { 1000.f }; // 밀도, 실제 무게는 부피에 따라 달라짐
|
||||
_float3 vMassCenter = {};
|
||||
}RIGIDBODY_PROTOTYPE_DYNAMIC_DESC;
|
||||
|
||||
typedef struct tagRigidBody_DYNAMIC_Desc : public CRigidBody::RIGIDBODY_DESC
|
||||
{
|
||||
|
||||
}RIGIDBODY_DYNAMIC_DESC;
|
||||
|
||||
private:
|
||||
CRigidBody_Dynamic(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRigidBody_Dynamic(const CRigidBody_Dynamic& rhs);
|
||||
virtual ~CRigidBody_Dynamic() = default;
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render()override;
|
||||
#endif // _DEBUG
|
||||
|
||||
virtual PSX::PxRigidDynamic* Get_Actor() override { return m_pRigidBody; };
|
||||
_float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
|
||||
_float Get_Density() const { return m_fDensity; }
|
||||
|
||||
virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향
|
||||
virtual void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향 ( 회전축은 MassCenter )
|
||||
void Set_Kinematic(_bool bKinematic);
|
||||
|
||||
private:
|
||||
PSX::PxRigidDynamic* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
|
||||
_float3 m_vMatInfo = {};
|
||||
_float3 m_vhalfGeometryInfo = {};
|
||||
_float3 m_vMassCenter = {}; // 회전축
|
||||
_float m_fDensity = { 1000.f };
|
||||
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
#endif // _DEBUG
|
||||
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc);
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static CRigidBody_Dynamic* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include "RigidBody.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CTransform;
|
||||
class CMesh;
|
||||
|
||||
|
||||
class ENGINE_DLL CRigidBody_Static : public CRigidBody
|
||||
{
|
||||
public:
|
||||
typedef struct tagRigidBody_Prototype_STATIC_Desc : public CRigidBody::RIGIDBODY_PROTOTYPEDESC
|
||||
{
|
||||
|
||||
}RIGIDBODY_STATIC_PROTOTYPEDESC;
|
||||
|
||||
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_PROTOTYPEDESC
|
||||
{
|
||||
const _tchar* pMeshName = { nullptr };
|
||||
}RIGIDBODY_STATIC_DESC;
|
||||
|
||||
private:
|
||||
CRigidBody_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRigidBody_Static(const CRigidBody_Static& rhs);
|
||||
virtual ~CRigidBody_Static() = default;
|
||||
|
||||
public:
|
||||
PSX::PxRigidStatic* Get_Actor() override { return m_pRigidBody; }
|
||||
const _tchar* Get_PxMeshKey() const { return m_pMeshName; }
|
||||
|
||||
private:
|
||||
PSX::PxRigidStatic* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
|
||||
const _tchar* m_pMeshName = { nullptr }; // 짝꿍 스태틱 메시의 triangleMesh 키
|
||||
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_STATIC_PROTOTYPEDESC& Desc);
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
static CRigidBody_Static* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, RIGIDBODY_STATIC_PROTOTYPEDESC& Desc);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
Reference in New Issue
Block a user