[add] PhysxFilter 정상화
This commit is contained in:
@@ -119,7 +119,7 @@ HRESULT CEffectPool::Initialize(void* pArg)
|
||||
m_isActiveMonsterEffectCreate = true;
|
||||
#endif //
|
||||
#ifdef 기무리
|
||||
m_isActiveEffectCreate = false;
|
||||
m_isActiveEffectCreate = true;
|
||||
m_isActiveMonsterEffectCreate = false;
|
||||
#endif //
|
||||
#ifdef 나
|
||||
|
||||
@@ -126,7 +126,7 @@ HRESULT CLevel_GamePlay::Initialize(void* pArg)
|
||||
_bool bLoadNPC = { true };
|
||||
#ifdef _DEBUG
|
||||
#ifdef 기무리
|
||||
bLoadNPC = true;
|
||||
bLoadNPC = false;
|
||||
#endif
|
||||
#endif // _DEBUG
|
||||
if (true == bLoadNPC) {
|
||||
@@ -170,7 +170,7 @@ void CLevel_GamePlay::Update(_float fTimeDelta)
|
||||
_bool bStartCinematic = { true };
|
||||
#ifdef _DEBUG
|
||||
#ifdef 기무리
|
||||
bStartCinematic = true;
|
||||
bStartCinematic = false;
|
||||
#elif 진우
|
||||
bStartCinematic = true;
|
||||
#elif Bin
|
||||
@@ -365,7 +365,7 @@ HRESULT CLevel_GamePlay::Ready_Background()
|
||||
#ifdef 기무리
|
||||
isReady_Background = true;
|
||||
isReady_Hogsmeade = true;
|
||||
isReady_Hogwart = true;
|
||||
isReady_Hogwart = false;
|
||||
#endif //
|
||||
#ifdef 나
|
||||
isReady_Background = false;
|
||||
@@ -1140,8 +1140,8 @@ HRESULT CLevel_GamePlay::Ready_Layer_Npc()
|
||||
isLoad_NPC = false;
|
||||
#endif //
|
||||
#ifdef 기무리
|
||||
isLoad_NPC = true;
|
||||
isLoad_RandomNPC = true;
|
||||
isLoad_NPC = false;
|
||||
isLoad_RandomNPC = false;
|
||||
#endif //
|
||||
#ifdef 나
|
||||
isLoad_RandomNPC = true;
|
||||
|
||||
@@ -563,9 +563,9 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
#endif //
|
||||
#ifdef 기무리
|
||||
isLoad_Background = true;
|
||||
isLoad_Hogwart = true;
|
||||
isLoad_Hogwart = false;
|
||||
isLoad_UI_SEQUANTIAL = false;
|
||||
isLoad_NPC = true;
|
||||
isLoad_NPC = false;
|
||||
isLoad_Monster = true;
|
||||
#endif //
|
||||
#ifdef 나
|
||||
@@ -2538,10 +2538,10 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
}
|
||||
}
|
||||
{ // LIGHT PHYSX DYNAMIC
|
||||
CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{};
|
||||
{
|
||||
CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC Desc{};
|
||||
Desc.eType = ACTOR::BOX;
|
||||
Desc.ePxRigidBodyFlags = { /*PSX::PxRigidBodyFlag::eKINEMATIC*/ };
|
||||
Desc.ePxRigidBodyFlags = { };
|
||||
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 };
|
||||
@@ -2553,6 +2553,15 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
Desc.vAutoDamping = { 1.f, 1.f };
|
||||
Desc.vLocalRotQ = { 0.f, 0.f, 0.f, 1.f };
|
||||
Desc.vLocalTranslation = { 0.f, 0.f, 0.f };
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_THROWABLE_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
CRigidBody_Dynamic::RIGIDBODY_PROTOTYPE_DYNAMIC_DESC ShieldDesc{};
|
||||
@@ -2641,12 +2650,6 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
RanrokDesc.vLocalTranslation = { 0.f, 5.f, 0.f };
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_SHIELD"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, ShieldDesc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -2664,10 +2667,6 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_RANROK"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, RanrokDesc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Desc.ePxRigidBodyFlags = { PSX::PxRigidBodyFlag::eKINEMATIC };
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), CCharacter_Controller::Create(m_pDevice, m_pContext)))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -59,6 +59,7 @@ HRESULT CMapElement_Chest::Initialize(void* pArg)
|
||||
|
||||
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize);
|
||||
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition));
|
||||
m_pRigidBody->Set_Kinematic(true);
|
||||
m_bChest = true;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -235,7 +236,8 @@ HRESULT CMapElement_Chest::Ready_Components(void* pArg)
|
||||
// RIGID_BODY
|
||||
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
|
||||
Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
Desc.bAutoOwnerTranslation = false;
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_THROWABLE_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg)
|
||||
|
||||
// RIGID_BODY
|
||||
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
|
||||
Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind;
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX_KIN"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_THROWABLE_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ HRESULT CMapElement_Interactable::Initialize(void* pArg)
|
||||
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Move_LocalPos(XMVectorSet(0.f, 0.f, 0.f, 1.f), XMLoadFloat3(&pDesc->vBoxLocalPosition));
|
||||
//static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_Kinematic(false);
|
||||
|
||||
if (false == m_isPooled)
|
||||
{
|
||||
m_bVisible = true;
|
||||
m_pInfoInstance->Regist_ActiveInteractive(this);
|
||||
}
|
||||
else
|
||||
if (true == m_isPooled)
|
||||
{
|
||||
m_bVisible = false;
|
||||
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_Kinematic(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bVisible = true;
|
||||
m_pInfoInstance->Regist_ActiveInteractive(this);
|
||||
}
|
||||
|
||||
|
||||
m_pEffectPool = m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_EffectPool"))->Get_Object<CEffectPool>();
|
||||
|
||||
@@ -69,80 +69,7 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
|
||||
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel)
|
||||
{
|
||||
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix);
|
||||
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
PSX::PxGeometry* pGeometry = { nullptr };
|
||||
|
||||
switch (RigidBody.Get_Type())
|
||||
{
|
||||
case ACTOR::PLANE:
|
||||
break;
|
||||
case ACTOR::TRIANGLEMESH:
|
||||
{ // SetUp Geometry
|
||||
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey(), iLevel);
|
||||
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
|
||||
|
||||
_vector vPos, vRotq, vScale;
|
||||
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
|
||||
vRotq = XMQuaternionNormalize(vRotq);
|
||||
|
||||
PSX::PxTransform out;
|
||||
XMStoreFloat3((_float3*)&out.p, vPos);
|
||||
XMStoreFloat4((_float4*)&out.q, vRotq);
|
||||
PSX::PxMeshScale meshScale(
|
||||
PSX::PxVec3(fabsf(vScale.m128_f32[0]), fabsf(vScale.m128_f32[1]), fabsf(vScale.m128_f32[2])),
|
||||
PSX::PxQuat(PSX::PxIdentity) // 스케일 축은 로컬 기준
|
||||
);
|
||||
pPxMeshGeometry = new PSX::PxTriangleMeshGeometry(pPxMesh, meshScale);
|
||||
|
||||
// GeoFlag 중 더블사이드는 이제 지원 안함, 할거면 노말 뒤집어서 하라고 함
|
||||
// pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxMeshGeometry->isValid());
|
||||
pGeometry = pPxMeshGeometry;
|
||||
_bool bEmplaceSuccess = m_TriangleMeshGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry).second;
|
||||
if (false == bEmplaceSuccess) {
|
||||
Safe_Delete(pPxMeshGeometry);
|
||||
pGeometry = (*m_TriangleMeshGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTOR::HEIGHTFIELD:
|
||||
{ // SetUp HeightField
|
||||
PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey(), iLevel);
|
||||
PSX::PxHeightFieldGeometry* pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField);
|
||||
pPxHeightGeometry->heightScale = 0.01f/* 기본 정밀도 100배 0.01 -> 1cm, 1 -> 1m */;
|
||||
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxHeightGeometry->isValid());
|
||||
pGeometry = pPxHeightGeometry;
|
||||
_bool bEmplaceSuccess = m_HeightFieldGeometry[iLevel].emplace(RigidBody.Get_PxMeshKey(), pPxHeightGeometry).second;
|
||||
if (false == bEmplaceSuccess) {
|
||||
Safe_Delete(pPxHeightGeometry);
|
||||
pGeometry = (*m_HeightFieldGeometry[iLevel].find(RigidBody.Get_PxMeshKey())).second;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorStatic, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
|
||||
pShape->setFlags(RigidBody.Get_ShapeFlags());
|
||||
pShape->setContactOffset(RigidBody.Get_ContactOffset());
|
||||
pShape->setRestOffset(0.f);
|
||||
|
||||
m_pRestBodies[iLevel].insert(pActorStatic);
|
||||
ApplyFilterData(pActorStatic);
|
||||
Attach_Actor(*pActorStatic, iLevel);
|
||||
|
||||
return pActorStatic;
|
||||
return Add_StaticActor(RigidBody, iLevel, RigidBody.Get_TransformPtr()->Get_WorldMatrixPtr());
|
||||
}
|
||||
|
||||
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel, const _float4x4* pWorldMatrix)
|
||||
@@ -153,6 +80,7 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
pActorStatic->userData = RigidBody.Get_UserDataPtr();
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
PSX::PxGeometry* pGeometry = { nullptr };
|
||||
|
||||
@@ -650,36 +578,14 @@ uint32_t CPhysX_Manager::ConvertPhysxKindToBit(const PHYSX_USERDATA& physxUserDa
|
||||
return COLLISIONCATERGORY_BIT32::CharacterController;
|
||||
|
||||
if (physxUserData.eKind == PHYSX_KIND::BODY_DYNAMIC)
|
||||
{
|
||||
_bool isJointRelatedPart =
|
||||
physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ANCHOR) ||
|
||||
physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ROUTE);
|
||||
|
||||
if (true == isJointRelatedPart)
|
||||
return COLLISIONCATERGORY_BIT32::JointedParts;
|
||||
|
||||
return COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
return 0u;
|
||||
}
|
||||
|
||||
uint32_t CPhysX_Manager::BuildCollisionMaskFromCategoryBit(uint32_t iMyBit)
|
||||
{
|
||||
if (iMyBit == COLLISIONCATERGORY_BIT32::CharacterController)
|
||||
{
|
||||
// CCT는 조인트 파츠 충돌x
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
if (iMyBit == COLLISIONCATERGORY_BIT32::JointedParts)
|
||||
{
|
||||
// 조인트 파츠도 CCT 충돌x
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
// 기본값
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic | COLLISIONCATERGORY_BIT32::CharacterController | COLLISIONCATERGORY_BIT32::JointedParts;
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic | COLLISIONCATERGORY_BIT32::CharacterController;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::ApplyFilterData(PSX::PxRigidActor* pRigidActor)
|
||||
@@ -693,8 +599,8 @@ void CPhysX_Manager::ApplyFilterData(PSX::PxRigidActor* pRigidActor)
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t CategoryBit = ConvertPhysxKindToBit(*physxUserData); // who am i
|
||||
const uint32_t MaskBits = BuildCollisionMaskFromCategoryBit(CategoryBit); // for what
|
||||
_uint CategoryBit = ConvertPhysxKindToBit(*physxUserData); // who am i
|
||||
_uint MaskBits = BuildCollisionMaskFromCategoryBit(CategoryBit); // for what
|
||||
|
||||
PSX::PxFilterData DATAfilter = {};
|
||||
DATAfilter.word0 = CategoryBit; // 나는 누구인가
|
||||
@@ -717,7 +623,6 @@ void CPhysX_Manager::ApplyFilterData(PSX::PxRigidActor* pRigidActor)
|
||||
// 씬쿼리 대상 플래그 보장
|
||||
shape->setFlag(PSX::PxShapeFlag::eSCENE_QUERY_SHAPE, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PSX::PxFilterFlags CPhysX_Manager::SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0, PSX::PxFilterObjectAttributes pxAttributes1, PSX::PxFilterData pxFilterData1, PSX::PxPairFlags& pxPairFlags, const void* pConstantBlock, PSX::PxU32 iConstantBlockSize)
|
||||
|
||||
@@ -17,9 +17,8 @@ class CPhysX_Manager final : public CBase
|
||||
enum COLLISIONCATERGORY_BIT32 : uint32_t
|
||||
{
|
||||
CharacterController = 1u << 0
|
||||
, JointedParts = 1u << 1
|
||||
, WorldStatic = 1u << 2
|
||||
, WorldDynamic = 1u << 3
|
||||
, WorldStatic = 1u << 1
|
||||
, WorldDynamic = 1u << 2
|
||||
};
|
||||
private:
|
||||
CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
Reference in New Issue
Block a user