diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index ce14fe11d..4bf4d03e7 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -1892,13 +1892,13 @@ PS_OUT PS_SpellLearnBooster(PS_IN In) float4 tex3 = g_Texture3.Sample(DefaultSampler, In.vTexcoord); Color = lerp(Color, tex3, tex3.a); - } + } else if (g_iBoosterOn == 0 && g_iBoosterOff != 0) { float4 tex2 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); tex2.rgb *= float3(1.f, 0.f, 0.f); - Color = tex; + Color = tex; Color = lerp(Color, tex2, tex2.a); } @@ -2259,23 +2259,21 @@ PS_OUT PS_Interaction_Npc(PS_IN In) float4 tex1 = g_Texture.Sample(ClampSampler, Finaluv); Color = tex1; - - if (g_iHover != 0) - { - float2 texpos1 = g_fImageSipos1.xy / g_fCurrent_Size; - float2 texsize1 = g_fImageSipos1.zw / g_fCurrent_Size; - float2 texlocal1 = (In.vTexcoord - texpos1) / texsize1; - bool inside1 = all(texlocal1 >= 0.0f && texlocal1 <= 1.0f); - if (inside1) - { - float2 startUV = g_fImageUV.xy; - float2 endUV = g_fImageUV.zw; - float2 atlasUV = atlasUV = startUV + texlocal1 * (endUV - startUV); - float4 tex2 = g_Texture1.Sample(DefaultSampler, atlasUV); - Color = lerp(Color, tex2, tex2.a); - } + float2 texpos1 = g_fImageSipos1.xy / g_fCurrent_Size; + float2 texsize1 = g_fImageSipos1.zw / g_fCurrent_Size; + float2 texlocal1 = (In.vTexcoord - texpos1) / texsize1; + bool inside1 = all(texlocal1 >= 0.0f && texlocal1 <= 1.0f); + if (inside1) + { + float2 startUV = g_fImageUV.xy; + float2 endUV = g_fImageUV.zw; + float2 atlasUV = atlasUV = startUV + texlocal1 * (endUV - startUV); + float4 tex2 = g_Texture1.Sample(DefaultSampler, atlasUV); + Color = lerp(Color, tex2, tex2.a); + } + Color.a *= Alpha; diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index efd00ecf7..84e2df0f2 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -166,9 +166,11 @@ call Update_Resources.bat + + @@ -407,9 +409,11 @@ call Update_Resources.bat + + diff --git a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters index 93ee01ab7..42bd5e443 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj.filters +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj.filters @@ -722,9 +722,6 @@ 04.Mechanic\State\State_Combat\State_FireBall - - 02.GameObjects\Effect\MonsterEffect\Ranrok - 02.GameObjects\UI\NPCInteraction @@ -740,8 +737,17 @@ 02.GameObjects\Environment\99.Lights\PointLight + + 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_FireBall + + + 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath + - 02.GameObjects\Cameras\CameraPosition\AI + 02.GameObjects\Cameras\CameraPosition\AI + + + 04.Mechanic\Dialogue\Dialogue_Data @@ -1520,7 +1526,7 @@ {087ad9ea-445d-4bf7-8ec4-0f29a0c2dd53} - + {09764279-bf54-48e4-853a-45b5a65c92a7} @@ -1539,8 +1545,17 @@ {4151af66-59d0-496d-a9a0-0c0603166192} + + {a682b36b-cead-4c0d-abda-466b0a5f52c2} + + + {a3b5e707-dbb3-47da-a77b-b0ca62b89e99} + {a24f4687-f540-44e5-ae47-fe176c4c9042} + + + {b03591a7-a14e-425a-8a3f-2a6a054c884a} @@ -2211,9 +2226,6 @@ 02.GameObjects\PhysX\CallBack\HitReport\Monster\Ranrok - - 02.GameObjects\Effect\MonsterEffect\Ranrok - 02.GameObjects\UI\NPCInteraction @@ -2229,8 +2241,17 @@ 02.GameObjects\Environment\99.Lights\PointLight + + 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_FireBall + + + 02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath + 02.GameObjects\Cameras\CameraPosition\AI + + + 04.Mechanic\Dialogue\Dialogue_Data diff --git a/Jusin154_Team3D/Client/Private/Broom.cpp b/Jusin154_Team3D/Client/Private/Broom.cpp index 751912f6d..4802ebd41 100644 --- a/Jusin154_Team3D/Client/Private/Broom.cpp +++ b/Jusin154_Team3D/Client/Private/Broom.cpp @@ -60,6 +60,10 @@ HRESULT CBroom::Initialize(void* pArg) m_pWindEffect->Get_Effect_Info()->isBillboard = false; } + else { + m_fAISeed = m_pGameInstance->Real_Random_Float(0.f, XM_2PI); + m_fAICondition = 1.f; + } return S_OK; @@ -81,8 +85,15 @@ void CBroom::Update(_float fTimeDelta) else { m_bHoverToggle = m_Input.bHoverToggle; m_bTurbo = m_Input.bTurbo; - } + m_fAITime += fTimeDelta; + + _float target = 1.f + sinf(m_fAITime * 0.3f + m_fAISeed) * 0.15f; + + m_fAICondition += (target - m_fAICondition) * fTimeDelta * 0.3f; + + m_fAICondition = clamp(m_fAICondition, 0.85f, 1.15f); + } if (!m_bRide) { m_bHoverToggle = true; @@ -118,7 +129,7 @@ void CBroom::Update(_float fTimeDelta) return; } - m_pWindEffect->Set_Visible(true); + m_pWindEffect->Set_Visible(false); m_pWindEffect->Get_Component()->Set_TimeMult(0.5f + m_fSpeed / 20.f); m_pWindEffect->Get_Effect_Info()->fBlurIntensity = m_fSpeed / 30.f; @@ -283,15 +294,20 @@ void CBroom::PlayerInput() if (m_pGameInstance->Key_Up(DIK_LSHIFT)) { - m_Input.bHoverToggle = !m_Input.bHoverToggle; - m_bHoverToggle = m_Input.bHoverToggle; + m_bHoverToggle = !m_bHoverToggle; } - m_Input.bTurbo = m_pGameInstance->Mouse_Pressing(DIM_LBUTTON); m_bTurbo = m_Input.bTurbo; } +void CBroom::Set_AISpeed(_float speedMul, _float accelMul) +{ + m_fAISpeedMul = speedMul; + m_fAIAccelMul = accelMul; +} + + CBroom* CBroom::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CBroom* pInstance = new CBroom(pDevice, pContext); diff --git a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp index 80a048bb8..08a5d9a48 100644 --- a/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRaceManager.cpp @@ -40,13 +40,25 @@ HRESULT CBroomRaceManager::Initialize(void* pArg) void CBroomRaceManager::Priority_Update(_float fTimeDelta) { __super::Priority_Update(fTimeDelta); + switch (m_eRaceState) + { + case ENUM_CLASS(RACE_STATE::COUNTDOWN): + Update_Countdown(fTimeDelta); + break; + case ENUM_CLASS(RACE_STATE::RACING): + Check_RingPassed(); + break; + } - Check_RingPassed(); } void CBroomRaceManager::Update(_float fTimeDelta) { __super::Update(fTimeDelta); + + + + #ifdef _DEBUG Describe_Entity(); #endif // _DEBUG @@ -55,6 +67,14 @@ void CBroomRaceManager::Update(_float fTimeDelta) void CBroomRaceManager::Late_Update(_float fTimeDelta) { __super::Late_Update(fTimeDelta); + m_pGameInstance->Add_RenderGroup(RENDER::UI, this); +} + +HRESULT CBroomRaceManager::Render() +{ + m_pGameInstance->Render_Text(TEXT("Font_size20"), ToolTip.c_str(), _float2(g_iWinSizeX*0.5f, g_iWinSizeY*0.5f),XMVectorSet(1.f,1.f,1.f,1.f),5.f); + + return S_OK; } HRESULT CBroomRaceManager::Ready_Components() @@ -123,6 +143,7 @@ void CBroomRaceManager::Describe_Entity() { if (GUI::Button("Race Start")) { + m_eRaceState = ENUM_CLASS(RACE_STATE::READY); const _float SPAWN_DISTANCE = 80.f; for (auto& racer : m_Racers) @@ -140,25 +161,77 @@ void CBroomRaceManager::Describe_Entity() { CTransform* pBroomTransform = racer.pAI->Get_Broom()->Get_Component(); + _float fRand = m_pGameInstance->Real_Random_Float(-10.f, 10.f); + spawnPos.m128_f32[2] += fRand; pBroomTransform->Set_State(STATE::POSITION, spawnPos); - pBroomTransform->Set_State(STATE::LOOK, ringLook); + pBroomTransform->LookAt(pRingTransform->Get_State(STATE::POSITION)); + racer.pAI->Get_Broom()->Set_Move(false); } else if (racer.pRacer) { - CTransform* pBroomTransform = - racer.pRacer->Get_Broom()->Get_Component(); - - pBroomTransform->Set_State(STATE::POSITION, spawnPos); - pBroomTransform->Set_State(STATE::LOOK, ringLook); + CTransform* pTransform = + racer.pRacer->Get_Component(); + spawnPos.m128_f32[1] -= 2.f; + pTransform->Set_State(STATE::POSITION,spawnPos); + pTransform->LookAt(pRingTransform->Get_State(STATE::POSITION)); + racer.pRacer->Get_Component()->Change_State(FSMSTATE::BROOM_RIDE); + racer.pRacer->Get_Broom()->Set_Move(false); } } } + if (m_eRaceState == ENUM_CLASS(RACE_STATE::READY)) + { + if (GUI::Button("Countdown")) + { + m_eRaceState = ENUM_CLASS(RACE_STATE::COUNTDOWN); + } + } } #endif // _DEBUG +void CBroomRaceManager::Update_Countdown(_float fTimeDelta) +{ + m_fCountTimer += fTimeDelta; + + if (m_fCountTimer >= 1.f) + { + m_fCountTimer = 0.f; + --m_iCount; + + if (m_iCount > 0) + { + ToolTip = to_wstring(m_iCount); + } + else + { + ToolTip = to_wstring(0); + StartRaceMove(); + } + } +} + +void CBroomRaceManager::StartRaceMove() +{ + for (auto& racer : m_Racers) + { + if (racer.pAI) + { + racer.pAI->Get_Broom()->Set_Move(true); + } + else if (racer.pRacer) + { + racer.pRacer->Get_Broom()->Set_Move(true); + } + } + + m_eRaceState = ENUM_CLASS(RACE_STATE::RACING); +} + + + void CBroomRaceManager::Check_RingPassed() { const float PASS_RADIUS = 5.f; diff --git a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp index 763bb1a77..d2f1f3c84 100644 --- a/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp +++ b/Jusin154_Team3D/Client/Private/BroomRacerAI.cpp @@ -86,8 +86,6 @@ HRESULT CBroomRacerAI::Initialize(void* pArg) m_Batch = make_unique>(m_pContext); #endif // _DEBUG - - m_pBroom->Set_Ride(true); m_pBroomRaceManager = static_cast(pArg); @@ -100,16 +98,32 @@ HRESULT CBroomRacerAI::Initialize(void* pArg) m_pBroomRaceManager->Push_BroomRacer(Info); + m_LaneOffsetX = m_pGameInstance->Real_Random_Float(-3.f, 3.f); + m_LaneOffsetY = m_pGameInstance->Real_Random_Float(-3.f, 3.f); + + m_TurnGain = m_pGameInstance->Real_Random_Float(0.85f, 1.15f); + m_HeightGain = m_pGameInstance->Real_Random_Float(0.85f, 1.15f); + + m_pBroom->Set_AISpeed( + m_pGameInstance->Real_Random_Float(0.8f, 1.2f), + m_pGameInstance->Real_Random_Float(0.8f, 1.2f) + ); + + return S_OK; } void CBroomRacerAI::Priority_Update(_float fTimeDelta) { __super::Priority_Update(fTimeDelta); + + } void CBroomRacerAI::Update(_float fTimeDelta) { + Set_Input(fTimeDelta); + m_pFSM->Update_State(fTimeDelta); m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom); @@ -124,7 +138,6 @@ void CBroomRacerAI::Update(_float fTimeDelta) void CBroomRacerAI::Late_Update(_float fTimeDelta) { - Set_Input(fTimeDelta); m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius())); @@ -247,17 +260,23 @@ HRESULT CBroomRacerAI::Ready_Components() return E_FAIL; } - _int iRand = m_pGameInstance->Real_Random_Int(0, 1); - if (iRand == 0) + _int iRand = m_pGameInstance->Real_Random_Int(0, 2); + + switch (iRand) { + case 0: m_strModelPrototypeTag = TEXT("Prototype_Component_VictorRookWood_Model"); - } - else { + break; + case 1: m_strModelPrototypeTag = TEXT("Prototype_Component_Npc_Model"); + break; + case 2: + m_strModelPrototypeTag = TEXT("Prototype_Component_Ghost_Peeves_Model"); + break; + default: + break; } - - /* Com_Model */ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag, reinterpret_cast(&m_pModelCom)))) { @@ -318,6 +337,10 @@ HRESULT CBroomRacerAI::Bind_ShaderResources() if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) { return E_FAIL; } + _float Intensity = 0.f; + if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) { + return E_FAIL; + } return S_OK; } @@ -379,11 +402,11 @@ HRESULT CBroomRacerAI::Bind_ShaderParameters(_uint iMeshOrder) _vector CBroomRacerAI::Get_RingForwardTarget() { _vector ringPos = m_pRaceRing->Get_WorldPostion(); - _vector ringFwd = m_pRaceRing->Get_Component() - ->Get_State(STATE::RIGHT); + _vector ringFwd = m_pRaceRing->Get_Component()->Get_State(STATE::RIGHT); ringFwd = XMVector3Normalize(ringFwd); _vector targetPos = ringPos + ringFwd; + targetPos = XMVectorSet(targetPos.m128_f32[0] + m_LaneOffsetX, targetPos.m128_f32[1] + m_LaneOffsetY, targetPos.m128_f32[2], 1.f); return targetPos; } @@ -395,14 +418,12 @@ _float CBroomRacerAI::ComputeTurnToRing() _vector toTarget = targetPos - m_pBroom->Get_WorldPostion(); toTarget = XMVector3Normalize(XMVectorSetY(toTarget, 0.f)); - _vector myLook = m_pBroom->Get_Component() - ->Get_State(STATE::LOOK); + _vector myLook = m_pBroom->Get_Component()->Get_State(STATE::LOOK); myLook = XMVector3Normalize(XMVectorSetY(myLook, 0.f)); _float turn = XMVectorGetY(XMVector3Cross(myLook, toTarget)); - _float dist = - XMVectorGetX(XMVector3Length(targetPos - m_pBroom->Get_WorldPostion())); + _float dist = XMVectorGetX(XMVector3Length(targetPos - m_pBroom->Get_WorldPostion())); _float atten = clamp(dist / 40.f, 0.f, 1.f); @@ -420,8 +441,7 @@ _float CBroomRacerAI::ComputeHeightAdjust() _float dy = XMVectorGetY(targetPos) - XMVectorGetY(broomPos); - _float dist = - XMVectorGetX(XMVector3Length(targetPos - broomPos)); + _float dist = XMVectorGetX(XMVector3Length(targetPos - broomPos)); _float atten = clamp(dist / 40.f, 0.f, 1.f); @@ -522,9 +542,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_HoverExitCheck(_float fTimeDelta) if (!m_pBroom->Get_Hover()) { m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE); + return E_FAIL; } - return E_FAIL; + return S_OK; } void CBroomRacerAI::Behavior_Broom_HoverExit() @@ -585,9 +606,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_FlyExitCheck(_float fTimeDelta) if (m_pBroom->Get_Hover()) { m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE); + return E_FAIL; } - return E_FAIL; + return S_OK; } void CBroomRacerAI::Behavior_Broom_FlyExit() @@ -614,9 +636,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta) if (m_pBroom->Get_Hover()) { m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE); + return E_FAIL; } - return E_FAIL; + return S_OK; } void CBroomRacerAI::Behavior_Broom_TurboFlyExit() @@ -749,13 +772,24 @@ void CBroomRacerAI::Set_Input(_float fTimeDelta) _float targetX = ComputeTurnToRing(); _float targetY = ComputeHeightAdjust(); - CBroom::BroomInput InputDesc; - InputDesc.Z = 1.f; - InputDesc.X = targetX; - InputDesc.Y = targetY; - InputDesc.bHoverToggle = false; + CBroom::BroomInput InputDesc{}; + + InputDesc.X = 0.f; + InputDesc.Y = 0.f; + InputDesc.Z = 0.f; + + /*if (m_bMove) + {*/ + InputDesc.Z = 1.f; + InputDesc.X = targetX*m_TurnGain; + InputDesc.Y = targetY*m_HeightGain; + //} + + InputDesc.bHoverToggle = (m_pBroomRaceManager->Get_RaceState() != ENUM_CLASS(CBroomRaceManager::RACE_STATE::RACING)); + InputDesc.bTurbo = false; m_pBroom->Set_Input(InputDesc); } + diff --git a/Jusin154_Team3D/Client/Private/Broom_States.cpp b/Jusin154_Team3D/Client/Private/Broom_States.cpp index 11cbd9da5..46e9196be 100644 --- a/Jusin154_Team3D/Client/Private/Broom_States.cpp +++ b/Jusin154_Team3D/Client/Private/Broom_States.cpp @@ -123,6 +123,9 @@ void CBroom::Behavior_MoveEnter() HRESULT CBroom::Behavior_MoveExitCheck(_float fTimeDelta) { + if (false == m_bMove) + return S_OK; + pair<_uint, _bool> pairAnimInfo = {}; _uint iCurrentAnimIndex = m_pModelCom->Get_AnimIndex(); @@ -183,6 +186,8 @@ void CBroom::Behavior_Broom_HoverEnter() HRESULT CBroom::Behavior_Broom_HoverExitCheck(_float fTimeDelta) { + if (false == m_bMove) + return S_OK; pair<_uint, _bool> pairAnimInfo = {}; _uint iCurrentAnimIndex = m_pModelCom->Get_AnimIndex(); _bool bFwd = m_Input.Z > 0.f; @@ -317,15 +322,6 @@ HRESULT CBroom::Behavior_Broom_HoverExitCheck(_float fTimeDelta) pairAnimInfo = m_Animation[STATEANIM::BROOM_HOVER_STOP_B]; } - if (bShift) - { - m_bHoverToggle = false; - } - if (bTurbo) - { - m_bTurbo = true; - } - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); } @@ -376,6 +372,7 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta) if (SUCCEEDED(InputAction()) || SUCCEEDED(InputMove())) { + if (bFwd) { m_fTargetSpeed = m_fFlyMaxSpeed; } @@ -387,7 +384,13 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta) m_fTargetSpeed = m_fFlyMaxSpeed; } - m_fSpeed += (m_fTargetSpeed - m_fSpeed) * fTimeDelta * m_fFlyAccel; + if (m_pParentUnit->IsAI()) + { + m_fTargetSpeed *= m_fAICondition; + m_fTargetSpeed *= m_fAISpeedMul; + } + + m_fSpeed += (m_fTargetSpeed - m_fSpeed) * fTimeDelta * m_fFlyAccel* m_fAIAccelMul; m_pTransformCom->Go_LerpStraight(m_fSpeed, fTimeDelta); _float fTargetVertSpeed = 0.f; @@ -495,15 +498,6 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta) } } - if (bShift) - { - m_bHoverToggle = true; - } - if (bTurbo) - { - m_bTurbo = true; - } - if (m_bHoverToggle) { m_fTargetSpeed = 0.f; @@ -515,17 +509,17 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta) pairAnimInfo = m_Animation[STATEANIM::BROOM_HOVER_STOP_B]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false); - if (bShift && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first) + /*if (bShift && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first) { m_bHoverToggle = false; - } + }*/ if (SUCCEEDED(InputAction()) || SUCCEEDED(InputMove())) { if (fRatio >= 0.5f && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first) { m_pFSM->Change_State(FSMSTATE::HOVER); + return E_FAIL; } - return E_FAIL; } if (m_pModelCom->IsFinishedAnim()) { @@ -573,19 +567,6 @@ HRESULT CBroom::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta) _bool bShift = m_Input.bHoverToggle; _bool bTurbo = m_Input.bTurbo; - if (bShift) - { - m_bHoverToggle = true; - } - - if (bTurbo) - { - m_bTurbo = true; - } - else { - m_bTurbo = false; - } - if (!m_bHoverToggle) { if (SUCCEEDED(InputMove())) @@ -649,20 +630,20 @@ HRESULT CBroom::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta) { if (vInput.z <= 0.f) { - Camera_InterpTurn(fTimeDelta * 0.3f); + Camera_InterpTurn(fTimeDelta * 0.35f); } else { - Camera_InterpTurn(fTimeDelta * 0.15f); + Camera_InterpTurn(fTimeDelta * 0.2f); } } else if (vInput.x > 0.f) { if (vInput.z <= 0.f) { - Camera_InterpTurn(fTimeDelta * 0.3f); + Camera_InterpTurn(fTimeDelta * 0.35f); } else { - Camera_InterpTurn(fTimeDelta * 0.15f); + Camera_InterpTurn(fTimeDelta * 0.2f); } } @@ -837,7 +818,7 @@ void CBroom::Add_FSM() Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(fTimedelta); }; Desc.funcExitEvent = [this]() { Behavior_MoveExit(); }; Desc.funcPriorityUpdate = [this](_float fTimeDelta) { - if (m_bHoverToggle) + if (m_bHoverToggle && m_bMove) { _float3 fMove = m_pGameInstance->Get_MouseMove(); m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x * 0.02f); diff --git a/Jusin154_Team3D/Client/Private/Dialogue.cpp b/Jusin154_Team3D/Client/Private/Dialogue.cpp index 0fa9025b3..aa0095f1a 100644 --- a/Jusin154_Team3D/Client/Private/Dialogue.cpp +++ b/Jusin154_Team3D/Client/Private/Dialogue.cpp @@ -279,7 +279,10 @@ void CDialogue::Free() SAFE_RELEASE(m_pShaderCom); SAFE_RELEASE(m_pVIBufferCom); } - +#ifdef _DEBUG void CDialogue::Describe_Entity() { } +#endif // DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp b/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp new file mode 100644 index 000000000..e32387fbb --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Dialogue_Data.cpp @@ -0,0 +1,102 @@ +#include "pch.h" +#include "Dialogue_Data.h" +#include "GameObject.h" +#include "tinyxml2.h" +#include "InfoInstance.h" + +CDialogue_Data::CDialogue_Data() + :m_pInfoInstance(CInfoInstance::GetInstance()) +{ +} + +HRESULT CDialogue_Data::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex) +{ + Load_SpellInfo("../Bin/Resources/Data/UI/Dialogue/Dialogue.xml"); + + return S_OK; +} + +void CDialogue_Data::Update(_float fTimeDelta) +{ +} + +HRESULT CDialogue_Data::Load_SpellInfo(const _char* pFilePath) +{ + tinyxml2::XMLDocument doc; + if (doc.LoadFile(pFilePath) != tinyxml2::XML_SUCCESS) + return E_FAIL; + + tinyxml2::XMLElement* pDialogueInfo = doc.FirstChildElement("DialogueInfo"); + if (!pDialogueInfo) return E_FAIL; + + tinyxml2::XMLElement* pDialogue = pDialogueInfo->FirstChildElement("Dialogue"); + while (pDialogue) + { + NpcDialogue npc{}; + pDialogue->QueryIntAttribute("NpcID", &npc.iNpcID); + + tinyxml2::XMLElement* pLine = pDialogue->FirstChildElement("Line"); + while (pLine) + { + DialogueInfo line{}; + pLine->QueryIntAttribute("ID", &line.iLineID); + + int type = 0; + pLine->QueryIntAttribute("Type", &type); + line.bType = (type == 1); + + const char* text = pLine->Attribute("Text"); + if (text) line.pText = CMyTools::ToWstring(text); + + pLine->QueryIntAttribute("NextText", &line.NextTextID); + + // 선택지 처리 + tinyxml2::XMLElement* pChoice = pLine->FirstChildElement("Choice"); + while (pChoice) + { + DialogueChoice choice{}; + int choiceType = 0; + pChoice->QueryIntAttribute("Type", &choiceType); + choice.eType = choiceType; + + const char* choiceText = pChoice->Attribute("Text"); + if (choiceText) choice.pText = CMyTools::ToWstring(choiceText); + + pChoice->QueryIntAttribute("NextText", &choice.NextTypeID); + + line.ChoiceInfo.push_back(choice); + pChoice = pChoice->NextSiblingElement("Choice"); + } + + npc.Info.push_back(line); + pLine = pLine->NextSiblingElement("Line"); + } + + m_DialogueInfo.push_back(npc); + pDialogue = pDialogue->NextSiblingElement("Dialogue"); + } + return S_OK; +} + +const NPCDIALOGUEINFO& CDialogue_Data::Get_Info(_uint DialogueID) const +{ + return m_DialogueInfo[DialogueID]; +} + +CDialogue_Data* CDialogue_Data::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CDialogue_Data* pInstance = new CDialogue_Data(); + + if (FAILED(pInstance->Initialize(pDevice, pContext))) + { + MSG_BOX("Failed to Created : CDialogue_Data"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CDialogue_Data::Free() +{ + __super::Free(); +} diff --git a/Jusin154_Team3D/Client/Private/EffectObject.cpp b/Jusin154_Team3D/Client/Private/EffectObject.cpp index 22b4c592b..fd1b7642f 100644 --- a/Jusin154_Team3D/Client/Private/EffectObject.cpp +++ b/Jusin154_Team3D/Client/Private/EffectObject.cpp @@ -100,7 +100,7 @@ HRESULT CEffectObject::Render_Blur() } } - if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::NONPOS) + if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::NONPOS || m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::DEFAULT_NONPOS) BlurPass = SHADER_PASS_INSTANCE_MODEL::NONPOS_BLUR; if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::WB_CULLING) @@ -1056,7 +1056,9 @@ HRESULT CEffectObject::Bind_ShaderResources() return E_FAIL; } - + if (FAILED(m_pShaderCom->Bind_RawValue("g_isNoDissolveSmoothStep", &m_EffectInfo.isNoDissolveSmoothStep, sizeof(_bool)))) { + return E_FAIL; + } if (m_pDiffuse_TextureCom != nullptr) diff --git a/Jusin154_Team3D/Client/Private/EffectPool.cpp b/Jusin154_Team3D/Client/Private/EffectPool.cpp index b354ace1f..00a072d6e 100644 --- a/Jusin154_Team3D/Client/Private/EffectPool.cpp +++ b/Jusin154_Team3D/Client/Private/EffectPool.cpp @@ -43,6 +43,8 @@ #include "Transformation.h" #include "Avadakedavra.h" #include "Ranrok_FireBall.h" +#include "Ranrok_Breath.h" + CEffectPool::CEffectPool(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CGameObject(pDevice, pContext) @@ -81,7 +83,7 @@ HRESULT CEffectPool::Initialize(void* pArg) #endif // #ifdef 진우 m_isActiveEffectCreate = true; - m_isActiveMonsterEffectCreate = false; + m_isActiveMonsterEffectCreate = true; #endif // #ifdef 기무리 m_isActiveEffectCreate = true; @@ -570,6 +572,18 @@ HRESULT CEffectPool::Ready_MonsterEffect() ))) return E_FAIL; + if (FAILED(Create_Effect(SKILL_TYPE::RANROK_BREATH, 5, g_iStaticLevel, g_iStaticLevel, [&](_uint iPrototypeLevel, _uint iCloneLevel) -> CEffect_Container* { + + CRanrok_Breath* pEffect = nullptr; + + pEffect = m_pGameInstance->Clone_Prototype(iPrototypeLevel, nullptr); + + return pEffect; } + + ))) return E_FAIL; + + + return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/Effect_Container.cpp b/Jusin154_Team3D/Client/Private/Effect_Container.cpp index 592b01ed1..adf490335 100644 --- a/Jusin154_Team3D/Client/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Client/Private/Effect_Container.cpp @@ -619,7 +619,6 @@ HRESULT CEffect_Container::Reset_EffectParts() return S_OK; } - _int CEffect_Container::CollisionCheck() { _bool bIsCollide = { false }; @@ -657,10 +656,10 @@ _int CEffect_Container::CollisionCheck() default: break; } - + //switch (pUserData->eKind) //{ - + //case PHYSX_KIND::BODY_STATIC: //case PHYSX_KIND::BODY_DYNAMIC: //{ @@ -678,7 +677,6 @@ _int CEffect_Container::CollisionCheck() return -1; } - ON_COLLISION_INFO CEffect_Container::SweepTarget(_vector StartPos, _vector EndPos, _float fRadius , _bool isTerrainCollision ) { _vector vStartPos = StartPos; @@ -904,6 +902,83 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto return tagCollInfo; } +ON_COLLISION_INFO CEffect_Container::MonsterRayCast(_vector StartPos, _vector _vDir, _float _fLength, _uint iMaxHitCapacity) +{ + _vector vStartPos = StartPos; + _vector vDir = _vDir; + + _float fLength = _fLength; + + vector Raycasts = {}; + Raycasts.resize(iMaxHitCapacity); + + _bool bHit = m_pGameInstance->RayCast(vStartPos, vDir, fLength, Raycasts.data(), iMaxHitCapacity, m_iHitCount); + + ON_COLLISION_INFO tagCollInfo = {}; + + for (_uint i = 0; i < iMaxHitCapacity; i++) + { + PSX::PxRigidActor* pActor = Raycasts[i].actor; + PSX::PxShape* pShape = Raycasts[i].shape; + + + tagCollInfo.vWorldPos.w = 1.f; + + if (bHit) { + + memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &Raycasts[i].position, sizeof(Raycasts[i].position)); + + memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &Raycasts[i].normal, sizeof(Raycasts[i].normal)); + XMStoreFloat4(&tagCollInfo.vHitDir, vDir); + tagCollInfo.fLength = fLength; + + if (nullptr != pActor && nullptr != pActor->userData) + { + PhsXUserData* pUserData = static_cast(pActor->userData); + tagCollInfo.pObject = pUserData->pOwner; + + switch (pUserData->eKind) + { + case PHYSX_KIND::CCTActor: + { + switch (PXOBJECT(pUserData->iSubKind)) + { + + case PXOBJECT::PLAYER: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + break; + case PXOBJECT::SKILL_PROTEGO: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + } + } + } + + + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::TERRAIN: + { + + m_bHit = true; + break; + } + } + } + + } + + return tagCollInfo; + } + + return tagCollInfo; +} + void CEffect_Container::Update_Event(_float fTimeDelta) { diff --git a/Jusin154_Team3D/Client/Private/InfoInstance.cpp b/Jusin154_Team3D/Client/Private/InfoInstance.cpp index 9ab778ef6..70e96f3aa 100644 --- a/Jusin154_Team3D/Client/Private/InfoInstance.cpp +++ b/Jusin154_Team3D/Client/Private/InfoInstance.cpp @@ -368,7 +368,7 @@ HRESULT CInfoInstance::Initialize_Information(ID3D11Device* pDevice, ID3D11Devic if (FAILED(Stat_FileLoad("../Bin/Resources/Data/Stat/Stat.xml"))) { return E_FAIL; } - if (FAILED(Stat_FileLoad("../Bin/Resources/Data/Stat/NpcStat.xml"))) { + if (FAILED(NPC_FileLoad("../Bin/Resources/Data/Stat/NpcStat.xml"))) { return E_FAIL; } #pragma endregion diff --git a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp index 35e597eb0..2cca88c8f 100644 --- a/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp +++ b/Jusin154_Team3D/Client/Private/Level_GamePlay.cpp @@ -604,7 +604,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag) HRESULT CLevel_GamePlay::Ready_Layer_BroomRacerAI(const _wstring& strLayerTag) { - for (_uint i = 0; i < 1; ++i) { + for (_uint i = 0; i < 10; ++i) { if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) { return E_FAIL; } @@ -670,11 +670,13 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster() return E_FAIL; } -#if 진우 -#else if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) { return E_FAIL; } + +#if 진우 +#else + #endif diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index c2a38d006..f96dae1a0 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -182,6 +182,7 @@ #include "Mage_Nomal_Attack.h" #include "MageSide.h" #include "Ranrok_FireBall.h" +#include "Ranrok_Breath.h" #include "StunEffect.h" #include "Box_Splesh.h" @@ -1529,7 +1530,7 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_INSTANCE_PROP_MODEL, + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_INSTANCE_PROP_MODEL, CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl"), VTX_MODEL_INSTANCE_MODEL::Elements, VTX_MODEL_INSTANCE_MODEL::iNumElements)))) { return E_FAIL; @@ -1764,11 +1765,6 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_VictorRookWood_Model"), - CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { - return E_FAIL; - } - if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ return E_FAIL; @@ -1792,6 +1788,16 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_VictorRookWood_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { + return E_FAIL; + } + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Ghost_Peeves_Model"), + CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Troll_Model"), CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){ return E_FAIL; @@ -1991,7 +1997,11 @@ HRESULT CLoader::Loading_For_GamePlay() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CRanrok_Breath::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } + if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin_Teleport::Create(m_pDevice, m_pContext)))) { return E_FAIL; diff --git a/Jusin154_Team3D/Client/Private/Loding_Panel.cpp b/Jusin154_Team3D/Client/Private/Loding_Panel.cpp index af019652a..38efcfd65 100644 --- a/Jusin154_Team3D/Client/Private/Loding_Panel.cpp +++ b/Jusin154_Team3D/Client/Private/Loding_Panel.cpp @@ -101,9 +101,9 @@ HRESULT CLoding_Panel::Render() if (FAILED(m_pVIBufferCom->Render())) { return E_FAIL; } - m_pGameInstance->Render_Text(TEXT("Font_size20"), TEXT("<- N M ->."), _float2(100.f, 750.f)); + m_pGameInstance->Render_Text(TEXT("Font_size20"), TEXT("<- N M ->."), _float2(50.f, 850.f)); - m_pGameInstance->Render_Text(TEXT("Font_size20"), ToolTip[m_iToolTip_Count].c_str(), _float2(100.f, 800.f)); + m_pGameInstance->Render_Text(TEXT("Font_size20"), ToolTip[m_iToolTip_Count].c_str(), _float2(50.f, 900.f)); return S_OK; } diff --git a/Jusin154_Team3D/Client/Private/NPCInteraction.cpp b/Jusin154_Team3D/Client/Private/NPCInteraction.cpp index 7bd2bdf57..020a65e67 100644 --- a/Jusin154_Team3D/Client/Private/NPCInteraction.cpp +++ b/Jusin154_Team3D/Client/Private/NPCInteraction.cpp @@ -82,11 +82,6 @@ void CNPCInteraction::NpcInfo(_wstring Name) m_NpcName = Name; } -void CNPCInteraction::Interaction(_bool bInteraction) -{ - m_bInteraction = bInteraction; -} - void CNPCInteraction::Priority_Update(_float fTimeDelta) { @@ -169,15 +164,12 @@ HRESULT CNPCInteraction::Render() m_NpcName.c_str(), m_vFontPosition); - if (m_bInteraction == true) - { - m_pGameInstance->Perspective_Render_Text( - m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), - m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), - TEXT("Font_size15"), - TEXT("대화하기"), - m_vPosition); - } + m_pGameInstance->Perspective_Render_Text( + m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), + m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), + TEXT("Font_size15"), + TEXT("대화하기"), + m_vPosition); return S_OK; @@ -243,10 +235,6 @@ HRESULT CNPCInteraction::Bind_ShaderResources() { return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_RawValue("g_iHover", &m_bInteraction, sizeof(_bool)))) - { - return E_FAIL; - } return S_OK; } @@ -310,7 +298,10 @@ void CNPCInteraction::Free() SAFE_RELEASE(m_pShaderCom); SAFE_RELEASE(m_pVIBufferCom); } - +#ifdef _DEBUG void CNPCInteraction::Describe_Entity() { } +#endif // DEBUG + + diff --git a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp index 57f672cc2..91c8304cd 100644 --- a/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp +++ b/Jusin154_Team3D/Client/Private/NPC_Ollivander.cpp @@ -33,20 +33,6 @@ void CNPC_Ollivander::Update(_float fTimeDelta) #ifdef _DEBUG Describe_Entity(); #endif // _DEBUG - - if (false == m_bHasInteracted) - { - if (true == InteractWithPlayer()) { - m_vEnteringTimer.x += fTimeDelta; - if (m_vEnteringTimer.x > m_vEnteringTimer.y) { - m_vEnteringTimer.x -= m_vEnteringTimer.y; - m_bHasInteracted = true; - // Active(); - } - } - } - - if (false == m_bEntered) { if (true == CastToPlayer()) { @@ -54,7 +40,6 @@ void CNPC_Ollivander::Update(_float fTimeDelta) if (m_vEnteringTimer.x > m_vEnteringTimer.y) { m_vEnteringTimer.x -= m_vEnteringTimer.y; m_bEntered = true; - m_bHasInteracted = false; // Active(); } #ifdef _DEBUG @@ -73,7 +58,6 @@ void CNPC_Ollivander::Update(_float fTimeDelta) if (m_vEnteringTimer.x > m_vEnteringTimer.y) { m_vEnteringTimer.x -= m_vEnteringTimer.y; m_bEntered = false; - m_bHasInteracted = false; // DeActive(), Ready To Enter; } #ifdef _DEBUG @@ -116,9 +100,8 @@ void CNPC_Ollivander::Update(_float fTimeDelta) } m_pNPCInteraction->Set_Visible(m_bEntered); - m_pNPCInteraction->Interaction(m_bHasInteracted); - if (m_bHasInteracted == true) + if (m_bEntered == true) { if (m_pGameInstance->Key_Down(DIK_F)) { @@ -253,19 +236,6 @@ _bool CNPC_Ollivander::CastToPlayer() return false; } -_bool CNPC_Ollivander::InteractWithPlayer() -{ - _vector vCurrentPos = m_pTransformCom->Get_State(STATE::POSITION); - _vector vTargetPos = {}; - pair pairAllyInfo = m_pInfoInstance->Get_NearestPlayerAlly(m_pTransformCom->Get_State(STATE::POSITION)); - vTargetPos = pairAllyInfo.second->Get_State(STATE::POSITION); - _float fLength = XMVectorGetX(XMVector4Length(vTargetPos - vCurrentPos)); - if (fLength < m_fInteractionDistance) { - return true; - } - return false; -} - HRESULT CNPC_Ollivander::Initialize_Prototype() { return S_OK; @@ -337,15 +307,15 @@ HRESULT CNPC_Ollivander::Ready_Components(void* pArg) m_pCharacter_Controller->SetGravity(true); } - if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("OLLIVENDER"), (CComponent**)&m_pStat))) { + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("OLLIVENDER"), (CComponent**)&m_pNpcStat))) { return E_FAIL; } - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, nullptr, this, &m_pNPCInteraction))) { + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, &m_pNPCInteraction))) { return E_FAIL; } - m_pNPCInteraction->NpcInfo(m_pStat->Get_Stat().pNpc_Name); + m_pNPCInteraction->NpcInfo(m_pNpcStat->Get_Stat().pNpc_Name); return S_OK; } @@ -379,7 +349,7 @@ void CNPC_Ollivander::Free() __super::Free(); SAFE_RELEASE(m_pCharacter_Controller); - SAFE_RELEASE(m_pStat); + SAFE_RELEASE(m_pNpcStat); if (nullptr != m_pInfoInstance) { CInfoInstance* pInfo = m_pInfoInstance; m_pInfoInstance = nullptr; diff --git a/Jusin154_Team3D/Client/Private/Player_States.cpp b/Jusin154_Team3D/Client/Private/Player_States.cpp index fc5f6455a..e2bc1b266 100644 --- a/Jusin154_Team3D/Client/Private/Player_States.cpp +++ b/Jusin154_Team3D/Client/Private/Player_States.cpp @@ -2706,7 +2706,7 @@ void CPlayer::Add_SpellEvent(_uint AnimIndex,_float fRatio) Add_Event(AnimIndex, [this]() {m_pEffectPool->Use_Skill(SKILL_TYPE::TRANSFORMATION_SIDE, Get_PartObject()); }, 0.f); - Info.pText = TEXT("봄바르다"); + Info.pText = TEXT("베라베르토!"); m_pInfoInstance->Event_CallBack(TEXT("Dialogue"), &Info); break; @@ -3124,7 +3124,7 @@ void CPlayer::Add_FSM() _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); if (!m_bOnce) { m_pBroomTransform->Set_WorldMatrix(m_pTransformCom->Get_XMWorldMatrix()); - m_pBroomTransform->Set_State(STATE::POSITION, m_pBroomTransform->Get_State(STATE::POSITION) + XMVectorSet(0.f,2.f,0.f,0.f)); + m_pBroomTransform->Set_State(STATE::POSITION, m_pTransformCom->Get_State(STATE::POSITION) + XMVectorSet(0.f,2.f,0.f,0.f)); _float3 vScale = { 0.3f,0.3f,0.3f }; m_pBroomTransform->Set_Scale(vScale); m_bOnce = true; diff --git a/Jusin154_Team3D/Client/Private/RaceRing.cpp b/Jusin154_Team3D/Client/Private/RaceRing.cpp index fded95273..9617d7c93 100644 --- a/Jusin154_Team3D/Client/Private/RaceRing.cpp +++ b/Jusin154_Team3D/Client/Private/RaceRing.cpp @@ -29,11 +29,12 @@ HRESULT CRaceRing::Initialize(void* pArg) if (FAILED(Ready_Components())) { return E_FAIL; } + m_pBroomRaceManager = static_cast(pArg)->pBroomRaceManager; m_iIndex = static_cast(pArg)->iIndex; _float X = m_pGameInstance->Real_Random_Float(-200.f, 200.f); - _float Y = m_pGameInstance->Real_Random_Float(15.f, 45.f); - _float Z = m_pGameInstance->Real_Random_Float(-15.f, 15.f); + _float Y = m_pGameInstance->Real_Random_Float(15.f, 60.f); + _float Z = m_pGameInstance->Real_Random_Float(-50.f, 50.f); m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet((_float)m_iIndex *100.f, Y, Z, 1.f)); diff --git a/Jusin154_Team3D/Client/Private/Ranrok_Breath.cpp b/Jusin154_Team3D/Client/Private/Ranrok_Breath.cpp new file mode 100644 index 000000000..2022c4da7 --- /dev/null +++ b/Jusin154_Team3D/Client/Private/Ranrok_Breath.cpp @@ -0,0 +1,308 @@ +#include "pch.h" +#include "Ranrok_Breath.h" + +#include "GameInstance.h" +#include "EffectParts.h" +#include "Wand.h" +#include "Player.h" +#include "InfoInstance.h" + +CRanrok_Breath::CRanrok_Breath(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CEffect_Container{ pDevice, pContext } +{ +} + +CRanrok_Breath::CRanrok_Breath(const CRanrok_Breath& rhs) + : CEffect_Container(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ + SAFE_ADDREF(m_pInfoInstance); +} + +HRESULT CRanrok_Breath::Initialize_Prototype() +{ + + + if (FAILED(Load_Package("../Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokBreath"))) + return E_FAIL; + return S_OK; + +} + +HRESULT CRanrok_Breath::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + if (FAILED(Create_Effect())) + return E_FAIL; + + m_wstrEffectName = L"RanrokBreath"; + + + m_pBreath = Get_PartObject("Breath"); + m_pBreath_Black = Get_PartObject("Breath_Black"); + m_pBreathSlog = Get_PartObject("BreathSlog"); + m_pMouthFire = Get_PartObject("MouthFire"); + + SAFE_ADDREF(m_pBreath); + SAFE_ADDREF(m_pBreath_Black); + SAFE_ADDREF(m_pBreathSlog); + SAFE_ADDREF(m_pMouthFire); + + m_fDuration = 5.f; + + + m_Events.emplace(0.5f, [&]() { + m_isStartRayCast = true; + }); + + + m_Events.emplace(3.f, [&]() { + + // 파티클 제어 + m_isParticleEnd = true; + + CEffectParts* pRock_PT = Get_PartObject("Rock_PT"); + CEffectParts* pBottomFire = Get_PartObject("BottomFire"); + CEffectParts* pSplatterBottom0 = Get_PartObject("SplatterBottom0"); + + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + + pRock_PT->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + pBottomFire->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + pSplatterBottom0->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + + m_pBreath->Get_Component()->Set_Loop(false); + m_pBreath->Get_Effect_Info()->isDissolve = true; + + m_pBreath_Black->Get_Component()->Set_Loop(false); + m_pBreath_Black->Get_Effect_Info()->isDissolve = true; + + m_pBreathSlog->Set_Visible(false); + + }); + return S_OK; +} + +void CRanrok_Breath::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); + + +} + +void CRanrok_Breath::Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + __super::Update(fTimeDelta); + + Update_Event(fTimeDelta); + + _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("tongue_01")); + + for (int i = 0; i < 3; ++i) { + BoneMat.r[i] = XMVector3Normalize(BoneMat.r[i]); + } + + _matrix WorldMat = m_pOwner->Get_Component()->Get_XMWorldMatrix() ; + + _matrix CombinedMat = BoneMat * WorldMat; + + + + m_pBreath->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreath_Black->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreathSlog->Get_Component()->Set_WorldMatrix(CombinedMat); + + if(m_isParticleEnd == false) + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + + + _vector vStartPos = CombinedMat.r[3]; + + XMStoreFloat4(&m_vStartPos, vStartPos); + + if(m_isStartRayCast == true) + { + ON_COLLISION_INFO CollisionInfo = MonsterRayCast(XMLoadFloat4(&m_vStartPos), CombinedMat.r[2] * -1.f, 50.f, 50); + if (m_bHit = true) + OnCollision(this, &CollisionInfo); + + } + + + +} + +void CRanrok_Breath::Late_Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + __super::Late_Update(fTimeDelta); + + +} + +HRESULT CRanrok_Breath::Pre_Setting(CGameObject* pObject, void* pArg) +{ + if (FAILED(__super::Pre_Setting(pObject, nullptr))) + return E_FAIL; + + + /* 초기 객체 비지블*/ + + CEffectParts* pBlurMesh = Get_PartObject("BlurMesh"); + + m_pBreath->Set_Visible(true); + m_pBreath_Black->Set_Visible(true); + m_pBreathSlog->Set_Visible(true); + m_pMouthFire->Set_Visible(true); + pBlurMesh->Set_Visible(true); + + /* 초기 객체 위치 초기화*/ + + _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("tongue_01")); + + for (int i = 0; i < 3; ++i) { + BoneMat.r[i] = XMVector3Normalize(BoneMat.r[i]); + } + + _matrix WorldMat = m_pOwner->Get_Component()->Get_XMWorldMatrix() ; + + _matrix CombinedMat = BoneMat * WorldMat; + + + + m_pBreath->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreath_Black->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreathSlog->Get_Component()->Set_WorldMatrix(CombinedMat); + + _vector vStartPos = CombinedMat.r[3]; + + XMStoreFloat4(&m_vStartPos, vStartPos); + + + + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + pBlurMesh->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + + /* 브레스 디졸브를 위해 초기값 설정*/ + m_pBreath->Get_Component()->Set_Loop(true); + m_pBreath->Get_Effect_Info()->isDissolve = false; + + m_pBreath_Black->Get_Component()->Set_Loop(true); + m_pBreath_Black->Get_Effect_Info()->isDissolve = false; + + m_isParticleEnd = false; + m_isStartRayCast = false; + return S_OK; +} + +HRESULT CRanrok_Breath::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CRanrok_Breath::Ready_Child() +{ + return S_OK; +} + +CRanrok_Breath* CRanrok_Breath::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CRanrok_Breath* pInstance = new CRanrok_Breath(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CRanrok_Breath"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + + +CGameObject* CRanrok_Breath::Clone(void* pArg, CGameObject* pOwner) +{ + CRanrok_Breath* pInstance = new CRanrok_Breath(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CRanrok_Breath"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CRanrok_Breath::OnCollision(CGameObject* pOther, void* pDesc) +{ + if (m_bHit == false) + return; + + ON_COLLISION_INFO CollisionDesc = *static_cast(pDesc); + + _vector vPos = XMLoadFloat4(&CollisionDesc.vWorldPos); + + if (XMVectorGetX(XMVector4Length(vPos)) <= 0.f) /* 000 일때 들어오지마 */ + return; + + _vector vPrePos = XMLoadFloat4(&m_vPreCollisionPos); + _vector vDir = XMVector3Normalize(vPos - vPrePos); + + if (m_isParticleEnd == true) + return; + + CEffectParts* pRock_PT = Get_PartObject("Rock_PT"); + CEffectParts* pBottomFire = Get_PartObject("BottomFire"); + CEffectParts* pSplatterBottom0 = Get_PartObject("SplatterBottom0"); + + pRock_PT->Set_Visible(true); + pRock_PT->Get_Component()->Set_State(STATE::POSITION, vPos); + + pBottomFire->Set_Visible(true); + pBottomFire->Get_Component()->Set_State(STATE::POSITION, vPos); + + pSplatterBottom0->Set_Visible(true); + pSplatterBottom0->Get_Component()->Set_State(STATE::POSITION, vPos + vDir * 3.f); + + XMStoreFloat4(&m_vPreCollisionPos, vPos); +} + +void CRanrok_Breath::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pInfoInstance); + + SAFE_RELEASE(m_pBreath); + SAFE_RELEASE(m_pBreath_Black); + SAFE_RELEASE(m_pBreathSlog); + SAFE_RELEASE(m_pMouthFire); + + //SAFE_RELEASE(m_pFireBall_Tail); +} +#ifdef _DEBUG +void CRanrok_Breath::Describe_Entity() +{ + +} +#endif + +HRESULT CRanrok_Breath::Bind_ShaderResources() +{ + return S_OK; +} + + diff --git a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp index 313eb4932..00cf5893a 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_FireBall.cpp @@ -21,6 +21,7 @@ CRanrok_FireBall::CRanrok_FireBall(const CRanrok_FireBall& rhs) HRESULT CRanrok_FireBall::Initialize_Prototype() { + if (FAILED(Load_Package("../Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokFireBall"))) return E_FAIL; @@ -46,14 +47,13 @@ HRESULT CRanrok_FireBall::Initialize(void* pArg) m_pFireBall = Get_PartObject("FireBall"); m_pFireBall_PT = Get_PartObject("FireBall_PT"); m_pFireBall_Surface = Get_PartObject("FireBall_Surface"); - m_pFireBall_Tail = Get_PartObject("FireBall_Tail"); + SAFE_ADDREF(m_pFireBall); SAFE_ADDREF(m_pFireBall_PT); SAFE_ADDREF(m_pFireBall_Surface); - SAFE_ADDREF(m_pFireBall_Tail); - m_fDuration = 3.2f; + m_fDuration = 4.f; return S_OK; @@ -79,16 +79,16 @@ void CRanrok_FireBall::Update(_float fTimeDelta) m_pFireBall->Get_Component()->Translation(XMLoadFloat3(&m_vLook) * m_fLinearSpeed); m_pFireBall_PT->Get_Component()->Translation(XMLoadFloat3(&m_vLook) * m_fLinearSpeed); m_pFireBall_Surface->Get_Component()->Translation(XMLoadFloat3(&m_vLook) * m_fLinearSpeed); - m_pFireBall_Tail->Get_Component()->Translation(XMLoadFloat3(&m_vLook) * m_fLinearSpeed); + //m_pFireBall_Tail->Get_Component()->Translation(XMLoadFloat3(&m_vLook) * m_fLinearSpeed); if (false == m_bHit) { _vector vStartPos = XMLoadFloat4(&m_vStartPos); _vector vEndPos = m_pFireBall->Get_WorldPostion(); - ON_COLLISION_INFO CollisionInfo = MonsterSweepTarget(vStartPos, vEndPos, 0.2f , true); + ON_COLLISION_INFO CollisionInfo = MonsterSweepTarget(vStartPos, vEndPos, 0.2f, true); OnCollision(this, &CollisionInfo); } - + } void CRanrok_FireBall::Late_Update(_float fTimeDelta) @@ -106,15 +106,20 @@ HRESULT CRanrok_FireBall::Pre_Setting(CGameObject* pObject, void* pArg) if (FAILED(__super::Pre_Setting(pObject, nullptr))) return E_FAIL; + CEffectParts* pBlack_Smoke = Get_PartObject("Black_Smoke"); + CEffectParts* pFireBall_Ring = Get_PartObject("FireBall_Ring"); /* 초기 객체 비지블*/ m_pFireBall->Set_Visible(true); m_pFireBall_PT->Set_Visible(true); m_pFireBall_Surface->Set_Visible(true); + pBlack_Smoke->Set_Visible(true); + pFireBall_Ring->Set_Visible(true); + /* 초기 객체 위치 초기화*/ - _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("tongue_01_end")); + _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("jaw")); for (int i = 0; i < 3; ++i) { BoneMat.r[i] = XMVector3Normalize(BoneMat.r[i]); @@ -126,23 +131,34 @@ HRESULT CRanrok_FireBall::Pre_Setting(CGameObject* pObject, void* pArg) _vector vStartPos = CombinedMat.r[3]; - XMStoreFloat4(&m_vStartPos, vStartPos); + XMStoreFloat4(&m_vStartPos, vStartPos); - m_pFireBall->Get_Component()->Set_State(STATE::POSITION, vStartPos); - m_pFireBall_PT->Get_Component()->Set_State(STATE::POSITION, vStartPos); - m_pFireBall_Surface->Get_Component()->Set_State(STATE::POSITION, vStartPos); - - - /* 플레이어 위치 받기 */ + /* 플레이어 위치 받기 */ CUnit* pPlayer = m_pInfoInstance->Get_NearestPlayerAlly(m_pOwner->Get_WorldPostion()).first; - if (pPlayer == nullptr) - return E_FAIL; + if (pPlayer == nullptr) + return E_FAIL; - /* 초기 방향 */ - XMStoreFloat4(&m_vTargetPos, pPlayer->Get_Component()->Get_Position()); - XMStoreFloat3(&m_vLook, XMVector3Normalize(XMLoadFloat4(&m_vTargetPos) - XMLoadFloat4(&m_vStartPos))); + /* 초기 방향 */ + XMStoreFloat4(&m_vTargetPos, pPlayer->Get_Component()->Get_Position()); + XMStoreFloat3(&m_vLook, XMVector3Normalize(XMLoadFloat4(&m_vTargetPos) - XMLoadFloat4(&m_vStartPos))); + m_pFireBall_PT->Get_Component()->Set_State(STATE::POSITION, vStartPos); + //m_pFireBall_Tail->Get_Component()->Set_State(STATE::POSITION, vStartPos - XMLoadFloat3(&m_vLook) * 5.f); + pBlack_Smoke->Get_Component()->Set_State(STATE::POSITION, vStartPos); + pFireBall_Ring->Get_Component()->Set_State(STATE::POSITION, vStartPos); + /* PJ 월드 구성하기 */ + + + _vector vLook = XMVector3Normalize(XMLoadFloat3(&m_vLook)); + _vector vRight = XMVector3Normalize(XMVector3Cross(XMVectorSet(0.f, 1.f, 0.f, 0.f), vLook)); + _vector vUp = XMVector3Normalize(XMVector3Cross(vLook, vRight)); + _vector vPos = vStartPos; + + _matrix PJ_WorldMat = { vRight , vUp ,vLook , vPos }; + + m_pFireBall->Get_Component()->Set_WorldMatrix(PJ_WorldMat); + m_pFireBall_Surface->Get_Component()->Set_WorldMatrix(PJ_WorldMat); return S_OK; } @@ -208,9 +224,14 @@ void CRanrok_FireBall::OnCollision(CGameObject* pOther, void* pDesc) m_pFireBall->Set_Visible(false); m_pFireBall_Surface->Set_Visible(false); - m_pFireBall_Tail->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + //m_pFireBall_Tail->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); m_pFireBall_PT->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + + CEffectParts* pBlack_Smoke = Get_PartObject("Black_Smoke"); + + pBlack_Smoke->Set_Visible(false); + CPlayer* pPlayer = static_cast(m_pInfoInstance->Get_NearestPlayerAlly(m_pOwner->Get_WorldPostion()).first); @@ -230,7 +251,7 @@ void CRanrok_FireBall::Free() SAFE_RELEASE(m_pFireBall); SAFE_RELEASE(m_pFireBall_PT); SAFE_RELEASE(m_pFireBall_Surface); - SAFE_RELEASE(m_pFireBall_Tail); + //SAFE_RELEASE(m_pFireBall_Tail); } #ifdef _DEBUG void CRanrok_FireBall::Describe_Entity() diff --git a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp index cb4028dd8..36eb4c179 100644 --- a/Jusin154_Team3D/Client/Private/Ranrok_States.cpp +++ b/Jusin154_Team3D/Client/Private/Ranrok_States.cpp @@ -4,7 +4,6 @@ #include "GameInstance.h" #include "Player.h" #include "Effect_Container.h" -#include "EffectParts.h" #include "EffectPool.h" #pragma region STATE @@ -39,7 +38,7 @@ void CRanrok::Behavior_IdleEnter() HRESULT CRanrok::Behavior_IdleExitCheck() { - if (m_fTargetDistance <= 35.f && m_fTargetDistance !=0.f) + if (m_fTargetDistance <= 100.f && m_fTargetDistance != 0.f) { m_pFSM->Change_State(FSMSTATE::COMBAT); return E_FAIL; @@ -87,7 +86,7 @@ HRESULT CRanrok::Behavior_MoveExitCheck(_float fTimeDelta) pair<_uint, _bool> pairAnimInfo = {}; _uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); - if (m_fTargetDistance <= 35.f && m_fTargetDistance != 0.f) + if (m_fTargetDistance <= 100.f && m_fTargetDistance != 0.f) { m_pFSM->Change_State(FSMSTATE::COMBAT); return E_FAIL; @@ -117,33 +116,33 @@ HRESULT CRanrok::Behavior_CombatExitCheck(_float fTimeDelta) } - if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] <= 0.f) + if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] <= 0.f) { m_pFSM->Change_State(FSMSTATE::FIREBREATH); return E_FAIL; } - else if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)] <= 0.f) + else if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)] <= 0.f) { m_pFSM->Change_State(FSMSTATE::FIREBALL); return E_FAIL; } - else if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] <= 0.f) + else if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] <= 0.f) { m_pFSM->Change_State(FSMSTATE::FIRESWEEP); return E_FAIL; } - else if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::RUSH)] <= 0.f && m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) + else if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::RUSH)] <= 0.f && m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { m_pFSM->Change_State(FSMSTATE::RUSH); return E_FAIL; } - else if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::SWIPE)] <= 0.f && m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) + else if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::SWIPE)] <= 0.f && m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { m_pFSM->Change_State(FSMSTATE::SWIPE); return E_FAIL; } - else if (m_fTargetDistance <= 35.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)] <= 0.f) + else if (m_fTargetDistance <= 100.f && m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)] <= 0.f) { m_pFSM->Change_State(FSMSTATE::PULSE); return E_FAIL; @@ -154,7 +153,7 @@ HRESULT CRanrok::Behavior_CombatExitCheck(_float fTimeDelta) return E_FAIL; } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { - if (m_pFSM->IsEnable_Previous(FSMSTATE::TUCKED| FSMSTATE::PULSE)) + if (m_pFSM->IsEnable_Previous(FSMSTATE::TUCKED | FSMSTATE::PULSE)) { m_pFSM->Change_State(FSMSTATE::LAND); } @@ -184,7 +183,7 @@ void CRanrok::Behavior_GroundEnter() HRESULT CRanrok::Behavior_GroundExitCheck(_float fTimeDelta) { - if (m_fTargetDistance <= 35.f && m_fTargetDistance != 0.f) + if (m_fTargetDistance <= 100.f && m_fTargetDistance != 0.f) { m_pFSM->Change_State(FSMSTATE::COMBAT); return E_FAIL; @@ -292,13 +291,18 @@ void CRanrok::Behavior_FireBreathEnter() Add_Event(pairAnimInfo.first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)];}, + m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)]; + m_pModelCom->Play_HeadBone(true); }, 0.95f); Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);}, + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, 0.95f); + Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.1f); } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { @@ -312,9 +316,25 @@ HRESULT CRanrok::Behavior_FireBreathExitCheck(_float fTimeDelta) { pair<_uint, _bool> pairAnimInfo = {}; _int iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + if (m_pModelCom->Get_PlayHeadBone()) + { + m_fHeadAimWeight += fTimeDelta; + if (m_fHeadAimWeight >= 1.f) + { + m_fHeadAimWeight = 1.f; + } + m_pModelCom->Set_HeadAimWeight(m_fHeadAimWeight); + } + + if (iCurrAnimIndex == m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A].first) + { + m_fHeadAimWeight -= fTimeDelta*2.f; + m_pModelCom->Set_HeadAimWeight(m_fHeadAimWeight); + } if (m_pModelCom->IsFinishedAnim()) { + m_pModelCom->Play_HeadBone(false); if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_AIR)) { m_pFSM->Change_State(FSMSTATE::IDLEBREAK); @@ -332,6 +352,7 @@ HRESULT CRanrok::Behavior_FireBreathExitCheck(_float fTimeDelta) void CRanrok::Behavior_FireBreathExit() { m_pFSM->Disable_State(FSMSTATE::FIREBREATH); + m_fHeadAimWeight = 0.f; } void CRanrok::Behavior_FireSweepEnter() @@ -345,18 +366,32 @@ void CRanrok::Behavior_FireSweepEnter() Add_Event(pairAnimInfo.first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; }, + m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; + m_pModelCom->Play_HeadBone(true); }, 0.95f); Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_COOLDOWN_A]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, - 0.95f); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_bLookAt = true; + }, + 0.94f); + + + Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.08f); } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_G]; m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; + + Add_Event(m_Animation[STATEANIM::FIRESWEEP_G].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.2f); } m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } @@ -366,8 +401,25 @@ HRESULT CRanrok::Behavior_FireSweepExitCheck(_float fTimeDelta) pair<_uint, _bool> pairAnimInfo = {}; _int iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); + if (m_pModelCom->Get_PlayHeadBone()) + { + m_fHeadAimWeight += fTimeDelta; + if (m_fHeadAimWeight >= 1.f) + { + m_fHeadAimWeight = 1.f; + } + m_pModelCom->Set_HeadAimWeight(m_fHeadAimWeight); + } + + if (iCurrAnimIndex == m_Animation[STATEANIM::FIRESWEEP_COOLDOWN_A].first) + { + m_fHeadAimWeight -= fTimeDelta * 2.f; + m_pModelCom->Set_HeadAimWeight(m_fHeadAimWeight); + } + if (m_pModelCom->IsFinishedAnim()) { + m_pModelCom->Play_HeadBone(false); if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_AIR)) { m_pFSM->Change_State(FSMSTATE::IDLEBREAK); @@ -385,6 +437,7 @@ HRESULT CRanrok::Behavior_FireSweepExitCheck(_float fTimeDelta) void CRanrok::Behavior_FireSweepExit() { m_pFSM->Disable_State(FSMSTATE::FIRESWEEP); + m_fHeadAimWeight = 0.f; } void CRanrok::Behavior_FireBallEnter() @@ -399,17 +452,24 @@ void CRanrok::Behavior_FireBallEnter() { case 0: pairAnimInfo = m_Animation[STATEANIM::FIREBALL1_A]; + + Add_Event(pairAnimInfo.first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); + }, 0.38f); + break; case 1: pairAnimInfo = m_Animation[STATEANIM::FIREBALL2_A]; + + Add_Event(pairAnimInfo.first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); + }, 0.5f); + break; } - /*Add_Event(pairAnimInfo.first, - [this]() { - m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); - }, 0.1f);*/ - } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { @@ -419,11 +479,25 @@ void CRanrok::Behavior_FireBallEnter() { case 0: pairAnimInfo = m_Animation[STATEANIM::FIREBALL1_G]; + + Add_Event(pairAnimInfo.first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); + }, 0.4f); + break; case 1: pairAnimInfo = m_Animation[STATEANIM::FIREBALL2_G]; + + Add_Event(pairAnimInfo.first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_FIREBALL, this); + }, 0.45f); break; } + + + } m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBALL)]; @@ -442,7 +516,7 @@ HRESULT CRanrok::Behavior_FireBallExitCheck(_float fTimeDelta) m_pFSM->Change_State(FSMSTATE::COMBAT); return E_FAIL; } - else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)){ + else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { m_pFSM->Change_State(FSMSTATE::GROUND); return E_FAIL; } @@ -462,13 +536,13 @@ void CRanrok::Behavior_SwipeEnter() m_pFSM->Enable_State(FSMSTATE::SWIPE); if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { - if (m_fCross > 0) - { - pairAnimInfo = m_Animation[STATEANIM::GROUND_SWIPE_L]; - } + /*if (m_fCross > 0) + {*/ + pairAnimInfo = m_Animation[STATEANIM::GROUND_SWIPE_L]; + /*} else { pairAnimInfo = m_Animation[STATEANIM::GROUND_SWIPE_R]; - } + }*/ m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } @@ -536,8 +610,8 @@ HRESULT CRanrok::Behavior_RushExitCheck(_float fTimeDelta) m_fRushTime += fTimeDelta; if (m_fRushTime >= 2.5f && iCurrAnimIndex == m_Animation[STATEANIM::RUSH_LOOP].first) { - m_pFSM->Change_State(FSMSTATE::SWIPE); - return E_FAIL; + m_pFSM->Change_State(FSMSTATE::SWIPE); + return E_FAIL; } else if (iCurrAnimIndex == m_Animation[STATEANIM::RUSH_LOOP].first) @@ -576,9 +650,9 @@ void CRanrok::Behavior_PulseEnter() m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::PULSE)]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - Add_Event(pairAnimInfo.first, + /*Add_Event(pairAnimInfo.first, [this]() { CameraShake(10.f, 2.f, 5.f, 1.2f); }, - 0.39f); + 0.39f);*/ } HRESULT CRanrok::Behavior_PulseExitCheck(_float fTimeDelta) @@ -587,7 +661,7 @@ HRESULT CRanrok::Behavior_PulseExitCheck(_float fTimeDelta) _int iCurrAnimIndex = m_pModelCom->Get_AnimIndex(); _float fRatio = m_pModelCom->Get_CurrentTrackProgressRatio(); - if (fRatio>=0.95f) + if (fRatio >= 0.95f) { m_pFSM->Change_State(FSMSTATE::COMBAT); return E_FAIL; @@ -605,8 +679,7 @@ void CRanrok::Behavior_TuckedEnter() { pair<_uint, _bool> pairAnimInfo = {}; m_pFSM->Enable_State(FSMSTATE::TUCKED); - m_pCharacter_Controller->SetGravity(true); - + //if (m_iCurrentFlow == 0) //{ // pairAnimInfo = m_Animation[STATEANIM::FLY]; @@ -625,7 +698,7 @@ HRESULT CRanrok::Behavior_TuckedExitCheck(_float fTimeDelta) MoveTo(fTimeDelta); - if (m_bTucked && iCurrAnimIndex !=m_Animation[STATEANIM::FLY_TO_HOVER].first) + if (m_bTucked && iCurrAnimIndex != m_Animation[STATEANIM::FLY_TO_HOVER].first) { m_iCurrentFlow++; pairAnimInfo = m_Animation[STATEANIM::FLY_TO_HOVER]; @@ -657,9 +730,9 @@ void CRanrok::Behavior_LandEnter() pairAnimInfo = m_Animation[STATEANIM::LAND]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - Add_Event(pairAnimInfo.first, + /*Add_Event(pairAnimInfo.first, [this]() { CameraShake(30.f, 5.f, 10.f, 1.2f); }, - 0.53f); + 0.53f);*/ } HRESULT CRanrok::Behavior_LandExitCheck(_float fTimeDelta) @@ -1024,7 +1097,7 @@ void CRanrok::Set_Anim() m_Animation[STATEANIM::HIT_BWD3] = { 35,false }; // Ground Large m_Animation[STATEANIM::HIT_BWD4] = { 36,false }; // Ground Small - m_Animation[STATEANIM::DEAD] = { 34,false }; + m_Animation[STATEANIM::DEAD] = { 34,false }; m_Animation[STATEANIM::FLY] = { 18,true }; diff --git a/Jusin154_Team3D/Client/Public/Broom.h b/Jusin154_Team3D/Client/Public/Broom.h index 89fe2f206..60fa310ca 100644 --- a/Jusin154_Team3D/Client/Public/Broom.h +++ b/Jusin154_Team3D/Client/Public/Broom.h @@ -35,6 +35,8 @@ class CBroom final : public CUnit _bool Get_Turbo() { return m_bTurbo; } void Set_Input(BroomInput broomInput) { m_Input = broomInput; } + void Set_AISpeed(_float speedMul, _float accelMul); + void Set_Move(_bool bMove) { m_bMove = bMove; } HRESULT Ready_Child(); private: CInfoInstance* m_pInfoInstance = { nullptr }; @@ -60,13 +62,23 @@ class CBroom final : public CUnit _float m_fTurnDecel = 0.3f; _float m_fVerticalSpeed = 0.f; - _float m_fFlyAccel = 1.f; _float m_fFlyDecel = 1.f; _float m_fTurboAccel = 1.3f; _float m_fTurboDecel = 0.6f; + _bool m_bMove = { true }; + +#pragma region AI + _float m_fAISpeedMul = 1.f; + _float m_fAIAccelMul = 1.f; + + _float m_fAICondition = 1.f; + _float m_fAISeed = 0.f; + _float m_fAITime = 0.f; + +#pragma endregion _float3 m_vCameraLookDir = { 0.f, 0.f, 1.f, }; @@ -76,7 +88,6 @@ class CBroom final : public CUnit class CEffectParts* m_pWindEffect = { nullptr }; _float m_fCameraOffset = { 10.f }; - _bool m_bHit = { false }; private: HRESULT Ready_Components(); HRESULT Bind_ShaderResources(); diff --git a/Jusin154_Team3D/Client/Public/BroomRaceManager.h b/Jusin154_Team3D/Client/Public/BroomRaceManager.h index b4113498b..d93a98846 100644 --- a/Jusin154_Team3D/Client/Public/BroomRaceManager.h +++ b/Jusin154_Team3D/Client/Public/BroomRaceManager.h @@ -16,6 +16,17 @@ class CBroomRaceManager final : public CGameObject _vector prevPos = XMVectorZero(); }; + enum class RACE_STATE + { + READY, + COUNTDOWN, + START, + RACING, + FINISH, + END + }; + + private: CBroomRaceManager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CBroomRaceManager(const CBroomRaceManager& Prototype); @@ -25,19 +36,25 @@ class CBroomRaceManager final : public CGameObject virtual void Priority_Update(_float fTimeDelta) override; virtual void Update(_float fTimeDelta) override; virtual void Late_Update(_float fTimeDelta) override; + virtual HRESULT Render() override; void SetTargetRing(CGameObject* pRacer); void Push_BroomRacer(RacerInfo Info); void Push_RaceRing(class CRaceRing* Ring); + _int Get_RaceState() const { return m_eRaceState; } private: vector m_pRaceRings = {}; vector m_Racers = {}; - - + _float m_fCountTimer = {}; + _int m_iCount = { 3 }; + _int m_eRaceState = { ENUM_CLASS(RACE_STATE::END) }; + _wstring ToolTip; private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; HRESULT Ready_Components(); HRESULT Bind_ShaderResources() override; + void Update_Countdown(_float fTimeDelta); + void StartRaceMove(); void Check_RingPassed(); public: diff --git a/Jusin154_Team3D/Client/Public/BroomRacerAI.h b/Jusin154_Team3D/Client/Public/BroomRacerAI.h index c865dda87..e6e4097ad 100644 --- a/Jusin154_Team3D/Client/Public/BroomRacerAI.h +++ b/Jusin154_Team3D/Client/Public/BroomRacerAI.h @@ -41,6 +41,7 @@ class CBroomRacerAI final : public CUnit virtual void OnHit(CGameObject* pOther, CGameObject* pCaller = nullptr)override; void Set_RaceRing(class CRaceRing* pRaceRing) {m_pRaceRing = pRaceRing;} class CBroom* Get_Broom() { return m_pBroom; } + void Set_Move(_bool bMove) { m_bMove = bMove; } private: CLight* m_pLightCom = { nullptr }; LIGHT_DESC LightDesc = {}; @@ -99,6 +100,11 @@ class CBroomRacerAI final : public CUnit _float m_fScaleSmoothSpeed = 2.5f; _float m_fAnimTime = {}; _bool m_bTurbo = {}; + _bool m_bMove = {}; + _float m_LaneOffsetX = 0.f; + _float m_LaneOffsetY = 0.f; + _float m_TurnGain = 1.f; + _float m_HeightGain =1.f; void Behavior_Broom_Ride_MoveEnter(); HRESULT Behavior_Broom_Ride_MoveExitCheck(_float fTimeDelta); diff --git a/Jusin154_Team3D/Client/Public/Client_Enum.h b/Jusin154_Team3D/Client/Public/Client_Enum.h index 8f26c2cde..4c825a93d 100644 --- a/Jusin154_Team3D/Client/Public/Client_Enum.h +++ b/Jusin154_Team3D/Client/Public/Client_Enum.h @@ -11,7 +11,7 @@ namespace Client enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, ENV_TERRAIN_ANISO, SHADOW, END }; enum class SHADER_PASS_PARTICLE { EXPLOSION, END }; enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, TRAIL_BLEND, TRAILWB_FOR_BLEND, TRAIL_BLUR, TRAIL_BLOOM, END }; - enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, DEPTH_STOP, WB_CULLING, SCREEN_FX, DISTORTION, NONPOS, NONPOS_BLUR , BLUR_MESH, BLUR_CULLING, BLUR_CULLING_NO_EMISSIVE, BLOOM_CULLING, END}; + enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, DEPTH_STOP, WB_CULLING, SCREEN_FX, DISTORTION, NONPOS, NONPOS_BLUR , BLUR_MESH, BLUR_CULLING, BLUR_CULLING_NO_EMISSIVE, BLOOM_CULLING, DEFAULT_NONPOS, END}; enum class SHADER_PASS_UIEDITOR { DEFAULT, COLOR, LOGO, LOGO_TEXT, LOGO_GLOW, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTTYPE, UVMULT, NINECLICE, @@ -70,7 +70,7 @@ namespace Client /*란록*/ - RANROK_FIREBALL, + RANROK_FIREBALL, RANROK_BREATH, END }; diff --git a/Jusin154_Team3D/Client/Public/Client_Struct.h b/Jusin154_Team3D/Client/Public/Client_Struct.h index f9237447a..7a17c270d 100644 --- a/Jusin154_Team3D/Client/Public/Client_Struct.h +++ b/Jusin154_Team3D/Client/Public/Client_Struct.h @@ -37,6 +37,28 @@ namespace Client _float fVidio{}; }SPELL_INFO; + typedef struct DialogueChoice + { + _int eType = {false}; + _wstring pText; + _int NextTypeID{}; + }DIALOGUECHOICEINFO; + + typedef struct DialogueInfo + { + _int iLineID{}; + _bool bType = {false}; + _wstring pText; + _int NextTextID{}; + vector ChoiceInfo; + }CURRENTDIALOGUEINFO; + + typedef struct NpcDialogue + { + _int iNpcID{}; + vector Info; + }NPCDIALOGUEINFO; + typedef struct tagLockOnInfo { CUnit* pUnit = { nullptr }; class CMapElement_Interactable* pInteractive = { nullptr }; @@ -235,7 +257,7 @@ namespace Client _bool isBlurDissolve = {}; _bool isNomalMap = {}; - _bool isPadding2 = {}; + _bool isNoDissolveSmoothStep = {}; _bool isPadding3 = {}; _float4 vPadding5 = {}; diff --git a/Jusin154_Team3D/Client/Public/Dialogue.h b/Jusin154_Team3D/Client/Public/Dialogue.h index 38c2f69ed..d11cb0bcb 100644 --- a/Jusin154_Team3D/Client/Public/Dialogue.h +++ b/Jusin154_Team3D/Client/Public/Dialogue.h @@ -59,7 +59,9 @@ class CDialogue final : public CElementObject static CDialogue* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; +#ifdef _DEBUG void Describe_Entity() override; +#endif // _DEBUG }; NS_END diff --git a/Jusin154_Team3D/Client/Public/Dialogue_Data.h b/Jusin154_Team3D/Client/Public/Dialogue_Data.h new file mode 100644 index 000000000..a9abb91a3 --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Dialogue_Data.h @@ -0,0 +1,45 @@ +#pragma once + +#include "Client_Define.h" +#include "Base.h" + +NS_BEGIN(Engine) +class CGameInstance; +class CUIObject; +NS_END + +NS_BEGIN(Client) + +class CDialogue_Data final : public CBase +{ +public: + +private: + CDialogue_Data(); + ~CDialogue_Data() = default; + +public: + void Update(_float fTimeDelta); + +public: + HRESULT Load_SpellInfo(const _char* pFilePath); + +public: + const NPCDIALOGUEINFO& Get_Info(_uint DialogueID) const; + +private: + CInfoInstance* m_pInfoInstance = { nullptr }; + + _int m_iDialogue_Count{}; + vector m_DialogueInfo; + +private: + HRESULT Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex); + + +public: + static CDialogue_Data* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual void Free() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Client/Public/Effect_Container.h b/Jusin154_Team3D/Client/Public/Effect_Container.h index 261256e24..ef543c9ff 100644 --- a/Jusin154_Team3D/Client/Public/Effect_Container.h +++ b/Jusin154_Team3D/Client/Public/Effect_Container.h @@ -78,6 +78,7 @@ class CEffect_Container abstract : public CContainerObject _int CollisionCheck(); ON_COLLISION_INFO SweepTarget(_vector StartPos, _vector EndPos, _float fRadius, _bool isTerrainCollision = false); ON_COLLISION_INFO MonsterSweepTarget(_vector StartPos, _vector EndPos, _float fRadius, _bool isTerrainCollision = false); + ON_COLLISION_INFO MonsterRayCast(_vector StartPos, _vector vDir, _float fLength, _uint iMaxHitCapacity); protected: _float4 m_vStartPos = {}; @@ -94,6 +95,7 @@ class CEffect_Container abstract : public CContainerObject _float m_fDelay = {}; _bool m_isDelayed = { false }; _bool m_isCollisionEnter = { false }; + _uint m_iHitCount = {}; map<_float, function> m_Events = {}; _uint m_iSkillType = ENUM_CLASS(SKILL_TYPE::END); diff --git a/Jusin154_Team3D/Client/Public/NPCInteraction.h b/Jusin154_Team3D/Client/Public/NPCInteraction.h index db8fefb55..6a2955456 100644 --- a/Jusin154_Team3D/Client/Public/NPCInteraction.h +++ b/Jusin154_Team3D/Client/Public/NPCInteraction.h @@ -32,7 +32,6 @@ class CNPCInteraction final : public CGameObject public: void NpcInfo(_wstring Name); - void Interaction(_bool bInteraction); private: CTexture* m_pDiffuse_TextureCom = { nullptr }; @@ -41,8 +40,6 @@ class CNPCInteraction final : public CGameObject CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; - _bool m_bInteraction = {false}; - _vector m_vFontPosition{}; _vector m_vFontPosition1{}; @@ -66,7 +63,11 @@ class CNPCInteraction final : public CGameObject static CNPCInteraction* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; virtual void Free() override; +#ifdef _DEBUG void Describe_Entity() override; +#endif // DEBUG + + }; NS_END diff --git a/Jusin154_Team3D/Client/Public/NPC_Ollivander.h b/Jusin154_Team3D/Client/Public/NPC_Ollivander.h index 7b98e877a..f78ef2a6a 100644 --- a/Jusin154_Team3D/Client/Public/NPC_Ollivander.h +++ b/Jusin154_Team3D/Client/Public/NPC_Ollivander.h @@ -32,21 +32,18 @@ class CNPC_Ollivander final : public CUnit CUnit* m_pPlayerAllyUnit = { nullptr }; CNPC_Ollivander* m_pNPC_Ollivander = { nullptr }; - class CNPCInteraction* m_pNPCInteraction = { nullptr }; + class CNPCInteraction* m_pNPCInteraction = { nullptr }; - CNPCStat* m_pStat = { nullptr }; - _bool m_bEntered = { false }; - _bool m_bHasInteracted = { false }; - _float2 m_vEnteringTimer = { 0.f, 1.f }; - _float m_fEncounterDistance = { 10.f }; - _float m_fInteractionDistance = { 3.f }; + CNPCStat* m_pNpcStat = { nullptr }; + _bool m_bEntered = { false }; + _float2 m_vEnteringTimer = { 0.f, 1.f }; + _float m_fEncounterDistance = { 3.f }; protected: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; HRESULT Ready_Components(void* pArg); HRESULT Bind_ShaderResources() override; _bool CastToPlayer(); - _bool InteractWithPlayer(); public: static CNPC_Ollivander* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Client/Public/Ranrok.h b/Jusin154_Team3D/Client/Public/Ranrok.h index 0c09bb118..1ce067a01 100644 --- a/Jusin154_Team3D/Client/Public/Ranrok.h +++ b/Jusin154_Team3D/Client/Public/Ranrok.h @@ -112,6 +112,7 @@ class CRanrok final : public CMonster _float m_fAroundRadius = 40.f; _float m_fAroundTime = {}; _float m_fRushTime = {}; + _float m_fHeadAimWeight = {}; void Behavior_IdleEnter(); diff --git a/Jusin154_Team3D/Client/Public/Ranrok_Breath.h b/Jusin154_Team3D/Client/Public/Ranrok_Breath.h new file mode 100644 index 000000000..0f36e0daa --- /dev/null +++ b/Jusin154_Team3D/Client/Public/Ranrok_Breath.h @@ -0,0 +1,63 @@ +#pragma once + +#include "Client_Define.h" +#include "Effect_Container.h" + +NS_BEGIN(Engine) +NS_END + +NS_BEGIN(Client) + +class CRanrok_Breath final : public CEffect_Container +{ +private: + CRanrok_Breath(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CRanrok_Breath(const CRanrok_Breath& rhs); + virtual ~CRanrok_Breath() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + +public: + virtual HRESULT Pre_Setting(CGameObject* pObject, void* pArg = nullptr) override; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Ready_Child(); + HRESULT Bind_ShaderResources() override; + virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr) override; +private: + _wstring m_wstrEffectName = {}; + + class CEffectParts* m_pBreath = { nullptr }; + class CEffectParts* m_pBreath_Black = { nullptr }; + class CEffectParts* m_pBreathSlog = { nullptr }; + class CEffectParts* m_pMouthFire = { nullptr }; + + _float3 m_vLook = {}; + _float m_fLinearSpeed = 0.8f; + + _float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; + _float4 m_vPreCollisionPos = {}; + _float4 m_vTargetPos = { 0.f, 0.f, 10.f, 1.f }; + + _bool m_isParticleEnd = {}; + _bool m_isStartRayCast = {}; +private: + class CInfoInstance* m_pInfoInstance = { nullptr }; +public: + static CRanrok_Breath* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual void Free() override; + CGameObject* Clone(void* pArg, CGameObject* pOwner) override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // DEBUG + + +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml index 90814474e..d49d0319b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Dialogue/Dialogue.xml @@ -1,6 +1,11 @@ - - - - - - + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokBreath.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokBreath.bin new file mode 100644 index 000000000..969dd22c1 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokBreath.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:689aba78dedc0a31d77676d8498b666885b1ccf8848e97a07c0c24f4c8b865ae +size 577 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/RanrokFireBall.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/RanrokFireBall.bin deleted file mode 100644 index ea828365d..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MonsterPackage/RanrokFireBall.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fee4d7cee8de5dbf3d10f48f79b4baac04aaaea16c1f564be81993b345bd59ad -size 608 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BlurMesh.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BlurMesh.bin new file mode 100644 index 000000000..ec269f07c --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BlurMesh.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e458f561b69c5157c688b2f416872cb393c78dc4791d267eda37759b755b5b7b +size 1038 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BottomFire.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BottomFire.bin new file mode 100644 index 000000000..7be447225 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BottomFire.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82aea24600f34897eb0a253d865e345bc6d3a4738ce257e7ce8dbf27262df86b +size 1083 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath.bin index 305afb326..82bd7a315 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:797ae2a0449254d0a20c0f44d00dd5338bee979ab2605889add9023961c392ec +oid sha256:4aec22635c4c3534141810ad650cf7647c34eb127d585eeead519b646d0c10bd size 1087 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BreathSlog.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BreathSlog.bin new file mode 100644 index 000000000..6e3f0d30d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/BreathSlog.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:110c5b86656c242c26b9b07f3bc4d2b3308b27621bf1b983581d69301f796f0d +size 1085 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath_Black.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath_Black.bin new file mode 100644 index 000000000..cd9fb2076 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Breath_Black.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fd1fb444559795f21e6a3237b7828a0451be68b22ab976bd8c60fb19fd93374e +size 1073 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/MouthFire.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/MouthFire.bin new file mode 100644 index 000000000..dc8b85cb8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/MouthFire.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ce40554cacbecb31c81657d1d5f2c2e77f1c1c2d3c03f44444598ac80b71fc82 +size 1074 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Rock_PT.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Rock_PT.bin new file mode 100644 index 000000000..823d704a8 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/Rock_PT.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e265053a3bca6057227f0f9c28cb1bf4650f0ff70eab5371f6eab0bc310c1b24 +size 1066 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/SplatterBottom0.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/SplatterBottom0.bin new file mode 100644 index 000000000..46228fd43 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokBreath/SplatterBottom0.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6c88d141245be0050de3b55f35a9fb0755bc13ecdca5bb22a0b5897c3081dc25 +size 1088 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokFireBall/Black_Smoke.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokFireBall/Black_Smoke.bin index d3a39ccc9..487698e46 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokFireBall/Black_Smoke.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/RanrokFireBall/Black_Smoke.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6e8bb46e911f9de6427e47cceb990919608a0c731071b3b723afa96ca839e2c0 +oid sha256:4dafa174f05596126fd1d236c4c1655eff779b63a303f3a771005c884d0530d3 size 1077 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/Splatter1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/Splatter1.bin new file mode 100644 index 000000000..39242d7f3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/Splatter1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a258564d6ced7c563880da76d4674bed6408a274782eac790faecba3aa575937 +size 1081 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/SplatterBottom0.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/SplatterBottom0.bin new file mode 100644 index 000000000..026781fb9 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ranrok/SplatterBottom0.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf659187a0d8d627c867b59dc4b81873a9102a9b140a4bcfe87e6011e0c62909 +size 1088 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin index c76d77da6..028f209ca 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:99a40bb54a9bb42e6ef3ab6eaeee3e365caf51d21936f12395d4bf812ff7a45d -size 1026 +oid sha256:bdb2956e17b565f1634c1932ef1cc1d02e178a205a206ab099c406c3e72b93c4 +size 1039 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml index c1a89d003..194e17680 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Stat/NpcStat.xml @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/BaseFlattenNormalMap.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/BaseFlattenNormalMap.png new file mode 100644 index 000000000..d8e1fd944 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/BaseFlattenNormalMap.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin new file mode 100644 index 000000000..bed108392 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:89714a23c6f418c533029f0af1bd2e38a20e57bce367c5546047a3c8496d35f8 +size 19993985 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.fbx new file mode 100644 index 000000000..fc1fa14a0 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.fbx @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97a26ad1e1082ebd3c53bf35f781e6329966a7ef6a6f3999ea5512b671c054b6 +size 64858588 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.xml b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.xml new file mode 100644 index 000000000..fdefae55a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.xml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Adult_M_Arms_Ivory_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Adult_M_Arms_Ivory_N.dds new file mode 100644 index 000000000..ce4f7d3de Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Adult_M_Arms_Ivory_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_DefaultGrey_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_DefaultGrey_D.png new file mode 100644 index 000000000..b414d5691 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_DefaultGrey_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Sclera_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Sclera_D.png new file mode 100644 index 000000000..6e082532d Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Sclera_D.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Wetness_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Wetness_N.dds new file mode 100644 index 000000000..3eacfd4ac Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Eye_Wetness_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_D.dds new file mode 100644 index 000000000..e02bb269b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_MRO.dds new file mode 100644 index 000000000..76b40694b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Arms_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_D.dds new file mode 100644 index 000000000..017c27d4d Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_D.dds new file mode 100644 index 000000000..8c8437a67 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_MRO.dds new file mode 100644 index 000000000..826cbfa03 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_N.dds new file mode 100644 index 000000000..6888b23e1 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_Hair_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_MRO.dds new file mode 100644 index 000000000..1d8ef0982 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_N.dds new file mode 100644 index 000000000..7f19879aa Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Ghost_Peeves_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_Decay5_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_Decay5_D.dds new file mode 100644 index 000000000..5c0f6cae3 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_Decay5_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_N.dds new file mode 100644 index 000000000..4d226e763 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_HUM_Head_Teeth_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_D.dds new file mode 100644 index 000000000..26ce9b846 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_MRO.dds new file mode 100644 index 000000000..8d72c7b14 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_N.dds new file mode 100644 index 000000000..4a7e8f998 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Old_M_Head_Peeves_N.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_D.dds new file mode 100644 index 000000000..9cefbede6 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_D.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_E.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_E.dds new file mode 100644 index 000000000..6886922fb Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_E.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_MRO.dds new file mode 100644 index 000000000..8dd44d423 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Ghost_Peeves/T_Poltergeist_Eye_MRO.dds differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0d14ceee3..0a4ed6bb2 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -94,6 +94,9 @@ float g_fFogPow; float g_fFogHeightValue; bool g_bFogVisible; vector g_vFogColor; +float g_fDepthPackExponent; + +Texture3D g_VolumeTexture; float g_fWeights_32[32] = { @@ -1142,6 +1145,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord); vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + float3 vVolumeUV = float3(In.vTexcoord.xy, pow(vDepthDesc.y, g_fDepthPackExponent)); + if (0.f == g_fFogPow) { if (1 == vDepthDesc.y) @@ -1151,9 +1156,10 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) return Out; } + float4 vVolumeValue = g_VolumeTexture.Sample(DefaultSampler, vVolumeUV); float fViewZ = vDepthDesc.y * g_fFar; - float4 vPosition, vPreShadowPosition; + float4 vPosition; vPosition.x = In.vTexcoord.x * 2.f - 1.f; vPosition.y = In.vTexcoord.y * -2.f + 1.f; vPosition.z = vDepthDesc.x; @@ -1174,14 +1180,19 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - vFinalColor = lerp(vColor, g_vFogColor, fRatio); - vFinalColor.a = 1.f; + vVolumeValue.r = vVolumeValue.r < 1.413f ? pow(abs(vVolumeValue.r * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.r); + vVolumeValue.g = vVolumeValue.g < 1.413f ? pow(abs(vVolumeValue.g * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.g); + vVolumeValue.b = vVolumeValue.b < 1.413f ? pow(abs(vVolumeValue.b * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.b); + vVolumeValue.a = saturate(1.f - vVolumeValue.a); + vFinalColor = float4(lerp(vColor.rgb, vVolumeValue.rgb, vVolumeValue.a), 1.f); if (1.f == vDepthDesc.y) { - vFinalColor = float4(g_vFogColor); + vFinalColor = float4(vVolumeValue.rgb, 1.f); } - Out.vFirstTarget = vFinalColor; + + + Out.vFirstTarget = vVolumeValue; return Out; } @@ -1302,7 +1313,7 @@ technique11 DefaultTechnique pass DebugPass // 0 { SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default, 0); + SetDepthStencilState(DSS_None, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); GeometryShader = NULL; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index 602d99a61..d81caa548 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -168,6 +168,37 @@ void DecomposeAffine_RowMajor(row_major float4x4 M, out float3 S, out float4 R, R = QuatNormalize(q); } +row_major float4x4 ApplyHeadAim(uint bone, row_major float4x4 M) +{ + if (PlayHeadBone != 1) + return M; + if (bone != HeadBoneIndex) + return M; + if (HeadAimWeight <= 0.f) + return M; + + float3 curFwd = normalize(float3(M._31, M._32, M._33)); + float3 target = normalize(TargetDir_Local); + + float d = dot(curFwd, target); + + float3 axis = cross(curFwd, target); + float axisLen = length(axis); + if (axisLen <= EPS) + return M; + + axis /= axisLen; + + float angle = acos(saturate(d)); + angle *= saturate(HeadAimWeight); + + float4 qAim = float4(axis * sin(angle * 0.5f), cos(angle * 0.5f)); + qAim = QuatNormalize(qAim); + + row_major float4x4 AimM = MakeAffine(float3(1, 1, 1), qAim, float3(0, 0, 0)); + return mul(AimM, M); +} + uint FindKeyIndexCur(uint start, uint count, float t) { @@ -279,100 +310,48 @@ void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out flo row_major float4x4 SampleBlendedLocal(uint bone) { - if (PrevAnimIndex == -1) + float3 S; + float4 R; + float3 T; + + if (PrevAnimIndex == -1 || CurrentAnimIndex == PrevAnimIndex) { - float3 S; - float4 R; - float3 T; SampleLocalTRS_Cur(bone, CurrentTime, S, R, T); if (bone == RootBoneIndex) { T = 0; R = RootInitRot; } - return MakeAffine(S, R, T); - } - if (CurrentAnimIndex == PrevAnimIndex) - { - float3 S; - float4 R; - float3 T; - SampleLocalTRS_Cur(bone, CurrentTime, S, R, T); - - if (bone == RootBoneIndex) - { - T = 0; - R = RootInitRot; - } - return MakeAffine(S, R, T); + row_major float4x4 M = MakeAffine(S, R, T); + return ApplyHeadAim(bone, M); } float br = saturate(BlendRatio); float3 sA, sB, tA, tB; float4 rA, rB; - - float prevT = PrevTime; - if (BlendRatio < 1e-4f) - { - prevT = CurrentTime; - } + float prevT = (BlendRatio < 1e-4f) ? CurrentTime : PrevTime; SampleLocalTRS_Prev(bone, prevT, sA, rA, tA); SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB); - float3 S = lerp(sA, sB, br); - float3 T = lerp(tA, tB, br); - float4 R = QuatSlerp(rA, rB, br); + S = lerp(sA, sB, br); + T = lerp(tA, tB, br); + R = QuatSlerp(rA, rB, br); if (bone == RootBoneIndex) { T = 0; R = RootInitRot; } - - float4x4 M = MakeAffine(S, R, T); - - if (PlayHeadBone == 1) - { - if (bone == HeadBoneIndex && HeadAimWeight > 0.f) - { - float3 curFwd = normalize(float3(M._31, M._32, M._33)); - float3 target = normalize(TargetDir_Local); - float3 axis = cross(curFwd, target); - float axisLen = length(axis); - - if (axisLen > EPS) - { - axis /= axisLen; - - float angle = acos(saturate(dot(curFwd, target))); - angle *= HeadAimWeight; - - float4 qAim = float4(axis * sin(angle * 0.5f), cos(angle * 0.5f)); - qAim = QuatNormalize(qAim); - - row_major float4x4 AimM = - MakeAffine(float3(1, 1, 1), qAim, float3(0, 0, 0)); - - M = mul(AimM, M); - } - } - } - - - - return M; - - - - - //return MakeAffine(S, R, T); + row_major float4x4 M = MakeAffine(S, R, T); + return ApplyHeadAim(bone, M); } + [numthreads(256, 1, 1)] void CS_LOCAL(uint3 DTid : SV_DispatchThreadID) { diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 49412e2fe..737b5e082 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -27,6 +27,8 @@ float g_fOutLinePower; float g_fUsingSurfaceParams; float g_fEtherealRatio; float g_fMixerFactor; +float g_fMBIntensity = 1.f; + Texture2D g_DiffuseTexture : register(t00); @@ -326,7 +328,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE_READ(PS_IN In) (In.vProjPos.w / g_fFar), // 酉??ㅽ럹?댁뒪 Z (float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, // ?쒗럹?댁뒪 ?뚮씪誘명꽣 1.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -367,7 +369,7 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -395,7 +397,7 @@ PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSRXO_MASK.r, vSRXO_MASK.g, vSRXO_MASK.a, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -422,7 +424,7 @@ PS_OUT PS_EYE_DN_SRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(0.5f, 0.5f, 1.f, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -472,7 +474,7 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -514,7 +516,7 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -541,7 +543,7 @@ PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSRXO_Mask.r, vSRXO_Mask.g, vSRXO_Mask.a, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -569,7 +571,7 @@ PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSRO_Mask.r, vSRO_Mask.g, vSRO_Mask.b, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -597,7 +599,7 @@ PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // MRO return Out; } @@ -625,7 +627,7 @@ PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -654,7 +656,7 @@ PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -683,7 +685,7 @@ PS_OUT PS_DNMRO_ToMRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -712,7 +714,7 @@ PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSpecular_Mask.r, 0.5f, 1.f, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -747,7 +749,7 @@ PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSRO_Mask.r, Roughness, Occlusion, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -783,7 +785,7 @@ PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO_MASK.r, Roughness, Occlusion, vSRXO_Mask.b); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -826,7 +828,7 @@ PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.1f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } PS_OUT PS_Player_Eye_ToMRO(PS_IN In) @@ -851,7 +853,7 @@ PS_OUT PS_Player_Eye_ToMRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMROColor.r, vMROColor.g, vMROColor.b, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } PS_OUT PS_Player_Robe_ToMRO(PS_IN In) @@ -878,7 +880,7 @@ PS_OUT PS_Player_Robe_ToMRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMROColor.r, vMROColor.g, vMROColor.b, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In) @@ -903,7 +905,7 @@ PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vSROColor.r, vSROColor.g, vSROColor.b, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) @@ -947,7 +949,7 @@ PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f); // SRO - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -1017,7 +1019,7 @@ PS_OUT PS_Dragon_Body(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } @@ -1050,7 +1052,7 @@ PS_OUT PS_Dragon_Wings(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(vMRO, 0.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); // SRO return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index ce14fe11d..4bf4d03e7 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -1892,13 +1892,13 @@ PS_OUT PS_SpellLearnBooster(PS_IN In) float4 tex3 = g_Texture3.Sample(DefaultSampler, In.vTexcoord); Color = lerp(Color, tex3, tex3.a); - } + } else if (g_iBoosterOn == 0 && g_iBoosterOff != 0) { float4 tex2 = g_Texture2.Sample(DefaultSampler, In.vTexcoord); tex2.rgb *= float3(1.f, 0.f, 0.f); - Color = tex; + Color = tex; Color = lerp(Color, tex2, tex2.a); } @@ -2259,23 +2259,21 @@ PS_OUT PS_Interaction_Npc(PS_IN In) float4 tex1 = g_Texture.Sample(ClampSampler, Finaluv); Color = tex1; - - if (g_iHover != 0) - { - float2 texpos1 = g_fImageSipos1.xy / g_fCurrent_Size; - float2 texsize1 = g_fImageSipos1.zw / g_fCurrent_Size; - float2 texlocal1 = (In.vTexcoord - texpos1) / texsize1; - bool inside1 = all(texlocal1 >= 0.0f && texlocal1 <= 1.0f); - if (inside1) - { - float2 startUV = g_fImageUV.xy; - float2 endUV = g_fImageUV.zw; - float2 atlasUV = atlasUV = startUV + texlocal1 * (endUV - startUV); - float4 tex2 = g_Texture1.Sample(DefaultSampler, atlasUV); - Color = lerp(Color, tex2, tex2.a); - } + float2 texpos1 = g_fImageSipos1.xy / g_fCurrent_Size; + float2 texsize1 = g_fImageSipos1.zw / g_fCurrent_Size; + float2 texlocal1 = (In.vTexcoord - texpos1) / texsize1; + bool inside1 = all(texlocal1 >= 0.0f && texlocal1 <= 1.0f); + if (inside1) + { + float2 startUV = g_fImageUV.xy; + float2 endUV = g_fImageUV.zw; + float2 atlasUV = atlasUV = startUV + texlocal1 * (endUV - startUV); + float4 tex2 = g_Texture1.Sample(DefaultSampler, atlasUV); + Color = lerp(Color, tex2, tex2.a); + } + Color.a *= Alpha; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl new file mode 100644 index 000000000..aa5694dfa --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl @@ -0,0 +1,88 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float DensityScale = 0.01f; + +Texture3D g_VolumeSRV : register(t0); + +RWTexture3D g_AccVolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float ConvertNdcZToDepth(float ndcZ); +float SliceTickness(float ndcZ, uint dimZ); +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness); +// 볼륨 텍스쳐 밀도, 산란 누적 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f); + uint3 Position = uint3(DispatchThreadID.xy, 0); + + [loop] + for (uint i = 0; i < dims.z; ++i) + { + Position.z = i; + float4 slice = g_VolumeSRV[Position]; + float tickness = SliceTickness((float)i / dims.z, dims.z); + + accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness); + g_AccVolumeUAV[Position] = accumulatedColor; + } +} + +float SliceTickness (float ndcZ, uint dimZ) +{ + return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ); +} + +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} + +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness) +{ + sliceDensity = max(sliceDensity, 0.000001f); + sliceDensity *= DensityScale; + float sliceTransmittance = exp(-sliceDensity * tickness); + + // Frostbite의 누적 방식 + float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity; + + accumulatedLight += sliceLightIntegral * accumulatedTransmittance; + accumulatedTransmittance *= sliceTransmittance; + + return float4(accumulatedLight, accumulatedTransmittance); +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl new file mode 100644 index 000000000..b602fc1e4 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl @@ -0,0 +1,111 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float EPSILON = 1e-6f; + +struct LightData +{ + uint itype; + float3 vDirection; + + float3 vPosition; + float fRange; + + float4 vColor; +}; + +//StructuredBuffer g_LightBuffer : register(t1); + +RWTexture3D g_VolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims); +float ConvertNdcZToDepth(float ndcZ); +float3 ConvertToWorldPosition(float3 ndc, float depth); +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims); +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy); + +// 볼륨 텍스쳐 밀도, 산란 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims); + float3 toCamera = normalize(vCameraPosition - worldPosition); + + float3 lighting = vLightColor.rgb * vLightColor.a; + float3 lightDir = normalize(vLightDirection); + float3 toLight = -lightDir; + + float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter); + + lighting += vLightColor.rgb * vLightColor.rgb * phase; + + g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity); +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims) +{ + float3 ndc = id + 0.5f; + + ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z); + ndc += float3(-1.0f, 1.0f, 0.0f); + + return ndc; +} +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} +float3 ConvertToWorldPosition(float3 ndc, float depth) +{ + float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix); + vViewRay /= vViewRay.w; + vViewRay /= vViewRay.z; + float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix); + return worldPosition.xyz; +} +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims) +{ + float3 ndc = ConvertThreadIdToNdc(id, dims); + float depth = ConvertNdcZToDepth(ndc.z); + return ConvertToWorldPosition(ndc, depth); +} +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter) +{ + float cosTheta = dot(vInputDir, vOutputDir); + + float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f); + return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON)); +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Accumulate.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Accumulate.hlsl new file mode 100644 index 000000000..aa5694dfa --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Accumulate.hlsl @@ -0,0 +1,88 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float DensityScale = 0.01f; + +Texture3D g_VolumeSRV : register(t0); + +RWTexture3D g_AccVolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float ConvertNdcZToDepth(float ndcZ); +float SliceTickness(float ndcZ, uint dimZ); +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness); +// 볼륨 텍스쳐 밀도, 산란 누적 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f); + uint3 Position = uint3(DispatchThreadID.xy, 0); + + [loop] + for (uint i = 0; i < dims.z; ++i) + { + Position.z = i; + float4 slice = g_VolumeSRV[Position]; + float tickness = SliceTickness((float)i / dims.z, dims.z); + + accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness); + g_AccVolumeUAV[Position] = accumulatedColor; + } +} + +float SliceTickness (float ndcZ, uint dimZ) +{ + return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ); +} + +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} + +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness) +{ + sliceDensity = max(sliceDensity, 0.000001f); + sliceDensity *= DensityScale; + float sliceTransmittance = exp(-sliceDensity * tickness); + + // Frostbite의 누적 방식 + float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity; + + accumulatedLight += sliceLightIntegral * accumulatedTransmittance; + accumulatedTransmittance *= sliceTransmittance; + + return float4(accumulatedLight, accumulatedTransmittance); +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Compute.hlsl new file mode 100644 index 000000000..b602fc1e4 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Volumetrix_Compute.hlsl @@ -0,0 +1,111 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float EPSILON = 1e-6f; + +struct LightData +{ + uint itype; + float3 vDirection; + + float3 vPosition; + float fRange; + + float4 vColor; +}; + +//StructuredBuffer g_LightBuffer : register(t1); + +RWTexture3D g_VolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims); +float ConvertNdcZToDepth(float ndcZ); +float3 ConvertToWorldPosition(float3 ndc, float depth); +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims); +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy); + +// 볼륨 텍스쳐 밀도, 산란 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims); + float3 toCamera = normalize(vCameraPosition - worldPosition); + + float3 lighting = vLightColor.rgb * vLightColor.a; + float3 lightDir = normalize(vLightDirection); + float3 toLight = -lightDir; + + float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter); + + lighting += vLightColor.rgb * vLightColor.rgb * phase; + + g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity); +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims) +{ + float3 ndc = id + 0.5f; + + ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z); + ndc += float3(-1.0f, 1.0f, 0.0f); + + return ndc; +} +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} +float3 ConvertToWorldPosition(float3 ndc, float depth) +{ + float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix); + vViewRay /= vViewRay.w; + vViewRay /= vViewRay.z; + float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix); + return worldPosition.xyz; +} +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims) +{ + float3 ndc = ConvertThreadIdToNdc(id, dims); + float depth = ConvertNdcZToDepth(ndc.z); + return ConvertToWorldPosition(ndc, depth); +} +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter) +{ + float cosTheta = dot(vInputDir, vOutputDir); + + float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f); + return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON)); +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index 85a25120b..d52149768 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl @@ -29,6 +29,7 @@ float g_fOutLinePower; float g_fDisolveRatio; float g_fDisolveAmount; float g_fDisolveEdgeWidth; +float g_fMBIntensity = 1.f; float4 g_vDisolveEdgeColor; float4 g_vCamPosition; @@ -416,7 +417,7 @@ PS_OUT PS_MAIN(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -480,7 +481,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE(PS_IN_OUTLINE In) (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z (float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터 1.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl index d2bbbab20..4c8eb51df 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl @@ -22,6 +22,7 @@ vector g_vCamPosition; uint g_iIndexU; uint g_iIndexV; float2 g_vTime; +float g_fMBIntensity = 1.f; float g_fDisolveRatio; float g_fUsingSurfaceParams; @@ -442,7 +443,7 @@ PS_OUT PS_MAIN(PS_IN In) Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -478,7 +479,7 @@ PS_OUT PS_GLASS(PS_IN In) Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 15.f / 27.f, 1.f); Out.vSurface = vSurface; Out.vVelocityUV = float2(0.5f, 0.5f); - //CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + //CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -507,7 +508,7 @@ PS_OUT PS_GLASS_CUBE(PS_IN In) Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 15.f / 27.f, 1.f); Out.vSurface = vSurface; Out.vVelocityUV = float2(0.5f, 0.5f); - //CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + //CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -697,7 +698,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE(PS_IN_OUTLINE In) (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z AI_TEXTURE_TYPE_METALNESS, // 서페이스 파라미터 1.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -762,7 +763,7 @@ PS_OUT PS_LAKE(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -798,7 +799,7 @@ PS_OUT PS_LAND(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -826,7 +827,7 @@ PS_OUT PS_NONMRO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = g_vSurfaceColor; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -868,7 +869,7 @@ PS_OUT PS_SPECTOR_WEAPON_MAIN(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -920,7 +921,7 @@ PS_OUT PS_LEVIOSO(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl index 60ee87d32..b30a62965 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl @@ -75,6 +75,7 @@ Texture2D g_SurfaceParamsTexture : register(t10); float4 g_vCamPosition; float g_fFar; float g_fUsingSurfaceParams; +float g_fMBIntensity = 1.f; /* 디퓨즈 */ vector g_vColor; @@ -130,6 +131,8 @@ bool g_isDissolveMove; bool g_isReverseDissolve; bool g_isNomalDissolve; +bool g_isNoDissolveSmoothStep; + bool g_isDissolve_B; bool g_isDissolve_G; @@ -283,6 +286,61 @@ VS_BULR_MESH_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_InstanceID) + vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + + Out.vPosition = vPosition; + Out.vNormal = normalize(mul(vector(In.vNormal, 0.f), matW)); + Out.vTangent = normalize(mul(vector(In.vTangent, 0.f), matW)).xyz; + Out.vBinormal = normalize(mul(vector(In.vBinormal, 0.f), matW)).xyz; + Out.vTexcoord = In.vTexcoord; + Out.vLifeTime = In.vLifeTime; + Out.vWorldPos = mul(vector(In.vPosition, 1.f), matW); + Out.iGPUIndex = iGPUIndex; + Out.vProjPos = vPosition; + Out.vPrevProjPos = mul(vector(In.vPosition, 1.f), matPrevWVP); + + return Out; +} + +VS_BULR_MESH_OUT VS_MAIN_NO_POS(VS_IN In, uint iGPUIndex : SV_InstanceID) +{ + VS_BULR_MESH_OUT Out = (VS_BULR_MESH_OUT) 0; + + matrix matW, matWV, matWVP; + + row_major matrix TransformMatrix = float4x4(In.vRight, In.vUp, In.vLook, In.vTranslation); + + row_major matrix Wolrd_NonPosMatrix = g_WorldMatrix; + + + Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + + matW = mul(TransformMatrix, Wolrd_NonPosMatrix); + + matW[3] = In.vTranslation; + + matWV = mul(matW, g_ViewMatrix); + matWVP = mul(matWV, g_ProjMatrix); + + /* PRE MAT */ + + row_major matrix PreTransformMatrix = g_ParticleValue[iGPUIndex].PreWorldMatrix; + + row_major matrix PreWolrd_NonPosMatrix = g_PrevWorldMatrix; + + + Wolrd_NonPosMatrix[3] = vector(0.f, 0.f, 0.f, 1.f); + + matrix matPrevW, matPrevWV, matPrevWVP; + + matPrevW = mul(PreTransformMatrix, PreWolrd_NonPosMatrix); + + matPrevW[3] = g_ParticleValue[iGPUIndex].PreWorldMatrix[3]; + + matPrevWV = mul(matPrevW, g_PrevViewMatrix); + matPrevWVP = mul(matPrevWV, g_PrevProjMatrix); + + vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); Out.vPosition = vPosition; @@ -301,6 +359,7 @@ VS_BULR_MESH_OUT VS_MAIN(VS_IN In, uint iGPUIndex : SV_InstanceID) VS_OUT VS_NOWORLD(VS_IN In, uint iGPUIndex : SV_InstanceID) { + VS_OUT Out = (VS_OUT) 0; matrix matW, matWV, matWVP; @@ -695,14 +754,15 @@ float4 DrawEffect(PS_IN In) } - //if (vMtrlDissolve.r <= fTimeRatio + 0.1f) - // discard; - - - //fTimeRatio = 1 - pow(1 - fTimeRatio, 3); float fFade = smoothstep(fTimeRatio - 0.1f, fTimeRatio + 0.1f, vMtrlDissolve.r); + if (g_isNoDissolveSmoothStep == true) + { + fFade = smoothstep(fTimeRatio, fTimeRatio, vMtrlDissolve.r); + + } + vMtrlDiffuse.a *= fFade; } @@ -883,7 +943,7 @@ PS_NOMAL_OUT PS_MAIN(PS_BLUR_MESH_IN In) vSurface.b = 0.5f; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); Out.vAlbedo = vMtrlDiffuse; Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; @@ -1518,6 +1578,16 @@ technique11 DefaultTechnique GeometryShader = NULL; PixelShader = compile ps_5_0 PS_BLOOM(); } +//23 + pass Default_NonPos + { + SetRasterizerState(RS_Nocull); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); + VertexShader = compile vs_5_0 VS_MAIN_NO_POS(); + GeometryShader = NULL; + PixelShader = compile ps_5_0 PS_MAIN(); + } } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl index e21521de5..c1156ec94 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxNorTex.hlsl @@ -9,6 +9,7 @@ float g_fUsingSurfaceParams; float g_fDiffuseMultiplier; float g_fSurfaceMultiplier; float g_fNormalMultiplier; +float g_fMBIntensity = 1.f; Texture2D g_DiffuseTexture; Texture2D g_NormalTexture; @@ -131,7 +132,7 @@ PS_OUT PS_MAIN(PS_IN In) 1.f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } @@ -190,7 +191,7 @@ PS_OUT PS_MAIN_TERRAIN_ANISO(PS_IN In) (1.f / 255.f)); // 지형은 1 Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = vSurface; - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl index 75dc56f2d..10d6b3467 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl @@ -10,6 +10,7 @@ Texture2D g_SurfaceParamsTexture; float4 g_vCamPosition; float g_fFar; float g_fUsingSurfaceParams; +float g_fMBIntensity = 1.f; struct VS_IN @@ -112,7 +113,7 @@ PS_OUT PS_MAIN(PS_IN In) Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, g_fUsingSurfaceParams, 0.0f); Out.vColor = float4(0.f, 0.f, 0.f, 1.f); Out.vSurface = float4(g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord).xy, 1.f, 1.f); - Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos); + Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity); return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_AccioBallFrame_4K.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_AccioBallFrame_4K.png new file mode 100644 index 000000000..ac6a0b938 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_AccioBallFrame_4K.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right.png new file mode 100644 index 000000000..70e003d31 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right_Mask.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right_Mask.png new file mode 100644 index 000000000..711702470 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BRFlag_Right_Mask.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BR_BestTime_Trophy.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BR_BestTime_Trophy.png new file mode 100644 index 000000000..ed6cef853 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_BR_BestTime_Trophy.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Collections_Brooms.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Collections_Brooms.png new file mode 100644 index 000000000..d14316d67 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Collections_Brooms.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_CountdownDisolveGlow.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_CountdownDisolveGlow.png new file mode 100644 index 000000000..304438d0e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_CountdownDisolveGlow.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_MainDivider_Horz_4K.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_MainDivider_Horz_4K.png new file mode 100644 index 000000000..7edde549e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_MainDivider_Horz_4K.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Map_RaceGate.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Map_RaceGate.png new file mode 100644 index 000000000..6521aa397 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_Map_RaceGate.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_SilverNotificationBack.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_SilverNotificationBack.png new file mode 100644 index 000000000..84d975c3e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/BroomFlight/UI_T_SilverNotificationBack.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/base_Black_SRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Textures/base_Black_SRO.dds new file mode 100644 index 000000000..aa93c713b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/base_Black_SRO.dds differ diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 460529e7c..62df3fcf6 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -203,6 +203,7 @@ call Update_Shaders.bat + @@ -451,6 +452,7 @@ call Update_Shaders.bat + diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index a31791f3c..8b16cb5f8 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters @@ -669,16 +669,19 @@ {4070f5a1-7f80-42da-afa0-f7f0500376f9} - + {48e893e6-2374-44a3-b091-814ad89451c4} - + {ee491ec4-bc46-48de-8cfb-396a29d2c98b} {3b9768b5-8c85-4465-b0ad-2d14722d88ce} + + {fbf574e7-159e-43c3-914d-6a200383a45c} + @@ -1367,7 +1370,7 @@ 02.GameObjects\Layer_Effect\Effect\Monster_Effect\Ranrok\FireBall - + 02.GameObjects\Env\08.LightSpawner @@ -1377,6 +1380,9 @@ 50.UI\Dialogue + + 02.GameObjects\Layer_Effect\Effect\Monster_Effect\Ranrok\Breath + @@ -2070,16 +2076,19 @@ 02.GameObjects\Layer_Effect\Effect\Monster_Effect\Ranrok\FireBall - + 02.GameObjects\Env\08.LightSpawner - + 50.UI\GamePlay_Canvas\Action_Panel\NPCInteraction 50.UI\Dialogue + + 02.GameObjects\Layer_Effect\Effect\Monster_Effect\Ranrok\Breath + diff --git a/Jusin154_Team3D/Editor/Private/EditEffect.cpp b/Jusin154_Team3D/Editor/Private/EditEffect.cpp index 2232ed706..3bc14a346 100644 --- a/Jusin154_Team3D/Editor/Private/EditEffect.cpp +++ b/Jusin154_Team3D/Editor/Private/EditEffect.cpp @@ -456,7 +456,7 @@ void CEditEffect::Describe_Entity() const char* pEffectType[] = { "EFFECT" , "TRAIL" }; const char* pShaderPass[] = { "DEFAULT" , "NON_NOMALMAP" , "BLUR" , "WEIGHTBLEND" , "NON_WORLD" , "NON_WORLD_BLUR", "BLEND", "BLEND_NOWORLD", "BLOOM" ,"BLOOM_NOWORLD" ,"BLUR_NO_EMMISVE", - "BLUR_NO_WORLD_NO_EMISSIVE","WEIGHTBLEND_FOR_BLEND" , "DEPTH_STOP" , "WB_CULLING", "SCREEN_FX" , "DISTORTION" ,"NONPOS" , "NONPOS_BLUR" , "BULR_MESH" , "BLUR_CULLING" ,"BLUR_CULLING_NO_EMISSIVE" , "BLOOM_CULLING"}; + "BLUR_NO_WORLD_NO_EMISSIVE","WEIGHTBLEND_FOR_BLEND" , "DEPTH_STOP" , "WB_CULLING", "SCREEN_FX" , "DISTORTION" ,"NONPOS" , "NONPOS_BLUR" , "BULR_MESH" , "BLUR_CULLING" ,"BLUR_CULLING_NO_EMISSIVE" , "BLOOM_CULLING" , "DEFAULT_NONPOS"}; const char* pBloomType[] = { "NONE" , "BASIC" , "MUILTY"}; _int iCurrentItem = static_cast<_int>(m_EffectInfo.eRenderOrder); @@ -852,6 +852,8 @@ void CEditEffect::Describe_Entity() GUI::Checkbox("Nomal Dissolve", &m_EffectInfo.isNomalDissolve); GUI::Checkbox("Reverse Dissolve", &m_EffectInfo.isReverseDissolve); + GUI::Checkbox("StopDissolveSmoothStep", &m_EffectInfo.isNoDissolveSmoothStep); + ImGui::PushItemWidth(80); GUI::Spacing(); diff --git a/Jusin154_Team3D/Editor/Private/EffectObject.cpp b/Jusin154_Team3D/Editor/Private/EffectObject.cpp index ee5a92bb6..94439961f 100644 --- a/Jusin154_Team3D/Editor/Private/EffectObject.cpp +++ b/Jusin154_Team3D/Editor/Private/EffectObject.cpp @@ -100,7 +100,7 @@ HRESULT CEffectObject::Render_Blur() } } - if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::NONPOS) + if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::NONPOS || m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::DEFAULT_NONPOS) BlurPass = SHADER_PASS_INSTANCE_MODEL::NONPOS_BLUR; if (m_EffectInfo.eShaderPass == SHADER_PASS_INSTANCE_MODEL::WB_CULLING) @@ -210,6 +210,7 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) SAFE_RELEASE(m_pMasking_TextureCom); SAFE_RELEASE(m_pDissolve_TextureCom); SAFE_RELEASE(m_pEmissive_TextureCom); + SAFE_RELEASE(m_pNormal_TextureCom); SAFE_RELEASE(m_pInstance_ModelCom); @@ -454,6 +455,31 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) } + if (m_EffectInfo.isNomalMap) + { + size_t iComponentLength = {}; + + if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + _char szName[MAX_PATH] = {}; + + if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + + m_strNomalMapName = szName; + + if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strNomalMapName), + reinterpret_cast(&m_pNormal_TextureCom)))) + return E_FAIL; + } + } + + size_t iComponentLength = {}; @@ -481,31 +507,7 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) } } - if (m_EffectInfo.isNomalMap) - { - size_t iComponentLength = {}; - if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { - return E_FAIL; - } - - if (iComponentLength != 0) - { - _char szName[MAX_PATH] = {}; - - if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { - return E_FAIL; - } - - m_strNomalMapName = szName; - - if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strNomalMapName), - reinterpret_cast(&m_pNormal_TextureCom)))) - return E_FAIL; - } - - - } @@ -1050,6 +1052,10 @@ HRESULT CEffectObject::Bind_ShaderResources() return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_isNoDissolveSmoothStep", &m_EffectInfo.isNoDissolveSmoothStep, sizeof(_bool)))) { + return E_FAIL; + } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fDissolveMaskEdge", &m_EffectInfo.vDissolveValue.x, sizeof(_float)))) { return E_FAIL; } @@ -1114,6 +1120,7 @@ HRESULT CEffectObject::Bind_ShaderResources() return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_isMask_G", &m_EffectInfo.isMask_G, sizeof(_bool)))) { diff --git a/Jusin154_Team3D/Editor/Private/EffectPool.cpp b/Jusin154_Team3D/Editor/Private/EffectPool.cpp index 3f5c04de1..c86d0816e 100644 --- a/Jusin154_Team3D/Editor/Private/EffectPool.cpp +++ b/Jusin154_Team3D/Editor/Private/EffectPool.cpp @@ -22,6 +22,7 @@ #include "StunEffect.h" #include "Blink.h" #include "Ranrok_FireBall.h" +#include "Ranrok_Breath.h" CEffectPool::CEffectPool(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) : CGameObject(pDevice, pContext) @@ -323,10 +324,17 @@ HRESULT CEffectPool::Ready_MonsterEffect() ))) return E_FAIL; + if (FAILED(Create_Effect(SKILL_TYPE::RANROK_BREATH, 5, NEXT_LEVEL, NEXT_LEVEL, [&](_uint iPrototypeLevel, _uint iCloneLevel) -> CEffect_Container* { + + CRanrok_Breath* pEffect = nullptr; + + pEffect = m_pGameInstance->Clone_Prototype(iPrototypeLevel, nullptr); + + return pEffect; } + ))) return E_FAIL; + return S_OK; - - } HRESULT CEffectPool::Use_Skill(SKILL_TYPE eType, CGameObject* pOwner, void* pArg) diff --git a/Jusin154_Team3D/Editor/Private/Effect_Container.cpp b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp index 8e03b9cf2..4e928fe72 100644 --- a/Jusin154_Team3D/Editor/Private/Effect_Container.cpp +++ b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp @@ -645,6 +645,84 @@ ON_COLLISION_INFO CEffect_Container::MonsterSweepTarget(_vector StartPos, _vecto return tagCollInfo; } + +ON_COLLISION_INFO CEffect_Container::MonsterRayCast(_vector StartPos, _vector _vDir, _float _fLength, _uint iMaxHitCapacity) +{ + _vector vStartPos = StartPos; + _vector vDir = _vDir; + + _float fLength = _fLength; + + vector Raycasts = {}; + Raycasts.resize(iMaxHitCapacity); + + _bool bHit = m_pGameInstance->RayCast(vStartPos, vDir, fLength, Raycasts.data(), iMaxHitCapacity, m_iHitCount); + + ON_COLLISION_INFO tagCollInfo = {}; + + for (_uint i = 0; i < iMaxHitCapacity; i++) + { + PSX::PxRigidActor* pActor = Raycasts[i].actor; + PSX::PxShape* pShape = Raycasts[i].shape; + + + tagCollInfo.vWorldPos.w = 1.f; + + if (bHit) { + + memcpy_s(&tagCollInfo.vWorldPos, sizeof(tagCollInfo.vWorldPos), &Raycasts[i].position, sizeof(Raycasts[i].position)); + + memcpy_s(&tagCollInfo.vWorldNomal, sizeof(tagCollInfo.vWorldNomal), &Raycasts[i].normal, sizeof(Raycasts[i].normal)); + XMStoreFloat4(&tagCollInfo.vHitDir, vDir); + tagCollInfo.fLength = fLength; + + if (nullptr != pActor && nullptr != pActor->userData) + { + PhsXUserData* pUserData = static_cast(pActor->userData); + tagCollInfo.pObject = pUserData->pOwner; + + switch (pUserData->eKind) + { + case PHYSX_KIND::CCTActor: + { + switch (PXOBJECT(pUserData->iSubKind)) + { + + case PXOBJECT::PLAYER: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + break; + case PXOBJECT::SKILL_PROTEGO: + { + pUserData->pOwner->OnCollision(this, &tagCollInfo); + m_bHit = true; + } + } + } + } + + + switch (PXOBJECT(pUserData->iSubKind)) + { + case PXOBJECT::TERRAIN: + { + + m_bHit = true; + break; + } + } + } + + } + + return tagCollInfo; + } + + return tagCollInfo; +} + _int CEffect_Container::CollisionCheck() { _bool bIsCollide = { false }; @@ -702,3 +780,5 @@ _int CEffect_Container::CollisionCheck() return -1; } + + diff --git a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp index 5a676ccb6..ec7b30f23 100644 --- a/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp +++ b/Jusin154_Team3D/Editor/Private/Level_EffectViewer.cpp @@ -102,6 +102,7 @@ HRESULT CLevel_EffectViewer::Initialize() //m_PlaneData.iSubKind = ENUM_CLASS(PXOBJECT::TERRAIN); //m_pGameInstance->Add_Editor_Plane(m_PlaneData); + m_pGameInstance->Setting_Volumetirc(0.5f, 0.064f, 0.902f, 2.0f); return S_OK; } @@ -149,8 +150,17 @@ HRESULT CLevel_EffectViewer::Ready_Layer_Camera(const _wstring& strLayerTag) HRESULT CLevel_EffectViewer::Ready_Layer_Light() { - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, LAYER_LIGHT))) + CMainLight* pLight = { nullptr }; + + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, LAYER_LIGHT, nullptr, nullptr, &pLight))) { return E_FAIL; + } + + _float4 vDiffuse = _float4(0.607f, 0.658f, 0.698f, 0.f); + _float4 vAmbient = _float4(0.1f, 0.13f, 0.13f, 0.f); + _float4 vSpecular = _float4(0.05f, 0.05f, 0.05f, 0.f); + + pLight->Get_Component()->Set_Color(vDiffuse, vAmbient, vSpecular); return S_OK; } diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 8318ec2ca..c5e806319 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -194,6 +194,7 @@ #include "StunEffect.h" #include "Blink.h" #include "Ranrok_FireBall.h" +#include "Ranrok_Breath.h" #pragma endregion #pragma region PHYSX_HEADER @@ -1268,6 +1269,11 @@ HRESULT CLoader::Loading_For_Effect() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Base_SRO"), + CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/base_Black_SRO.dds"), 0)))) { + return E_FAIL; + } + Asset_FileLoad("../Bin/Resources/Textures/Effect/Noises", L"Prototype_Texture_", [&](_wstring wstrFileName, const _char* pFilePath) { _string strFilePath = pFilePath; @@ -1793,6 +1799,9 @@ HRESULT CLoader::Loading_For_Effect() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Prototype(NEXT_LEVEL, CRanrok_Breath::Create(m_pDevice, m_pContext)))) { + return E_FAIL; + } /* For.Prototype_GameObject_Wand */ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CWand::Create(m_pDevice, m_pContext)))) @@ -2422,17 +2431,10 @@ HRESULT CLoader::Loading_For_ObjectViewer() )); futures.emplace_back(Deferred_ModelLoad( - MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), - TEXT("Prototype_Component_Professor_EleazarFig_Model") + MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(), + TEXT("Prototype_Component_Ghost_Peeves_Model") )); - //if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_ConjuredDragon_Model"), - // CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationZ(XMConvertToRadians(180.f))* XMMatrixIdentity())))) - // return E_FAIL; - futures.emplace_back(Deferred_ModelLoad( - MODEL::ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon_Anim.bin", XMMatrixIdentity(), - TEXT("Prototype_Component_ConjuredDragon_Anim_Model") - )); #pragma endregion diff --git a/Jusin154_Team3D/Editor/Private/Ranrok_Breath.cpp b/Jusin154_Team3D/Editor/Private/Ranrok_Breath.cpp new file mode 100644 index 000000000..65bd4dde9 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Ranrok_Breath.cpp @@ -0,0 +1,307 @@ +#include "pch.h" +#include "Ranrok_Breath.h" + +#include "GameInstance.h" +#include "EditEffect.h" +#include "Wand.h" +#include "Player.h" +#include "InfoInstance.h" + +CRanrok_Breath::CRanrok_Breath(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CEffect_Container{ pDevice, pContext } +{ +} + +CRanrok_Breath::CRanrok_Breath(const CRanrok_Breath& rhs) + : CEffect_Container(rhs), + m_pInfoInstance(CInfoInstance::GetInstance()) +{ + SAFE_ADDREF(m_pInfoInstance); +} + +HRESULT CRanrok_Breath::Initialize_Prototype() +{ + + + return S_OK; + +} + +HRESULT CRanrok_Breath::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + + if (FAILED(Load_Package("../Bin/Resources/Data/Effect/MonsterPackage/Ranrok/RanrokBreath"))) + return E_FAIL; + + m_wstrEffectName = L"RanrokBreath"; + + + m_pBreath = Get_PartObject("Breath"); + m_pBreath_Black = Get_PartObject("Breath_Black"); + m_pBreathSlog = Get_PartObject("BreathSlog"); + m_pMouthFire = Get_PartObject("MouthFire"); + + SAFE_ADDREF(m_pBreath); + SAFE_ADDREF(m_pBreath_Black); + SAFE_ADDREF(m_pBreathSlog); + SAFE_ADDREF(m_pMouthFire); + + m_fDuration = 5.f; + + + m_Events.emplace(0.5f, [&]() { + m_isStartRayCast = true; + }); + + + m_Events.emplace(3.f, [&]() { + + // 파티클 제어 + m_isParticleEnd = true; + + CEditEffect* pRock_PT = Get_PartObject("Rock_PT"); + CEditEffect* pBottomFire = Get_PartObject("BottomFire"); + CEditEffect* pSplatterBottom0 = Get_PartObject("SplatterBottom0"); + + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + + pRock_PT->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + pBottomFire->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + pSplatterBottom0->Get_Component()->Set_State(STATE::POSITION, XMVectorSet(0.f, -500.f, 0.f, 1.f)); + + m_pBreath->Get_Component()->Set_Loop(false); + m_pBreath->Get_Effect_Info()->isDissolve = true; + + m_pBreath_Black->Get_Component()->Set_Loop(false); + m_pBreath_Black->Get_Effect_Info()->isDissolve = true; + + m_pBreathSlog->Set_Visible(false); + + }); + return S_OK; +} + +void CRanrok_Breath::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); + + +} + +void CRanrok_Breath::Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + __super::Update(fTimeDelta); + + Update_Event(fTimeDelta); + + _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("tongue_01")); + + for (int i = 0; i < 3; ++i) { + BoneMat.r[i] = XMVector3Normalize(BoneMat.r[i]); + } + + _matrix WorldMat = m_pOwner->Get_Component()->Get_XMWorldMatrix() ; + + _matrix CombinedMat = BoneMat * WorldMat; + + + + m_pBreath->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreath_Black->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreathSlog->Get_Component()->Set_WorldMatrix(CombinedMat); + + if(m_isParticleEnd == false) + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + + + _vector vStartPos = CombinedMat.r[3]; + + XMStoreFloat4(&m_vStartPos, vStartPos); + + if(m_isStartRayCast == true) + { + ON_COLLISION_INFO CollisionInfo = MonsterRayCast(XMLoadFloat4(&m_vStartPos), CombinedMat.r[2] * -1.f, 50.f, 50); + if (m_bHit = true) + OnCollision(this, &CollisionInfo); + + } + + + +} + +void CRanrok_Breath::Late_Update(_float fTimeDelta) +{ + if (m_bVisible == false) + return; + + __super::Late_Update(fTimeDelta); + + +} + +HRESULT CRanrok_Breath::Pre_Setting(CGameObject* pObject, void* pArg) +{ + if (FAILED(__super::Pre_Setting(pObject, nullptr))) + return E_FAIL; + + + /* 초기 객체 비지블*/ + + CEditEffect* pBlurMesh = Get_PartObject("BlurMesh"); + + m_pBreath->Set_Visible(true); + m_pBreath_Black->Set_Visible(true); + m_pBreathSlog->Set_Visible(true); + m_pMouthFire->Set_Visible(true); + pBlurMesh->Set_Visible(true); + + /* 초기 객체 위치 초기화*/ + + _matrix BoneMat = XMLoadFloat4x4(m_pOwner->Get_Component()->Get_BoneMatrixPtr("tongue_01")); + + for (int i = 0; i < 3; ++i) { + BoneMat.r[i] = XMVector3Normalize(BoneMat.r[i]); + } + + _matrix WorldMat = m_pOwner->Get_Component()->Get_XMWorldMatrix() ; + + _matrix CombinedMat = BoneMat * WorldMat; + + + + m_pBreath->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreath_Black->Get_Component()->Set_WorldMatrix(CombinedMat); + m_pBreathSlog->Get_Component()->Set_WorldMatrix(CombinedMat); + + _vector vStartPos = CombinedMat.r[3]; + + XMStoreFloat4(&m_vStartPos, vStartPos); + + + + m_pMouthFire->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + pBlurMesh->Get_Component()->Set_State(STATE::POSITION, CombinedMat.r[3]); + + /* 브레스 디졸브를 위해 초기값 설정*/ + m_pBreath->Get_Component()->Set_Loop(true); + m_pBreath->Get_Effect_Info()->isDissolve = false; + + m_pBreath_Black->Get_Component()->Set_Loop(true); + m_pBreath_Black->Get_Effect_Info()->isDissolve = false; + + m_isParticleEnd = false; + m_isStartRayCast = false; + return S_OK; +} + +HRESULT CRanrok_Breath::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CRanrok_Breath::Ready_Child() +{ + return S_OK; +} + +CRanrok_Breath* CRanrok_Breath::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CRanrok_Breath* pInstance = new CRanrok_Breath(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CRanrok_Breath"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + + +CGameObject* CRanrok_Breath::Clone(void* pArg, CGameObject* pOwner) +{ + CRanrok_Breath* pInstance = new CRanrok_Breath(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CRanrok_Breath"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CRanrok_Breath::OnCollision(CGameObject* pOther, void* pDesc) +{ + if (m_bHit == false) + return; + + ON_COLLISION_INFO CollisionDesc = *static_cast(pDesc); + + _vector vPos = XMLoadFloat4(&CollisionDesc.vWorldPos); + + if (XMVectorGetX(XMVector4Length(vPos)) <= 0.f) /* 000 일때 들어오지마 */ + return; + + _vector vPrePos = XMLoadFloat4(&m_vPreCollisionPos); + _vector vDir = XMVector3Normalize(vPos - vPrePos); + + if (m_isParticleEnd == true) + return; + + CEditEffect* pRock_PT = Get_PartObject("Rock_PT"); + CEditEffect* pBottomFire = Get_PartObject("BottomFire"); + CEditEffect* pSplatterBottom0 = Get_PartObject("SplatterBottom0"); + + pRock_PT->Set_Visible(true); + pRock_PT->Get_Component()->Set_State(STATE::POSITION, vPos); + + pBottomFire->Set_Visible(true); + pBottomFire->Get_Component()->Set_State(STATE::POSITION, vPos); + + pSplatterBottom0->Set_Visible(true); + pSplatterBottom0->Get_Component()->Set_State(STATE::POSITION, vPos + vDir * 3.f); + + XMStoreFloat4(&m_vPreCollisionPos, vPos); +} + +void CRanrok_Breath::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pInfoInstance); + + SAFE_RELEASE(m_pBreath); + SAFE_RELEASE(m_pBreath_Black); + SAFE_RELEASE(m_pBreathSlog); + SAFE_RELEASE(m_pMouthFire); + + //SAFE_RELEASE(m_pFireBall_Tail); +} +#ifdef _DEBUG +void CRanrok_Breath::Describe_Entity() +{ + +} +#endif + +HRESULT CRanrok_Breath::Bind_ShaderResources() +{ + return S_OK; +} + + diff --git a/Jusin154_Team3D/Editor/Private/Ranrok_States.cpp b/Jusin154_Team3D/Editor/Private/Ranrok_States.cpp index 9787d7e9d..ee2ebdbd3 100644 --- a/Jusin154_Team3D/Editor/Private/Ranrok_States.cpp +++ b/Jusin154_Team3D/Editor/Private/Ranrok_States.cpp @@ -289,15 +289,25 @@ void CRanrok::Behavior_FireBreathEnter() pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_WINDUP_A]; Add_Event(pairAnimInfo.first, - [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_A]; + [&]() { + pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)]; }, - 0.95f); + m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIREBREATH)]; + m_bLookAt = false; + },0.95f); Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, - [&]() { pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, - 0.95f); + [&]() { + pairAnimInfo = m_Animation[STATEANIM::FIREBREATH_COOLDOWN_A]; + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_bLookAt = true; + },0.95f); + + Add_Event(m_Animation[STATEANIM::FIREBREATH_A].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.1f); + } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { @@ -344,18 +354,32 @@ void CRanrok::Behavior_FireSweepEnter() Add_Event(pairAnimInfo.first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_A]; m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); - m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; }, - 0.95f); + m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; + m_bLookAt = false; + },0.95f); Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, [&]() { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_COOLDOWN_A]; - m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); }, - 0.95f); + m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); + m_bLookAt = true; + }, + 0.94f); + + + Add_Event(m_Animation[STATEANIM::FIRESWEEP_A].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.08f); } else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND)) { pairAnimInfo = m_Animation[STATEANIM::FIRESWEEP_G]; m_fSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)] = m_fMaxSkillCoolTime[ENUM_CLASS(RANROK_SKILL::FIRESWEEP)]; + + Add_Event(m_Animation[STATEANIM::FIRESWEEP_G].first, + [this]() { + m_pEffectPool->Use_Skill(SKILL_TYPE::RANROK_BREATH, this); + }, 0.2f); } m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second); } diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index efa60118b..0c933939a 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -37,7 +37,7 @@ namespace Editor SPELL_LEARN, SPELLLEARNCOLOR, SPELLLEARNBOOSTER, NPCINTERACTION, CANVASFADE, ENEMY_DETECTION, INTERACTION_OBJECT, INTERACTION_NPC, END }; - enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, DEPTH_STOP, WB_CULLING, SCREEN_FX , DISTORTION , NONPOS , NONPOS_BLUR, BLUR_MESH, BLUR_CULLING , BLUR_CULLING_NO_EMISSIVE, BLOOM_CULLING ,END }; + enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, WEIGHTBLEND, NON_WORLD, NON_WORLD_BLUR, BLEND, BLEND_NOWORLD, BLOOM, BLOOM_NOWORLD, BLUR_NO_EMMISVE, BLUR_NO_WORLD_NO_EMISSIVE, WEIGHTBLEND_FOR_BLEND, DEPTH_STOP, WB_CULLING, SCREEN_FX , DISTORTION , NONPOS , NONPOS_BLUR, BLUR_MESH, BLUR_CULLING , BLUR_CULLING_NO_EMISSIVE, BLOOM_CULLING , DEFAULT_NONPOS , END }; enum class SHADER_PASS_UIINTANCE { DEFAULT, ALPHABLEND, UVALPHABLEND, MAGIC_METER, SPELL_LIST, EESSENTIAL_SPELL_SOLT, EESSENTIAL_SPELL, COLOR, SPELL_HOVER, SPELL_SLOT_EFFECT, SPELL_SLOT, SPELL_LOCK, QUEST_SLOT, END }; @@ -57,7 +57,7 @@ namespace Editor JAP_SIDE, BOMBARDA_SIDE, DESCENDO_SIDE, LEVIOSO_SIDE, STUN, - TROLL_ATTACK, TROLL_RUSH_HIT, TROLL_NOMAL_SMOKE, BLINK, RANROK_FIREBALL, + TROLL_ATTACK, TROLL_RUSH_HIT, TROLL_NOMAL_SMOKE, BLINK, RANROK_FIREBALL, RANROK_BREATH, END }; diff --git a/Jusin154_Team3D/Editor/Public/EffectObject.h b/Jusin154_Team3D/Editor/Public/EffectObject.h index 23839d5ab..56e92ac57 100644 --- a/Jusin154_Team3D/Editor/Public/EffectObject.h +++ b/Jusin154_Team3D/Editor/Public/EffectObject.h @@ -139,7 +139,7 @@ class CEffectObject abstract : public CPartObject _bool isBlurDissolve = {}; _bool isNomalMap = {}; - _bool isPadding2 = {}; + _bool isNoDissolveSmoothStep = {}; _bool isPadding3 = {}; _float4 vPadding5 = {}; @@ -273,7 +273,7 @@ class CEffectObject abstract : public CPartObject #ifdef _DEBUG HRESULT LoadPre(const _char* pFilePath, LEVEL eLevel); #endif // DEBUG - + EFFECT_INFO* Get_Effect_Info() { return &m_EffectInfo; } protected: virtual HRESULT Bind_ShaderResources() override; @@ -291,6 +291,7 @@ class CEffectObject abstract : public CPartObject CTexture* m_pNormal_TextureCom = { nullptr }; CTexture* m_pSurface_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; CLight* m_pLightCom = { nullptr }; diff --git a/Jusin154_Team3D/Editor/Public/Effect_Container.h b/Jusin154_Team3D/Editor/Public/Effect_Container.h index c16ea395a..b148ba8d4 100644 --- a/Jusin154_Team3D/Editor/Public/Effect_Container.h +++ b/Jusin154_Team3D/Editor/Public/Effect_Container.h @@ -38,12 +38,15 @@ class CEffect_Container abstract : public CContainerObject _int CollisionCheck(); ON_COLLISION_INFO SweepTarget(_vector StartPos, _vector EndPos, _float fRadius, _bool isTerrainCollision = false); ON_COLLISION_INFO MonsterSweepTarget(_vector StartPos, _vector EndPos, _float fRadius, _bool isTerrainCollision = false); + ON_COLLISION_INFO MonsterRayCast(_vector StartPos, _vector vDir, _float fLength, _uint iMaxHitCapacity); protected: _uint m_iSkillType = ENUM_CLASS(SKILL_TYPE::END); _float4 m_vStartPos = {}; _float4 m_vEndPos = {}; PSX::PxSweepBufferN<12> m_Hitbuffer = {}; + PSX::PxRaycastHit m_RayHitbuffer = {}; + _uint m_iHitCount = {}; _bool m_bHit = { false }; protected: _wstring m_wstrEffectName = {}; diff --git a/Jusin154_Team3D/Editor/Public/Ranrok_Breath.h b/Jusin154_Team3D/Editor/Public/Ranrok_Breath.h new file mode 100644 index 000000000..86cfe5099 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Ranrok_Breath.h @@ -0,0 +1,63 @@ +#pragma once + +#include "Editor_Define.h" +#include "Effect_Container.h" + +NS_BEGIN(Engine) +NS_END + +NS_BEGIN(Editor) + +class CRanrok_Breath final : public CEffect_Container +{ +private: + CRanrok_Breath(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CRanrok_Breath(const CRanrok_Breath& rhs); + virtual ~CRanrok_Breath() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + +public: + virtual HRESULT Pre_Setting(CGameObject* pObject, void* pArg = nullptr) override; + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Ready_Child(); + HRESULT Bind_ShaderResources() override; + virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr) override; +private: + _wstring m_wstrEffectName = {}; + + class CEditEffect* m_pBreath = { nullptr }; + class CEditEffect* m_pBreath_Black = { nullptr }; + class CEditEffect* m_pBreathSlog = { nullptr }; + class CEditEffect* m_pMouthFire = { nullptr }; + + _float3 m_vLook = {}; + _float m_fLinearSpeed = 0.8f; + + _float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; + _float4 m_vPreCollisionPos = {}; + _float4 m_vTargetPos = { 0.f, 0.f, 10.f, 1.f }; + + _bool m_isParticleEnd = {}; + _bool m_isStartRayCast = {}; +private: + class CInfoInstance* m_pInfoInstance = { nullptr }; +public: + static CRanrok_Breath* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual void Free() override; + CGameObject* Clone(void* pArg, CGameObject* pOwner) override; +#ifdef _DEBUG + void Describe_Entity() override; +#endif // DEBUG + + +}; + +NS_END diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 0d14ceee3..0a4ed6bb2 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl @@ -94,6 +94,9 @@ float g_fFogPow; float g_fFogHeightValue; bool g_bFogVisible; vector g_vFogColor; +float g_fDepthPackExponent; + +Texture3D g_VolumeTexture; float g_fWeights_32[32] = { @@ -1142,6 +1145,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord); vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + float3 vVolumeUV = float3(In.vTexcoord.xy, pow(vDepthDesc.y, g_fDepthPackExponent)); + if (0.f == g_fFogPow) { if (1 == vDepthDesc.y) @@ -1151,9 +1156,10 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) return Out; } + float4 vVolumeValue = g_VolumeTexture.Sample(DefaultSampler, vVolumeUV); float fViewZ = vDepthDesc.y * g_fFar; - float4 vPosition, vPreShadowPosition; + float4 vPosition; vPosition.x = In.vTexcoord.x * 2.f - 1.f; vPosition.y = In.vTexcoord.y * -2.f + 1.f; vPosition.z = vDepthDesc.x; @@ -1174,14 +1180,19 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In) fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow); - vFinalColor = lerp(vColor, g_vFogColor, fRatio); - vFinalColor.a = 1.f; + vVolumeValue.r = vVolumeValue.r < 1.413f ? pow(abs(vVolumeValue.r * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.r); + vVolumeValue.g = vVolumeValue.g < 1.413f ? pow(abs(vVolumeValue.g * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.g); + vVolumeValue.b = vVolumeValue.b < 1.413f ? pow(abs(vVolumeValue.b * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.b); + vVolumeValue.a = saturate(1.f - vVolumeValue.a); + vFinalColor = float4(lerp(vColor.rgb, vVolumeValue.rgb, vVolumeValue.a), 1.f); if (1.f == vDepthDesc.y) { - vFinalColor = float4(g_vFogColor); + vFinalColor = float4(vVolumeValue.rgb, 1.f); } - Out.vFirstTarget = vFinalColor; + + + Out.vFirstTarget = vVolumeValue; return Out; } @@ -1302,7 +1313,7 @@ technique11 DefaultTechnique pass DebugPass // 0 { SetRasterizerState(RS_Default); - SetDepthStencilState(DSS_Default, 0); + SetDepthStencilState(DSS_None, 0); SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff); VertexShader = compile vs_5_0 VS_MAIN(); GeometryShader = NULL; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl index 602d99a61..d81caa548 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl @@ -168,6 +168,37 @@ void DecomposeAffine_RowMajor(row_major float4x4 M, out float3 S, out float4 R, R = QuatNormalize(q); } +row_major float4x4 ApplyHeadAim(uint bone, row_major float4x4 M) +{ + if (PlayHeadBone != 1) + return M; + if (bone != HeadBoneIndex) + return M; + if (HeadAimWeight <= 0.f) + return M; + + float3 curFwd = normalize(float3(M._31, M._32, M._33)); + float3 target = normalize(TargetDir_Local); + + float d = dot(curFwd, target); + + float3 axis = cross(curFwd, target); + float axisLen = length(axis); + if (axisLen <= EPS) + return M; + + axis /= axisLen; + + float angle = acos(saturate(d)); + angle *= saturate(HeadAimWeight); + + float4 qAim = float4(axis * sin(angle * 0.5f), cos(angle * 0.5f)); + qAim = QuatNormalize(qAim); + + row_major float4x4 AimM = MakeAffine(float3(1, 1, 1), qAim, float3(0, 0, 0)); + return mul(AimM, M); +} + uint FindKeyIndexCur(uint start, uint count, float t) { @@ -279,100 +310,48 @@ void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out flo row_major float4x4 SampleBlendedLocal(uint bone) { - if (PrevAnimIndex == -1) + float3 S; + float4 R; + float3 T; + + if (PrevAnimIndex == -1 || CurrentAnimIndex == PrevAnimIndex) { - float3 S; - float4 R; - float3 T; SampleLocalTRS_Cur(bone, CurrentTime, S, R, T); if (bone == RootBoneIndex) { T = 0; R = RootInitRot; } - return MakeAffine(S, R, T); - } - if (CurrentAnimIndex == PrevAnimIndex) - { - float3 S; - float4 R; - float3 T; - SampleLocalTRS_Cur(bone, CurrentTime, S, R, T); - - if (bone == RootBoneIndex) - { - T = 0; - R = RootInitRot; - } - return MakeAffine(S, R, T); + row_major float4x4 M = MakeAffine(S, R, T); + return ApplyHeadAim(bone, M); } float br = saturate(BlendRatio); float3 sA, sB, tA, tB; float4 rA, rB; - - float prevT = PrevTime; - if (BlendRatio < 1e-4f) - { - prevT = CurrentTime; - } + float prevT = (BlendRatio < 1e-4f) ? CurrentTime : PrevTime; SampleLocalTRS_Prev(bone, prevT, sA, rA, tA); SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB); - float3 S = lerp(sA, sB, br); - float3 T = lerp(tA, tB, br); - float4 R = QuatSlerp(rA, rB, br); + S = lerp(sA, sB, br); + T = lerp(tA, tB, br); + R = QuatSlerp(rA, rB, br); if (bone == RootBoneIndex) { T = 0; R = RootInitRot; } - - float4x4 M = MakeAffine(S, R, T); - - if (PlayHeadBone == 1) - { - if (bone == HeadBoneIndex && HeadAimWeight > 0.f) - { - float3 curFwd = normalize(float3(M._31, M._32, M._33)); - float3 target = normalize(TargetDir_Local); - float3 axis = cross(curFwd, target); - float axisLen = length(axis); - - if (axisLen > EPS) - { - axis /= axisLen; - - float angle = acos(saturate(dot(curFwd, target))); - angle *= HeadAimWeight; - - float4 qAim = float4(axis * sin(angle * 0.5f), cos(angle * 0.5f)); - qAim = QuatNormalize(qAim); - - row_major float4x4 AimM = - MakeAffine(float3(1, 1, 1), qAim, float3(0, 0, 0)); - - M = mul(AimM, M); - } - } - } - - - - return M; - - - - - //return MakeAffine(S, R, T); + row_major float4x4 M = MakeAffine(S, R, T); + return ApplyHeadAim(bone, M); } + [numthreads(256, 1, 1)] void CS_LOCAL(uint3 DTid : SV_DispatchThreadID) { diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl new file mode 100644 index 000000000..aa5694dfa --- /dev/null +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl @@ -0,0 +1,88 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float DensityScale = 0.01f; + +Texture3D g_VolumeSRV : register(t0); + +RWTexture3D g_AccVolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float ConvertNdcZToDepth(float ndcZ); +float SliceTickness(float ndcZ, uint dimZ); +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness); +// 볼륨 텍스쳐 밀도, 산란 누적 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f); + uint3 Position = uint3(DispatchThreadID.xy, 0); + + [loop] + for (uint i = 0; i < dims.z; ++i) + { + Position.z = i; + float4 slice = g_VolumeSRV[Position]; + float tickness = SliceTickness((float)i / dims.z, dims.z); + + accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness); + g_AccVolumeUAV[Position] = accumulatedColor; + } +} + +float SliceTickness (float ndcZ, uint dimZ) +{ + return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ); +} + +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} + +float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness) +{ + sliceDensity = max(sliceDensity, 0.000001f); + sliceDensity *= DensityScale; + float sliceTransmittance = exp(-sliceDensity * tickness); + + // Frostbite의 누적 방식 + float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity; + + accumulatedLight += sliceLightIntegral * accumulatedTransmittance; + accumulatedTransmittance *= sliceTransmittance; + + return float4(accumulatedLight, accumulatedTransmittance); +} diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl new file mode 100644 index 000000000..b602fc1e4 --- /dev/null +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl @@ -0,0 +1,111 @@ +#include "Engine_Shader_Functions.hlsli" +#include "Engine_Shader_Defines.hlsli" + +static const float EPSILON = 1e-6f; + +struct LightData +{ + uint itype; + float3 vDirection; + + float3 vPosition; + float fRange; + + float4 vColor; +}; + +//StructuredBuffer g_LightBuffer : register(t1); + +RWTexture3D g_VolumeUAV : register(u0); + +cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함 +{ + uint3 VolumeSize; + float fDepthPackExponent; + + float fTemporalAccum; + float fFrameIndex; + float fNear; + float fFar; + + float3 vCameraPosition; + float fDensity; + + float fLightIntensity; + float3 vLightDirection; + + float4 vLightColor; + + row_major matrix InvProjMatrix; + row_major matrix InvViewMatrix; + + float fAsymmetryParameter; + float padding0; + float padding1; + float padding2; +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims); +float ConvertNdcZToDepth(float ndcZ); +float3 ConvertToWorldPosition(float3 ndc, float depth); +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims); +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy); + +// 볼륨 텍스쳐 밀도, 산란 계산 +[numthreads(8, 8, 4)] +void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID) +{ + uint3 dims; + g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z); + if (!all(DispatchThreadID < dims)) + return; + + float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims); + float3 toCamera = normalize(vCameraPosition - worldPosition); + + float3 lighting = vLightColor.rgb * vLightColor.a; + float3 lightDir = normalize(vLightDirection); + float3 toLight = -lightDir; + + float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter); + + lighting += vLightColor.rgb * vLightColor.rgb * phase; + + g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity); +} + +float3 ConvertThreadIdToNdc(uint3 id, uint3 dims) +{ + float3 ndc = id + 0.5f; + + ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z); + ndc += float3(-1.0f, 1.0f, 0.0f); + + return ndc; +} +float ConvertNdcZToDepth(float ndcZ) +{ + float t = pow(ndcZ, fDepthPackExponent); + return t * (fFar - fNear) + fNear; +} +float3 ConvertToWorldPosition(float3 ndc, float depth) +{ + float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix); + vViewRay /= vViewRay.w; + vViewRay /= vViewRay.z; + float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix); + return worldPosition.xyz; +} +float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims) +{ + float3 ndc = ConvertThreadIdToNdc(id, dims); + float depth = ConvertNdcZToDepth(ndc.z); + return ConvertToWorldPosition(ndc, depth); +} +float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter) +{ + float cosTheta = dot(vInputDir, vOutputDir); + + float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f); + return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON)); +} diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj index 7b2c71af3..1d215d3c5 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj @@ -331,6 +331,7 @@ call Update_Lib.bat + @@ -570,6 +571,7 @@ call Update_Lib.bat + @@ -647,6 +649,8 @@ call Update_Lib.bat Effect 5.0 + + Effect 5.0 diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters index d3601b1e1..f09c9f9a1 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters @@ -313,6 +313,9 @@ {a564976c-cade-4f34-85c8-891b28d96b93} + + {950977f0-f3c9-42f1-83f1-270b4bebf7ef} + @@ -597,6 +600,9 @@ 02.Element\02.Component\13.NPCStat + + 01.Utility\08.Volumetric + @@ -1247,6 +1253,9 @@ 02.Element\02.Component\13.NPCStat + + 01.Utility\08.Volumetric + @@ -1341,5 +1350,11 @@ 99.Define\01.SHADER + + 99.Define\01.SHADER + + + 99.Define\01.SHADER + \ No newline at end of file diff --git a/Jusin154_Team3D/Engine/Private/ComputeShader.cpp b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp index 8a6d629df..9c5ea8a5c 100644 --- a/Jusin154_Team3D/Engine/Private/ComputeShader.cpp +++ b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp @@ -173,8 +173,6 @@ ID3D11UnorderedAccessView* CComputeShader::GetOutputUAV(_uint iIndex) const return m_pOutputUAV[iIndex]; } - - void CComputeShader::Reset() { //다음 랜더링 패스에 연관되지 않도록 초기화 diff --git a/Jusin154_Team3D/Engine/Private/Fog.cpp b/Jusin154_Team3D/Engine/Private/Fog.cpp index 0f655776f..fb9b6a6a3 100644 --- a/Jusin154_Team3D/Engine/Private/Fog.cpp +++ b/Jusin154_Team3D/Engine/Private/Fog.cpp @@ -33,6 +33,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader) pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_bool)); pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV)); pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV)); + pShader->Bind_SRV("g_VolumeTexture", m_pGameInstance->Get_VolumeSRV()); } else { diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index 3a53bfa8f..3b7e82526 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -19,6 +19,7 @@ #include "Fog.h" #include "Resource_Manager.h" #include "Font_Manager.h" +#include "Volumetric.h" IMPLEMENT_SINGLETON(CGameInstance) @@ -115,6 +116,11 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De return E_FAIL; } + m_pVolumetric = CVolumetric::Create(*ppDevice, *ppContext); + if (nullptr == m_pVolumetric) { + return E_FAIL; + } + m_pFont_Manager = CFont_Manager::Create(*ppDevice, *ppContext); if (nullptr == m_pFont_Manager) { return E_FAIL; @@ -150,6 +156,8 @@ void CGameInstance::Update_Engine(_float fTimeDelta) m_pObject_Manager->Late_Update(fExcuteTimeDelta); + m_pVolumetric->Dispatch(); + m_pLevel_Manager->Update(fExcuteTimeDelta); m_pObject_Manager->Clear_DeadObj(); @@ -939,6 +947,10 @@ _float CGameInstance::Get_CameraFov() { return m_pCamera_Manager->Get_CameraFov(); } +_float CGameInstance::Get_CameraNear() +{ + return m_pCamera_Manager->Get_CameraNear(); +} const _float* CGameInstance::Get_CurrentCameraFar() { return m_pCamera_Manager->Get_CurrentCameraFar(); @@ -1284,8 +1296,27 @@ _float CGameInstance::FontSizeX(const _wstring& strFontTag, const _tchar* pText) return m_pFont_Manager->FontSizeX(strFontTag, pText); } + + #pragma endregion +#pragma region VOLUMETRIC +ID3D11ShaderResourceView* CGameInstance::Get_VolumeSRV() +{ + return m_pVolumetric->Get_VolumeSRV(); +} + +_float* CGameInstance::Get_DepthPackExponentPtr() +{ + return m_pVolumetric->Get_DepthPackExponentPtr(); +} + +void CGameInstance::Setting_Volumetirc(_float fDensity, _float fLightIntensity, _float fAsymmetryParameter, _float fDepthPackExponent) +{ + m_pVolumetric->Setting_Volumetirc(fDensity , fLightIntensity , fAsymmetryParameter, fDepthPackExponent); +} + +#pragma endregion void CGameInstance::Release_Engine() { SAFE_RELEASE(m_pThreadHolder); @@ -1302,6 +1333,7 @@ void CGameInstance::Release_Engine() SAFE_RELEASE(m_pKey_Manager); SAFE_RELEASE(m_pMouse_Manager); SAFE_RELEASE(m_pTimer_Manager); + SAFE_RELEASE(m_pVolumetric); SAFE_RELEASE(m_pRenderer); SAFE_RELEASE(m_pObject_Manager); SAFE_RELEASE(m_pPhysX_Manager); diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index 16c6be949..1362df56a 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -1710,7 +1710,7 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex) pDesc->RootBoneIndex = m_iRootBoneIndex; pDesc->PlayHeadBone = m_bHeadBone; pDesc->HeadBoneIndex = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)]; - pDesc->HeadAimWeight = 1.f; + pDesc->HeadAimWeight = m_fHeadAimWeight; if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] != -1) { _vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION)); diff --git a/Jusin154_Team3D/Engine/Private/NPCStat.cpp b/Jusin154_Team3D/Engine/Private/NPCStat.cpp index f3395ee51..fcb9499a4 100644 --- a/Jusin154_Team3D/Engine/Private/NPCStat.cpp +++ b/Jusin154_Team3D/Engine/Private/NPCStat.cpp @@ -16,9 +16,10 @@ CNPCStat::CNPCStat(const CNPCStat& rhs) HRESULT CNPCStat::Initialize_Prototype(tinyxml2::XMLNode* pChild) { auto pElement = pChild->ToElement(); + pElement->QueryIntAttribute("ID", &m_NpcInfo.iID); m_NpcInfo.pNpc_Name = CMyTools::ToWstring(pElement->Attribute("Name")); - pElement->QueryIntAttribute("OBJECTID", &m_NpcInfo.iNpcType); - pElement->QueryFloatAttribute("HP", &m_NpcInfo.fFontPos); + pElement->QueryIntAttribute("TAG", &m_NpcInfo.iNpcType); + pElement->QueryFloatAttribute("SizeX", &m_NpcInfo.fFontPos); return S_OK; } @@ -62,9 +63,9 @@ void CNPCStat::Free() void CNPCStat::Describe_Entity() { } - +#endif // _DEBUG CNPCStat::NPCINFO CNPCStat::Get_Stat() { return m_NpcInfo; } -#endif // _DEBUG + diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp index 46f9f77c6..011ef2521 100644 --- a/Jusin154_Team3D/Engine/Private/Renderer.cpp +++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp @@ -563,16 +563,23 @@ void CRenderer::Render_Fog() { COMPUTE_TIMEDELTA("Timer_Render_Fog"); EVENTSCOPE_("Render_Fog"); + + + if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_Texture"))) { + return; + } + m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::DEBUG)); + + m_pVIBuffer->Bind_Resources(); + m_pVIBuffer->Render(); + m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)); + m_pShader->Bind_RawValue("g_fDepthPackExponent", m_pGameInstance->Get_DepthPackExponentPtr(), sizeof(_float)); if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌 assert(false); } - if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_OriginalTexture"))) { - return; - } - if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) { return; } diff --git a/Jusin154_Team3D/Engine/Private/Volumetric.cpp b/Jusin154_Team3D/Engine/Private/Volumetric.cpp new file mode 100644 index 000000000..353da513a --- /dev/null +++ b/Jusin154_Team3D/Engine/Private/Volumetric.cpp @@ -0,0 +1,363 @@ +#include "pch.h" +#include "Volumetric.h" +#include "GameInstance.h" +#include "RenderEventDebugger.h" + +CVolumetric::CVolumetric(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : m_pDevice{ pDevice } + , m_pContext{ pContext } + , m_pGameInstance{ CGameInstance::GetInstance() } +{ + SAFE_ADDREF(m_pDevice); + SAFE_ADDREF(m_pContext); + SAFE_ADDREF(m_pGameInstance); +} + +HRESULT CVolumetric::Initialize() +{ + if (FAILED(CreateBlob())) + return E_FAIL; + + if (FAILED(CreateComputeShader())) + return E_FAIL; + + if (FAILED(CreateBuffers())) + return E_FAIL; + + if(FAILED(CreateResourceViews())) + return E_FAIL; + + return S_OK; +} + +void CVolumetric::Update() +{ + +} + +void CVolumetric::Cumpute_Volume() +{ + EVENTSCOPE_("Render_Cumpute_Volume"); + + D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {}; + + if (FAILED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource))) + { + MSG_BOX("Failed to Map : CVolumetric"); + } + else + { + CS_VOLUME_CONSTANT_DESC* pDesc = static_cast(ConstantSubResource.pData); + + pDesc->VolumeSize = { 160, 90, 128 }; + pDesc->fDepthPackExponent = m_fDepthPackExponent; + + pDesc->fTemporalAccum = 0.f; + pDesc->fFrameIndex = 0.f; + + pDesc->fNear = m_pGameInstance->Get_CameraNear(); + pDesc->fFar = *(m_pGameInstance->Get_CurrentCameraFar()); + + memcpy(&pDesc->vCameraPosition, m_pGameInstance->Get_CamPosition(), sizeof(_float3)); + pDesc->fDensity = m_fDensity; + pDesc->fLightIntensity = m_fLightIntensity; + + const LIGHT_DESC* pLightDesc = m_pGameInstance->Get_Light_Info(m_pGameInstance->Get_CurrentLevelID(), 0); + if(nullptr != pLightDesc) + { + memcpy(&pDesc->vLightDirection, pLightDesc->pDirection, sizeof(_float3)); + pDesc->vLightColor = pLightDesc->vDiffuse; + } + else + pDesc->vLightDirection = _float3(-0.5f, -0.5f, 0.f); + + XMStoreFloat4x4(&pDesc->InvProjMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ_INV)); + XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV)); + + pDesc->fAsymmetryParameter = m_fAsymmetryParameter; + pDesc->padding0 = 0.f; + pDesc->padding1 = 0.f; + pDesc->padding2 = 0.f; + + m_pContext->Unmap(m_pConstantBuffer, 0); + } + + //컴퓨트 쉐이더 바인딩 + m_pContext->CSSetShader(m_pCSVolumeCalculate, nullptr, 0); + m_pContext->CSSetConstantBuffers(0, 1, &m_pConstantBuffer); + + //SRV, UAV 바인딩 + m_pContext->CSSetUnorderedAccessViews(0, 1, &m_pVolumeUAV, nullptr); + + //컴퓨트 쉐이더 실행 + XMUINT3 vGroupCount = { (160 + 7) / 8, (90 + 7) / 8, (128 + 3) / 4 }; + m_pContext->Dispatch((_uint)vGroupCount.x, (_uint)vGroupCount.y, (_uint)vGroupCount.z); + + //m_pContext->CopyResource(ppBuffers[i], m_pOutputBuffer[i]); + + + ID3D11ShaderResourceView* nullSRV = { nullptr }; + ID3D11UnorderedAccessView* nullUAV = { nullptr }; + // Reset + //m_pContext->CSSetShaderResources(0, 1, &nullSRV); + m_pContext->CSSetUnorderedAccessViews(0, 1, &nullUAV, nullptr); + m_pContext->CSSetShader(nullptr, nullptr, 0); +} + +void CVolumetric::Accumulate_Volume() +{ + EVENTSCOPE_("Render_Accumulate_Volume"); + + //컴퓨트 쉐이더 바인딩 + m_pContext->CSSetShader(m_pCSVolumeAccumulate, nullptr, 0); + m_pContext->CSSetConstantBuffers(0, 1, &m_pConstantBuffer); + + //SRV, UAV 바인딩 + m_pContext->CSSetShaderResources(0, 1, &m_pVolumeSRV); + m_pContext->CSSetUnorderedAccessViews(0, 1, &m_pAccVolumeUAV, nullptr); + + //컴퓨트 쉐이더 실행 + XMUINT3 vGroupCount = { (160 + 7) / 8, (90 + 7) / 8, (128 + 3) / 4 }; + m_pContext->Dispatch((_uint)vGroupCount.x, (_uint)vGroupCount.y, (_uint)vGroupCount.z); + + ID3D11ShaderResourceView* nullSRV = { nullptr }; + ID3D11UnorderedAccessView* nullUAV = { nullptr }; + // Reset + m_pContext->CSSetShaderResources(0, 1, &nullSRV); + m_pContext->CSSetUnorderedAccessViews(0, 1, &nullUAV, nullptr); + m_pContext->CSSetShader(nullptr, nullptr, 0); +} + +HRESULT CVolumetric::Dispatch() +{ +#ifdef _DEBUG + Describe_Entity(); +#endif // _DEBUG + + Cumpute_Volume(); + + Accumulate_Volume(); + + return S_OK; + +} + +void CVolumetric::Setting_Volumetirc(_float fDensity, _float fLightIntensity, _float fAsymmetryParameter, _float fDepthPackExponent) +{ + m_fDensity = fDensity; + m_fLightIntensity = fLightIntensity; + m_fAsymmetryParameter = fAsymmetryParameter; + m_fDepthPackExponent = fDepthPackExponent; +} + +CVolumetric* CVolumetric::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CVolumetric* pInstance = new CVolumetric(pDevice, pContext); + + if (FAILED(pInstance->Initialize())) + { + MSG_BOX("Failed to Created : CVolumetric"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CVolumetric::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pConstantBuffer); + SAFE_RELEASE(m_pLightInfoBuffer); + + SAFE_RELEASE(m_pAccVolumeUAV); + SAFE_RELEASE(m_pAccVolumeSRV); + SAFE_RELEASE(m_pVolumeUAV); + SAFE_RELEASE(m_pVolumeSRV); + SAFE_RELEASE(m_pTexture3D); + SAFE_RELEASE(m_pAccumulateTexture3D); + + SAFE_RELEASE(m_pCSBlobCalculate); + SAFE_RELEASE(m_pCSVolumeCalculate); + SAFE_RELEASE(m_pCSVolumeAccumulate); + SAFE_RELEASE(m_pCSBlobAccumulate); + + SAFE_RELEASE(m_pDevice); + SAFE_RELEASE(m_pContext); + SAFE_RELEASE(m_pGameInstance); +} + +#ifdef _DEBUG +void CVolumetric::Describe_Entity() +{ + _bool open = true; + GUI::Begin("SYSTEM", &open, IMGUI_GLOBAL_BEGIN_FLAG); + if (GUI::CollapsingHeader("VOLUMETRIC")) { + GUI::SliderFloat("Density", &m_fDensity,0.01f, 5.f); + GUI::SliderFloat("LightIntensity", &m_fLightIntensity, 0.01f, 5.f); + GUI::SliderFloat("AsymmetryParameter", &m_fAsymmetryParameter, 0.01f, 5.f); + GUI::SliderFloat("DepthPackExponent", &m_fDepthPackExponent, 0.01f, 5.f); + } + GUI::End(); + + +} +#endif // _DEBUG + +HRESULT CVolumetric::CreateComputeShader() +{ + if (FAILED(m_pDevice->CreateComputeShader( + m_pCSBlobCalculate->GetBufferPointer(), // 컴파일된 쉐이더 코드 + m_pCSBlobCalculate->GetBufferSize(), // 코드 길이 + nullptr, // 클래스 인스턴스 (없음) + &m_pCSVolumeCalculate // 컴퓨트 쉐이더 객체 + ))) + return E_FAIL; + + if (FAILED(m_pDevice->CreateComputeShader( + m_pCSBlobAccumulate->GetBufferPointer(), + m_pCSBlobAccumulate->GetBufferSize(), + nullptr, + &m_pCSVolumeAccumulate + ))) + return E_FAIL; + + return S_OK; +} + +HRESULT CVolumetric::CreateBlob() +{ + UINT HLSLFlags = {}; +#ifdef _DEBUG + HLSLFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION; +#else + HLSLFlags = D3DCOMPILE_OPTIMIZATION_LEVEL1; +#endif // _DEBUG + + if(FAILED(D3DCompileFromFile(TEXT("../Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl"), + nullptr, + D3D_COMPILE_STANDARD_FILE_INCLUDE, + "CS_MAIN", + "cs_5_0", + HLSLFlags, + 0, + &m_pCSBlobCalculate, + nullptr))) + return E_FAIL; + + if (FAILED(D3DCompileFromFile(TEXT("../Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl"), + nullptr, + D3D_COMPILE_STANDARD_FILE_INCLUDE, + "CS_MAIN", + "cs_5_0", + HLSLFlags, + 0, + &m_pCSBlobAccumulate, + nullptr))) + return E_FAIL; + + return S_OK; +} + +HRESULT CVolumetric::CreateBuffers() +{ + //컨스턴트 버퍼 생성 + D3D11_BUFFER_DESC cbDesc = {}; + cbDesc.Usage = D3D11_USAGE_DYNAMIC; + cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; + cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; + cbDesc.ByteWidth = sizeof(CS_VOLUME_CONSTANT_DESC); + + D3D11_SUBRESOURCE_DATA CBInitialDesc = {}; + + if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer))) + return E_FAIL; + + D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {}; + + if (FAILED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource))) + { + MSG_BOX("Failed to Map : CVolumetric"); + } + else + { + CS_VOLUME_CONSTANT_DESC* pDesc = static_cast(ConstantSubResource.pData); + + pDesc->VolumeSize = { 160, 90, 128 }; + pDesc->fDepthPackExponent = m_fDepthPackExponent; + + pDesc->fTemporalAccum = 0.f; + pDesc->fFrameIndex = 0.f; + + pDesc->fNear = m_pGameInstance->Get_CameraNear(); + pDesc->fFar = *(m_pGameInstance->Get_CurrentCameraFar()); + + memcpy(&pDesc->vCameraPosition, m_pGameInstance->Get_CamPosition(), sizeof(_float3)); + pDesc->fDensity = m_fDensity; + pDesc->fLightIntensity = m_fLightIntensity; + + // GetLingtInfo .................... + pDesc->vLightDirection = _float3(0.f, 0.577f, 0.f); + pDesc->vLightColor = _float4(1.f, 1.f, 1.f, 1.f); + + XMStoreFloat4x4(&pDesc->InvProjMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ_INV)); + XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV)); + + pDesc->fAsymmetryParameter = 0.0f; + pDesc->padding0 = 0.f; + pDesc->padding1 = 0.f; + pDesc->padding2 = 0.f; + + m_pContext->Unmap(m_pConstantBuffer, 0); + } + + return S_OK; +} + +HRESULT CVolumetric::CreateResourceViews() +{ + D3D11_TEXTURE3D_DESC TextureDesc{}; + + TextureDesc.Width = 160; + TextureDesc.Height = 90; + TextureDesc.Depth = 128; // 64 or 128 + TextureDesc.MipLevels = 1; + TextureDesc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + TextureDesc.Usage = D3D11_USAGE_DEFAULT; + TextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS; + TextureDesc.CPUAccessFlags = 0; + TextureDesc.MiscFlags = 0; + + if (FAILED(m_pDevice->CreateTexture3D(&TextureDesc, nullptr, &m_pTexture3D))) { + return E_FAIL; + } + + if (FAILED(m_pDevice->CreateTexture3D(&TextureDesc, nullptr, &m_pAccumulateTexture3D))) { + return E_FAIL; + } + + if (FAILED(m_pDevice->CreateShaderResourceView(m_pTexture3D, nullptr, &m_pVolumeSRV))) { + return E_FAIL; + } + + if (FAILED(m_pDevice->CreateShaderResourceView(m_pAccumulateTexture3D, nullptr, &m_pAccVolumeSRV))) { + return E_FAIL; + } + + D3D11_UNORDERED_ACCESS_VIEW_DESC UAV_Decs{}; + + UAV_Decs.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D; + UAV_Decs.Format = DXGI_FORMAT_R16G16B16A16_FLOAT; + UAV_Decs.Texture3D.FirstWSlice = 0; + UAV_Decs.Texture3D.MipSlice = 0; + UAV_Decs.Texture3D.WSize = TextureDesc.Depth; + + if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pTexture3D, &UAV_Decs, &m_pVolumeUAV))) + return E_FAIL; + + if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pAccumulateTexture3D, &UAV_Decs, &m_pAccVolumeUAV))) + return E_FAIL; + + return S_OK; +} + diff --git a/Jusin154_Team3D/Engine/Public/Camera_Manager.h b/Jusin154_Team3D/Engine/Public/Camera_Manager.h index c992083e1..e599912ee 100644 --- a/Jusin154_Team3D/Engine/Public/Camera_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Camera_Manager.h @@ -18,6 +18,7 @@ class CCamera_Manager final : public CBase HRESULT IsBinded_Camera(const _wstring& wstrCameraKey); _vector Get_CameraLook(); _float Get_CameraFov(); + _float Get_CameraNear() const { return m_fNear; } void Force_CamPosition(_fvector vPos); @@ -35,6 +36,7 @@ class CCamera_Manager final : public CBase _wstring m_wstrCurrentCameraKey = {}; _float m_fFar = 500.f; + _float m_fNear = 0.1f; private: HRESULT Initialize(_uint iLevelNumber); diff --git a/Jusin154_Team3D/Engine/Public/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 978624970..7ffe06d36 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -196,6 +196,7 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT IsBinded_Camera(const _wstring& strCameraKey); _vector Get_CameraLook(); _float Get_CameraFov(); + _float Get_CameraNear(); const _float* Get_CurrentCameraFar(); void Force_CamPosition(_fvector vPos); #pragma endregion @@ -265,6 +266,12 @@ class ENGINE_DLL CGameInstance final : public CBase _float FontSizeX(const _wstring& strFontTag, const _tchar* pText); #pragma endregion +#pragma region VOLUMETRIC + ID3D11ShaderResourceView* Get_VolumeSRV(); + _float* Get_DepthPackExponentPtr(); + void Setting_Volumetirc(_float fDensity, _float fLightIntensity, _float fAsymmetryParameter, _float fDepthPackExponent); +#pragma endregion + public: void Add_ModelToMap(const _char* filePath, CModel* pModel); @@ -304,6 +311,7 @@ class ENGINE_DLL CGameInstance final : public CBase class CFog* m_pFog = { nullptr }; class CResource_Manager* m_pResource_Manager = { nullptr }; class CFont_Manager* m_pFont_Manager = { nullptr }; + class CVolumetric* m_pVolumetric = { nullptr }; mt19937 m_Rng{ random_device{}() }; _float2 m_vViewPortSize = {}; diff --git a/Jusin154_Team3D/Engine/Public/Instance_Model.h b/Jusin154_Team3D/Engine/Public/Instance_Model.h index 9eac36571..50fe8e1a0 100644 --- a/Jusin154_Team3D/Engine/Public/Instance_Model.h +++ b/Jusin154_Team3D/Engine/Public/Instance_Model.h @@ -275,6 +275,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent HRESULT Bind_CS_Output(_uint Index, _uint iBufferIndex); public: void Set_TimeMult(_float fTimeMult) { m_InstanceDesc.fTimeMult = fTimeMult; } + void Set_Loop(_bool isLoop) { m_InstanceDesc.isLoop = isLoop; } private: bool LoadData(const _char* filename); diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h index 260168000..6aa29ae45 100644 --- a/Jusin154_Team3D/Engine/Public/Model.h +++ b/Jusin154_Team3D/Engine/Public/Model.h @@ -51,6 +51,8 @@ class ENGINE_DLL CModel final : public CComponent void Set_TargetPos(_vector vTargetPos) { m_vTargetPos = vTargetPos; } void Set_HeadPos(_vector vHeadPos) { m_vHeadPos = vHeadPos; } void Play_HeadBone(_bool bPlay) { m_bHeadBone = bPlay; } + void Set_HeadAimWeight(_float fWeight) { m_fHeadAimWeight = fWeight; } + _bool Get_PlayHeadBone() const { return m_bHeadBone; } #pragma endregion #pragma region Animation _bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌 @@ -177,21 +179,21 @@ class ENGINE_DLL CModel final : public CComponent vector<_bool> m_CPUBoneMask; // 바이너리 - SaveModel* m_pSaveModel = { nullptr }; + SaveModel* m_pSaveModel = { nullptr }; // - vector<_float4x4> m_BoneMatrix; + vector<_float4x4> m_BoneMatrix; - _float3 m_vPrevRootPos = { 0.f, 0.f, 0.f }; - _float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f }; - _matrix m_BoneTransformationMatrix = {}; - _float4 m_vInitialRootRot = {}; + _float3 m_vPrevRootPos = { 0.f, 0.f, 0.f }; + _float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f }; + _matrix m_BoneTransformationMatrix = {}; + _float4 m_vInitialRootRot = {}; - _float m_fRadius = { 0.f }; // 컬링용 Radius - _int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스 - _int m_iIndexAnimPlayableMesh = { -1 }; - _vector m_vector[3]; + _float m_fRadius = { 0.f }; // 컬링용 Radius + _int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스 + _int m_iIndexAnimPlayableMesh = { -1 }; + _vector m_vector[3]; vector<_uint> m_iBoneMask; _bool m_bInitialRootPos = { false }; @@ -206,6 +208,7 @@ class ENGINE_DLL CModel final : public CComponent _vector m_vTargetPos = XMVectorZero(); _vector m_vHeadPos = XMVectorZero(); _bool m_bHeadBone = { false }; + _float m_fHeadAimWeight = { 0.f }; private: diff --git a/Jusin154_Team3D/Engine/Public/NPCStat.h b/Jusin154_Team3D/Engine/Public/NPCStat.h index 2789745eb..97ab4669c 100644 --- a/Jusin154_Team3D/Engine/Public/NPCStat.h +++ b/Jusin154_Team3D/Engine/Public/NPCStat.h @@ -8,6 +8,7 @@ class ENGINE_DLL CNPCStat final : public CComponent { typedef struct tagNpcInfo { + _int iID{}; _wstring pNpc_Name; _int iNpcType{}; _float fFontPos{}; diff --git a/Jusin154_Team3D/Engine/Public/Volumetric.h b/Jusin154_Team3D/Engine/Public/Volumetric.h new file mode 100644 index 000000000..7bd847a2b --- /dev/null +++ b/Jusin154_Team3D/Engine/Public/Volumetric.h @@ -0,0 +1,101 @@ +#pragma once + +#include "Base.h" +#include "RenderEventDebugger.h" +NS_BEGIN(Engine) + +class CVolumetric final : public CBase +{ + typedef struct tagCSVolumeConstantDesc + { + XMUINT3 VolumeSize; + _float fDepthPackExponent; // 깊이 비선형 분포 지수 2.0 정도 + + _float fTemporalAccum; // Temporal 사용 여부 off :0 /On: 1 + _float fFrameIndex; + _float fNear; + _float fFar; + + _float3 vCameraPosition; + _float fDensity; + + _float fLightIntensity; + _float3 vLightDirection; + + _float4 vLightColor; + + _float4x4 InvProjMatrix; + _float4x4 InvViewMatrix; + + _float fAsymmetryParameter; + _float padding0; + _float padding1; + _float padding2; + }CS_VOLUME_CONSTANT_DESC; + + +private: + CVolumetric(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual ~CVolumetric() = default; + +public: + HRESULT Initialize(); + void Update(); + void Cumpute_Volume(); + void Accumulate_Volume(); + HRESULT Dispatch(); + + ID3D11ShaderResourceView* Get_VolumeSRV() { return m_pAccVolumeSRV; } + _float* Get_DepthPackExponentPtr() { return &m_fDepthPackExponent; } + + void Setting_Volumetirc(_float fDensity , _float fLightIntensity, _float fAsymmetryParameter , _float fDepthPackExponent); +private: + class CGameInstance* m_pGameInstance = { nullptr }; + ID3D11Device* m_pDevice = { nullptr }; + ID3D11DeviceContext* m_pContext = { nullptr }; + ID3D11Texture3D* m_pTexture3D = { nullptr }; + ID3D11Texture3D* m_pAccumulateTexture3D = { nullptr }; + + ID3D11ShaderResourceView* m_pVolumeSRV = {nullptr}; + ID3D11UnorderedAccessView* m_pVolumeUAV = { nullptr }; + + ID3D11ShaderResourceView* m_pAccVolumeSRV = {nullptr}; + ID3D11UnorderedAccessView* m_pAccVolumeUAV = { nullptr }; + + ID3D11Buffer* m_pConstantBuffer = { nullptr }; + ID3D11Buffer* m_pLightInfoBuffer = { nullptr }; + + ID3D11ComputeShader* m_pCSVolumeCalculate = { nullptr }; + ID3DBlob* m_pCSBlobCalculate = { nullptr }; + + ID3D11ComputeShader* m_pCSVolumeAccumulate = { nullptr }; + ID3DBlob* m_pCSBlobAccumulate = { nullptr }; + + _float m_fDensity = { 0.5f }; + _float m_fLightIntensity = { 1.f }; + _float m_fAsymmetryParameter = { 0.2f }; + _float m_fDepthPackExponent = { 2.f }; + +#ifdef _DEBUG + class CRenderEventDebugger m_AnnotationHelper = {}; + +#endif // _DEBUG + + +private: + HRESULT CreateComputeShader(); + HRESULT CreateBlob(); + HRESULT CreateBuffers(); + HRESULT CreateResourceViews(); + +public: + static CVolumetric* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual void Free(); + +#ifdef _DEBUG + void Describe_Entity(); +#endif // _DEBUG + +}; + +NS_END