diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/NomalSmoke.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/NomalSmoke.bin index 8f9213d08..6d34d30df 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/NomalSmoke.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/NomalSmoke.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c950def68a4ebfe689e9190574d7a474726fd239871e428ebcad02dadeb4bc18 +oid sha256:fbb5a0c4ac4ac92472e290518a55aed3a0fcbecb82a1ed9b216048ec8ec2e6c1 size 1081 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/Rock_PT_15.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/Rock_PT_15.bin index 33eccd1f6..5cdad11d7 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/Rock_PT_15.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollNomalSmoke/Rock_PT_15.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56a43ac7ebafc5e38d85c58a33fa5007bfa8ac6b2ff1ab3abb6394e723707b85 +oid sha256:63f6f81087a07cb00f8b487dd2820270c4794a1387b4ed13d8c937e027acd6e7 size 1023 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollSwing/Rock_PT_25.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollSwing/Rock_PT_25.bin index f419ec2bc..39a5eb571 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollSwing/Rock_PT_25.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Troll/TrollSwing/Rock_PT_25.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d3e451d893a7c2979e9844c4dcf50f23b5b118d5c4ffda9f1947a1a46843997f -size 1023 +oid sha256:86ddfc69f4752004c34ba936aac4548a6596bea57fbcf36bc1e60eac2bf95111 +size 1031 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl index 74b2e59f7..bd75f7635 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl @@ -43,9 +43,12 @@ struct ParticleValue float3 vDeltaSize; float2 vDelay; + bool isCompareStop; float fCollisionTime; float fDropAttenuation; + + float3 vVelocity; }; @@ -108,6 +111,8 @@ void CS_MAIN( float fGravity = particleValue.fGravity; float fOnlyDropY = 0.f; + float fRatio = particle.vLifeTime.x / particle.vLifeTime.y; + particleValue.vDelay.x += fTimeDelta; if (particleValue.vDelay.x < particleValue.vDelay.y) @@ -144,8 +149,14 @@ void CS_MAIN( if (particle.vLifeTime.x >= particle.vLifeTime.y) { + particleValue.isCompareStop = false; + particleValue.fCollisionTime = 0.f; + if (isLoop == false) { + g_VBInstanceOutput[iIndex] = particle; + g_ParticleValueOutput[iIndex] = particleValue; + return ; } //초기화 @@ -157,8 +168,7 @@ void CS_MAIN( particle.vLifeTime.x = 0.f; particleValue.vAniIndex.x = 0.f; particleValue.vDelay.x = 0.f; - particleValue.isCompareStop = false; - particleValue.fCollisionTime = 0.f; + g_VBInstanceOutput[iIndex] = particle; g_ParticleValueOutput[iIndex] = particleValue; @@ -168,17 +178,11 @@ void CS_MAIN( if (isDrop == true) - { + { if (particleValue.isCompareStop == true) // 지면에 부딪혔을 때 { - // 내 현재 시간의 비례 - // 0.0 ~ 3 - // 2초에 부딧혓으면 - // 2 - 2 / 3 - 2 - // 0 ~ 1 cos(0) * - 1 - - float fRatio = saturate((particle.vLifeTime.x - particleValue.fCollisionTime) / (particle.vLifeTime.y - particleValue.fCollisionTime)); + fRatio = saturate((particle.vLifeTime.x - particleValue.fCollisionTime) / (particle.vLifeTime.y - particleValue.fCollisionTime)); fGravity *= (2.f * fRatio - 1.f) / particleValue.fDropAttenuation; } @@ -187,8 +191,7 @@ void CS_MAIN( fOnlyDropY = particle.vTranslation.y; } - - + if (isMoveForward) { float fTime = (particle.vLifeTime.x / particle.vLifeTime.y); @@ -274,7 +277,7 @@ void CS_MAIN( } - if (isDetphCompareStop) + if (isDetphCompareStop == true) { float2 vTexcoord; @@ -301,7 +304,7 @@ void CS_MAIN( float fOldViewZ = vDepthDesc.y * fFar; - if (vProjPos.w >= fOldViewZ && particle.vLifeTime.x >= 0.3f) + if (vProjPos.w >= fOldViewZ && particle.vLifeTime.x >= 0.2f) { if (particleValue.isCompareStop == false) { @@ -319,6 +322,10 @@ void CS_MAIN( } + /*가속력*/ + if (length(particleValue.vVelocity) > FLT_EPSILON5) + particle.vTranslation.xyz += fRatio * particleValue.vVelocity; + if (isSizeMove == true) { float3 CurLength = diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl index 87fde2ea8..83525fbfa 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl @@ -35,6 +35,9 @@ struct ParticleValue bool isCompareStop; float fCollisionTime; float fDropAttenuation; + + float3 vVelocity; + }; diff --git a/Jusin154_Team3D/Editor/Private/EditEffect.cpp b/Jusin154_Team3D/Editor/Private/EditEffect.cpp index 5656290eb..07c5b6615 100644 --- a/Jusin154_Team3D/Editor/Private/EditEffect.cpp +++ b/Jusin154_Team3D/Editor/Private/EditEffect.cpp @@ -421,7 +421,7 @@ void CEditEffect::Describe_Entity() //여기서 모델, 텍스쳐, 선택할 수 있도록 함 const char* pLerp[] = { "Linear" , "EaseInQuad", "EaseOutQuad", "EaseInCubic" , "EaseOutCubic" , "EaseInOutSin" , "EaseInBack" , "Expo" , "Circle" }; - const char* pRenderNames[] = { "PRIORITY" , "SHADOW", "NONBLEND", "DECAL", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" ,"BLOOM" , "UI", "OCCLUSION" , "PRESHADOW"}; + const char* pRenderNames[] = { "PRIORITY" , "SHADOW", "NONBLEND", "DECAL", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" ,"BLOOM" , "UI", "OCCLUSION" , "PRESHADOW", "UI_OVERLAY"}; 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" }; const char* pBloomType[] = { "NONE" , "BASIC" , "MUILTY"}; diff --git a/Jusin154_Team3D/Editor/Private/Monster.cpp b/Jusin154_Team3D/Editor/Private/Monster.cpp index bb8b159a5..5132f867a 100644 --- a/Jusin154_Team3D/Editor/Private/Monster.cpp +++ b/Jusin154_Team3D/Editor/Private/Monster.cpp @@ -171,6 +171,23 @@ void CMonster::Free() void CMonster::Describe_Entity() { + _bool isToggle = { true }; + + if (ImGui::TreeNode("ANIM STATE")) { + + for (auto& pState : m_States) + { + if (ImGui::Button(to_string(pState.first).c_str())) + { + m_pFSM->Change_State(pState.first); + } + + } + + GUI::Text(to_string(m_pModelCom->Get_CurrentTrackProgressRatio()).c_str()); + + ImGui::TreePop(); + } } #endif // _DEBUG diff --git a/Jusin154_Team3D/Editor/Private/TrailObject.cpp b/Jusin154_Team3D/Editor/Private/TrailObject.cpp index 12fbd1dcf..ece375502 100644 --- a/Jusin154_Team3D/Editor/Private/TrailObject.cpp +++ b/Jusin154_Team3D/Editor/Private/TrailObject.cpp @@ -484,7 +484,7 @@ void CTrailObject::Free() void CTrailObject::Describe_Entity() { - const char* pRenderNames[] = { "PRIORITY" , "SHADOW", "NONBLEND", "DECAL", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" ,"BLOOM" , "UI", "OCCLUSION" , "PRESHADOW" }; + const char* pRenderNames[] = { "PRIORITY" , "SHADOW", "NONBLEND", "DECAL", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" ,"BLOOM" , "UI", "OCCLUSION" , "PRESHADOW" , "UI_OVERLAY"}; const char* pEffectType[] = { "EFFECT" , "TRAIL" }; const char* pShaderPass[] = { "DEFAULT" , "SCISSOR" , "UI" , "UVMOVE" , "TRAIL" , "TRAIL_BLEND" , "TRAILWB_FOR_BLEND" , "TRAIL_BLUR", "TRAIL_BLOOM" }; const char* pBloomType[] = { "NONE" , "BASIC" , "MUILTY" }; diff --git a/Jusin154_Team3D/Editor/Private/Troll.cpp b/Jusin154_Team3D/Editor/Private/Troll.cpp index 0fe00881a..34ad753b6 100644 --- a/Jusin154_Team3D/Editor/Private/Troll.cpp +++ b/Jusin154_Team3D/Editor/Private/Troll.cpp @@ -8,6 +8,7 @@ #include "EditEffect.h" #include "EffectPool.h" #include "Layer.h" +#include "TrailObject.h" #pragma region STATE #include "State_Idle.h" @@ -67,6 +68,9 @@ HRESULT CTroll::Initialize(void* pArg) m_pEffectPool = m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_EffectPool"))->Get_Object(); SAFE_ADDREF(m_pEffectPool); + m_pLeftHand_BoneMat = m_pModelCom->Get_BoneMatrixPtr("LeftHand"); + m_pRightHand_BoneMat = m_pModelCom->Get_BoneMatrixPtr("RightHand"); + return S_OK; } @@ -112,6 +116,27 @@ void CTroll::Update(_float fTimeDelta) m_fSkillCoolTime[i] = max(0.f, m_fSkillCoolTime[i] - fTimeDelta); +#pragma region TRAIL_UPDATE + + _matrix WorldMat = m_pTransformCom->Get_XMWorldMatrix(); + + _matrix LeftHandMatrix = {}; + _matrix RightHandMatrix = {}; + + LeftHandMatrix = XMLoadFloat4x4(m_pLeftHand_BoneMat); + RightHandMatrix = XMLoadFloat4x4(m_pRightHand_BoneMat); + + for (int i = 0; i < 3; ++i) { + LeftHandMatrix.r[i] = XMVector3Normalize(LeftHandMatrix.r[i]); + RightHandMatrix.r[i] = XMVector3Normalize(RightHandMatrix.r[i]); + } + + + m_pLeftTrail->Trail_Update(LeftHandMatrix * WorldMat, fTimeDelta); + m_pRightTrail->Trail_Update(RightHandMatrix * WorldMat, fTimeDelta); + +#pragma endregion + } void CTroll::Late_Update(_float fTimeDelta) @@ -357,6 +382,20 @@ HRESULT CTroll::Ready_Parts() m_pLeft_Smoke->Load("../Bin/Resources/Data/Effect/Troll/TrollSide/Troll_Smoke", static_cast(NEXT_LEVEL)); m_pLeft_Smoke->FollowParants(m_pModelCom->Get_BoneMatrixPtr("LeftArm")); + + if (FAILED(Add_PartObject("Left_Trail", NEXT_LEVEL, &m_pLeftTrail, &PartsDesc))) { + return E_FAIL; + } + ; + + m_pLeftTrail->Load_Trail("../Bin/Resources/Data/Effect/Troll/TrollSide/Troll_Trail", static_cast(NEXT_LEVEL)); + + if (FAILED(Add_PartObject("Right_Trail", NEXT_LEVEL, &m_pRightTrail, &PartsDesc))) { + return E_FAIL; + } + + m_pRightTrail->Load_Trail("../Bin/Resources/Data/Effect/Troll/TrollSide/Troll_Trail", static_cast(NEXT_LEVEL)); + #pragma endregion return S_OK; } @@ -423,38 +462,15 @@ void CTroll::Free() SAFE_RELEASE(m_pTroll_Particle2); SAFE_RELEASE(m_pRight_Smoke); SAFE_RELEASE(m_pLeft_Smoke); - SAFE_RELEASE(m_pEffectPool); + SAFE_RELEASE(m_pEffectPool); + SAFE_RELEASE(m_pLeftTrail); + SAFE_RELEASE(m_pRightTrail); } #ifdef _DEBUG void CTroll::Describe_Entity() { - GUI::Begin("Troll"); - - GUI::Checkbox("LookAt", &m_bLookAt); - - string AnimList = m_pModelCom->Get_AnimList(m_pModelCom->Get_AnimIndex()); - GUI::Text(AnimList.c_str()); - - GUI::Text("AnimTrack %.2f", m_pModelCom->Get_CurrentTrackPosition()); - GUI::Text("AnimRatio %.2f", m_pModelCom->Get_CurrentTrackProgressRatio()); - - _float4 vMomentum = {}; - XMStoreFloat4(&vMomentum, m_pTransformCom->Get_CurrentMomentum()); - GUI::Text("%.2f %.2f %.2f %.2f ", vMomentum.x, vMomentum.y, vMomentum.z, vMomentum.w); - - _float3 Pos; - XMStoreFloat3(&Pos, Get_WorldPostion()); - - if (GUI::DragFloat3("Pos",(_float*)&Pos)) - { - m_pCharacter_Controller->Set_Position(XMLoadFloat3(&Pos)); - } - GUI::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Degree %.2f", m_fDegree); - GUI::TextColored(ImVec4(1.f, 0.f, 0.f, 1.f), "Distance %.2f", m_fTargetDistance); - - GUI::End(); - + __super::Describe_Entity(); } #endif // _DEBUG diff --git a/Jusin154_Team3D/Editor/Private/TrollSwing.cpp b/Jusin154_Team3D/Editor/Private/TrollSwing.cpp index 6c9c6a0e5..f669901ac 100644 --- a/Jusin154_Team3D/Editor/Private/TrollSwing.cpp +++ b/Jusin154_Team3D/Editor/Private/TrollSwing.cpp @@ -39,7 +39,7 @@ HRESULT CTrollSwing::Initialize(void* pArg) m_wstrEffectName = L"TrollSwing"; - m_fDuration = 1.5f; + m_fDuration = 3.2f; return S_OK; } @@ -85,8 +85,8 @@ HRESULT CTrollSwing::Pre_Setting(CGameObject* pObject, void* pArg) CEditEffect* pRockPT = Get_PartObject("Rock_PT_25"); CEditEffect* pSmoke = Get_PartObject("Smoke"); - pRockPT->Get_Component()->Set_State(STATE::POSITION, vPos); - pSmoke->Get_Component()->Set_State(STATE::POSITION, vPos); + pRockPT->Get_Component()->Set_State(STATE::POSITION, vPos + XMVectorSet(0.f, 0.5f, 0.f, 0.f)); + pSmoke->Get_Component()->Set_State(STATE::POSITION, vPos + XMVectorSet(0.f, 0.2f, 0.f, 0.f)); pRockPT->Set_Visible(true); diff --git a/Jusin154_Team3D/Editor/Private/Troll_Nomal_Smoke.cpp b/Jusin154_Team3D/Editor/Private/Troll_Nomal_Smoke.cpp index 1e338b5a8..317dfaee3 100644 --- a/Jusin154_Team3D/Editor/Private/Troll_Nomal_Smoke.cpp +++ b/Jusin154_Team3D/Editor/Private/Troll_Nomal_Smoke.cpp @@ -39,7 +39,7 @@ HRESULT CTroll_Nomal_Smoke::Initialize(void* pArg) m_wstrEffectName = L"Troll_Nomal_Smoke"; - m_fDuration = 1.f; + m_fDuration = 2.5f; return S_OK; } @@ -84,8 +84,9 @@ HRESULT CTroll_Nomal_Smoke::Pre_Setting(CGameObject* pObject, void* pArg) CEditEffect* pRockPT = Get_PartObject("Rock_PT_15"); CEditEffect* pSmoke = Get_PartObject("NomalSmoke"); - pRockPT->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&vPos)); - pSmoke->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&vPos)); + + pRockPT->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&vPos) + XMVectorSet(0.f , 0.2f ,0.f, 0.f) ); + pSmoke->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&vPos) + XMVectorSet(0.f, 0.2f, 0.f, 0.f)); pRockPT->Set_Visible(true); pSmoke->Set_Visible(true); diff --git a/Jusin154_Team3D/Editor/Private/Troll_States.cpp b/Jusin154_Team3D/Editor/Private/Troll_States.cpp index 2231cfa56..da5d6af2a 100644 --- a/Jusin154_Team3D/Editor/Private/Troll_States.cpp +++ b/Jusin154_Team3D/Editor/Private/Troll_States.cpp @@ -49,16 +49,48 @@ void CTroll::Behavior_IdleBreakEnter() _int RandIndex = m_pGameInstance->Real_Random_Int(0, 3); switch (RandIndex) { - case 0: + case 0: //땅 두번구르기 왼발 오른발 pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK1]; + + Add_Event(pairAnimInfo.first, [this]() { + + _matrix HandMat = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("IK_LeftFoot")) * m_pTransformCom->Get_XMWorldMatrix(); + + _float4 vPosition = {}; + XMStoreFloat4(&vPosition, HandMat.r[3]); + + m_pEffectPool->Use_Skill(SKILL_TYPE::TROLL_NOMAL_SMOKE, this, &vPosition); + }, 0.3f); + + Add_Event(pairAnimInfo.first, [this]() { + + _matrix HandMat = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("IK_RightFoot")) * m_pTransformCom->Get_XMWorldMatrix(); + + _float4 vPosition = {}; + XMStoreFloat4(&vPosition, HandMat.r[3]); + + m_pEffectPool->Use_Skill(SKILL_TYPE::TROLL_NOMAL_SMOKE, this, &vPosition); + }, 0.7f); + break; - case 1: + case 1:// 방망이 pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK2]; break; - case 2: + case 2: // 발구르기 pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK3]; + + Add_Event(pairAnimInfo.first, [this]() { + + _matrix HandMat = XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("IK_RightFoot")) * m_pTransformCom->Get_XMWorldMatrix(); + + _float4 vPosition = {}; + XMStoreFloat4(&vPosition, HandMat.r[3]); + + m_pEffectPool->Use_Skill(SKILL_TYPE::TROLL_NOMAL_SMOKE, this, &vPosition); + }, 0.2f); + break; - case 3: + case 3: //소리지르기 pairAnimInfo = m_Animation[STATEANIM::IDLE_BREAK4]; break; } @@ -404,7 +436,7 @@ void CTroll::Behavior_SlamEnter() Add_Event(m_Animation[STATEANIM::SLAM].first, [this]() { m_pEffectPool->Use_Skill(SKILL_TYPE::TROLL_ATTACK, this); - } , 0.6f); + } , 0.3f); } HRESULT CTroll::Behavior_SlamExitCheck(_float fTimeDelta) diff --git a/Jusin154_Team3D/Editor/Public/Monster.h b/Jusin154_Team3D/Editor/Public/Monster.h index 6e51eeaec..bb03f7c3a 100644 --- a/Jusin154_Team3D/Editor/Public/Monster.h +++ b/Jusin154_Team3D/Editor/Public/Monster.h @@ -24,8 +24,8 @@ class CMonster abstract : public CUnit protected: class CInfoInstance* m_pInfoInstance = { nullptr }; - CUnit* m_pTarget = { nullptr }; - CStat* m_pStat = { nullptr }; + CUnit* m_pTarget = { nullptr }; + CStat* m_pStat = { nullptr }; _float4 m_vTargetPos = { }; _float3 m_vToTargetDir = { }; _float m_fTargetDistance = { FLT_MAX }; @@ -42,8 +42,7 @@ class CMonster abstract : public CUnit virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr)PURE; virtual void Free() override; #ifdef _DEBUG - virtual void Describe_Entity() override; - + virtual void Describe_Entity(); #endif // _DEBUG }; diff --git a/Jusin154_Team3D/Editor/Public/Troll.h b/Jusin154_Team3D/Editor/Public/Troll.h index a33e219aa..0796a7e4b 100644 --- a/Jusin154_Team3D/Editor/Public/Troll.h +++ b/Jusin154_Team3D/Editor/Public/Troll.h @@ -48,6 +48,12 @@ class CTroll final : public CMonster class CEditEffect* m_pTroll_Particle = { nullptr }; class CEditEffect* m_pTroll_Particle2 = { nullptr }; + class CTrailObject* m_pLeftTrail = {}; + class CTrailObject* m_pRightTrail = {}; + + const _float4x4* m_pLeftHand_BoneMat = { nullptr }; + const _float4x4* m_pRightHand_BoneMat = { nullptr }; + private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl index 74b2e59f7..bd75f7635 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl @@ -43,9 +43,12 @@ struct ParticleValue float3 vDeltaSize; float2 vDelay; + bool isCompareStop; float fCollisionTime; float fDropAttenuation; + + float3 vVelocity; }; @@ -108,6 +111,8 @@ void CS_MAIN( float fGravity = particleValue.fGravity; float fOnlyDropY = 0.f; + float fRatio = particle.vLifeTime.x / particle.vLifeTime.y; + particleValue.vDelay.x += fTimeDelta; if (particleValue.vDelay.x < particleValue.vDelay.y) @@ -144,8 +149,14 @@ void CS_MAIN( if (particle.vLifeTime.x >= particle.vLifeTime.y) { + particleValue.isCompareStop = false; + particleValue.fCollisionTime = 0.f; + if (isLoop == false) { + g_VBInstanceOutput[iIndex] = particle; + g_ParticleValueOutput[iIndex] = particleValue; + return ; } //초기화 @@ -157,8 +168,7 @@ void CS_MAIN( particle.vLifeTime.x = 0.f; particleValue.vAniIndex.x = 0.f; particleValue.vDelay.x = 0.f; - particleValue.isCompareStop = false; - particleValue.fCollisionTime = 0.f; + g_VBInstanceOutput[iIndex] = particle; g_ParticleValueOutput[iIndex] = particleValue; @@ -168,17 +178,11 @@ void CS_MAIN( if (isDrop == true) - { + { if (particleValue.isCompareStop == true) // 지면에 부딪혔을 때 { - // 내 현재 시간의 비례 - // 0.0 ~ 3 - // 2초에 부딧혓으면 - // 2 - 2 / 3 - 2 - // 0 ~ 1 cos(0) * - 1 - - float fRatio = saturate((particle.vLifeTime.x - particleValue.fCollisionTime) / (particle.vLifeTime.y - particleValue.fCollisionTime)); + fRatio = saturate((particle.vLifeTime.x - particleValue.fCollisionTime) / (particle.vLifeTime.y - particleValue.fCollisionTime)); fGravity *= (2.f * fRatio - 1.f) / particleValue.fDropAttenuation; } @@ -187,8 +191,7 @@ void CS_MAIN( fOnlyDropY = particle.vTranslation.y; } - - + if (isMoveForward) { float fTime = (particle.vLifeTime.x / particle.vLifeTime.y); @@ -274,7 +277,7 @@ void CS_MAIN( } - if (isDetphCompareStop) + if (isDetphCompareStop == true) { float2 vTexcoord; @@ -301,7 +304,7 @@ void CS_MAIN( float fOldViewZ = vDepthDesc.y * fFar; - if (vProjPos.w >= fOldViewZ && particle.vLifeTime.x >= 0.3f) + if (vProjPos.w >= fOldViewZ && particle.vLifeTime.x >= 0.2f) { if (particleValue.isCompareStop == false) { @@ -319,6 +322,10 @@ void CS_MAIN( } + /*가속력*/ + if (length(particleValue.vVelocity) > FLT_EPSILON5) + particle.vTranslation.xyz += fRatio * particleValue.vVelocity; + if (isSizeMove == true) { float3 CurLength = diff --git a/Jusin154_Team3D/Engine/Private/Instance_Model.cpp b/Jusin154_Team3D/Engine/Private/Instance_Model.cpp index 593d19408..9103dc341 100644 --- a/Jusin154_Team3D/Engine/Private/Instance_Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Instance_Model.cpp @@ -700,6 +700,14 @@ void CInstance_Model::Instane_Buffer_ReStruct() pParticleValues[i].vPivot = vPivot; + _float3 vVelocity = _float3( + m_pGameInstance->Random_Float(m_InstanceDesc.vVelocityMin.x, m_InstanceDesc.vVelocityMax.x), + m_pGameInstance->Random_Float(m_InstanceDesc.vVelocityMin.y, m_InstanceDesc.vVelocityMax.y), + m_pGameInstance->Random_Float(m_InstanceDesc.vVelocityMin.z, m_InstanceDesc.vVelocityMax.z) + ); + + pParticleValues[i].vVelocity = vVelocity; + _float3 vSizeLerp = _float3( m_InstanceDesc.vDeltaSize.x, m_InstanceDesc.vDeltaSize.y, @@ -725,9 +733,12 @@ void CInstance_Model::Instane_Buffer_ReStruct() pParticleValues[i].fDrag = m_pGameInstance->Random_Float(m_InstanceDesc.vDrag.x, m_InstanceDesc.vDrag.y); pParticleValues[i].fSizeDrag = m_pGameInstance->Random_Float(m_InstanceDesc.vSizeDrag.x, m_InstanceDesc.vSizeDrag.y); pParticleValues[i].vDelay = _float2(0.0f, m_pGameInstance->Random_Float(m_InstanceDesc.vDelay.x, m_InstanceDesc.vDelay.y)); - pParticleValues[i].isCompareStop = false; pParticleValues[i].fDropAttenuation = m_pGameInstance->Random_Float(m_InstanceDesc.vDropAttenuation.x, m_InstanceDesc.vDropAttenuation.y); + pParticleValues[i].fCollisionTime = 0.f; + pParticleValues[i].isCompareStop = false; + m_InstanceDesc.isDetphCompareStop = true; + memcpy(&pParticleValues[i].vOriginRight, SRMatrix.m[0], sizeof(_float4)); memcpy(&pParticleValues[i].vOriginUp, SRMatrix.m[1], sizeof(_float4)); memcpy(&pParticleValues[i].vOriginLook, SRMatrix.m[2], sizeof(_float4)); @@ -969,6 +980,16 @@ void CInstance_Model::Describe_Entity() Instane_Buffer_ReStruct(); } + if (ImGui::DragFloat3("VelocityMin", reinterpret_cast<_float*>(&m_InstanceDesc.vVelocityMin))) + { + Instane_Buffer_ReStruct(); + } + + if (ImGui::DragFloat3("VelocityMax", reinterpret_cast<_float*>(&m_InstanceDesc.vVelocityMax))) + { + Instane_Buffer_ReStruct(); + } + if (ImGui::DragFloat3("DeltaAngleMin", reinterpret_cast<_float*>(&m_InstanceDesc.vDeltaAngleMin))) { Instane_Buffer_ReStruct(); diff --git a/Jusin154_Team3D/Engine/Public/Instance_Model.h b/Jusin154_Team3D/Engine/Public/Instance_Model.h index 5063cd9d7..0e8d404c4 100644 --- a/Jusin154_Team3D/Engine/Public/Instance_Model.h +++ b/Jusin154_Team3D/Engine/Public/Instance_Model.h @@ -70,8 +70,10 @@ class ENGINE_DLL CInstance_Model final : public CComponent _bool isDetphCompareStop = {}; _bool isPadding0 = {}; - _float4 vPadding2 = {}; - _float4 vPadding3 = {}; + _float3 vVelocityMin = {}; + _float3 vVelocityMax = {}; + + _float2 vPadding3 = {}; _float4 vPadding4 = {}; _float4 vPadding5 = {}; _float4 vPadding6 = {}; @@ -219,6 +221,7 @@ class ENGINE_DLL CInstance_Model final : public CComponent _bool isCompareStop = {}; _float fCollisionTime = {}; _float fDropAttenuation = {}; + _float3 vVelocity = {}; }CS_PARTICLE_VALUE_DESC;