Merge branch 'Model' of https://github.com/SpicyGangjeong/Team3D into Model
This commit is contained in:
@@ -206,6 +206,7 @@ call Update_Resources.bat
|
||||
<ClInclude Include="..\Public\State_Broom_Hover.h" />
|
||||
<ClInclude Include="..\Public\State_Broom_Ride_Move.h" />
|
||||
<ClInclude Include="..\public\MiniMap_Camera.h" />
|
||||
<ClInclude Include="..\Public\Goblin_Teleport.h" />
|
||||
<ClInclude Include="..\Public\Troll_State_Stun.h" />
|
||||
<ClInclude Include="..\Public\State_Sustain.h" />
|
||||
<ClInclude Include="..\Public\WandEnd.h" />
|
||||
@@ -389,6 +390,7 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\Private\Mage_Down_Attack.cpp" />
|
||||
<ClCompile Include="..\Private\Box_Splesh.cpp" />
|
||||
<ClCompile Include="..\Private\StunEffect.cpp" />
|
||||
<ClCompile Include="..\Private\Goblin_Teleport.cpp" />
|
||||
<ClCompile Include="..\Private\Troll_State_Stun.cpp" />
|
||||
<ClCompile Include="..\Private\WandEnd.cpp" />
|
||||
<ClCompile Include="..\Private\Magic_Icon.cpp" />
|
||||
|
||||
@@ -557,6 +557,9 @@
|
||||
<ClInclude Include="..\Public\Item_Potion.h">
|
||||
<Filter>02.GameObjects\Item\Potion</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Goblin_Teleport.h">
|
||||
<Filter>02.GameObjects\Effect\MonsterEffect\Goblin_Teleport</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="Client.ico">
|
||||
@@ -1176,6 +1179,9 @@
|
||||
<Filter Include="02.GameObjects\Item\Potion">
|
||||
<UniqueIdentifier>{ace6c64f-901a-424e-99da-53f281413d77}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Effect\MonsterEffect\Goblin_Teleport">
|
||||
<UniqueIdentifier>{8f5dbf8c-be74-4512-a84f-586397744b24}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Client.cpp">
|
||||
@@ -1677,6 +1683,9 @@
|
||||
<ClCompile Include="..\Private\Item_Potion.cpp">
|
||||
<Filter>02.GameObjects\Item\Potion</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Goblin_Teleport.cpp">
|
||||
<Filter>02.GameObjects\Effect\MonsterEffect\Goblin_Teleport</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Goblin_States.cpp">
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "Box_Splesh.h"
|
||||
#include "Chair_Splesh.h"
|
||||
#include "Barral_Splesh.h"
|
||||
#include "Goblin_Teleport.h"
|
||||
|
||||
CEffectPool::CEffectPool(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject(pDevice, pContext)
|
||||
@@ -409,7 +410,15 @@ HRESULT CEffectPool::Ready_MonsterEffect()
|
||||
|
||||
))) return E_FAIL;
|
||||
|
||||
if (FAILED(Create_Effect(SKILL_TYPE::GOBILN_TELEPORT, 5, NEXT_LEVEL, NEXT_LEVEL, [&](_uint iPrototypeLevel, _uint iCloneLevel) -> CEffect_Container* {
|
||||
|
||||
CGoblin_Teleport* pEffect = nullptr;
|
||||
|
||||
pEffect = m_pGameInstance->Clone_Prototype<CGoblin_Teleport>(iPrototypeLevel, nullptr);
|
||||
|
||||
return pEffect; }
|
||||
|
||||
))) return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -326,6 +326,11 @@ void CGoblin_Mage::Behavior_BlinkEnter()
|
||||
|
||||
m_pCharacter_Controller->Set_Position(vFinalPos); }
|
||||
, 0.99f);
|
||||
|
||||
Add_Event(pairAnimInfo.first,
|
||||
[this]() {
|
||||
m_pEffectPool->Use_Skill(SKILL_TYPE::GOBILN_TELEPORT, this);
|
||||
}, 0.1f);
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Mage::Behavior_BlinkExitCheck(_float fTimeDelta)
|
||||
|
||||
@@ -369,6 +369,11 @@ void CGoblin::Behavior_BlinkEnter()
|
||||
|
||||
m_pCharacter_Controller->Set_Position(vFinalPos); }
|
||||
, 0.99f);
|
||||
|
||||
Add_Event(pairAnimInfo.first,
|
||||
[this]() {
|
||||
m_pEffectPool->Use_Skill(SKILL_TYPE::GOBILN_TELEPORT, this);
|
||||
}, 0.1f);
|
||||
}
|
||||
|
||||
HRESULT CGoblin::Behavior_BlinkExitCheck(_float fTimeDelta)
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
#include "pch.h"
|
||||
#include "Goblin_Teleport.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
#include "EffectParts.h"
|
||||
#include "Wand.h"
|
||||
#include "Player.h"
|
||||
|
||||
CGoblin_Teleport::CGoblin_Teleport(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CEffect_Container{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CGoblin_Teleport::CGoblin_Teleport(const CGoblin_Teleport& rhs)
|
||||
: CEffect_Container(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Teleport::Initialize_Prototype()
|
||||
{
|
||||
|
||||
if (FAILED(Load_Package("../Bin/Resources/Data/Effect/MonsterPackage/GoblinTeleport")))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Teleport::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"GoblinTeleport";
|
||||
|
||||
|
||||
m_fDuration = 2.f;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CGoblin_Teleport::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
|
||||
}
|
||||
|
||||
void CGoblin_Teleport::Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_bVisible == false)
|
||||
return;
|
||||
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
Update_Event(fTimeDelta);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CGoblin_Teleport::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_bVisible == false)
|
||||
return;
|
||||
|
||||
__super::Late_Update(fTimeDelta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Teleport::Pre_Setting(CGameObject* pObject, void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Pre_Setting(pObject, nullptr)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
CEffectParts* pSmoke = Get_PartObject<CEffectParts>("Smoke");
|
||||
|
||||
pSmoke->Get_Component<CTransform>()->Set_State(STATE::POSITION, m_pOwner->Get_Component<CCharacter_Controller>()->Get_Position());
|
||||
|
||||
pSmoke->Set_Visible(true);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Teleport::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CGoblin_Teleport::Ready_Child()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CGoblin_Teleport* CGoblin_Teleport::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CGoblin_Teleport* pInstance = new CGoblin_Teleport(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CGoblin_Teleport");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
|
||||
CGameObject* CGoblin_Teleport::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CGoblin_Teleport* pInstance = new CGoblin_Teleport(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CGoblin_Teleport");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CGoblin_Teleport::OnCollision(CGameObject* pOther, void* pDesc)
|
||||
{
|
||||
_int iIndex = CollisionCheck();
|
||||
|
||||
if (iIndex < 0)
|
||||
return;
|
||||
|
||||
if (m_isCollisionEnter == true)
|
||||
return;
|
||||
|
||||
m_isCollisionEnter = true;
|
||||
|
||||
_vector vPos = XMVectorSet(m_Hitbuffer.touches[iIndex].position.x, m_Hitbuffer.touches[iIndex].position.y, m_Hitbuffer.touches[iIndex].position.z, 1.f);
|
||||
|
||||
|
||||
for (auto& pPair : m_PartObjects)
|
||||
{
|
||||
pPair.second->Set_Visible(true);
|
||||
pPair.second->Get_Component<CTransform>()->Set_State(STATE::POSITION, vPos);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CGoblin_Teleport::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
void CGoblin_Teleport::Describe_Entity()
|
||||
{
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT CGoblin_Teleport::Bind_ShaderResources()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@
|
||||
#include "EffectPool.h"
|
||||
#include "Levioso.h"
|
||||
#include "Lumos.h"
|
||||
|
||||
#include "Goblin_Teleport.h"
|
||||
|
||||
|
||||
#include "TrollSwing.h"
|
||||
@@ -1609,6 +1609,10 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CGoblin_Teleport>(NEXT_LEVEL, CGoblin_Teleport::Create(m_pDevice, m_pContext)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CEffectPool>(g_iStaticLevel, CEffectPool::Create(m_pDevice, m_pContext)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Client
|
||||
TROLL_ATTACK, TROLL_RUSH_HIT, TROLL_NOMAL_SMOKE, GOBLIN_PROTEGO,
|
||||
|
||||
/*고블린*/
|
||||
GOBLIN_ATTACK,
|
||||
GOBLIN_ATTACK, GOBILN_TELEPORT,
|
||||
|
||||
/*고블린 메이지*/
|
||||
GOBLIN_MAGE_ATTACK , GOBLIN_MAGE_DOWN , GOBLIN_MAGE_SIDE,
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include "Client_Define.h"
|
||||
#include "Effect_Container.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
NS_END
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CGoblin_Teleport final : public CEffect_Container
|
||||
{
|
||||
private:
|
||||
CGoblin_Teleport(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CGoblin_Teleport(const CGoblin_Teleport& rhs);
|
||||
virtual ~CGoblin_Teleport() = 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 = {};
|
||||
|
||||
public:
|
||||
static CGoblin_Teleport* 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
|
||||
Binary file not shown.
BIN
Binary file not shown.
@@ -72,17 +72,17 @@ float2 g_vDiffuseUVGainAmount;
|
||||
float2 g_vMaskingUVGainAmount;
|
||||
float2 g_vNoiseUVGainAmount;
|
||||
|
||||
int g_iMaskMoveLerpOption;
|
||||
int g_iDiffuseMoveLerpOption;
|
||||
int g_iNoiseMoveLerpOption;
|
||||
int g_iMaskMoveLerpOption;
|
||||
int g_iDiffuseMoveLerpOption;
|
||||
int g_iNoiseMoveLerpOption;
|
||||
|
||||
//
|
||||
float2 g_vDistortionTime;
|
||||
float2 g_vMaskDistortionUVGainAmount;
|
||||
|
||||
|
||||
int g_iMaskDistortionMoveLerpOption;
|
||||
int g_iDiffuseDistortionMoveLerpOption;
|
||||
int g_iMaskDistortionMoveLerpOption;
|
||||
int g_iDiffuseDistortionMoveLerpOption;
|
||||
//
|
||||
|
||||
float2 g_vUVCutting;
|
||||
@@ -90,12 +90,12 @@ float2 g_vUVMaskCutting;
|
||||
|
||||
float g_fDiffuseAlpha;
|
||||
|
||||
int g_iBlurWeight; // 블러 강도
|
||||
int g_iBlurWeight; // 블러 강도
|
||||
float g_fBlurIntensity; //블러 세기
|
||||
float g_fNoiseDistortionIntensity; // 디스토션 왜곡 세기
|
||||
|
||||
float4 g_vEmissive;
|
||||
float g_fEmissiveStrength;
|
||||
float g_fEmissiveStrength;
|
||||
|
||||
float g_fSoftenExp;
|
||||
float g_fSoftStrength;
|
||||
@@ -137,18 +137,18 @@ bool g_isBlurReverseDissolve;
|
||||
|
||||
float g_fBluringStrength;
|
||||
|
||||
bool g_isBloomDissolve;
|
||||
bool g_isBloomReverseDissolve;
|
||||
bool g_isBloomDissolve;
|
||||
bool g_isBloomReverseDissolve;
|
||||
|
||||
float g_fBloomStrength;
|
||||
int g_iBloomType;
|
||||
float g_fBloomStrength;
|
||||
int g_iBloomType;
|
||||
|
||||
float g_fFar;
|
||||
|
||||
float g_fDissolveDelay;
|
||||
float g_fReverseDissolveDelay;
|
||||
float2 g_vDissolveUVGainAmount;
|
||||
bool g_isDissolveMove;
|
||||
float g_fDissolveDelay;
|
||||
float g_fReverseDissolveDelay;
|
||||
float2 g_vDissolveUVGainAmount;
|
||||
bool g_isDissolveMove;
|
||||
|
||||
float g_fDissolveMaskEdge;
|
||||
float g_fDissolveSoftMask;
|
||||
@@ -263,7 +263,6 @@ struct PS_OUT
|
||||
{
|
||||
float4 vDiffuse : SV_TARGET0;
|
||||
float4 vRevealage : SV_TARGET1;
|
||||
float4 vColorTarget : SV_TARGET2;
|
||||
};
|
||||
|
||||
float4 DrawEffect(PS_IN In)
|
||||
@@ -274,7 +273,7 @@ float4 DrawEffect(PS_IN In)
|
||||
vector vMtrlDissolve;
|
||||
vector vMtrlDistortion;
|
||||
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
|
||||
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
|
||||
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
|
||||
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
|
||||
@@ -456,7 +455,7 @@ float4 DrawEffect(PS_IN In)
|
||||
|
||||
|
||||
if (g_isDissolve == true)
|
||||
{
|
||||
{
|
||||
float fTimeX = (In.vLifeTime.x - g_fDissolveDelay);
|
||||
float fTimeY = (In.vLifeTime.y - g_fDissolveDelay);
|
||||
float fTimeRatio = 0;
|
||||
@@ -481,14 +480,14 @@ float4 DrawEffect(PS_IN In)
|
||||
{
|
||||
vMtrlDiffuse.a *= In.vLifeTime.x / In.vLifeTime.y;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
float2 vDissolveUV = In.vTexcoord + SelectLerpUV(g_vDissolveUVGainAmount, (vDissolveUVMoveTime.x / vDissolveUVMoveTime.y), 0);
|
||||
|
||||
if (g_isDissolveMove)
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, vDissolveUV );
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, vDissolveUV);
|
||||
else
|
||||
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
@@ -557,12 +556,12 @@ float4 DrawEffect(PS_IN In)
|
||||
return vMtrlDiffuse;
|
||||
}
|
||||
|
||||
float4 EmissiveDraw(PS_IN In , float4 Diffuse)
|
||||
float4 EmissiveDraw(PS_IN In, float4 Diffuse)
|
||||
{
|
||||
float4 vEmissiveMtrl = vector(0.f, 0.f, 0.f, 0.f);
|
||||
float2 CenteredUV = In.vTexcoord - 0.5f;
|
||||
float fEmissive = 0.f;
|
||||
float fEmissiveStrength = g_fEmissiveStrength;
|
||||
float fEmissive = 0.f;
|
||||
float fEmissiveStrength = g_fEmissiveStrength;
|
||||
|
||||
if (g_fEmissiveColorCut >= FLT_EPSILON5)
|
||||
{
|
||||
@@ -661,7 +660,7 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
}
|
||||
|
||||
PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
{
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
vector vMtrlDiffuse;
|
||||
@@ -682,9 +681,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w);
|
||||
|
||||
//// 색깔 추가할 처리 (이미시브)
|
||||
|
||||
//Out.vDiffuse // 이미시브 스트랭스
|
||||
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
|
||||
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -753,7 +750,7 @@ PS_BLUR_OUT PS_BLUR_NOEMISSIVE(PS_IN In)
|
||||
|
||||
vector vMtrlDiffuse;
|
||||
|
||||
vMtrlDiffuse= DrawEffect(In);
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
//// 색깔 추가할 처리 (이미시브)
|
||||
|
||||
@@ -768,7 +765,7 @@ PS_BLUR_OUT PS_BLUR_NOEMISSIVE(PS_IN In)
|
||||
// }
|
||||
//}
|
||||
|
||||
Out.vDiffuse = vector(vMtrlDiffuse.rgb * g_fBlurIntensity , vMtrlDiffuse.a);
|
||||
Out.vDiffuse = vector(vMtrlDiffuse.rgb * g_fBlurIntensity, vMtrlDiffuse.a);
|
||||
Out.vBlurWeight = g_iBlurWeight / 128.f;
|
||||
|
||||
return Out;
|
||||
@@ -824,7 +821,7 @@ PS_BLOOM_OUT PS_BLOOM(PS_IN In)
|
||||
|
||||
vMtrlDiffuse.rgb += EmissiveDraw(In, vMtrlDiffuse).rgb;
|
||||
|
||||
float fBloomStrength = g_fBloomStrength;
|
||||
float fBloomStrength = g_fBloomStrength;
|
||||
|
||||
if (g_isBloomDissolve == true)
|
||||
{
|
||||
|
||||
@@ -4,30 +4,63 @@
|
||||
#include "Instance_Model.h"
|
||||
|
||||
CComputeShader::CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: m_pDevice{ pDevice }
|
||||
, m_pContext{ pContext }
|
||||
, m_pGameInstance{ CGameInstance::GetInstance() }
|
||||
: CComponent{ pDevice, pContext }
|
||||
{
|
||||
SAFE_ADDREF(m_pDevice);
|
||||
SAFE_ADDREF(m_pContext);
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
|
||||
CComputeShader::CComputeShader(const CComputeShader& rhs)
|
||||
: CComponent(rhs),
|
||||
m_pCSBlob(rhs.m_pCSBlob)
|
||||
{
|
||||
m_iNumElement = iNumElement;
|
||||
m_iNumInputBuffer = iNumInputBuffer;
|
||||
m_iNumOutputBuffer = iNumOutputBuffer;
|
||||
SAFE_ADDREF(m_pCSBlob);
|
||||
}
|
||||
|
||||
if (FAILED(CreateComputeShader(pShaderFilePath, pStartFunctionName)))
|
||||
HRESULT CComputeShader::Initialize(void* pArg)
|
||||
{
|
||||
|
||||
CS_INFO* CsDesc = static_cast<CS_INFO*>(pArg);
|
||||
|
||||
if (CsDesc == nullptr)
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateBuffer(iNumElement, iInputStructStride, iOutputStructStride)))
|
||||
|
||||
m_iNumElement = CsDesc->iNumElement;
|
||||
m_iNumInputBuffer = CsDesc->iNumInputBuffer;
|
||||
m_iNumOutputBuffer = CsDesc->iNumOutputBuffer;
|
||||
|
||||
|
||||
if (FAILED(CreateComputeShader()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateResurceViews(iNumElement, iNumInputBuffer)))
|
||||
if (FAILED(CreateBuffer(CsDesc->iInputStructStride, CsDesc->iOutputStructStride)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateResurceViews()))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::Initialize_Prototype(const _tchar* pShaderFilePath, const _char* pStartFunctionName)
|
||||
{
|
||||
// Debug 모드와 release 모드의 플레그를 다르게 줘야함
|
||||
UINT HLSLFlags = {};
|
||||
#ifdef _DEBUG
|
||||
HLSLFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#else
|
||||
HLSLFlags = D3DCOMPILE_OPTIMIZATION_LEVEL1;
|
||||
#endif // _DEBUG
|
||||
|
||||
HRESULT hr = D3DCompileFromFile(pShaderFilePath,
|
||||
nullptr,
|
||||
D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
pStartFunctionName,
|
||||
"cs_5_0",
|
||||
HLSLFlags,
|
||||
0,
|
||||
&m_pCSBlob,
|
||||
nullptr);
|
||||
|
||||
|
||||
return S_OK;
|
||||
@@ -136,7 +169,7 @@ void CComputeShader::Reset()
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride[], _uint iOuputStructStride[])
|
||||
HRESULT CComputeShader::CreateBuffer(_uint iInputStructStride[], _uint iOuputStructStride[])
|
||||
{
|
||||
//인 아웃풋 버퍼
|
||||
|
||||
@@ -145,7 +178,7 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
{
|
||||
D3D11_BUFFER_DESC InputBufferdesc = {};
|
||||
|
||||
InputBufferdesc.ByteWidth = iInputStructStride[i] * iNumElement;
|
||||
InputBufferdesc.ByteWidth = iInputStructStride[i] * m_iNumElement;
|
||||
InputBufferdesc.StructureByteStride = iInputStructStride[i];
|
||||
InputBufferdesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
InputBufferdesc.CPUAccessFlags = 0;
|
||||
@@ -165,7 +198,7 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
// 아웃풋 버퍼
|
||||
|
||||
D3D11_BUFFER_DESC Bufferdesc = {};
|
||||
Bufferdesc.ByteWidth = iOuputStructStride[i] * iNumElement;
|
||||
Bufferdesc.ByteWidth = iOuputStructStride[i] * m_iNumElement;
|
||||
Bufferdesc.StructureByteStride = iOuputStructStride[i];
|
||||
Bufferdesc.Usage = D3D11_USAGE_DEFAULT; // 인 아웃풋 버퍼는 디폴트로 설정해야함
|
||||
Bufferdesc.CPUAccessFlags = 0; // 디폴트 버퍼는 CPU에서 Read Write가 불가능하며
|
||||
@@ -186,10 +219,10 @@ HRESULT CComputeShader::CreateBuffer(_uint iNumElement, _uint iInputStructStride
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuffer)
|
||||
HRESULT CComputeShader::CreateResurceViews()
|
||||
{
|
||||
// SRV
|
||||
for (_uint i = 0; i < iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
for (_uint i = 0; i < m_iNumInputBuffer; i++) // 인풋 버퍼를 여러개 사용할 수 있도록 만든다
|
||||
{
|
||||
ID3D11ShaderResourceView* pSrv = {};
|
||||
|
||||
@@ -197,7 +230,7 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
srvDesc.Buffer.NumElements = m_iNumElement;
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pInputBuffer[i], &srvDesc, &pSrv)))
|
||||
return E_FAIL;
|
||||
@@ -215,7 +248,7 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uavDesc.Buffer.FirstElement = 0;
|
||||
uavDesc.Buffer.NumElements = iNumElement;
|
||||
uavDesc.Buffer.NumElements = m_iNumElement;
|
||||
|
||||
ID3D11UnorderedAccessView* pOutputUAV = { nullptr };
|
||||
|
||||
@@ -230,7 +263,7 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN; // StructuredBuffer는 UNKNOWN
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Buffer.NumElements = iNumElement;
|
||||
srvDesc.Buffer.NumElements = m_iNumElement;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
|
||||
|
||||
@@ -246,48 +279,26 @@ HRESULT CComputeShader::CreateResurceViews(_uint iNumElement, _uint iNumInputBuf
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CComputeShader::CreateComputeShader(const _tchar* pShaderFilePath, const _char* pStartFunctionName)
|
||||
HRESULT CComputeShader::CreateComputeShader()
|
||||
{
|
||||
ID3DBlob* pCSBlob = nullptr;
|
||||
|
||||
// Debug 모드와 release 모드의 플레그를 다르게 줘야함
|
||||
UINT HLSLFlags = {};
|
||||
#ifdef _DEBUG
|
||||
HLSLFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#else
|
||||
HLSLFlags = D3DCOMPILE_OPTIMIZATION_LEVEL1;
|
||||
#endif // _DEBUG
|
||||
|
||||
HRESULT hr = D3DCompileFromFile(pShaderFilePath,
|
||||
nullptr,
|
||||
D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
pStartFunctionName,
|
||||
"cs_5_0",
|
||||
HLSLFlags,
|
||||
0,
|
||||
&pCSBlob,
|
||||
nullptr);
|
||||
|
||||
|
||||
if (FAILED(m_pDevice->CreateComputeShader(
|
||||
pCSBlob->GetBufferPointer(), // 컴파일된 쉐이더 코드
|
||||
pCSBlob->GetBufferSize(), // 코드 길이
|
||||
m_pCSBlob->GetBufferPointer(), // 컴파일된 쉐이더 코드
|
||||
m_pCSBlob->GetBufferSize(), // 코드 길이
|
||||
nullptr, // 클래스 인스턴스 (없음)
|
||||
&m_pComputeShader // 컴퓨트 쉐이더 객체
|
||||
)))
|
||||
return E_FAIL;
|
||||
|
||||
SAFE_RELEASE(pCSBlob);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[])
|
||||
CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName)
|
||||
{
|
||||
CComputeShader* pInstance = new CComputeShader(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName, iNumElement, iNumInputBuffer, iNumOutputBuffer, iInputStructStride, iOutputStructStride)))
|
||||
if (FAILED(pInstance->Initialize_Prototype(pShaderFilePath, pStartFunctionName)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CComputeShader Prototype");
|
||||
SAFE_RELEASE(pInstance);
|
||||
@@ -318,4 +329,28 @@ void CComputeShader::Free()
|
||||
SAFE_RELEASE(m_pDevice);
|
||||
SAFE_RELEASE(m_pContext);
|
||||
SAFE_RELEASE(m_pGameInstance);
|
||||
|
||||
SAFE_RELEASE(m_pCSBlob);
|
||||
}
|
||||
|
||||
CComponent* CComputeShader::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CComputeShader* pInstance = new CComputeShader(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CComputeShader");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CComputeShader::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -498,11 +498,22 @@ HRESULT CInstance_Model::Create_CS()
|
||||
sizeof(CS_PARTICLE_VALUE_DESC),
|
||||
};
|
||||
|
||||
m_pComputeShader = CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl", "CS_MAIN", m_iNumInstance, 2, 2, CS_InputStrides, CS_OutputStrides);
|
||||
//, 2, 2, CS_InputStrides, CS_OutputStrides
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
CS_Desc.iNumElement = m_iNumInstance;
|
||||
CS_Desc.iNumInputBuffer = 2;
|
||||
CS_Desc.iNumOutputBuffer = 2;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pComputeShader = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, CS_EFFECT, &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pComputeShader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -98,6 +98,12 @@ HRESULT CPrototype_Manager::Ready_StaticComponents()
|
||||
if (FAILED(Add_Prototype(g_iStaticLevel, CLight::Create(m_pDevice, m_pContext)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#pragma region Compute Shader
|
||||
|
||||
|
||||
|
||||
#pragma endregion
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -120,6 +126,24 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#pragma region COMPUTE_SHADER
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_EFFECT,
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Particle_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_INSTANCE_MODEL,
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Instance_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -418,9 +418,9 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
//if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
|
||||
/* MRT_Fog */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_Fog")))) {
|
||||
|
||||
@@ -369,11 +369,20 @@ HRESULT CVIBuffer_Model_Instance::Create_ComputeShader()
|
||||
sizeof(VTX_INSTANCE_MODEL),
|
||||
};
|
||||
|
||||
m_pComputeShader = CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Instance_Compute.hlsl", "CS_MAIN", m_iMaxNumInstance, 2, 1, CS_InputStrides, CS_OutputStrides);
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
CS_Desc.iNumElement = m_iMaxNumInstance;
|
||||
CS_Desc.iNumInputBuffer = 2;
|
||||
CS_Desc.iNumOutputBuffer = 1;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pComputeShader = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, CS_INSTANCE_MODEL, &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pComputeShader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1,18 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
#include "Component.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL CComputeShader final : public CBase
|
||||
class ENGINE_DLL CComputeShader final : public CComponent
|
||||
{
|
||||
public:
|
||||
typedef struct tagComputeShaderInfo
|
||||
{
|
||||
_uint iNumElement = {};
|
||||
_uint iNumInputBuffer = {};
|
||||
_uint iNumOutputBuffer = {};
|
||||
_uint* iInputStructStride = { nullptr };
|
||||
_uint* iOutputStructStride = { nullptr };
|
||||
}CS_INFO;
|
||||
private:
|
||||
CComputeShader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CComputeShader(const CComputeShader& rhs);
|
||||
virtual ~CComputeShader() = default;
|
||||
|
||||
|
||||
public:
|
||||
HRESULT Initialize(const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[]);
|
||||
virtual HRESULT Initialize_Prototype(const _tchar* pShaderFilePath, const _char* pStartFunctionName);
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
public:
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
|
||||
void Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex);
|
||||
@@ -24,14 +35,9 @@ class ENGINE_DLL CComputeShader final : public CBase
|
||||
void Bind_UAV(_uint iIndex);
|
||||
void Reset();
|
||||
|
||||
HRESULT CreateBuffer(_uint iNumElement, _uint iInputStructStride[], _uint iOuputStructStride[]);
|
||||
HRESULT CreateResurceViews(_uint iNumElement, _uint iNumInputBuffer);
|
||||
HRESULT CreateComputeShader(const _tchar* pShaderFilePath, const _char* pStartFunctionName);
|
||||
|
||||
private:
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
ID3D11DeviceContext* m_pContext = { nullptr };
|
||||
class CGameInstance* m_pGameInstance = { nullptr };
|
||||
HRESULT CreateBuffer(_uint iInputStructStride[], _uint iOuputStructStride[]);
|
||||
HRESULT CreateResurceViews();
|
||||
HRESULT CreateComputeShader();
|
||||
|
||||
private:
|
||||
vector<ID3D11ShaderResourceView*> m_pInputSRV = {};
|
||||
@@ -42,9 +48,9 @@ class ENGINE_DLL CComputeShader final : public CBase
|
||||
vector<ID3D11Buffer*> m_pOutputBuffer = {};
|
||||
|
||||
|
||||
ID3D11ComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11ComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3DBlob* m_pCSBlob = nullptr;
|
||||
|
||||
private:
|
||||
_uint m_iNumElement = 0; // 인수 개수
|
||||
@@ -52,8 +58,13 @@ class ENGINE_DLL CComputeShader final : public CBase
|
||||
_uint m_iNumOutputBuffer = 0; // 인풋 버퍼의 개수
|
||||
|
||||
public:
|
||||
static CComputeShader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName, _uint iNumElement, _uint iNumInputBuffer, _uint iNumOutputBuffer, _uint iInputStructStride[], _uint iOutputStructStride[]);
|
||||
static CComputeShader* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _tchar* pShaderFilePath, const _char* pStartFunctionName);
|
||||
virtual void Free() override;
|
||||
CComponent* Clone(void* pArg, CGameObject* pOwner) override;
|
||||
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -75,6 +75,8 @@
|
||||
#define FX_LASTCOLOR TEXT("FX_LASTCOLOR")
|
||||
#define FX_WEIGHTBELND TEXT("FX_WEIGHTBELND")
|
||||
|
||||
#define CS_EFFECT TEXT("CS_EFFECT")
|
||||
#define CS_INSTANCE_MODEL TEXT("CS_INSTANCE_MODEL")
|
||||
|
||||
#define SAFE_ADDREF(pInstance) Safe_AddRef(pInstance)
|
||||
#define SAFE_RELEASE(pInstance) Safe_Release(pInstance)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Trail.h"
|
||||
#include "OcclusionQuery.h"
|
||||
#include "Font.h"
|
||||
#include "ComputeShader.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CGameInstance;
|
||||
|
||||
Reference in New Issue
Block a user