@@ -25,7 +25,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||
//_CrtSetBreakAlloc(1181);
|
||||
_CrtSetBreakAlloc(45489776);
|
||||
//_CrtSetBreakAlloc(1182);
|
||||
//_CrtSetBreakAlloc(1183);
|
||||
//_CrtSetBreakAlloc(1184);
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>cd /d "$(SolutionDir)"
|
||||
call Update_Shaders.bat
|
||||
call Update_Resources.bat
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
@@ -154,7 +154,7 @@ call Update_Shaders.bat
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>cd /d "$(SolutionDir)"
|
||||
call Update_Shaders.bat
|
||||
call Update_Resources.bat
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -1070,9 +1070,27 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
|
||||
#pragma region MAP PROTOTYPE
|
||||
/* For.Prototype_Component_VIBuffer_Terrain */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"),
|
||||
CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "Hogsmeade_HeightMap.bin", 512, 512))))
|
||||
return E_FAIL;
|
||||
{
|
||||
CVIBuffer_Terrain* pTerrain = CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "Hogsmeade_HeightMap.bin", 512, 512);
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"), pTerrain))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
pTerrain->ConvertToHeightField(TEXT("Hogsmeade_HeightMap"));
|
||||
|
||||
CRigidBody_Static::RIGIDBODY_STATIC_PROTOTYPEDESC Desc{}; // 터레인 리지드 지형 추가
|
||||
{
|
||||
Desc.eType = ACTOR::HEIGHTFIELD;
|
||||
Desc.ePxRigidBodyFlags = {};
|
||||
Desc.ePxShapeFlags = { PSX::PxShapeFlag::eVISUALIZATION | PSX::PxShapeFlag::eSCENE_QUERY_SHAPE | PSX::PxShapeFlag::eSIMULATION_SHAPE };
|
||||
Desc.ePxMaterialTypes = PXMATERIAL::DEFAULT;
|
||||
Desc.vMatInfo = _float3(0.5f, 0.5f, 0.6f);
|
||||
Desc.fContactOffset = 0.f;
|
||||
}
|
||||
CRigidBody_Static* pRigid = CRigidBody_Static::Create(m_pDevice, m_pContext, Desc);
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"), pRigid))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
/* For.Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA */
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Model_Instancel_SM_OakTree_MedA"),
|
||||
|
||||
@@ -63,7 +63,7 @@ HRESULT CMonster::Render_OutLine()
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
GUI::Begin("OutLine");
|
||||
|
||||
GUI::SetNextItemWidth(80.f);
|
||||
static _float3 vOutLineColor = _float3(1.f, 0.960784376f, 0.933333397f);
|
||||
static _float fOutLineThickness = { 1.f }; // 카메라로부터 거리가 멀어지면 늘어나게끔 바꾸는걸 추천함
|
||||
@@ -73,7 +73,6 @@ HRESULT CMonster::Render_OutLine()
|
||||
GUI::SliderFloat("Thickness", &fOutLineThickness, 0.1f, 2.f, "%.1f");
|
||||
GUI::SliderFloat("Scale", &fOutLineScale, 0.1f, 2.f, "%.1f");
|
||||
GUI::SliderFloat("Power", &fOutLinePower, 0.1f, 2.f, "%.1f");
|
||||
GUI::End();
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_vOutLineColor", &vOutLineColor, sizeof(_float3)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -232,8 +232,10 @@ void CNomalJap::OnCollision(CGameObject* pOther, void* pDesc)
|
||||
Get_PartObject<CTrailObject>()->Set_Visible(false);
|
||||
Get_PartObject<CTrailObject>()->Get_Component<CTransform>()->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f, 0.f, 1.f));
|
||||
|
||||
m_pPhysHitBox->Set_Dead();
|
||||
SAFE_RELEASE(m_pPhysHitBox);
|
||||
if (nullptr != m_pPhysHitBox) {
|
||||
m_pPhysHitBox->Set_Dead();
|
||||
SAFE_RELEASE(m_pPhysHitBox);
|
||||
}
|
||||
}
|
||||
|
||||
void CNomalJap::Free()
|
||||
|
||||
@@ -110,7 +110,6 @@ void CPlayer::Update(_float fTimeDelta)
|
||||
|
||||
m_pFSM->Update_State(fTimeDelta);
|
||||
|
||||
|
||||
m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom);
|
||||
|
||||
|
||||
@@ -127,7 +126,7 @@ void CPlayer::Update(_float fTimeDelta)
|
||||
|
||||
void CPlayer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
m_pTransformCom->Set_State(STATE::POSITION, m_pCharacter_Controller->Get_Position());
|
||||
m_pTransformCom->Set_State(STATE::POSITION, m_pCharacter_Controller->Get_FootPosition());
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
|
||||
@@ -254,7 +253,7 @@ HRESULT CPlayer::Ready_Components()
|
||||
Desc.iSubKind = ENUM_CLASS(COLLIDABLEOBJECT::PLAYER);
|
||||
Desc.pTransform = m_pTransformCom;
|
||||
Desc.eBodyType = ACTOR::CAPSULE;
|
||||
Desc.fContactOffset = 0.1f;
|
||||
Desc.fContactOffset = 0.17f;
|
||||
Desc.fMaterial = { 0.5f, 0.5f, 0.6f };
|
||||
Desc.bAutoStepping = { false };
|
||||
Desc.fStepOffset = { 0.05f };
|
||||
|
||||
@@ -35,6 +35,15 @@ HRESULT CTerrain::Initialize(void* pArg)
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f));
|
||||
|
||||
|
||||
CRigidBody_Static::RIGIDBODY_STATIC_DESC Desc{};
|
||||
Desc.pMeshName = TEXT("Hogsmeade_HeightMap");
|
||||
Desc.iSubKind = 998;
|
||||
/* Com_RigidBody */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_RigidBody_Static_Terrain_Hogsmeade"),
|
||||
reinterpret_cast<CComponent**>(&m_pRigidBody), &Desc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -106,8 +115,10 @@ HRESULT CTerrain::Ready_Components(void* pArg)
|
||||
|
||||
/* Com_VIBuffer */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"),
|
||||
reinterpret_cast<CComponent**>(&m_pVIBufferCom))))
|
||||
reinterpret_cast<CComponent**>(&m_pVIBufferCom)))){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_NORTEX,
|
||||
@@ -205,6 +216,7 @@ void CTerrain::Free()
|
||||
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
SAFE_RELEASE(m_pRigidBody);
|
||||
SAFE_RELEASE(m_pDiffuseTextureCom);
|
||||
SAFE_RELEASE(m_pNormalTextureCom);
|
||||
SAFE_RELEASE(m_pMROTextureCom);
|
||||
|
||||
@@ -38,6 +38,7 @@ class CTerrain final : public CGameObject
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CVIBuffer_Terrain* m_pVIBufferCom = { nullptr };
|
||||
CRigidBody_Static* m_pRigidBody = { nullptr };
|
||||
CTexture* m_pDiffuseTextureCom = { nullptr };
|
||||
CTexture* m_pNormalTextureCom = { nullptr };
|
||||
CTexture* m_pMROTextureCom = { nullptr };
|
||||
|
||||
@@ -361,6 +361,7 @@ void CMapObject_LOD::Describe_Entity()
|
||||
{ // RIGID_BODY
|
||||
_wstring dest = CMyTools::ToWstring(m_pModelComs[iModelIndex]->Get_MeshName(iMeshIndex) + to_string(iMeshIndex)).c_str();
|
||||
Desc.pMeshName = dest.c_str();
|
||||
Desc.iSubKind = 998;
|
||||
|
||||
if (FAILED(Add_Asset_Component(g_iStaticLevel, Desc.pMeshName, nullptr, &Desc))) {
|
||||
assert(false);
|
||||
|
||||
@@ -159,7 +159,7 @@ void CCharacter_Controller::Move(_float fTimeDelta)
|
||||
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
|
||||
if (true == m_bGravity) {
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f));
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f));
|
||||
}
|
||||
XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum());
|
||||
|
||||
@@ -182,10 +182,10 @@ _vector CCharacter_Controller::Get_Position()
|
||||
return XMVectorSet((_float)pxVPos.x, (_float)pxVPos.y, (_float)pxVPos.z, 1.f);
|
||||
}
|
||||
|
||||
_float3 CCharacter_Controller::Get_FootPosition()
|
||||
_vector CCharacter_Controller::Get_FootPosition()
|
||||
{
|
||||
PSX::PxExtendedVec3 pxLVecfootPos = m_pController->getFootPosition();
|
||||
return { (_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z };
|
||||
return XMVectorSet((_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z, 1.f );
|
||||
}
|
||||
|
||||
HRESULT CCharacter_Controller::Initialize_Prototype()
|
||||
@@ -372,7 +372,8 @@ void CCharacter_Controller::Describe_Entity()
|
||||
GUIHelpMarker("A capsule is affected by its lower sphere and tends to generate an up vector on steps.\nIn eEASY, the up vector is combined with the step offset, allowing easier climbing; in eCONSTRAINED, the up vector is removed during step detection and only the step offset is used.");
|
||||
}
|
||||
}
|
||||
|
||||
GUI::Text("%.1f", XMConvertToDegrees(acosf(m_fSlopeLimit))); GUI::SameLine(); GUI::SliderFloat("m_fSlopeLimit", &m_fSlopeLimit, 0.0f, 1.f);
|
||||
GUI::SliderFloat("m_fGravity_Multiplier", &m_fGravity, 0.0f, 3.f);
|
||||
if (GUI::SliderFloat3("Volume", (_float*)&vVolume, 0.1f, 10.f, "%.2f")) {
|
||||
Modify_Volume(vVolume);
|
||||
}GUIHelpMarker("Box uses vSize; Capsule uses x->fRadius, y->fHeight.\nThe capsule's fHeight is likely the distance from the lower sphere center to the upper sphere center.");
|
||||
|
||||
@@ -652,6 +652,11 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
|
||||
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
|
||||
}
|
||||
|
||||
void CGameInstance::RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc)
|
||||
{
|
||||
return m_pPhysX_Manager->RegistHeight(pName, Desc);
|
||||
}
|
||||
|
||||
PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody_Dynamic& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
|
||||
|
||||
@@ -77,15 +77,17 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { 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());
|
||||
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
|
||||
|
||||
_vector vPos, vRotq, vScale;
|
||||
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
|
||||
vRotq = XMQuaternionNormalize(vRotq);
|
||||
@@ -103,17 +105,40 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
// pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxMeshGeometry->isValid());
|
||||
pGeometry = pPxMeshGeometry;
|
||||
m_TriangleMeshGeometry.emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry);
|
||||
}
|
||||
break;
|
||||
case ACTOR::HEIGHTFIELD:
|
||||
break;
|
||||
{ // SetUp HeightField
|
||||
PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxHeightFieldGeometry* pPxHeightGeometry = { 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) // 스케일 축은 로컬 기준
|
||||
);
|
||||
pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField);
|
||||
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxHeightGeometry->isValid());
|
||||
pGeometry = pPxHeightGeometry;
|
||||
m_HeightFieldGeometry.emplace(RigidBody.Get_PxMeshKey(), pPxHeightGeometry);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pPxMeshGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
|
||||
pShape->setFlags(RigidBody.Get_ShapeFlags());
|
||||
pShape->setContactOffset(RigidBody.Get_ContactOffset());
|
||||
@@ -144,6 +169,17 @@ void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxT
|
||||
{
|
||||
m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh);
|
||||
}
|
||||
void CPhysX_Manager::RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc)
|
||||
{
|
||||
PSX::PxHeightField* pHeightField = PxCreateHeightField(Desc);
|
||||
if (nullptr == pHeightField) {
|
||||
assert(false);
|
||||
}
|
||||
else {
|
||||
m_HeightFields.emplace(pName, pHeightField);
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
HRESULT CPhysX_Manager::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
@@ -243,6 +279,15 @@ PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _tchar* pMeshName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PSX::PxHeightField* CPhysX_Manager::Find_HeightField(const _tchar* pFieldName)
|
||||
{
|
||||
map<_wstring, PSX::PxHeightField*>::iterator iter = m_HeightFields.find(pFieldName);
|
||||
if (iter != m_HeightFields.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::Update_Kinematic()
|
||||
{
|
||||
for (auto& pBody : m_pActiveBodys) {
|
||||
@@ -489,16 +534,20 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
|
||||
|
||||
// m_pScene->overlap();??????
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
if (true == m_bDebugCreatePlane) {
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);;
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
}
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -537,7 +586,7 @@ CPhysX_Manager* CPhysX_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContex
|
||||
void CPhysX_Manager::Free()
|
||||
{
|
||||
ClearScene();
|
||||
|
||||
|
||||
for (auto& pMeshes : m_TriangleMeshes) {
|
||||
pMeshes.second->release();
|
||||
} m_TriangleMeshes.clear();
|
||||
@@ -546,6 +595,14 @@ void CPhysX_Manager::Free()
|
||||
Safe_Delete(pGeometry.second);
|
||||
} m_TriangleMeshGeometry.clear();
|
||||
|
||||
for (auto& pGeometry : m_HeightFieldGeometry) {
|
||||
Safe_Delete(pGeometry.second);
|
||||
} m_HeightFieldGeometry.clear();
|
||||
|
||||
for (auto& pField : m_HeightFields) {
|
||||
pField.second->release();
|
||||
} m_HeightFields.clear();
|
||||
|
||||
if (nullptr != m_pCookingParam) {
|
||||
Safe_Delete(m_pCookingParam);
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ HRESULT CRigidBody_Static::Initialize(void* pArg)
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
RIGIDBODY_STATIC_DESC* pDesc = static_cast<RIGIDBODY_STATIC_DESC*>(pArg);
|
||||
m_pMeshName = pDesc->pMeshName;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
|
||||
@@ -389,6 +389,44 @@ HRESULT CVIBuffer_Terrain::Initialize(void* pArg)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
{
|
||||
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;
|
||||
_uint iPhysXIndex = iCol * m_iNumVerticesZ + iRow;
|
||||
|
||||
_float fRealHeight = m_HeigthValues[iIndex];
|
||||
PSX::PxI16 iClampHeight = (PSX::PxI16)(PSX::PxClamp(fRealHeight, -32767.f, 32767.f));
|
||||
|
||||
PSX::PxHeightFieldSample& pxSample = pxSamples[iPhysXIndex];
|
||||
|
||||
pxSample.height = iClampHeight;
|
||||
pxSample.materialIndex0 = pxSample.materialIndex1 = 0;
|
||||
pxSample.clearTessFlag();
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
Desc.convexEdgeThreshold = 0;
|
||||
if (false == Desc.isValid()) {
|
||||
assert(false);
|
||||
}
|
||||
else {
|
||||
m_pGameInstance->RegistHeight(pStaticKey, Desc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_bool CVIBuffer_Terrain::Picking(_fmatrix WorldMatrix, _float3* pOut)
|
||||
{
|
||||
_matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
|
||||
|
||||
@@ -54,7 +54,7 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
void Move(_float fTimeDelta); // 이동 // 충돌보정만 있음,
|
||||
void Set_Position(_fvector vNewPos); // 순간이동
|
||||
_vector Get_Position();
|
||||
_float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
_vector Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
|
||||
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||
void Modify_Volume(_float3 fVolume);
|
||||
@@ -69,9 +69,10 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
private:
|
||||
ACTOR m_eBodyType = { ACTOR::END };
|
||||
PSX::PxController* m_pController = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
_bool m_bAutoStepping = { false };
|
||||
_float m_fSlopeLimit = { 0.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
_float m_fGravity = { 0.129f };
|
||||
_float m_fSlopeLimit = { 0.69f/*0~1*/}; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
PhsXUserData m_tagData = {};
|
||||
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
|
||||
|
||||
@@ -193,6 +193,7 @@ 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);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody);
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -27,6 +27,7 @@ class CPhysX_Manager final : public CBase
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame);
|
||||
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc);
|
||||
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
@@ -36,6 +37,7 @@ class CPhysX_Manager final : public CBase
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
PSX::PxTriangleMesh* Find_TriangleMesh(const _tchar* pMeshName);
|
||||
PSX::PxHeightField* Find_HeightField(const _tchar* pFieldName);
|
||||
|
||||
void Update(_float fTimeDelta);
|
||||
void ClearScene();
|
||||
@@ -80,11 +82,20 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
unordered_set<PSX::PxActor*> m_pActiveBodys = { };
|
||||
unordered_set<PSX::PxActor*> m_pRestBodies = { }; // 피직스의 액터로 구별되기 때문에 피직스액터 포인터를 키로 사용함
|
||||
|
||||
map<_wstring, PSX::PxTriangleMesh*> m_TriangleMeshes = {};
|
||||
map<_wstring, PSX::PxTriangleMeshGeometry*> m_TriangleMeshGeometry = {};
|
||||
|
||||
map<_wstring, PSX::PxHeightField*> m_HeightFields = {};
|
||||
map<_wstring, PSX::PxHeightFieldGeometry*> m_HeightFieldGeometry = {};
|
||||
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
_bool m_bDebugCreatePlane = { true };
|
||||
PhsXUserData PlaneData = {};
|
||||
#else
|
||||
_bool m_bDebugCreatePlane = { false };
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
vector<PSX::PxMaterial*> m_pMaterials = { };
|
||||
_uint m_iNumLevel = {};
|
||||
|
||||
@@ -14,7 +14,7 @@ class ENGINE_DLL CRigidBody_Static : public CRigidBody
|
||||
|
||||
}RIGIDBODY_STATIC_PROTOTYPEDESC;
|
||||
|
||||
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_PROTOTYPEDESC
|
||||
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_DESC
|
||||
{
|
||||
const _tchar* pMeshName = { nullptr };
|
||||
}RIGIDBODY_STATIC_DESC;
|
||||
|
||||
@@ -24,6 +24,7 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
|
||||
#endif // EDITOR_PROJECT
|
||||
virtual HRESULT Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
void ConvertToHeightField(const _tchar* pStaticKey);
|
||||
|
||||
_bool Picking(_fmatrix WorldMatrix, _float3* pOut);
|
||||
void Culling(_fmatrix WorldMatrix);
|
||||
|
||||
Reference in New Issue
Block a user