From ae6f462b0b69398cf4aca5f8f690808ed81faefb Mon Sep 17 00:00:00 2001 From: kimnuri Date: Mon, 1 Dec 2025 21:59:59 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[add]=20=EC=A4=91=EB=A0=A5=20=EC=9E=AC?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20[fix]=20=EB=AA=A8=EB=8D=B8=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=8A=A4=EB=A0=88=EB=93=9C=20?= =?UTF-8?q?=EC=83=81=ED=98=B8=EC=B0=B8=EC=A1=B0=20=ED=95=B4=EA=B2=B0=20[fi?= =?UTF-8?q?x]=20=ED=94=BC=EC=A7=81=EC=8A=A4=20=ED=94=8C=EB=A0=88=EC=9D=B8?= =?UTF-8?q?=20=EB=82=AE=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CallBack_EffectHitBox_HitReport.cpp | 11 +- .../Private/CallBack_Playable_HitReport.cpp | 86 ++++++++----- .../Client/Private/CamPosition_Shoulder.cpp | 46 ++++--- .../Client/Private/Dummy_PhysXPlayable.cpp | 1 + Jusin154_Team3D/Client/Private/Goblin.cpp | 1 + .../Client/Private/PhysXEffectHitBox.cpp | 1 + Jusin154_Team3D/Client/Private/Player.cpp | 20 +-- .../Public/CallBack_Playable_HitReport.h | 9 ++ .../Client/Public/CamPosition_Shoulder.h | 9 +- Jusin154_Team3D/Client/Public/Client_Enum.h | 89 ------------- .../ShaderFiles/Engine_Shader_States.hlsli | 2 +- .../Private/Dummy_PhysXEffectHitBox.cpp | 1 + .../Editor/Private/Dummy_PhysXMonster.cpp | 1 + .../Editor/Private/Dummy_PhysXPlayable.cpp | 1 + Jusin154_Team3D/Editor/Private/Goblin.cpp | 1 + .../Editor/Private/Level_EffectViewer.cpp | 18 +-- .../Editor/Private/Level_PhysXLab.cpp | 2 +- Jusin154_Team3D/Editor/Private/Player.cpp | 1 + .../Editor/Public/Level_EffectViewer.h | 2 + .../ShaderFiles/Engine_Shader_States.hlsli | 2 +- .../Engine/Private/Character_Controller.cpp | 119 ++++++++++++++++-- .../Engine/Private/GameInstance.cpp | 10 ++ .../Engine/Private/PhysX_Manager.cpp | 54 +++++--- Jusin154_Team3D/Engine/Private/Transform.cpp | 4 + .../Engine/Private/VIBuffer_Terrain.cpp | 3 +- .../Engine/Public/Character_Controller.h | 40 +++--- Jusin154_Team3D/Engine/Public/Engine_Enum.h | 94 +++++++++++++- Jusin154_Team3D/Engine/Public/GameInstance.h | 5 +- .../Public/PhysX/geometry/PxGeometryHit.h | 2 +- Jusin154_Team3D/Engine/Public/PhysX_Manager.h | 13 +- Jusin154_Team3D/Engine/Public/Transform.h | 1 + 31 files changed, 436 insertions(+), 213 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp index 403dc9311..acbbdb0ad 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_EffectHitBox_HitReport.cpp @@ -35,13 +35,12 @@ void CCallBack_EffectHitBox_HitReport::onShapeHit(const PSX::PxControllerShapeHi switch (pTargetActorData->eKind) { case PHYSX_KIND::BODY_STATIC: - // action break; case PHYSX_KIND::BODY_DYNAMIC: { - switch (pTargetActorData->iSubKind) + switch (PXOBJECT(pTargetActorData->iSubKind)) { - case ENUM_CLASS(PXOBJECT::WALL): + case PXOBJECT::WALL: /* OnCollision 함수에 넘길 값 */ CollisionDesc.vWorldPos = XMVectorSet( (_float)vWorldPos.x, (_float)vWorldPos.y, (_float)vWorldPos.z, 1.f); @@ -51,7 +50,7 @@ void CCallBack_EffectHitBox_HitReport::onShapeHit(const PSX::PxControllerShapeHi pOwnerActorData->pOwner->Get_Owner()->OnCollision(pTargetActorData->pOwner , &CollisionDesc); break; - case ENUM_CLASS(PXOBJECT::GOBLIN_WARRIOR): + case PXOBJECT::GOBLIN_WARRIOR: /* OnCollision 함수에 넘길 값 */ CollisionDesc.vWorldPos = XMVectorSet( (_float)vWorldPos.x, (_float)vWorldPos.y, (_float)vWorldPos.z, 1.f); @@ -108,9 +107,9 @@ void CCallBack_EffectHitBox_HitReport::onControllerHit(const PSX::PxControllersH assert(false); break; case PHYSX_KIND::CCTActor: - switch (pTargetActorData->iSubKind) + switch (PXOBJECT(pTargetActorData->iSubKind)) { - case ENUM_CLASS(PXOBJECT::GOBLIN_WARRIOR): + case PXOBJECT::GOBLIN_WARRIOR: /* OnCollision 함수에 넘길 값 */ CollisionDesc.vWorldPos = XMVectorSet((_float)vWorldPos.x, (_float)vWorldPos.y, (_float)vWorldPos.z, 1.f); diff --git a/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp b/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp index 60808b2c7..5086f601a 100644 --- a/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp +++ b/Jusin154_Team3D/Client/Private/CallBack_Playable_HitReport.cpp @@ -11,6 +11,14 @@ CCallBack_Playable_HitReport::~CCallBack_Playable_HitReport() { } +void CCallBack_Playable_HitReport::BeginFrame() +{ + // 매 프레임 초기화 + m_vClimbNormal = { 0.f, 1.f, 0.f }; + m_bGroundHit = { false }; + m_fBestNormal = { 0.f }; +} + void CCallBack_Playable_HitReport::onShapeHit(const PSX::PxControllerShapeHit& hit) { PSX::PxController* pController = hit.controller; @@ -32,49 +40,35 @@ void CCallBack_Playable_HitReport::onShapeHit(const PSX::PxControllerShapeHit& h switch (pTargetActorData->eKind) { case PHYSX_KIND::BODY_STATIC: - // action + switch (PXOBJECT(pTargetActorData->iSubKind)) + { + case PXOBJECT::TERRAIN: + case PXOBJECT::FLOOR: + case PXOBJECT::ROAD: + if (vWorldNormal.y > 0) { + _float fDotValue = vWorldNormal.dot({ 0.f, 1.f, 0.f }); + if (m_fBestNormal < fDotValue) { + m_bGroundHit = true; + m_fBestNormal = fDotValue; + m_vClimbNormal = { vWorldNormal.x, vWorldNormal.y, vWorldNormal.z }; + } + } + break; + default: + break; + } break; case PHYSX_KIND::BODY_DYNAMIC: { - switch (pTargetActorData->iSubKind) + switch (PXOBJECT(pTargetActorData->iSubKind)) { - case 23: // 무거운데 올라갈 수 있는 벽 - if (m_pGameInstance->Key_Pressing(DIK_E)) { - pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, 1.5f, 0.f, 0.f)); - } - else if (m_pGameInstance->Key_Pressing(DIK_R)) { - pOwnerActorData->pOwner->Get_Component()->BookMomentum(fLength * XMVectorSet(0.f, -1.f, 0.f, 0.f)); - } - //pOwnerActorData->pOwner->Get_Component()->BookMomentum(XMVectorSet(0.f, 0.5f * GRAVITY, 0.f, 0.f)); + case PXOBJECT::END: break; - case 24: // 문짝 - { - PSX::PxRigidDynamic* pDynamic = static_cast(pActor); - _float fDot = vDir.dot(PSX::PxVec3(0.f, 1.f, 0.f)); - if (fDot > 0) { - pDynamic->addTorque(PSX::PxVec3(0.f, 1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); - } - else { - pDynamic->addTorque(PSX::PxVec3(0.f, -1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); - } - } break; - case 25: // 문짝 - { - PSX::PxRigidDynamic* pDynamic = static_cast(pActor); - _float fDot = vDir.dot(PSX::PxVec3(0.f, 1.f, 0.f)); - if (fDot > 0) { - pDynamic->addTorque(PSX::PxVec3(0.f, 1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eFORCE); - } - else { - pDynamic->addTorque(PSX::PxVec3(0.f, -1.f, 0.f) * fLength * 100000.f, PSX::PxForceMode::eFORCE); - } - } break; default: { PSX::PxRigidDynamic* pDynamic = static_cast(pActor); pDynamic->addForce(vDir * fLength * 100000.f, PSX::PxForceMode::eIMPULSE); - } - break; + } break; } } break; case PHYSX_KIND::CCTActor: @@ -138,6 +132,20 @@ void CCallBack_Playable_HitReport::onObstacleHit(const PSX::PxControllerObstacle //} } +void CCallBack_Playable_HitReport::Set_CurrentSlop() +{ + m_pController->Rewind_Grounded(); + if (m_bGroundHit) + { + m_pController->Set_OnGroundFlag(m_bGroundHit); + float fDot = clamp(m_fBestNormal, -1.0f, 1.0f); + float fAngleRad = acosf(fDot); + float fAngleDeg = XMConvertToDegrees(fAngleRad); + + m_pController->Set_CurrentSlope(fAngleDeg); + } +} + HRESULT CCallBack_Playable_HitReport::Initialize(CCharacter_Controller* pController, CRigidBody_Dynamic* pPartDynamicObject) { m_pController = pController; @@ -157,6 +165,16 @@ HRESULT CCallBack_Playable_HitReport::Finalize() return S_OK; } +_bool CCallBack_Playable_HitReport::IsOnGround() +{ + return m_bGroundHit; +} + +_vector CCallBack_Playable_HitReport::Get_GroundVector() +{ + return XMLoadFloat3(&m_vClimbNormal); +} + CCallBack_Playable_HitReport* CCallBack_Playable_HitReport::Create() { return new CCallBack_Playable_HitReport(); diff --git a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp index 447eca4d8..0de4186f2 100644 --- a/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp +++ b/Jusin154_Team3D/Client/Private/CamPosition_Shoulder.cpp @@ -68,22 +68,22 @@ void CCamPosition_Shoulder::Priority_Update(_float fTimeDelta) m_vAccDegreeXY.x += m_pGameInstance->Get_MouseMove().y * m_fMouseSensor; CMyTools::AdjustAccumulateDegreePitchYawDegree(m_vAccDegreeXY); } - - _vector vLook = XMVector3Normalize(XMLoadFloat3(&m_vShoulderPosRatio)); - _vector vRotq = XMQuaternionRotationRollPitchYaw(0.f, XMConvertToRadians(m_vAccDegreeXY.y), 0.f); - vLook = XMVector3Normalize(XMVector3Rotate(vLook, vRotq)); + m_vPosLerpTimer.x += fTimeDelta; + if (m_vPosLerpTimer.x > m_vPosLerpTimer.y) { + m_vPosLerpTimer.x = 0.f; + Start_LerpShoulderPos(); + } + _vector vShoulderPos = XMVectorLerp(XMLoadFloat4(&m_StartPos), XMLoadFloat4(&m_DestPos), (m_vPosLerpTimer.x / m_vPosLerpTimer.y)); + m_pTransformCom->Set_State(STATE::POSITION, vShoulderPos); - m_pTransformCom->Set_State(STATE::POSITION, m_pParentTransformCom->Get_State(STATE::POSITION) + XMVector3Normalize(vLook) * m_fShoulderDistance); - _vector vShoulderPos = Get_WorldPostion(); - _vector vCameraLook = XMVectorSet(0.f, 0.f, 1.f, 0.f); _vector vRotCameraq = XMQuaternionRotationRollPitchYaw(XMConvertToRadians(m_vAccDegreeXY.x), XMConvertToRadians(m_vAccDegreeXY.y), 0.f); - vCameraLook = XMVector3Normalize(XMVector3Rotate(vCameraLook, vRotCameraq)); + _vector vCameraLook = XMVector3Normalize(XMVector3Rotate(XMVectorSet(0.f, 0.f, 1.f, 0.f), vRotCameraq)); CTransform* pLookTransform = m_pTarget_LookPart->Get_Component(); CTransform* pFollowTransform = m_pTarget_FollowPart->Get_Component(); - pLookTransform->Set_State(STATE::POSITION, vShoulderPos + vCameraLook * (m_fCameraFocalLength * m_fBackFrontRatio)); - pFollowTransform->Set_State(STATE::POSITION, vShoulderPos - vCameraLook * (m_fCameraFocalLength * (1 - m_fBackFrontRatio))); + pLookTransform->Set_State(STATE::POSITION, vShoulderPos + vCameraLook * (m_fCameraFocalLength * m_fBackFrontRatio)); + pFollowTransform->Set_State(STATE::POSITION, vShoulderPos - vCameraLook * (m_fCameraFocalLength * (1 - m_fBackFrontRatio))); } void CCamPosition_Shoulder::Update(_float fTimeDelta) @@ -110,8 +110,8 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta) if (m_pGameInstance->Key_Up(DIK_P)) { m_vShoulderOtherRatio = m_vShoulderPosRatio = m_vShoulderStartRatio; m_vShoulderStartRatio.x *= -1.f; - m_bLerp = true; - m_vLerpTimer.x = 0.f; + m_bShoulderLerp = true; + m_vShoulderLerpTimer.x = 0.f; } if (m_pGameInstance->Mouse_Pressing(DIM_RBUTTON)) { m_pBinded_Camera->ZoomIn(fTimeDelta); @@ -128,12 +128,12 @@ void CCamPosition_Shoulder::Late_Update(_float fTimeDelta) if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_SHOULDER))) { return; } - if (true == m_bLerp) { - m_vLerpTimer.x += fTimeDelta; - XMStoreFloat3(&m_vShoulderPosRatio, XMVectorLerp(XMLoadFloat3(&m_vShoulderStartRatio), XMLoadFloat3(&m_vShoulderOtherRatio), m_vLerpTimer.x / m_vLerpTimer.y)); - if (m_vLerpTimer.x > m_vLerpTimer.y) { - m_bLerp = false; - m_vLerpTimer.x = 0.f; + if (true == m_bShoulderLerp) { + m_vShoulderLerpTimer.x += fTimeDelta; + XMStoreFloat3(&m_vShoulderPosRatio, XMVectorLerp(XMLoadFloat3(&m_vShoulderStartRatio), XMLoadFloat3(&m_vShoulderOtherRatio), m_vShoulderLerpTimer.x / m_vShoulderLerpTimer.y)); + if (m_vShoulderLerpTimer.x > m_vShoulderLerpTimer.y) { + m_bShoulderLerp = false; + m_vShoulderLerpTimer.x = 0.f; m_vShoulderPosRatio = m_vShoulderOtherRatio; } @@ -196,6 +196,16 @@ HRESULT CCamPosition_Shoulder::Ready_SubParts() return S_OK; } +void CCamPosition_Shoulder::Start_LerpShoulderPos() +{ + XMStoreFloat4(&m_StartPos, m_pTransformCom->Get_State(STATE::POSITION)); + + _vector vLook = XMVector3Normalize(XMLoadFloat3(&m_vShoulderPosRatio)); + _vector vRotq = XMQuaternionRotationRollPitchYaw(0.f, XMConvertToRadians(m_vAccDegreeXY.y), 0.f); + vLook = XMVector3Normalize(XMVector3Rotate(vLook, vRotq)); + + XMStoreFloat4(&m_DestPos, m_pParentTransformCom->Get_State(STATE::POSITION) + XMVector3Normalize(vLook) * m_fShoulderDistance); +} CCamPosition_Shoulder* CCamPosition_Shoulder::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CCamPosition_Shoulder* pInstance = new CCamPosition_Shoulder(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Client/Private/Dummy_PhysXPlayable.cpp index c64ab4492..e65029f2e 100644 --- a/Jusin154_Team3D/Client/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Client/Private/Dummy_PhysXPlayable.cpp @@ -135,6 +135,7 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg) Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Playable_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Playable_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Goblin.cpp b/Jusin154_Team3D/Client/Private/Goblin.cpp index 6b90c0b24..398fa592a 100644 --- a/Jusin154_Team3D/Client/Private/Goblin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin.cpp @@ -207,6 +207,7 @@ HRESULT CGoblin::Ready_Components() Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Monster_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Monster_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/PhysXEffectHitBox.cpp b/Jusin154_Team3D/Client/Private/PhysXEffectHitBox.cpp index 2a2585bd8..3f369f7a2 100644 --- a/Jusin154_Team3D/Client/Private/PhysXEffectHitBox.cpp +++ b/Jusin154_Team3D/Client/Private/PhysXEffectHitBox.cpp @@ -112,6 +112,7 @@ HRESULT CPhysXEffectHitBox::Ready_Components(void* pArg) Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_EffectHitBox_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_EffectHitBox_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 057d4f8f6..210a1620c 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -108,6 +108,7 @@ void CPlayer::Priority_Update(_float fTimeDelta) m_pTransformCom->RewindMomentum(); __super::Priority_Update(fTimeDelta); + } void CPlayer::Update(_float fTimeDelta) @@ -119,15 +120,19 @@ void CPlayer::Update(_float fTimeDelta) m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); Play_Event(); - + __super::Update(fTimeDelta); #ifdef _DEBUG Describe_Entity(); #endif // _DEBUG + - - m_pCharacter_Controller->Move(fTimeDelta); + { // 세트 + m_pCallBack_HitReport->BeginFrame(); + m_pCharacter_Controller->Move(fTimeDelta); + m_pCallBack_HitReport->Set_CurrentSlop(); + } TestKeyInput(fTimeDelta); } @@ -198,7 +203,7 @@ void CPlayer::Render_CameraCoordinateSystem() GUI::Text("S : %.2f, %.2f, %.2f", -m_vCameraLookDir.x, 0.f, -m_vCameraLookDir.z); GUI::Text("D : %.2f, %.2f, %.2f", m_vCameraRightDir.x, 0.f, m_vCameraRightDir.z); - _float fButtonSize = 25.f; + _float fButtonSize = 45.f; GUI::Button("##0", { fButtonSize, fButtonSize }); GUI::SameLine(); GUI::Button(("W : " + to_string(XMConvertToDegrees(CMyTools::Get_Direction2D(vLook, { m_vCameraLookDir.x , m_vCameraLookDir.z })))).c_str(), { fButtonSize, fButtonSize }); GUI::SameLine(); GUI::Button("##2", { fButtonSize, fButtonSize }); @@ -273,7 +278,7 @@ HRESULT CPlayer::Ready_Components() Desc.iSubKind = ENUM_CLASS(PXOBJECT::PLAYER); Desc.pTransform = m_pTransformCom; Desc.eBodyType = ACTOR::CAPSULE; - Desc.fContactOffset = 0.17f; + Desc.fContactOffset = 0.01f; Desc.fMaterial = { 0.5f, 0.5f, 0.6f }; Desc.bAutoStepping = { true }; Desc.fStepOffset = { 0.05f }; @@ -282,6 +287,7 @@ HRESULT CPlayer::Ready_Components() Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Playable_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Playable_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } @@ -357,11 +363,11 @@ void CPlayer::ReLockOnTarget() void CPlayer::SetGravity() { - PSX::PxControllerCollisionFlags eCollisionFlags = m_pCharacter_Controller->Get_CollisionFlags(); if (true == m_pFSM->IsEnable(FSMSTATE::JUMP)){ + // 점프 중일 땐 off m_pCharacter_Controller->SetGravity(false); } - else { // 점프 중일 땐 off + else { m_pCharacter_Controller->SetGravity(true); } } diff --git a/Jusin154_Team3D/Client/Public/CallBack_Playable_HitReport.h b/Jusin154_Team3D/Client/Public/CallBack_Playable_HitReport.h index cc22f7e6a..4269462b3 100644 --- a/Jusin154_Team3D/Client/Public/CallBack_Playable_HitReport.h +++ b/Jusin154_Team3D/Client/Public/CallBack_Playable_HitReport.h @@ -18,6 +18,8 @@ class CCallBack_Playable_HitReport final : public PSX::PxUserControllerHitReport public: ~CCallBack_Playable_HitReport(); + void BeginFrame(); + public: // PxUserControllerHitReport을(를) 통해 상속됨 // 충돌알림!! @@ -28,14 +30,21 @@ class CCallBack_Playable_HitReport final : public PSX::PxUserControllerHitReport virtual void onObstacleHit(const PSX::PxControllerObstacleHit& hit) override; // 사용자 정의 장애물과 부딪힌 경우 + void Set_CurrentSlop(); + public: HRESULT Initialize(CCharacter_Controller* pController, CRigidBody_Dynamic* pPartDynamicObject); HRESULT Finalize(); + _bool IsOnGround(); + _vector Get_GroundVector(); private: CCharacter_Controller* m_pController = { nullptr }; CRigidBody_Dynamic* m_pPartDynamicBody = { nullptr }; CGameInstance* m_pGameInstance = { nullptr }; + _float3 m_vClimbNormal = { 0.f, 1.f, 0.f }; + _float m_fBestNormal = { 0.f }; + _bool m_bGroundHit = { false }; public: static CCallBack_Playable_HitReport* Create(); }; diff --git a/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h b/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h index c76122a38..b80981187 100644 --- a/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h +++ b/Jusin154_Team3D/Client/Public/CamPosition_Shoulder.h @@ -34,6 +34,7 @@ class CCamPosition_Shoulder final : public CCamPosition virtual HRESULT Initialize(void* pArg) override; HRESULT Ready_Components(void* pArg); HRESULT Ready_SubParts(); + void Start_LerpShoulderPos(); _bool m_bMovable = { true }; _float m_fMouseSensor = { 0.5f }; @@ -46,8 +47,12 @@ class CCamPosition_Shoulder final : public CCamPosition _float3 m_vShoulderStartRatio = { 1.f, 2.f, -1.f }; _float3 m_vShoulderOtherRatio = { 1.f, 2.f, -1.f }; - _bool m_bLerp = { false }; - _float2 m_vLerpTimer = { 0.f, 1.f }; + _bool m_bShoulderLerp = { false }; + _float2 m_vShoulderLerpTimer = { 0.f, 1.f }; + + _float2 m_vPosLerpTimer = { 0.f, 0.16f }; + _float4 m_StartPos = { }; + _float4 m_DestPos = { }; _bool m_bZoomIn = { false }; diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index b711a541b..2032a399d 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -46,93 +46,4 @@ namespace Client { NOCOLLIDE, END, }; - enum class PXOBJECT : _uint { -#pragma region NOT_DEFINE - NOT_DEFINE = 000, -#pragma endregion -#pragma region PLAYER - PLAYER = 010, -#pragma endregion -#pragma region MONSTER - MONSTER = 030, - GOBLIN_WARRIOR, // 031 - GOBLIN_MAGICIAN, - GOBLIN_THEIF, - TROLL, - PENSIVE_GUARDIAN, - -#pragma endregion -#pragma region HOSTILE_HITBOX - HOSTILE_HITBOX = 100, - GOBLIN_SMASH, - GOBLIN_DAGGER, - GOBLIN_SHIELD_BREAK_MELEE, - GOBLIN_SHIELD_BREAK_MAGIC, - GOBLIN_NORMAL_MAGIC, - -#pragma endregion -#pragma region ALLY_HITBOX - ALLY_HITBOX = 200, - SKILL_REVAILIO, - SKILL_ACCIO, - SKILL_DEPULSO, - SKILL_DEPULSO_OBSTACLE, - SKILL_DEPULSO_OBSTACLE_FLAMED, - SKILL_NORMALJAP, - SKILL_NORMALJAP_FINAL, - SKILL_BOMBARD_STRIKE, - SKILL_BOMBARD_FLAME, - SKILL_INCENDIO_STRIKE, - SKILL_INCENDIO_SPREAD, - -#pragma endregion -#pragma region NEUTRAL_HITBOX - NEUTRAL_HITBOX = 300, - FLAMED_FLOOR, - -#pragma endregion -#pragma region ENVIRIONMENT - ENVIRIONMENT = 400, - TERRAIN, - WATER, - WALL, - WALL_BREAKABLE, - WALL_CLIMBABLE, - DOOR, - BUILDING, - BOX, -#pragma endregion -#pragma region NPC - NPC = 500, - -#pragma endregion -#pragma region ITEM - ITEM = 600, - DROPITEM = 630, - TRAP = 660, - -#pragma endregion -#pragma region TRIGGERBOX - TRIGGERBOX = 700, - - - CINEMATIC = 770, - CINEMATIC_INTRO, - CINEMATIC_HOGSMEADE_ENTER, - CINEMATIC_TROLL_ENCOUNTER, - CINEMATIC_TROLL_DEAD, -#pragma endregion -#pragma region REGION - REGION = 800, - HOGWARTS, - HOGSMEADE, - -#pragma endregion -#pragma region NOCOLLIDE - NOCOLLIDE = 900, - GAIL, - -#pragma endregion - END = 999 - }; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli index 916fcb483..84342d279 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli @@ -129,7 +129,7 @@ DepthStencilState DSS_Default_Environment_SRead DepthStencilState DSS_Default_OutLine_SWrite { DepthEnable = true; - DepthWriteMask = zero; + DepthWriteMask = true; DepthFunc = less_equal; StencilEnable = true; diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXEffectHitBox.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXEffectHitBox.cpp index 5492daaa4..4e185c42b 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXEffectHitBox.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXEffectHitBox.cpp @@ -103,6 +103,7 @@ HRESULT CDummy_PhysXEffectHitBox::Ready_Components(void* pArg) Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_EffectHitBox_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_EffectHitBox_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMonster.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMonster.cpp index ea720422d..85dbe8065 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMonster.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMonster.cpp @@ -126,6 +126,7 @@ HRESULT CDummy_PhysXMonster::Ready_Components(void* pArg) Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Monster_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Monster_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp index bc676089f..9cd7897d5 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXPlayable.cpp @@ -142,6 +142,7 @@ HRESULT CDummy_PhysXPlayable::Ready_Components(void* pArg) Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Playable_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Playable_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Goblin.cpp b/Jusin154_Team3D/Editor/Private/Goblin.cpp index f7cbf1e00..e8c7401fc 100644 --- a/Jusin154_Team3D/Editor/Private/Goblin.cpp +++ b/Jusin154_Team3D/Editor/Private/Goblin.cpp @@ -148,6 +148,7 @@ HRESULT CGoblin::Ready_Components() Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Monster_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Monster_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp index 09ecf51ac..c1f4337fa 100644 --- a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp @@ -43,24 +43,28 @@ HRESULT CLevel_EffectViewer::Initialize() } if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_EffectPool")))) //플레이어보다 먼저 생성해야함! + { return E_FAIL; + } - - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::EFFECT), NEXT_LEVEL, TEXT("Layer_Editor")))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::EFFECT), NEXT_LEVEL, TEXT("Layer_Editor")))){ return E_FAIL; + } - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::EFFECT), NEXT_LEVEL, LAYER_CUBE))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::EFFECT), NEXT_LEVEL, LAYER_CUBE))){ return E_FAIL; + } - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_PLAYER))){ return E_FAIL; + } - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Sky")))) + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Sky")))){ return E_FAIL; + } - - + m_pGameInstance->Add_Editor_Plane(m_PlaneData); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp index 26291d98c..aa5db8b3c 100644 --- a/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_PhysXLab.cpp @@ -138,7 +138,7 @@ HRESULT CLevel_PhysXLab::Ready_Layer_PhysXObjects(const _wstring& strLayerTag) { CDummy_PhysXFreeDoor::PHYSXDUMMY_DESC Desc{}; Desc.vPos = { 10.f, 2.f, 10.f }; - Desc.vRotRPY = { 0.f, XMConvertToRadians(-XM_1DIV2PI), 0.f}; + Desc.vRotRPY = { 0.f, XMConvertToRadians(-XM_PIDIV2), 0.f}; Desc.iSubKind = 24; Desc.fAngleLimit = 70.f; if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) { diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index 4523fce20..bcfdcb884 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -187,6 +187,7 @@ HRESULT CPlayer::Ready_Components() Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Playable_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Playable_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; + Desc.fWalkableSlope = 45.f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h index 9d32f6815..b5be038ef 100644 --- a/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h +++ b/Jusin154_Team3D/Editor/Public/Level_EffectViewer.h @@ -24,6 +24,8 @@ class CLevel_EffectViewer final : public CLevel HRESULT Ready_Layer_Effect(const _wstring& strLayerTag); HRESULT Ready_Layer_PhysX(const _wstring& strLayerTag); + PhsXUserData m_PlaneData = {}; + public: static CLevel_EffectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID); virtual void Free() override; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli index 916fcb483..84342d279 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli @@ -129,7 +129,7 @@ DepthStencilState DSS_Default_Environment_SRead DepthStencilState DSS_Default_OutLine_SWrite { DepthEnable = true; - DepthWriteMask = zero; + DepthWriteMask = true; DepthFunc = less_equal; StencilEnable = true; diff --git a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp index d21daa66a..9578595d8 100644 --- a/Jusin154_Team3D/Engine/Private/Character_Controller.cpp +++ b/Jusin154_Team3D/Engine/Private/Character_Controller.cpp @@ -156,20 +156,117 @@ HRESULT CCharacter_Controller::ConvertToDO(CRigidBody_Dynamic& BodyOriginal) return S_OK; } +void CCharacter_Controller::Set_OnGroundFlag(_bool bOnGround) +{ + m_iIsOnGround = iCoyote_Counter; +} + +void CCharacter_Controller::Set_CurrentSlope(_float fSlope) +{ + m_fCurrentSlopeDegree = fSlope; +} + +void CCharacter_Controller::Rewind_Grounded() +{ + if (m_eBeforeCollisionFlags.isSet(PSX::PxControllerCollisionFlag::eCOLLISION_DOWN)) { + m_iIsOnGround = iCoyote_Counter; + return; + } + m_iIsOnGround -= 1; + if (0 > m_iIsOnGround) { + m_iIsOnGround = 0; + } +} + +_bool CCharacter_Controller::UpdateGroundByCast(_float fTimeDelta) +{ + _vector vFoot = Get_FootPosition(); + _float3 fFoot; + XMStoreFloat3(&fFoot, vFoot); + fFoot.y += 0.0625f; + + PSX::PxSweepBuffer pxBuffer = {}; + + m_pController->getFootPosition(); + _bool bHit = { false }; + + bHit = m_pGameInstance->SphereCast(0.0625f, fFoot, { 0.f, -1.f, 0.f }, 0.0625f, PSX::PxHitFlag::ePOSITION | PSX::PxHitFlag::eNORMAL, PSX::PxQueryFlag::eSTATIC, pxBuffer); + + if (true == bHit) { // 쿼리해서 스태틱 중에 터레인 액터들이 맞으면 다시 갱신 + const PSX::PxSweepHit& hit = pxBuffer.block; + + PSX::PxRigidActor* pActor = hit.actor; + PSX::PxShape* pShape = hit.shape; + + if (nullptr != pActor && nullptr != pActor->userData) + { + PhsXUserData* pUserData = static_cast(pActor->userData); + + switch (pUserData->eKind) + { + case PHYSX_KIND::BODY_STATIC: + { + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::TERRAIN: + case PXOBJECT::FLOOR: + case PXOBJECT::ROAD: + { // 임계값 이상이면 지면에 서서히 붙임 + _float fYHitPos = hit.position.y; + _float fYFoot = (_float)m_pController->getFootPosition().y; + _float fDiff = (fYHitPos - fYFoot); + if (fDiff > m_vAccHeight.w) { + _vector vMomentum = m_pTransform->Get_CurrentMomentum(); + _float fYCurrentMomentum = XMVectorGetY(vMomentum); + fYCurrentMomentum = fDiff * 0.3f; + m_pTransform->Set_CurrentMomentum(XMVectorSetY(vMomentum, fYCurrentMomentum)); + } + else { + m_iIsOnGround = iCoyote_Counter; + } + } + break; + default: + break; + } + } break; + case PHYSX_KIND::BODY_DYNAMIC: + break; + case PHYSX_KIND::CCTActor: + case PHYSX_KIND::OBSTACLEActor: + break; + default: + break; + } + } + } + + return bHit; +} + void CCharacter_Controller::Move(_float fTimeDelta) { PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량 _float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? ) PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터 const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다? - if (true == m_bGravity) { - m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f)); + if (0 >= m_iIsOnGround) { // 공중: 무조건 중력 + m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f)); + } + else if ((iCoyote_Counter) >= m_iIsOnGround) { + UpdateGroundByCast(fTimeDelta); // 바닥에 플레이어 붙이게 함 + } + else if (m_fCurrentSlopeDegree > m_fWalkableSlopeDegree) { // 너무 가파른 경사: 중력 + //m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f)); + } + else { + // 아니면 안함 + } } XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum()); - + m_eBeforeCollisionFlags = m_pController->move(pxVecMomentum, fMinimumDistant, fTimeDelta, pxFilter, pPxObstacles); - } void CCharacter_Controller::Set_Position(_fvector vNewPos) @@ -205,7 +302,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) m_eBodyType = pDesc->eBodyType; m_bAutoStepping = pDesc->bAutoStepping; m_pTransform = pDesc->pTransform; - + m_fWalkableSlopeDegree = pDesc->fWalkableSlope; } { // PhsXUserData m_tagData.eKind = PHYSX_KIND::CCTActor; @@ -226,6 +323,8 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) Desc.contactOffset = pDesc->fContactOffset; Desc.reportCallback = pDesc->pCallback_HitReport; Desc.behaviorCallback = pDesc->pCallback_Behavior; + Desc.slopeLimit = cosf(XMConvertToRadians(m_fWalkableSlopeDegree)); + Desc.nonWalkableMode = PSX::PxControllerNonWalkableMode::ePREVENT_CLIMBING; Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial); m_pController = m_pGameInstance->Add_BoxController(Desc); m_pController->setUserData(&m_tagData); @@ -240,6 +339,8 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) Desc.contactOffset = pDesc->fContactOffset; Desc.reportCallback = pDesc->pCallback_HitReport; Desc.behaviorCallback = pDesc->pCallback_Behavior; + Desc.slopeLimit = cosf(XMConvertToRadians(m_fWalkableSlopeDegree)); + Desc.nonWalkableMode = PSX::PxControllerNonWalkableMode::ePREVENT_CLIMBING; Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial); m_pController = m_pGameInstance->Add_CapsuleController(Desc); m_pController->setUserData(&m_tagData); @@ -256,8 +357,6 @@ HRESULT CCharacter_Controller::Initialize(void* pArg) return E_FAIL; } - m_pController->setSlopeLimit(m_fSlopeLimit); - #ifdef _DEBUG if (FAILED(Debug_Initialize())) { return E_FAIL; @@ -378,7 +477,11 @@ 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::Text("%.1f", m_fCurrentSlopeDegree); + GUI::Text("%.1f", m_fWalkableSlopeDegree); GUI::SameLine(); if (GUI::SliderFloat("m_fWalkableSlopeDegree", &m_fWalkableSlopeDegree, 0.0f, 90.f)) { + m_pController->setSlopeLimit(cosf(XMConvertToRadians(m_fWalkableSlopeDegree))); + } + GUI::DragFloat("m_vAccHeight.w", &m_vAccHeight.w, 0.01f, 0.f, 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); diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 5f44b7821..bd2847d80 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -652,7 +652,9 @@ void CGameInstance::Add_SaveModel(const _char* filePath, SaveModel sModel) SaveModel* CGameInstance::Load_SaveModel(const _char* filePath) { + m_mtxLoadModelLock.lock(); auto iter = m_sModelMap.find(filePath); + m_mtxLoadModelLock.unlock(); return &iter->second; } @@ -684,6 +686,10 @@ PSX::PxRevoluteJoint* CGameInstance::Create_PxRevoluteJoint(PSX::PxRigidActor* p { return m_pPhysX_Manager->Create_PxRevoluteJoint(pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame); } +_bool CGameInstance::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) +{ + return m_pPhysX_Manager->SphereCast(fRadius, vStartPos, vDir, fDistance, flagHitsData, flagQuery, hitBuffer); +} PSX::PxController* CGameInstance::Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc) { return m_pPhysX_Manager->Add_CapsuleController(Desc); @@ -727,6 +733,10 @@ HRESULT CGameInstance::LoadTriMeshes(const _char* pPath, vectorLoadTriMeshes(pPath, TriMeshes); } +void CGameInstance::Add_Editor_Plane(PhsXUserData& PlaneData) +{ + m_pPhysX_Manager->Add_Editor_Plane(PlaneData); +} #pragma endregion #pragma region FOG diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp index f4dd5f117..c0a2df655 100644 --- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp +++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp @@ -153,6 +153,23 @@ PSX::PxMaterial* CPhysX_Manager::Create_Material(const _float3* vMatInfo) return pPxMaterial; } +_bool CPhysX_Manager::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer) +{ + PSX::PxSphereGeometry sphereGeom(fRadius); + + PSX::PxVec3 startPos(vStartPos.x, vStartPos.y, vStartPos.z); + PSX::PxQuat startRot(PSX::PxIdentity); + + PSX::PxTransform startPose(startPos, startRot); + + PSX::PxVec3 sweepDir(vDir.x, vDir.y, vDir.z); + sweepDir.normalize(); + + PSX::PxQueryFilterData filterData(flagQuery); + + return m_pScene->sweep(sphereGeom, startPose, sweepDir, fDistance, hitBuffer, flagHitsData, filterData); +} + void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh) { m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh); @@ -220,6 +237,19 @@ HRESULT CPhysX_Manager::SaveTriMeshes(const _char* pPath, vectoruserData = &PlaneData; + pGroundPlane->setName("PHYSX_EDITPLANE"); + m_pScene->addActor(*pGroundPlane); +} + #endif // EDITOR_PROJECT HRESULT CPhysX_Manager::LoadTriMeshes(const _char* pPath, vector& TriMeshes) @@ -510,6 +540,7 @@ HRESULT CPhysX_Manager::Initialize() m_pCCTManager->setPreventVerticalSlidingAgainstCeiling(false); // 천장타고 슬라이딩 허용 비허용 } +#ifdef _DEBUG // 디버그서버의 클라 세팅 PSX::PxPvdSceneClient* pPvdClient = m_pScene->getScenePvdClient(); if (nullptr != pPvdClient) { @@ -517,25 +548,20 @@ HRESULT CPhysX_Manager::Initialize() pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_CONTACTS, true); pPvdClient->setScenePvdFlag(PSX::PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true); } +#endif DEBUG m_pMaterials.reserve(ENUM_CLASS(PXMATERIAL::END)); 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); - } -#endif + PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 50), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]); + pGroundPlane->userData = &PlaneData; + pGroundPlane->setName("PHYSX_MANAGER_PLANE"); + m_pScene->addActor(*pGroundPlane); return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp index a1c50edfb..28e0c6a42 100644 --- a/Jusin154_Team3D/Engine/Private/Transform.cpp +++ b/Jusin154_Team3D/Engine/Private/Transform.cpp @@ -193,6 +193,10 @@ _vector CTransform::Get_CurrentMomentum() const { return XMLoadFloat3(&m_vMomentum); } +void CTransform::Set_CurrentMomentum(_fvector vMomentum) +{ + XMStoreFloat3(&m_vMomentum, vMomentum); +} _vector CTransform::Get_EstimatedPositionByMomentum() const { return XMVectorSetW(Get_State(STATE::POSITION) + XMLoadFloat3(&m_vMomentum), 1.f); diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp index 1f3178c9f..4250b84eb 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp @@ -211,8 +211,9 @@ HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath) Safe_Delete_Array(pPixels); m_pQuadTree = CQuadTree::Create(m_iNumVerticesX * m_iNumVerticesZ - m_iNumVerticesX, m_iNumVerticesX * m_iNumVerticesZ - 1, m_iNumVerticesX - 1, 0); - if (nullptr == m_pQuadTree) + if (nullptr == m_pQuadTree){ return E_FAIL; + } m_pQuadTree->SetUp_Neighbors(); diff --git a/Jusin154_Team3D/Engine/Public/Character_Controller.h b/Jusin154_Team3D/Engine/Public/Character_Controller.h index 9b7b9cf3b..57c445758 100644 --- a/Jusin154_Team3D/Engine/Public/Character_Controller.h +++ b/Jusin154_Team3D/Engine/Public/Character_Controller.h @@ -3,6 +3,9 @@ NS_BEGIN(Engine) class CTransform; + +constexpr _int iCoyote_Counter = 3; + class ENGINE_DLL CCharacter_Controller final : public CComponent { @@ -14,19 +17,19 @@ class ENGINE_DLL CCharacter_Controller final : #pragma region STRUCT typedef struct tagCharacter_ControllerDesc { - CTransform* pTransform = { nullptr }; - ACTOR eBodyType = { ACTOR::END }; - _float fContactOffset = { 0.f }; - _float3 fMaterial = { 0.5f, 0.5f, 0.6f }; - _bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음 - _float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음 + CTransform* pTransform = { nullptr }; + ACTOR eBodyType = { ACTOR::END }; + _float fContactOffset = { 0.f }; + _float3 fMaterial = { 0.9f, 0.9f, 0.6f }; + _bool bAutoStepping = { false }; // 계단 높이 타게 할건지 // 박스 콜라이더는 생각한대로 되는데 캡슐은 바닥의 구체 때문에 예상보다 더 높은 곳까지 오를 수 있음 + _float fStepOffset = { 0.05f }; // 허용가능한 계단 높이, 작게 유지하는게 좋음 _uint iSubKind = { }; - PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 - PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 + PSX::PxUserControllerHitReport* pCallback_HitReport = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 + PSX::PxControllerBehaviorCallback* pCallback_Behavior = { }; // move가 호출될 때 호출 됨 // dll을 받는 각 프로젝트에서 구현해야함 // 타고 올라갈 수 없는 경사면의 각도를 정의함. 0.f 면 비활성화 됨 - // _float fSlopeLimit = { 코사인각도 }; - + _float fWalkableSlope = { 22.f }; + // Box인 경우 채워넣기 _float3 vBoxSize = { 0.5f, 0.5f, 0.5f }; // CCT박스는 회전없는 AABB임 @@ -46,7 +49,7 @@ class ENGINE_DLL CCharacter_Controller final : virtual HRESULT Render() override; #endif PSX::PxRigidDynamic* Get_Actor(); - PSX::PxController* Get_Controller(); + PSX::PxController* Get_Controller(); _float Get_ContactOffset() const { return m_pController->getContactOffset(); } void Set_ContactOffset(_float fValue) { return m_pController->setContactOffset((PSX::PxF32)fValue); } @@ -55,25 +58,32 @@ class ENGINE_DLL CCharacter_Controller final : void Set_Position(_fvector vNewPos); // 순간이동 _vector Get_Position(); _vector Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 ) - + PSX::PxControllerCollisionFlags Get_CollisionFlags(); void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임 - void Modify_Volume(_float3 fVolume); + void Modify_Volume(_float3 fVolume); // 높이 수정하고 바닥에 붙든 말든 상관안함 _float3 Get_Volume(); HRESULT ConvertToDO(class CRigidBody_Dynamic& BodyOriginal); + void Set_OnGroundFlag(_bool bOnGround); _bool IsGravity() { return m_bGravity; } void SetGravity(_bool bCondition) { m_bGravity = bCondition; }; + void Set_CurrentSlope(_float fSlope); + void Rewind_Grounded(); _bool IsActive() const { return m_bActive; } void SetActive(_bool bCondition) { m_bActive = bCondition; } + _bool UpdateGroundByCast(_float fTimeDelta); private: ACTOR m_eBodyType = { ACTOR::END }; PSX::PxController* m_pController = { nullptr }; CTransform* m_pTransform = { nullptr }; _bool m_bAutoStepping = { false }; - _float m_fGravity = { 0.259f }; - _float m_fSlopeLimit = { 0.302f/*0~1*/}; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 ) + _float m_fGravity = { 0.450f }; + _float m_fWalkableSlopeDegree = { 22.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 ) + _float m_fCurrentSlopeDegree = { 0.f }; + _int m_iIsOnGround = { 0 }; + _float4 m_vAccHeight = { 0.f, 0.16f, 0.f, 0.01f }; PhsXUserData m_tagData = {}; PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {}; diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h index 47d674d4e..49a647995 100644 --- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h +++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h @@ -19,7 +19,7 @@ enum class TEXTURE_LOAD_TYPE { }; enum class PXMATERIAL { DEFAULT, - END, + END, // 정지마찰, 운동마찰, 반발계수 }; enum class PXBODYSTATE { DYNAMIC, @@ -89,6 +89,98 @@ enum class PHYSX_KIND { OBSTACLEActor, }; +enum class PXOBJECT : _uint { +#pragma region NOT_DEFINE + NOT_DEFINE = 000, +#pragma endregion +#pragma region PLAYER + PLAYER = 010, +#pragma endregion +#pragma region MONSTER + MONSTER = 030, + GOBLIN_WARRIOR, // 031 + GOBLIN_MAGICIAN, + GOBLIN_THEIF, + TROLL, + PENSIVE_GUARDIAN, + +#pragma endregion +#pragma region HOSTILE_HITBOX + HOSTILE_HITBOX = 100, + GOBLIN_SMASH, + GOBLIN_DAGGER, + GOBLIN_SHIELD_BREAK_MELEE, + GOBLIN_SHIELD_BREAK_MAGIC, + GOBLIN_NORMAL_MAGIC, + +#pragma endregion +#pragma region ALLY_HITBOX + ALLY_HITBOX = 200, + SKILL_REVAILIO, + SKILL_ACCIO, + SKILL_DEPULSO, + SKILL_DEPULSO_OBSTACLE, + SKILL_DEPULSO_OBSTACLE_FLAMED, + SKILL_NORMALJAP, + SKILL_NORMALJAP_FINAL, + SKILL_BOMBARD_STRIKE, + SKILL_BOMBARD_FLAME, + SKILL_INCENDIO_STRIKE, + SKILL_INCENDIO_SPREAD, + +#pragma endregion +#pragma region NEUTRAL_HITBOX + NEUTRAL_HITBOX = 300, + FLAMED_FLOOR, + +#pragma endregion +#pragma region ENVIRIONMENT + ENVIRIONMENT = 400, + TERRAIN, + FLOOR, + ROAD, + WATER, + WALL, + WALL_BREAKABLE, + WALL_CLIMBABLE, + DOOR, + BUILDING, + BOX, +#pragma endregion +#pragma region NPC + NPC = 500, + +#pragma endregion +#pragma region ITEM + ITEM = 600, + DROPITEM = 630, + TRAP = 660, + +#pragma endregion +#pragma region TRIGGERBOX + TRIGGERBOX = 700, + + + CINEMATIC = 770, + CINEMATIC_INTRO, + CINEMATIC_HOGSMEADE_ENTER, + CINEMATIC_TROLL_ENCOUNTER, + CINEMATIC_TROLL_DEAD, +#pragma endregion +#pragma region REGION + REGION = 800, + HOGWARTS, + HOGSMEADE, + +#pragma endregion +#pragma region NOCOLLIDE + NOCOLLIDE = 900, + GAIL, + +#pragma endregion + END = 999 +}; + NS_END diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index c6a45d9a4..e3cc1d764 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -12,7 +12,7 @@ class ENGINE_DLL CGameInstance final : public CBase private: CGameInstance(); virtual ~CGameInstance() = default; - + mutex m_mtxLoadModelLock = {}; public: HRESULT Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11Device** ppDevice, ID3D11DeviceContext** ppContext); void Update_Engine(_float fTimeDelta); @@ -199,6 +199,8 @@ class ENGINE_DLL CGameInstance final : public CBase PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody); PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame); + _bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer); + PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc); PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc); PSX::PxController* Get_Controller(_uint iControllerIndex); @@ -211,6 +213,7 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); #endif // EDITOR_PROJECT HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // 모델 불러왔던 경로에 그대로 있음 + void Add_Editor_Plane(PhsXUserData& PlaneData); #pragma endregion #pragma region THREADHOLDER template diff --git a/Jusin154_Team3D/Engine/Public/PhysX/geometry/PxGeometryHit.h b/Jusin154_Team3D/Engine/Public/PhysX/geometry/PxGeometryHit.h index 303734f70..588335839 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX/geometry/PxGeometryHit.h +++ b/Jusin154_Team3D/Engine/Public/PhysX/geometry/PxGeometryHit.h @@ -1,4 +1,4 @@ -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // * Redistributions of source code must retain the above copyright diff --git a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h index 9f6e97662..43c4f40dd 100644 --- a/Jusin154_Team3D/Engine/Public/PhysX_Manager.h +++ b/Jusin154_Team3D/Engine/Public/PhysX_Manager.h @@ -29,10 +29,14 @@ class CPhysX_Manager final : public CBase void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh); void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc); PSX::PxMaterial* Create_Material(const _float3* vMatInfo); + + _bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer); + #ifdef EDITOR_PROJECT HRESULT ConvertToTriMeshes(vector& Meshes, vector& pxTriMeshes, _fmatrix WorldMatrix); HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); + void Add_Editor_Plane(PhsXUserData& PlaneData); #endif // EDITOR_PROJECT HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); //HRESULT LoadTriMeshes_Binary(const _char* pPath, vector& TriMeshes); @@ -74,7 +78,9 @@ class CPhysX_Manager final : public CBase PSX::PxScene* m_pScene = { nullptr }; // 피직스 시뮬레이션의 공간 PSX::PxControllerManager* m_pCCTManager = { nullptr }; // 피직스 캐릭터 컨트롤러를 전부 추적하고 매니징함 - PSX::PxPvd* m_pPvd = { nullptr }; // 피직스 시뮬레이션 디버깅을 위한 도구 +#ifdef _DEBUG + PSX::PxPvd* m_pPvd = { nullptr }; // 피직스 시뮬레이션 디버깅을 위한 도구 +#endif // _DEBUG PSX::PxCookingParams* m_pCookingParam = { nullptr }; PSX::PxPvdTransport* m_pTransport = { nullptr }; @@ -90,12 +96,7 @@ class CPhysX_Manager final : public CBase map<_wstring, PSX::PxHeightFieldGeometry*> m_HeightFieldGeometry = {}; -#ifdef EDITOR_PROJECT - _bool m_bDebugCreatePlane = { true }; PhsXUserData PlaneData = {}; -#else - _bool m_bDebugCreatePlane = { false }; -#endif // EDITOR_PROJECT vector m_pMaterials = { }; _uint m_iNumLevel = {}; diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h index a0400c51e..91556424b 100644 --- a/Jusin154_Team3D/Engine/Public/Transform.h +++ b/Jusin154_Team3D/Engine/Public/Transform.h @@ -53,6 +53,7 @@ class ENGINE_DLL CTransform final : void AccumulateMomentum(_fvector vMomentum); _vector Get_CurrentMomentum() const; + void Set_CurrentMomentum(_fvector vMomentum); void RewindMomentum(); _vector Get_EstimatedPositionByMomentum() const; From a9910ce0da1519fac5d4157e6048ed860279f881 Mon Sep 17 00:00:00 2001 From: Chanbin Kim Date: Mon, 1 Dec 2025 22:04:51 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[add]=20MapElementLight=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20[add]=20LightData=20=EC=B6=94=EA=B0=80=20[fix]=20Qc?= =?UTF-8?q?culsionQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Jusin154_Team3D/Client/Private/Light_Main.cpp | 2 +- .../Client/Private/Player_States.cpp | 2 +- .../Bin/Resources/Data/Map/LightElement.xml | 1356 +++++++++++++++++ .../Resources/Data/Map/TestLightElement.xml | 36 + Jusin154_Team3D/Editor/Private/Loader.cpp | 4 + Jusin154_Team3D/Editor/Private/MainLight.cpp | 10 +- Jusin154_Team3D/Editor/Private/MapElement.cpp | 7 +- .../Editor/Private/MapElement_Light.cpp | 138 +- .../Editor/Private/MapObject_Manager.cpp | 172 ++- Jusin154_Team3D/Editor/Public/Editor_Define.h | 2 +- Jusin154_Team3D/Editor/Public/MapElement.h | 5 + .../Editor/Public/MapElement_Light.h | 7 +- .../Editor/Public/MapObject_Manager.h | 8 +- Jusin154_Team3D/Engine/Private/Light.cpp | 2 - .../Engine/Private/OcclusionQuery.cpp | 65 +- .../Engine/Public/OcclusionQuery.h | 6 +- 16 files changed, 1769 insertions(+), 53 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/LightElement.xml create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/Map/TestLightElement.xml diff --git a/Jusin154_Team3D/Client/Private/Light_Main.cpp b/Jusin154_Team3D/Client/Private/Light_Main.cpp index 58d59055e..10787ff99 100644 --- a/Jusin154_Team3D/Client/Private/Light_Main.cpp +++ b/Jusin154_Team3D/Client/Private/Light_Main.cpp @@ -68,7 +68,7 @@ HRESULT CLight_Main::Ready_Components() { return E_FAIL; } - + m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index 4c3b712b5..d7fe8d1e8 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -916,7 +916,7 @@ HRESULT CPlayer::Behavior_CombatExitCheck() { pairAnimInfo = m_Animation[STATEANIM::ACCIO]; Add_Event(pairAnimInfo.first, - [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::BOMBARD, this);}, + [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::BOMBARDA, this);}, 0.15f); m_eSpell = STATEANIM::END; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/LightElement.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/LightElement.xml new file mode 100644 index 000000000..65a836577 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/LightElement.xml @@ -0,0 +1,1356 @@ + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_Light_Post_Floating + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/TestLightElement.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/TestLightElement.xml new file mode 100644 index 000000000..09cbbf08e --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/TestLightElement.xml @@ -0,0 +1,36 @@ + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + + Prototype_GameObject_SM_HM_LightPost + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index ee41d95b6..de9aa43d4 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -2303,6 +2303,10 @@ HRESULT CLoader::Loading_For_MapViewer() ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) return E_FAIL; + if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\LightFixtures", + ".fbx", true, ModelPrototypeTags, ModelPrototypePath))) + return E_FAIL; + #pragma endregion #ifdef gimch diff --git a/Jusin154_Team3D/Editor/Private/MainLight.cpp b/Jusin154_Team3D/Editor/Private/MainLight.cpp index f748f1c62..e00210c9e 100644 --- a/Jusin154_Team3D/Editor/Private/MainLight.cpp +++ b/Jusin154_Team3D/Editor/Private/MainLight.cpp @@ -109,7 +109,7 @@ void CMainLight::Update(_float fTimeDelta) //m_pLightCom->Set_Color(m_vCurDiffuse, m_vAmbient, m_vSpecular); - //m_pLightCom->Describe_Entity(); + Describe_Entity(); } void CMainLight::Late_Update(_float fTimeDelta) @@ -130,8 +130,8 @@ HRESULT CMainLight::Ready_Components() LIGHT_DESC LightDesc{}; LightDesc.eType = LIGHT::DIRECTIONAL; - LightDesc.vDiffuse = _float4(0.3f, 0.3f, 0.3f, 0.f); - LightDesc.vAmbient = _float4(0.3f, 0.3f, 0.3f, 0.f); + LightDesc.vDiffuse = _float4(0.3f, 0.3f, 0.1f, 0.f); + LightDesc.vAmbient = _float4(0.3f, 0.3f, 0.5f, 0.f); LightDesc.vSpecular = _float4(0.f, 0.f, 0.f, 0.f); LightDesc.pDirection = m_pTransformCom->Get_StatePtr(STATE::LOOK); LightDesc.iLevel = NEXT_LEVEL; @@ -142,6 +142,10 @@ HRESULT CMainLight::Ready_Components() return E_FAIL; } + m_pGameInstance->Add_Light(NEXT_LEVEL, m_pLightCom); + + _float4 vColor = _float4(0.1f, 0.1f, 0.15f, 0.5f); + m_pGameInstance->Set_FogColor(vColor); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/MapElement.cpp b/Jusin154_Team3D/Editor/Private/MapElement.cpp index 1ed1d51e1..7587bece8 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "MapElement.h" #include "GameInstance.h" @@ -73,3 +73,8 @@ void CMapElement::Free() void CMapElement::Describe_Entity() { } + +HRESULT CMapElement::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + return S_OK; +} diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Light.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Light.cpp index 5588522c1..1f75abd1b 100644 --- a/Jusin154_Team3D/Editor/Private/MapElement_Light.cpp +++ b/Jusin154_Team3D/Editor/Private/MapElement_Light.cpp @@ -78,10 +78,32 @@ void CMapElement_Light::Late_Update(_float fTimeDelta) } #endif - if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) { - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - if(m_bOnLight) + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) + { + if (m_isLightOn) + { + _float fDistance = XMVectorGetX(XMVector3LengthSq(XMLoadFloat4(m_pGameInstance->Get_CamPosition()) - m_pTransformCom->Get_State(STATE::POSITION))); + if (m_LightAdded_Distance > fDistance) // 카메라 범위 안 + { + if(!m_isLightAdded) + { + m_isLightAdded = true; + m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom); + } + } + else + { + if (m_isLightAdded) + { + m_isLightAdded = false; + m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom); + } + } + m_pGameInstance->Add_RenderGroup(RENDER::BLOOM, this); + } + + m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); } } @@ -94,7 +116,7 @@ HRESULT CMapElement_Light::Render() for (_uint i = 0; i < iNumMeshes; i++) { - if (true == m_bOnLight && m_iGlassMeshIndex == i) + if (true == m_isLightOn && m_iGlassMeshIndex == i) continue; if (m_iGlassMeshIndex == i) @@ -121,7 +143,7 @@ HRESULT CMapElement_Light::Render() } else { - if (FAILED(m_pModelComs[0]->Bind_Material(1, m_pShaderCom))) { + if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) { return E_FAIL; } @@ -191,12 +213,16 @@ HRESULT CMapElement_Light::Ready_Components(void* pArg) LightDesc.fRange = pDesc->fRange; LightDesc.iLevel = NEXT_LEVEL; LightDesc.pPosition = m_pTransformCom->Get_StatePtr(STATE::POSITION); + /* Com_Light*/ if (FAILED(Add_Component(g_iStaticLevel, &m_pLightCom, &LightDesc))) { return E_FAIL; } + if(false == pDesc->isPow) + m_pLightCom->Switch_LightAttenationMethod(); + return S_OK; } @@ -245,12 +271,12 @@ HRESULT CMapElement_Light::Render_Bloom() void CMapElement_Light::Toggle_Light() { - if (m_bOnLight) + if (m_isLightOn) m_pGameInstance->Delete_Light(CURRENT_LEVEL, m_pLightCom); else m_pGameInstance->Add_Light(CURRENT_LEVEL, m_pLightCom); - m_bOnLight = !m_bOnLight; + m_isLightAdded = m_isLightOn = !m_isLightOn; } CMapElement_Light* CMapElement_Light::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -302,7 +328,7 @@ void CMapElement_Light::Describe_Entity() if (nullptr == m_pGameInstance) return; GUI::Text("LIGHT "); - + GUI::InputFloat("Distacne", &m_LightAdded_Distance, 1.f, 10.f); if (GUI::Button("Light ON / OFF")) Toggle_Light(); @@ -345,3 +371,99 @@ void CMapElement_Light::Describe_Entity() m_bSelected = true; } + +HRESULT CMapElement_Light::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root) +{ + tinyxml2::XMLElement* object = doc.NewElement("Object"); + object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_LIGHT)); + object->SetAttribute("Lod_Level", m_iLodIndex); + root->InsertEndChild(object); + +#pragma region PROTOTYPETAG + for (_uint i = 0; i < m_iLodIndex + 1; ++i) + { + tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag"); + prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str()); + object->InsertEndChild(prototype); + } +#pragma endregion + +#pragma region TRANSFORM + _float3 vPosition = {}; + XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION)); + + _float3 vScale = m_pTransformCom->Get_Scale(); + + _float3 vRotation = {}; + XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector()); + vRotation.x = XMConvertToDegrees(vRotation.x); + vRotation.y = XMConvertToDegrees(vRotation.y); + vRotation.z = XMConvertToDegrees(vRotation.z); + + tinyxml2::XMLElement* Position = doc.NewElement("Position"); + Position->SetAttribute("x", vPosition.x); + Position->SetAttribute("y", vPosition.y); + Position->SetAttribute("z", vPosition.z); + object->InsertEndChild(Position); + + tinyxml2::XMLElement* Scale = doc.NewElement("Scale"); + Scale->SetAttribute("x", vScale.x); + Scale->SetAttribute("y", vScale.y); + Scale->SetAttribute("z", vScale.z); + object->InsertEndChild(Scale); + + tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation"); + Rotation->SetAttribute("x", vRotation.x); + Rotation->SetAttribute("y", vRotation.y); + Rotation->SetAttribute("z", vRotation.z); + object->InsertEndChild(Rotation); +#pragma endregion + +#pragma region LIGHT_DESC + const LIGHT_DESC* pLight = m_pLightCom->Get_LightDesc(); + + /* Diffuse */ + tinyxml2::XMLElement* Diffuse = doc.NewElement("Diffuse"); + Diffuse->SetAttribute("x", pLight->vDiffuse.x); + Diffuse->SetAttribute("y", pLight->vDiffuse.y); + Diffuse->SetAttribute("z", pLight->vDiffuse.z); + object->InsertEndChild(Diffuse); + + /* Ambient */ + tinyxml2::XMLElement* Ambient = doc.NewElement("Ambient"); + Ambient->SetAttribute("x", pLight->vAmbient.x); + Ambient->SetAttribute("y", pLight->vAmbient.y); + Ambient->SetAttribute("z", pLight->vAmbient.z); + object->InsertEndChild(Ambient); + + /* Specular */ + tinyxml2::XMLElement* Specular = doc.NewElement("Specular"); + Specular->SetAttribute("x", pLight->vSpecular.x); + Specular->SetAttribute("y", pLight->vSpecular.y); + Specular->SetAttribute("z", pLight->vSpecular.z); + object->InsertEndChild(Specular); + + /* PosOffset */ + tinyxml2::XMLElement* PosOffset = doc.NewElement("PosOffset"); + PosOffset->SetAttribute("x", pLight->vPosOffset.x); + PosOffset->SetAttribute("y", pLight->vPosOffset.y); + PosOffset->SetAttribute("z", pLight->vPosOffset.z); + object->InsertEndChild(PosOffset); + + /* Info */ + tinyxml2::XMLElement* Info = doc.NewElement("Info"); + Info->SetAttribute("GlassIndex", m_iGlassMeshIndex); + Info->SetAttribute("BloomStrength", m_fBloomStrength); + Info->SetAttribute("Range", pLight->fRange); + + if(false == m_pLightCom->Is_PowerLightAtt()) + Info->SetAttribute("Pow", 0); + else + Info->SetAttribute("Pow", 1); + + object->InsertEndChild(Info); +#pragma endregion + + + return S_OK; +} diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp index 70978b4f3..1230e7b80 100644 --- a/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp +++ b/Jusin154_Team3D/Editor/Private/MapObject_Manager.cpp @@ -58,6 +58,11 @@ HRESULT CMapObject_Manager::Initialize(void* pArg) m_iContainerObjectIndex = 99; //m_pContainer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Building"))->Get_Object(); + if (FAILED(Load_MapData("Map1129"))) + return E_FAIL; + /*if (FAILED(Load_LightObject("LightElement"))) + return E_FAIL; + */ return S_OK; } @@ -75,7 +80,7 @@ void CMapObject_Manager::Priority_Update(_float fTimeDelta) void CMapObject_Manager::Update(_float fTimeDelta) { - GUI::Begin("File"); + GUI::Begin("Map Manager"); const char* ModeNames[4] = { "CONTAINER", @@ -107,6 +112,20 @@ void CMapObject_Manager::Update(_float fTimeDelta) Save_ContainerData("ContainerTest", m_szSaveContainerName); } } + else if (ADD_TYPE::ELEMENT_LIGHT == m_eType) + { + GUI::InputInt("GlassIndex", &m_iGlassIndex); + m_iGlassIndex = min(1, m_iGlassIndex); + if (GUI::Button("Save_LightElements")) + { + Save_LightObject(m_szSaveContainerName); + } + if (GUI::Button("Load_LightElements")) + { + Load_LightObject(m_szSaveContainerName); + } + } + if (GUI::Button("Load_Container")) { Load_ContainerData("ContainerTest", m_szSaveContainerName); @@ -1140,13 +1159,143 @@ HRESULT CMapObject_Manager::Load_ContainerToMapObject(const _char* pFileName, co return S_OK; } + HRESULT CMapObject_Manager::Save_LightObject(const _char* pFileName) { + CLayer* pLayer; + + pLayer = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Element_Light")); + + if (nullptr == pLayer) + return S_OK; + + tinyxml2::XMLDocument doc; + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str()); + + doc.Clear(); + doc.InsertFirstChild(doc.NewDeclaration()); + + tinyxml2::XMLElement* root = doc.NewElement("MapLightObjects"); + doc.InsertEndChild(root); + + + + if (nullptr != pLayer) + { + const list* pList = pLayer->Get_Objects(); + + for (auto pGamObject : *pList) + { + CMapElement* pElement = dynamic_cast(pGamObject); + + if (nullptr == pElement) + return E_FAIL; + + if (FAILED(pElement->Save_XML(doc, root))) + return E_FAIL; + } +#pragma endregion + } + + if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) { + MSG_BOX("Failed to Save File"); + } + else + { + MSG_BOX("Succeed to Save File"); + } + return S_OK; } -#pragma endregion +HRESULT CMapObject_Manager::Load_LightObject(const _char* pFileName) +{ + tinyxml2::XMLDocument xmlDoc; + + string strPath = "../Bin/Resources/Data/Map/" + string(pFileName) + ".xml"; + + if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str()))) + return E_FAIL; + + tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("MapLightObjects"); + + if (nullptr == root) + { + MSG_BOX("Failed to Find root"); + return S_OK; + } + + for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object")) + { + CMapElement_Light::MAPELEMENT_LIGHT_DESC Desc = {}; + + /* Model Prototypes */ + Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel); + + string strTag = {}; + for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag")) + { + strTag = PrototypeTag->GetText(); + + Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag)); + } + + /* Transform */ + auto* Position = Object->FirstChildElement("Position"); + Position->QueryFloatAttribute("x", &Desc.vPosition.x); + Position->QueryFloatAttribute("y", &Desc.vPosition.y); + Position->QueryFloatAttribute("z", &Desc.vPosition.z); + + auto* Scale = Object->FirstChildElement("Scale"); + Scale->QueryFloatAttribute("x", &Desc.vScale.x); + Scale->QueryFloatAttribute("y", &Desc.vScale.y); + Scale->QueryFloatAttribute("z", &Desc.vScale.z); + + auto* Rotation = Object->FirstChildElement("Rotation"); + Rotation->QueryFloatAttribute("x", &Desc.vRotation.x); + Rotation->QueryFloatAttribute("y", &Desc.vRotation.y); + Rotation->QueryFloatAttribute("z", &Desc.vRotation.z); + + /* Light Desc */ + auto* Diffuse = Object->FirstChildElement("Diffuse"); + Diffuse->QueryFloatAttribute("x", &Desc.vDiffuse.x); + Diffuse->QueryFloatAttribute("y", &Desc.vDiffuse.y); + Diffuse->QueryFloatAttribute("z", &Desc.vDiffuse.z); + + auto* Ambient = Object->FirstChildElement("Ambient"); + Ambient->QueryFloatAttribute("x", &Desc.vAmbient.x); + Ambient->QueryFloatAttribute("y", &Desc.vAmbient.y); + Ambient->QueryFloatAttribute("z", &Desc.vAmbient.z); + + auto* Specular = Object->FirstChildElement("Specular"); + Specular->QueryFloatAttribute("x", &Desc.vSpecular.x); + Specular->QueryFloatAttribute("y", &Desc.vSpecular.y); + Specular->QueryFloatAttribute("z", &Desc.vSpecular.z); + + auto* PosOffset = Object->FirstChildElement("PosOffset"); + PosOffset->QueryFloatAttribute("x", &Desc.vPosOffset.x); + PosOffset->QueryFloatAttribute("y", &Desc.vPosOffset.y); + PosOffset->QueryFloatAttribute("z", &Desc.vPosOffset.z); + + auto* Info = Object->FirstChildElement("Info"); + Info->QueryUnsignedAttribute("GlassIndex", &Desc.iGlassMeshIndex); + Info->QueryFloatAttribute("BloomStrength", &Desc.fBloomStregth); + Info->QueryFloatAttribute("Range", &Desc.fRange); + _uint iPow = {}; + Info->QueryUnsignedAttribute("Pow", &iPow); + + Desc.isPow = 0 == iPow ? false : true; + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Desc))) + return E_FAIL; + } + + MSG_BOX("Successed to Load File"); + return S_OK; +} void CMapObject_Manager::Update_PrototypeList() { GUI::Begin("Model Prototype List"); @@ -1470,15 +1619,20 @@ void CMapObject_Manager::Create_Elemnt(_wstring& strPrototypeTag) } else if (ADD_TYPE::ELEMENT_LIGHT == m_eType) { - Light_Desc.iGlassMeshIndex = 0; - Light_Desc.fBloomStregth = 3.5f; - Light_Desc.fRange = 10.f; - Light_Desc.vDiffuse = _float4(1.f, 0.6f, 0.3f, 1.f); - Light_Desc.vAmbient = _float4(1.f, 0.6f, 0.3f, 1.f); + Light_Desc.isPow = false; + Light_Desc.iGlassMeshIndex = m_iGlassIndex; + Light_Desc.fBloomStregth = 4.5f; + Light_Desc.fRange = 7.f; + Light_Desc.vDiffuse = _float4(1.f, 0.6f, 0.2f, 1.f); + Light_Desc.vAmbient = _float4(1.f, 0.64f, 0.2f, 1.f); Light_Desc.vSpecular = _float4(0.f, 0.f, 0.f, 1.f); - Light_Desc.vPosOffset = _float4(0.f, 3.5f, 0.f, 1.f); + Light_Desc.vPosOffset = _float4(0.f, 3.3f, 0.f, 1.f); + + CMapElement_Light* pElement = { nullptr }; - m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Light_Desc); + m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, TEXT("Layer_Element_Light"), &Light_Desc, nullptr, &pElement); + + m_pSelectElemnt = pElement; } } diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 83cfa6c7b..43cb7b2e4 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -15,7 +15,7 @@ namespace Editor enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, BLOOM, END }; enum class COLLIDABLEOBJECT { PLAYER, MONSTER, HOSTILE_HITBOX, ALLY_HITBOX, NEUTRAL_HITBOX, ENVIRIONMENT, NPC, ITEM, TRIGGERBOX, REGION, NOCOLLIDE, END }; - enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT }; + enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT, ELEMENT_LIGHT }; enum class MAPOBJECT_RENDER_TYPE { NORMAL, DECAL, GLASS }; enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, HAIR, EYELASH, OUTLINE_WRITE, OUTLINE_READ, END }; diff --git a/Jusin154_Team3D/Editor/Public/MapElement.h b/Jusin154_Team3D/Editor/Public/MapElement.h index c903efc46..9ffdd20d3 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement.h +++ b/Jusin154_Team3D/Editor/Public/MapElement.h @@ -27,6 +27,9 @@ class CMapElement abstract : public CGameObject virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; + + + protected: _bool m_bSelected = { false }; _uint m_iMaxLodLevel = {}; @@ -53,6 +56,8 @@ class CMapElement abstract : public CGameObject virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) PURE; virtual void Free() override; void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root); + }; NS_END diff --git a/Jusin154_Team3D/Editor/Public/MapElement_Light.h b/Jusin154_Team3D/Editor/Public/MapElement_Light.h index 4c513313e..24971cdae 100644 --- a/Jusin154_Team3D/Editor/Public/MapElement_Light.h +++ b/Jusin154_Team3D/Editor/Public/MapElement_Light.h @@ -15,6 +15,7 @@ class CMapElement_Light : public CMapElement public: typedef struct MapElement_Light_Desc : MAPOBJECT_LOD_DESC { + _bool isPow; _uint iGlassMeshIndex; _float fBloomStregth; _float fRange; @@ -44,11 +45,14 @@ class CMapElement_Light : public CMapElement CTexture* m_pMaskTextureCom = { nullptr }; CTexture* m_pGlassTextureCom = { nullptr }; - _bool m_bOnLight = { true }; + _bool m_isLightOn = { true }; + _bool m_isLightAdded = { false }; _uint m_iGlassMeshIndex = {}; _float m_fBloomStrength = {1.f}; _float m_fGlassRatio = { 0.5f }; + _float m_LightAdded_Distance = { 5000.f }; + private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; @@ -61,6 +65,7 @@ class CMapElement_Light : public CMapElement virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; void Describe_Entity() override; + virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root); }; NS_END diff --git a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h index 72e60fb6b..586779c86 100644 --- a/Jusin154_Team3D/Editor/Public/MapObject_Manager.h +++ b/Jusin154_Team3D/Editor/Public/MapObject_Manager.h @@ -22,9 +22,9 @@ class CMapObject_Manager final : public CGameObject public: virtual HRESULT Initialize_Prototype(vector<_wstring>& ModelPrototypeTags, vector& ModelPrototypePaths); virtual HRESULT Initialize(void* pArg) override; - virtual void Priority_Update(_float fTimeDelta) override; - virtual void Update(_float fTimeDelta) override; - virtual void Late_Update(_float fTimeDelta) override; + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; virtual HRESULT Render() override; const filesystem::path Get_PrototypePath(_uint iModelIndex); @@ -45,6 +45,7 @@ class CMapObject_Manager final : public CGameObject vector m_ModelPrototypePaths; _uint m_iContainerObjectIndex = {}; + _int m_iGlassIndex = { 1 }; class CBuildingContainer* m_pContainer = { nullptr }; _char m_szSaveFileName[MAX_PATH] = {}; @@ -62,6 +63,7 @@ class CMapObject_Manager final : public CGameObject HRESULT Load_ContainerToMapObject(const _char* pFileName, const _char* pContainerName); HRESULT Save_LightObject(const _char* pFileName); + HRESULT Load_LightObject(const _char* pFileName); #pragma endregion void Update_PrototypeList(); diff --git a/Jusin154_Team3D/Engine/Private/Light.cpp b/Jusin154_Team3D/Engine/Private/Light.cpp index 0d5a0638f..52d5cd939 100644 --- a/Jusin154_Team3D/Engine/Private/Light.cpp +++ b/Jusin154_Team3D/Engine/Private/Light.cpp @@ -52,8 +52,6 @@ HRESULT CLight::Initialize(void* pArg) m_LightDesc = *pLightDesc; - m_pGameInstance->Add_Light(m_LightDesc.iLevel, this); - return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp b/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp index f48aa11b7..a280e141f 100644 --- a/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp +++ b/Jusin154_Team3D/Engine/Private/OcclusionQuery.cpp @@ -13,36 +13,54 @@ COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs) void COcclusionQuery::Begin_Query() { - m_pContext->Begin(m_pQuery); + m_pContext->Begin(m_pQuery[m_iCountFrame]); } _bool COcclusionQuery::isDraw() { - UINT64 iNumSample; - - if (m_pContext->GetData(m_pQuery, &iNumSample, sizeof(UINT64), 0) != S_OK) - return m_bPreFrameDraw; + static int sCheckFrame = 0; - 0 < iNumSample ? m_bThisFrameDraw = true : m_bThisFrameDraw = false; + bool bVisible = m_bPreFrameDraw; - _bool bDraw = { false }; - - if(true == m_bThisFrameDraw) - m_NumCullFrame = 0; - else + if (++sCheckFrame >= 5) { - if(m_NumCullFrame < 5) - ++m_NumCullFrame; + sCheckFrame = 0; + + UINT64 sampleCount = 0; + HRESULT hr = m_pContext->GetData( + m_pQuery[m_iGetFrameIndex], + &sampleCount, + sizeof(UINT64), + D3D11_ASYNC_GETDATA_DONOTFLUSH + ); + + if (hr == S_OK) + { + bVisible = (sampleCount > 0); + } } - m_bPreFrameDraw = m_bThisFrameDraw; + if (bVisible) + { + m_iNumCullFrame = 0; + } + else + { + if (m_iNumCullFrame < 2) + ++m_iNumCullFrame; + } - return m_NumCullFrame < 5; + m_bPreFrameDraw = bVisible; + return (m_iNumCullFrame < 2); } void COcclusionQuery::End_Query() { - m_pContext->End(m_pQuery); + m_pContext->End(m_pQuery[m_iCountFrame]); + + m_iGetFrameIndex = (m_iCountFrame + 5 - 1) % 5; + + m_iCountFrame = (m_iCountFrame + 1) % 5; } HRESULT COcclusionQuery::Initialize_Prototype() @@ -57,14 +75,17 @@ HRESULT COcclusionQuery::Initialize(void* pArg) queryDesc.Query = D3D11_QUERY_OCCLUSION; queryDesc.MiscFlags = 0; - if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery))) + for (_uint i = 0; i < 5; i++) { - MSG_BOX("Failed to Created : ID3D11Query"); - return E_FAIL; + if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery[i]))) + { + MSG_BOX("Failed to Created : ID3D11Query"); + return E_FAIL; + } } m_bPreFrameDraw = m_bThisFrameDraw = true; - m_NumCullFrame = 0; + m_iNumCullFrame = 0; return S_OK; } @@ -99,7 +120,9 @@ void COcclusionQuery::Free() { __super::Free(); - SAFE_RELEASE(m_pQuery); + for(auto& pQuery : m_pQuery) + SAFE_RELEASE(pQuery); + } #ifdef _DEBUG diff --git a/Jusin154_Team3D/Engine/Public/OcclusionQuery.h b/Jusin154_Team3D/Engine/Public/OcclusionQuery.h index 941f2a5f3..70c91c223 100644 --- a/Jusin154_Team3D/Engine/Public/OcclusionQuery.h +++ b/Jusin154_Team3D/Engine/Public/OcclusionQuery.h @@ -17,11 +17,13 @@ class ENGINE_DLL COcclusionQuery final : public CComponent void End_Query(); private: - ID3D11Query* m_pQuery = { nullptr }; + ID3D11Query* m_pQuery[5] = {}; _bool m_bPreFrameDraw = {}; _bool m_bThisFrameDraw = {}; - _uint m_NumCullFrame = {}; + _uint m_iNumCullFrame = {}; + _uint m_iCountFrame = {}; + _uint m_iGetFrameIndex = {}; private: virtual HRESULT Initialize_Prototype() override; From 17e2ef71c0634f3a5d42c09d99901dff2bdf6288 Mon Sep 17 00:00:00 2001 From: kimnuri Date: Mon, 1 Dec 2025 22:07:14 +0900 Subject: [PATCH 3/3] [add] Slope --- Jusin154_Team3D/Client/Private/Player.cpp | 2 +- Jusin154_Team3D/Client/Private/Player_States.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index e4fd3257f..c7e5b2f7a 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -289,7 +289,7 @@ HRESULT CPlayer::Ready_Components() Desc.pCallback_HitReport = m_pCallBack_HitReport = CCallBack_Playable_HitReport::Create(); Desc.pCallback_Behavior = m_pCallBack_Behavior = CCallBack_Playable_Behavior::Create(); Desc.eClimbingMode = PSX::PxCapsuleClimbingMode::eEASY; - Desc.fWalkableSlope = 45.f; + Desc.fWalkableSlope = 22.5f; if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_CCT_CAPSULE"), (CComponent**)&m_pCharacter_Controller, &Desc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index 4c3b712b5..d7fe8d1e8 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -916,7 +916,7 @@ HRESULT CPlayer::Behavior_CombatExitCheck() { pairAnimInfo = m_Animation[STATEANIM::ACCIO]; Add_Event(pairAnimInfo.first, - [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::BOMBARD, this);}, + [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::BOMBARDA, this);}, 0.15f); m_eSpell = STATEANIM::END; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);