[add] 다음레벨 활성화
This commit is contained in:
@@ -1044,9 +1044,9 @@ void CGameInstance::Detach_Actor(PSX::PxActor& Actor, _uint iLevel)
|
||||
{
|
||||
m_pPhysX_Manager->Detach_Actor(Actor, iLevel);
|
||||
}
|
||||
void CGameInstance::Release_Actor(PSX::PxActor& Actor, _uint iLevel)
|
||||
void CGameInstance::Release_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Detach_Actor(Actor, iLevel);
|
||||
m_pPhysX_Manager->Release_Actor(Actor);
|
||||
}
|
||||
HRESULT CGameInstance::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,8 @@ 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_NoScale(WorldMatrix);
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
|
||||
|
||||
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
@@ -494,18 +495,24 @@ unordered_set<PSX::PxActor*>::iterator CPhysX_Manager::Detach_Actor(PSX::PxActor
|
||||
return iterOut;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::Release_Actor(PSX::PxActor& Actor, _uint iLevel)
|
||||
void CPhysX_Manager::Release_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
// 혹시 활성화 맵에 들어있을 수도 있으니 검사
|
||||
unordered_set<PSX::PxActor*>::iterator iterResult = Detach_Actor(Actor, iLevel);
|
||||
if (m_pRestBodies[iLevel].end() != iterResult) { // 방금 전까지만 해도 활성화 중이었던 액터 라면
|
||||
m_pRestBodies[iLevel].erase(iterResult); // 바로 지워줌
|
||||
unordered_set<PSX::PxActor*>::iterator iterResult = {};
|
||||
_uint iReleasedLevel = UINT_MAX;
|
||||
for (_uint iLevel = 0; iLevel < m_iMaxLevel; ++iLevel) {
|
||||
iterResult = Detach_Actor(Actor, iLevel);
|
||||
if (m_pRestBodies[iLevel].end() != iterResult) { // 방금 전까지만 해도 활성화 중이었던 액터 라면
|
||||
m_pRestBodies[iLevel].erase(iterResult); // 바로 지워줌
|
||||
iReleasedLevel = iLevel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_pActiveBodys[iLevel].erase(&Actor);
|
||||
m_pRestBodies[iLevel].erase(&Actor);
|
||||
if (UINT_MAX == iReleasedLevel) {
|
||||
m_pActiveBodys[iReleasedLevel].erase(&Actor);
|
||||
m_pRestBodies[iReleasedLevel].erase(&Actor);
|
||||
}
|
||||
Actor.release();
|
||||
//Actor.release();
|
||||
}
|
||||
|
||||
PSX::PxController* CPhysX_Manager::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc)
|
||||
@@ -647,7 +654,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 50), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 85), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
|
||||
@@ -393,9 +393,11 @@ HRESULT CVIBuffer_Terrain::Initialize(void* pArg)
|
||||
|
||||
void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
{
|
||||
PSX::PxHeightFieldDesc Desc{};
|
||||
Desc.format = PSX::PxHeightFieldFormat::eS16_TM;
|
||||
|
||||
vector<PSX::PxHeightFieldSample> pxSamples = {};
|
||||
pxSamples.resize(m_iNumVerticesZ * m_iNumVerticesX);
|
||||
|
||||
for (_uint iRow = 0; iRow < m_iNumVerticesZ; ++iRow) {
|
||||
for (_uint iCol = 0; iCol < m_iNumVerticesX; ++iCol) {
|
||||
_uint iIndex = iRow * m_iNumVerticesX + iCol;
|
||||
@@ -411,11 +413,9 @@ void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
pxSample.clearTessFlag();
|
||||
}
|
||||
}
|
||||
Desc.nbRows = m_iNumVerticesX;
|
||||
Desc.nbColumns = m_iNumVerticesZ;
|
||||
|
||||
PSX::PxHeightFieldDesc Desc{};
|
||||
Desc.format = PSX::PxHeightFieldFormat::eS16_TM;
|
||||
Desc.nbRows = m_iNumVerticesZ;
|
||||
Desc.nbColumns = m_iNumVerticesX;
|
||||
|
||||
Desc.samples.data = pxSamples.data();
|
||||
Desc.samples.stride = sizeof(PSX::PxHeightFieldSample);
|
||||
@@ -426,7 +426,6 @@ void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
else {
|
||||
m_pGameInstance->RegistHeight(pStaticKey, Desc, m_pGameInstance->Get_NextLevelID());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_bool CVIBuffer_Terrain::Picking(_fmatrix WorldMatrix, _float3* pOut)
|
||||
|
||||
@@ -184,6 +184,7 @@ enum class PXOBJECT : _uint {
|
||||
#pragma endregion
|
||||
#pragma region NPC
|
||||
NPC = 500,
|
||||
OLLIVANDER,
|
||||
|
||||
#pragma endregion
|
||||
#pragma region ITEM
|
||||
|
||||
@@ -223,7 +223,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void ReleaseController(_uint iControllerIndex);
|
||||
void Attach_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
void Detach_Actor(PSX::PxActor& pActor, _uint iLevel);
|
||||
void Release_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
void Release_Actor(PSX::PxActor& Actor);
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
|
||||
@@ -51,7 +51,7 @@ class CPhysX_Manager final : public CBase
|
||||
void ClearScene(_uint iLevel);
|
||||
void Attach_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
unordered_set<PSX::PxActor*>::iterator Detach_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
void Release_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
void Release_Actor(PSX::PxActor& Actor);
|
||||
#pragma endregion
|
||||
#pragma region CHARACTER_CONTROLLER
|
||||
/* dev-treadmill.tistory.com/158 */
|
||||
|
||||
Reference in New Issue
Block a user