@@ -48,12 +48,14 @@ HRESULT CAccio::Initialize(void* pArg)
|
||||
|
||||
m_pRope_Trail = Get_PartObject<CTrailObject>("Accio_Trail");
|
||||
m_pWandLight = Get_PartObject<CEffectParts>("Wand_Light");
|
||||
m_pRotate0 = Get_PartObject<CEffectParts>("Rotate0");
|
||||
|
||||
if (m_pRope_Trail == nullptr)
|
||||
return E_FAIL;
|
||||
|
||||
SAFE_ADDREF(m_pRope_Trail);
|
||||
SAFE_ADDREF(m_pWandLight);
|
||||
SAFE_ADDREF(m_pRotate0);
|
||||
|
||||
XMStoreFloat4x4(&m_TrailWorld, XMMatrixIdentity());
|
||||
|
||||
@@ -101,6 +103,8 @@ void CAccio::Update(_float fTimeDelta)
|
||||
{
|
||||
/* 특정 대상과 충돌 했다면*/
|
||||
TrailPos.r[3] = m_pEnemyCCT->Get_Position();
|
||||
|
||||
m_pRotate0->Get_Component<CTransform>()->Set_State(STATE::POSITION, m_pEnemyCCT->Get_FootPosition());
|
||||
}
|
||||
|
||||
XMStoreFloat4x4(&m_TrailWorld, TrailPos);
|
||||
@@ -111,12 +115,16 @@ void CAccio::Update(_float fTimeDelta)
|
||||
_matrix rotMat = XMMatrixRotationAxis(XMLoadFloat3(&m_vCameraLook), m_fAccRotateTime);
|
||||
|
||||
_float fRange = m_fRange - m_fAccRotateTime / m_fAttenuation;
|
||||
|
||||
|
||||
if (fRange > 0)
|
||||
TrailPos.r[3] += rotMat.r[1] * fRange;
|
||||
}
|
||||
|
||||
m_pRope_Trail->Rope_Trail_Update(TrailPos, pPlayer->Get_WandPos(), fTimeDelta);
|
||||
if(m_isReverse == false)
|
||||
m_pRope_Trail->Rope_Trail_Update(TrailPos, pPlayer->Get_WandPos(), fTimeDelta);
|
||||
else
|
||||
m_pRope_Trail->Rope_Trail_Update(pPlayer->Get_WandPos(), TrailPos, fTimeDelta);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -176,7 +184,9 @@ HRESULT CAccio::Pre_Setting(CGameObject* pObject, void* pArg)
|
||||
_vector vStartPos = WandPos;
|
||||
XMStoreFloat4(&m_vStartPos, vStartPos);
|
||||
|
||||
_matrix WandWorld = pPlayer->Get_WandPos();
|
||||
_matrix WandWorld = XMMatrixIdentity();
|
||||
|
||||
WandWorld.r[3] = pPlayer->Get_WandPos().r[3];
|
||||
|
||||
XMStoreFloat4x4(&m_TrailWorld , WandWorld);
|
||||
|
||||
@@ -266,14 +276,23 @@ void CAccio::OnCollision(CGameObject* pOther, void* pDesc)
|
||||
CEffectParts* pCircle = Get_PartObject<CEffectParts>("Accio_Circle");
|
||||
CEffectParts* pWandLight = Get_PartObject<CEffectParts>("Wand_Light");
|
||||
CEffectParts* pSpread_Circle = Get_PartObject<CEffectParts>("Spread_Circle");
|
||||
CEffectParts* pAccio_PT = Get_PartObject<CEffectParts>("Accio_PT");
|
||||
|
||||
|
||||
pCircle->Set_Visible(false);
|
||||
pWandLight->Set_Visible(false);
|
||||
pSpread_Circle->Set_Visible(false);
|
||||
|
||||
|
||||
m_pRotate0->Set_Visible(true);
|
||||
pAccio_PT->Set_Visible(true);
|
||||
|
||||
pAccio_PT->Get_Component<CTransform>()->Set_State(STATE::POSITION, vPos);
|
||||
|
||||
m_pRope_Trail->Get_Component<CTrail>()->Rope_Fix(true);
|
||||
m_pRope_Trail->SetDissolve(true);
|
||||
|
||||
if(m_isDissolve)
|
||||
m_pRope_Trail->SetDissolve(true);
|
||||
|
||||
}
|
||||
|
||||
@@ -283,7 +302,7 @@ void CAccio::Free()
|
||||
|
||||
SAFE_RELEASE(m_pRope_Trail);
|
||||
SAFE_RELEASE(m_pWandLight);
|
||||
|
||||
SAFE_RELEASE(m_pRotate0);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -295,8 +314,10 @@ void CAccio::Describe_Entity()
|
||||
GUI::DragFloat("Speed", &m_fLinearSpeed);
|
||||
GUI::DragFloat("Range", &m_fRange);
|
||||
GUI::DragFloat("Attenuation", &m_fAttenuation);
|
||||
GUI::Checkbox("Dissolve", &m_isDissolve);
|
||||
GUI::Checkbox("Reverse", &m_isReverse);
|
||||
GUI::InputInt("LoopTime", &m_iLoopTime);
|
||||
|
||||
|
||||
m_pRope_Trail->Describe_Entity();
|
||||
m_pRope_Trail->Get_Component<CTrail>()->Describe_Entity();
|
||||
|
||||
|
||||
@@ -60,9 +60,12 @@ HRESULT CBroom::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pWindEffect->Get_Effect_Info()->isBillboard = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -115,13 +118,13 @@ void CBroom::Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_fSpeed <= 5.f)
|
||||
{
|
||||
m_pWindEffect->Set_Visible(false);
|
||||
//m_pWindEffect->Set_Visible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pWindEffect->Set_Visible(true);
|
||||
m_pWindEffect->Get_Component<CInstance_Model>()->Set_TimeMult(0.5f + m_fSpeed / 20.f);
|
||||
m_pWindEffect->Get_Effect_Info()->fSoftMask = 1.f + m_fSpeed / 10.f;
|
||||
m_pWindEffect->Get_Effect_Info()->fBlurIntensity = m_fSpeed / 30.f;
|
||||
|
||||
}
|
||||
|
||||
@@ -137,15 +140,22 @@ void CBroom::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
CTransform* WindTransform = m_pWindEffect->Get_Component<CTransform>();
|
||||
|
||||
_matrix WorldMat = m_pTransformCom->Get_XMWorldMatrix() * XMMatrixRotationAxis(WindTransform->Get_State(STATE::UP) , XMConvertToRadians(180.f));
|
||||
_matrix WorldMat = m_pTransformCom->Get_XMWorldMatrix()/* * XMMatrixRotationAxis(XMVectorSet(0.f , 1.f, 0.f ,0.f), XMConvertToRadians(180.f))*/;
|
||||
WindTransform->Set_WorldMatrix(WorldMat);
|
||||
WindTransform->Set_State(STATE::POSITION, m_pGameInstance->Get_CamXMPosition());
|
||||
|
||||
_vector vCameraLook = XMVector3Normalize(m_pGameInstance->Get_CameraLook());
|
||||
WindTransform->Set_State(STATE::POSITION, m_pGameInstance->Get_CamXMPosition() + vCameraLook * m_fCameraOffset);
|
||||
|
||||
#if _DEBUG
|
||||
#if 진우
|
||||
GUI::Begin("Wind");
|
||||
|
||||
m_pWindEffect->Get_Component<CInstance_Model>()->Describe_Entity();
|
||||
|
||||
GUI::Checkbox("BillBoard", &m_pWindEffect->Get_Effect_Info()->isBillboard);
|
||||
GUI::DragFloat("Offset", &m_fCameraOffset);
|
||||
GUI::End();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
@@ -166,17 +176,24 @@ HRESULT CBroom::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -189,13 +189,20 @@ HRESULT CBroomRacerAI::Render_Shadow(SHADOW eType)
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "CamPosition_Target.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Camera_Gaze.h"
|
||||
#include "Player.h"
|
||||
|
||||
CCamPosition_Shoulder::CCamPosition_Shoulder(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CCamPosition(pDevice, pContext)
|
||||
@@ -100,6 +101,14 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
|
||||
if (dynamic_cast<CPlayer*>(m_pOwner)->Get_UIState() == ENUM_CLASS(UI_STATE::GAMEPLAYER))
|
||||
{
|
||||
m_bMovable = true;
|
||||
}
|
||||
else {
|
||||
m_bMovable = false;
|
||||
}
|
||||
if (m_pGameInstance->Key_Up(DIK_PGDN)) {
|
||||
m_bDampingParentPos = !m_bDampingParentPos;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@ void CCamera_Debug::Priority_Update(_float fTimeDelta)
|
||||
m_pGameInstance->Bind_Camera(g_iStaticLevel, CAMERA_DEBUG, false);
|
||||
#endif // _DEBUG
|
||||
|
||||
}
|
||||
|
||||
void CCamera_Debug::Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_DEBUG))) {
|
||||
return;
|
||||
}
|
||||
@@ -88,6 +84,10 @@ void CCamera_Debug::Update(_float fTimeDelta)
|
||||
__super::Bind_Matrices();
|
||||
}
|
||||
|
||||
void CCamera_Debug::Update(_float fTimeDelta)
|
||||
{
|
||||
}
|
||||
|
||||
void CCamera_Debug::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_DEBUG))) {
|
||||
|
||||
@@ -146,7 +146,7 @@ void CEffectPool::Priority_Update(_float fTimeDelta)
|
||||
|
||||
(*m_EffectList[ENUM_CLASS(SKILL_TYPE::ACCIO)].begin())->Describe_Entity();
|
||||
|
||||
|
||||
Describe_Entity();
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -517,6 +517,34 @@ HRESULT CEffectPool::Use_Skill(SKILL_TYPE eType, CGameObject* pOwner, void* pArg
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CEffectPool::Reset_Pool()
|
||||
{
|
||||
for (size_t i = 0; i < ENUM_CLASS(SKILL_TYPE::END); i++)
|
||||
{
|
||||
for (auto& pEffect : m_EffectList[i])
|
||||
{
|
||||
SAFE_RELEASE(pEffect);
|
||||
}
|
||||
|
||||
m_EffectList[i].clear();
|
||||
}
|
||||
|
||||
for (auto& pEffect : m_ActiveEffectList)
|
||||
{
|
||||
SAFE_RELEASE(pEffect);
|
||||
}
|
||||
|
||||
|
||||
m_ActiveEffectList.clear();
|
||||
|
||||
|
||||
if (FAILED(Ready_Effect()))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
CEffectPool* CEffectPool::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
@@ -567,6 +595,14 @@ void CEffectPool::Free()
|
||||
|
||||
void CEffectPool::Describe_Entity()
|
||||
{
|
||||
|
||||
GUI::Begin("Effect Pool");
|
||||
if (GUI::Button("Reset Pool"))
|
||||
{
|
||||
Reset_Pool();
|
||||
}
|
||||
GUI::End();
|
||||
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -174,18 +174,24 @@ HRESULT CGoblin::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(iShaderPass))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -240,13 +246,21 @@ HRESULT CGoblin::Render_Shadow(SHADOW eType)
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -175,7 +175,12 @@ HRESULT CGoblin_Mage::Render()
|
||||
}
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -187,6 +192,8 @@ HRESULT CGoblin_Mage::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -233,13 +240,20 @@ HRESULT CGoblin_Mage::Render_Shadow(SHADOW eType)
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ void CGoblin_Mage::Behavior_HitEnter()
|
||||
{
|
||||
if (m_fHitDegree >= 90.f)
|
||||
{
|
||||
_int iRandIndex = m_pGameInstance->Real_Random_Int(0, 5);
|
||||
_int iRandIndex = m_pGameInstance->Real_Random_Int(0, 3);
|
||||
switch (iRandIndex)
|
||||
{
|
||||
case 0:
|
||||
@@ -467,7 +467,8 @@ HRESULT CGoblin_Mage::Behavior_HitExitCheck(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if(m_eHitSpell == ENUM_CLASS(SKILL_TYPE::ACCIO))
|
||||
{
|
||||
if (!m_bPos)
|
||||
{
|
||||
|
||||
@@ -161,7 +161,12 @@ HRESULT CGoblin_Spector::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -173,6 +178,8 @@ HRESULT CGoblin_Spector::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ void CGoblin::Behavior_HitEnter()
|
||||
{
|
||||
if (m_fHitDegree >= 90.f)
|
||||
{
|
||||
_int iRandIndex = m_pGameInstance->Real_Random_Int(0, 5);
|
||||
_int iRandIndex = m_pGameInstance->Real_Random_Int(0, 3);
|
||||
switch (iRandIndex)
|
||||
{
|
||||
case 0:
|
||||
@@ -543,7 +543,8 @@ HRESULT CGoblin::Behavior_HitExitCheck(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (m_eHitSpell == ENUM_CLASS(SKILL_TYPE::ACCIO))
|
||||
{
|
||||
if (!m_bPos)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,11 @@ void CInstancedProp::Late_Update(_float fTimeDelta)
|
||||
}
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
|
||||
//pair<_bool, _ubyte> pairShadowResult = m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius());
|
||||
//if (0 == ((_ubyte)SHADOW::SHADOW_FAR & pairShadowResult.second)) {
|
||||
// pairShadowResult.first = true;
|
||||
// Set_Shadow(pairShadowResult);
|
||||
//}
|
||||
}
|
||||
|
||||
HRESULT CInstancedProp::Render()
|
||||
|
||||
@@ -118,16 +118,19 @@ void CInteraction_Key::ReLockOnTarget()
|
||||
m_bActive = false;
|
||||
m_LockOnInteractionObject.pInteractive = nullptr;
|
||||
}
|
||||
m_bActive = true;
|
||||
m_fSize = _float3(40.f, 40.f, 1.f);
|
||||
_vector Position = XMVectorSet(m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[0],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[1] + 0.5f,
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[2],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[3]);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, Position);
|
||||
else {
|
||||
m_bActive = true;
|
||||
m_fSize = _float3(40.f, 40.f, 1.f);
|
||||
_vector Position = XMVectorSet(m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[0],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[1] + 0.5f,
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[2],
|
||||
m_LockOnInteractionObject.pInteractive->Get_WorldPostion().m128_f32[3]);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, Position);
|
||||
}
|
||||
}
|
||||
else
|
||||
else{
|
||||
m_bActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CInteraction_Key::Ready_Components()
|
||||
@@ -231,7 +234,10 @@ void CInteraction_Key::Free()
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CInteraction_Key::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -47,6 +47,28 @@ HRESULT CLand::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLand::Render_Shadow(SHADOW eType)
|
||||
{
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ViewMatrix", D3DTS::VIEW, eType))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShaderCom, "g_ProjMatrix", D3DTS::PROJ, eType))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Render(0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLand::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
|
||||
@@ -509,21 +509,25 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
/*for (_uint i = 0; i < 1; ++i) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CNPC_Ollivander>(g_iStaticLevel, NEXT_LEVEL, strLayerTag))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}*/
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLevel_GamePlay::Ready_Layer_BroomRacerAI(const _wstring& strLayerTag)
|
||||
{
|
||||
for (_uint i = 0; i < 1; ++i) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroomRacerAI>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
//for (_uint i = 0; i < 1; ++i) {
|
||||
// if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroomRacerAI>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) {
|
||||
// return E_FAIL;
|
||||
// }
|
||||
//}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -534,7 +538,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Item(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_GamePlay::Ready_Layer_RaceRing(const _wstring& strLayerTag)
|
||||
{
|
||||
for (_uint i = 0; i < 50; ++i) {
|
||||
for (_uint i = 0; i < 1; ++i) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRaceRing>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -564,12 +568,12 @@ HRESULT CLevel_GamePlay::Ready_Layer_Monster()
|
||||
{
|
||||
for (_uint i = 0; i < 1; ++i)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin>(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER,&i))) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin>(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < 1; ++i)
|
||||
for (_uint i = 0; i <1; ++i)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CGoblin_Mage>(g_iStaticLevel, NEXT_LEVEL, LAYER_MONSTER, &i))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
#include "pch.h"
|
||||
#include "Level_Loading.h"
|
||||
|
||||
#include "Loader.h"
|
||||
#include "Light_Main.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Layer.h"
|
||||
#include "Level_Logo.h"
|
||||
#include "Level_GamePlay.h"
|
||||
#include "Level_Restart.h"
|
||||
#include "Level_Field.h"
|
||||
|
||||
#include "Intro_Image.h"
|
||||
#include "Intro_BG.h"
|
||||
#include "Loding_Panel.h"
|
||||
@@ -23,9 +22,6 @@ HRESULT CLevel_Loading::Initialize(LEVEL eNextLevelID)
|
||||
m_eNextLevelID = eNextLevelID;
|
||||
|
||||
m_pLoader = CLoader::Create(m_pDevice, m_pContext, eNextLevelID);
|
||||
//m_ShadowDesc.vAt = _float4(-10.f, -10.f, 10.f, 1.f);
|
||||
//m_ShadowDesc.fWidth = 300.f;
|
||||
//m_ShadowDesc.fHeight = 300.f;
|
||||
if (nullptr == m_pLoader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -64,7 +60,6 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (m_bNextLevel == true)
|
||||
{
|
||||
pair<CLevel*, function<void()>> pairLevel = { nullptr, nullptr };
|
||||
@@ -77,10 +72,8 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
} break;
|
||||
case LEVEL::GAMEPLAY:
|
||||
{
|
||||
//m_ShadowDesc.vAt = _float4(-194, 18.5f, -153.f, 1.f);
|
||||
//m_ShadowDesc.fHeight = 1000.f;
|
||||
//m_ShadowDesc.fWidth = 1000.f;
|
||||
pairLevel = CLevel_GamePlay::Create(m_pDevice, m_pContext, m_eNextLevelID, nullptr);
|
||||
Capture_TerrainPreShadow();
|
||||
} break;
|
||||
case LEVEL::FIELD:
|
||||
{
|
||||
@@ -90,12 +83,10 @@ void CLevel_Loading::Update(_float fTimeDelta)
|
||||
{
|
||||
pairLevel = CLevel_Restart::Create(m_pDevice, m_pContext, m_eNextLevelID);
|
||||
} break;
|
||||
|
||||
default:
|
||||
assert(false); // E_IMPL
|
||||
break;
|
||||
}
|
||||
// Capture_TerrainPreShadow(m_ShadowDesc);
|
||||
if (SUCCEEDED(m_pGameInstance->Change_Level(pairLevel.first))) {
|
||||
if (nullptr != pairLevel.second)
|
||||
{
|
||||
@@ -115,34 +106,17 @@ HRESULT CLevel_Loading::Render()
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
//
|
||||
//void CLevel_Loading::Capture_TerrainPreShadow(SHADOW_LIGHT_DESC& ShadowDesc)
|
||||
//{
|
||||
// CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_BACKGROUND);
|
||||
// if (nullptr != pLayer) {
|
||||
// ShadowDesc.fFar = 1000.f;
|
||||
// ShadowDesc.fNear = 0.1f;
|
||||
// _float3 vRollPichYaw = { 35.2643897f, 45.f, 0.f }; // (1, -1, 1) 방향 look
|
||||
//
|
||||
// _matrix matRotation = XMMatrixRotationRollPitchYaw(
|
||||
// XMConvertToRadians(vRollPichYaw.x), XMConvertToRadians(vRollPichYaw.y), XMConvertToRadians(vRollPichYaw.z));
|
||||
//
|
||||
// XMStoreFloat4(&ShadowDesc.vEye, XMLoadFloat4(&ShadowDesc.vAt) - matRotation.r[2] * (ShadowDesc.fFar * 0.25f));
|
||||
//
|
||||
// if (FAILED(m_pGameInstance->Ready_Shadow_Light(ShadowDesc))) {
|
||||
// assert(false);
|
||||
// }
|
||||
//
|
||||
// const list<CGameObject*>* pObjects = pLayer->Get_Objects();
|
||||
// _float4 vPos = {};
|
||||
// for (auto& pObject : *pObjects) {
|
||||
// if (FAILED(m_pGameInstance->Add_RenderGroup(RENDER::PRESHADOW, pObject))) {
|
||||
// assert(false);
|
||||
// }
|
||||
// }
|
||||
// m_pGameInstance->Render_PreShadow();
|
||||
// }
|
||||
//}
|
||||
|
||||
void CLevel_Loading::Capture_TerrainPreShadow()
|
||||
{
|
||||
CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_LIGHT);
|
||||
assert(nullptr != pLayer);
|
||||
CLight_Main* pLight = pLayer->Get_Object<CLight_Main>();
|
||||
assert(nullptr != pLight);
|
||||
if (FAILED(pLight->Capture_PreShadow())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CLevel_Loading::Ready_Layer_BackGround(const _wstring& strLayerTag)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pch.h"
|
||||
#include "Light_Main.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Layer.h"
|
||||
|
||||
CLight_Main::CLight_Main(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject(pDevice, pContext)
|
||||
@@ -22,32 +23,24 @@ HRESULT CLight_Main::Initialize(void* pArg)
|
||||
if (FAILED(__super::Initialize(pArg))){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(Ready_Components())){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pTransformCom->Set_State(STATE::LOOK, XMVectorSet(1.f, -1.f, 1.f, 0.f));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CLight_Main::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
_float4 vLook = {};
|
||||
XMStoreFloat4(&vLook, m_pTransformCom->Get_State(STATE::LOOK));
|
||||
m_pGameInstance->Ready_Shadow_Light(vLook);
|
||||
_float4 vRPYQuat = {};
|
||||
XMStoreFloat4(&vRPYQuat, m_pTransformCom->Get_QuarternionVector());
|
||||
m_pGameInstance->Ready_Shadow_Light(vRPYQuat);
|
||||
}
|
||||
|
||||
void CLight_Main::Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
GUI::Begin("LIGHT", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("Main_Light")) {
|
||||
m_pLightCom->Describe_Entity();
|
||||
}
|
||||
GUI::End();
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
}
|
||||
|
||||
@@ -60,10 +53,49 @@ HRESULT CLight_Main::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLight_Main::Capture_PreShadow()
|
||||
{
|
||||
CLayer* pLayer = m_pGameInstance->Get_Layer(NEXT_LEVEL, LAYER_BACKGROUND);
|
||||
assert(nullptr != pLayer);
|
||||
|
||||
const list<CGameObject*>* pObjects = pLayer->Get_Objects();
|
||||
for (auto& pObject : *pObjects) {
|
||||
if (FAILED(m_pGameInstance->Add_RenderGroup(RENDER::PRESHADOW, pObject))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
vector<_float3> vNeededPos = {};
|
||||
vNeededPos.reserve(12);
|
||||
{
|
||||
// 외곽이 더 많아지면 많아질수록 더 정밀한 경계가 가능
|
||||
// 하지만 더 실제보다 멀리 외곽을 두르면 필요한 것보다 더 많이 찍게 됨
|
||||
// 결국 딱 맞춰서 찍는게 제일 중요함
|
||||
vNeededPos.emplace_back(_float3(-112.f, 155.f, 362.f));
|
||||
vNeededPos.emplace_back(_float3(- 188.f, 10.f, 476.f));
|
||||
vNeededPos.emplace_back(_float3(- 571.f, 19.f, 476.f));
|
||||
vNeededPos.emplace_back(_float3(- 326.f, -64.f, 480.f));
|
||||
vNeededPos.emplace_back(_float3(569.f, 77.f, 250.f));
|
||||
vNeededPos.emplace_back(_float3(320.f, -236.f, 360.f));
|
||||
vNeededPos.emplace_back(_float3(570.f, 277.f, -277.f));
|
||||
vNeededPos.emplace_back(_float3(570.f, 176.f, -527.f));
|
||||
vNeededPos.emplace_back(_float3(- 108.f, -64.f, -1146.f));
|
||||
vNeededPos.emplace_back(_float3(- 824.f, 128.f, -533.f));
|
||||
vNeededPos.emplace_back(_float3(- 826.f, 145.f, -150.f));
|
||||
vNeededPos.emplace_back(_float3(- 256.f, -92.f, -414.f));
|
||||
}
|
||||
_matrix xmViewMatrix = m_pTransformCom->Get_WorldMatrixInv();
|
||||
_float4x4 ViewMatrix = {}; XMStoreFloat4x4(&ViewMatrix, xmViewMatrix);
|
||||
_float4x4 ProjMatrix = {}; XMStoreFloat4x4(&ProjMatrix, Get_OffCenterProjMatrix(xmViewMatrix, vNeededPos));
|
||||
|
||||
m_pGameInstance->Render_PreShadow(ViewMatrix, ProjMatrix);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CLight_Main::Ready_Components()
|
||||
{
|
||||
__super::Ready_Components(nullptr);
|
||||
|
||||
m_pTransformCom->LookAt(XMVectorSet(1.f, -4.f, 1.f, 1.f));
|
||||
LIGHT_DESC LightDesc{};
|
||||
|
||||
LightDesc.eType = LIGHT::DIRECTIONAL;
|
||||
@@ -95,6 +127,35 @@ HRESULT CLight_Main::Bind_ShaderResources()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_matrix CLight_Main::Get_OffCenterProjMatrix(_fmatrix ViewMatrix, vector<_float3>& WorldPositions)
|
||||
{
|
||||
_float fMinX = FLT_MAX;
|
||||
_float fMinY = FLT_MAX;
|
||||
_float fMinZ = FLT_MAX;
|
||||
_float fMaxX = -FLT_MAX;
|
||||
_float fMaxY = -FLT_MAX;
|
||||
_float fMaxZ = -FLT_MAX;
|
||||
|
||||
_uint iPosNum = (_uint)WorldPositions.size();
|
||||
for (_uint iIndexPoint = 0; iIndexPoint < iPosNum; ++iIndexPoint)
|
||||
{
|
||||
_vector vLightViewPos = XMVector4Transform(XMVectorSetW(XMLoadFloat3(&WorldPositions[iIndexPoint]), 1.f), ViewMatrix);
|
||||
|
||||
_float x = XMVectorGetX(vLightViewPos);
|
||||
_float y = XMVectorGetY(vLightViewPos);
|
||||
_float z = XMVectorGetZ(vLightViewPos);
|
||||
|
||||
fMinX = min(fMinX, x); fMaxX = max(fMaxX, x);
|
||||
fMinY = min(fMinY, y); fMaxY = max(fMaxY, y);
|
||||
fMinZ = min(fMinZ, z); fMaxZ = max(fMaxZ, z);
|
||||
}
|
||||
_float fShadowDepthMArgin = 10.f; // 캐릭터 이동 보정
|
||||
fMinZ -= fShadowDepthMArgin;
|
||||
fMaxZ += fShadowDepthMArgin;
|
||||
return XMMatrixOrthographicOffCenterLH(fMinX, fMaxX, fMinY, fMaxY, fMinZ, fMaxZ);
|
||||
}
|
||||
|
||||
|
||||
CLight_Main* CLight_Main::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CLight_Main* pInstance = new CLight_Main(pDevice, pContext);
|
||||
@@ -131,6 +192,20 @@ void CLight_Main::Free()
|
||||
|
||||
void CLight_Main::Describe_Entity()
|
||||
{
|
||||
GUI::Begin("LIGHT", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("Main_Light")) {
|
||||
if (GUI::Button("Capture_PreShadow")) {
|
||||
if (FAILED(Capture_PreShadow())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
m_pLightCom->Describe_Entity();
|
||||
if (GUI::Button("Sync_CamToLight")) {
|
||||
m_pTransformCom->Set_WorldMatrix(m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f, 0.f, 1.f));
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -913,6 +913,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
}
|
||||
#pragma endregion
|
||||
#if 진우
|
||||
#elif 기무리
|
||||
#else
|
||||
#pragma region UI_ANI
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Altering_Spell"),
|
||||
|
||||
@@ -87,6 +87,7 @@ void CMapObject_Render::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
case MAPOBJECT_RENDER_TYPE::NORMAL:
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(XMLoadFloat4((_float4*)&m_CombinedWorldMatrix.m[3][0]), m_fRadius));
|
||||
break;
|
||||
case MAPOBJECT_RENDER_TYPE::GLASS:
|
||||
break;
|
||||
@@ -139,10 +140,6 @@ HRESULT CMapObject_Render::Render_Shadow(SHADOW eType)
|
||||
|
||||
for (_uint i = 0; i < iMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,12 @@ HRESULT CNPC_Ollivander::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -66,6 +71,9 @@ HRESULT CNPC_Ollivander::Render()
|
||||
if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -89,12 +97,20 @@ HRESULT CNPC_Ollivander::Render_Shadow(SHADOW eType)
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -253,17 +253,25 @@ HRESULT CPlayer::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -292,14 +300,21 @@ HRESULT CPlayer::Render_Shadow(SHADOW eType)
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,8 @@ void CPlayer::Get_UIState(_int UIState)
|
||||
|
||||
HRESULT CPlayer::InputAction()
|
||||
{
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL))) {
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL) &&
|
||||
m_eUIState !=ENUM_CLASS(UI_STATE::QUEST_CANVES))) {
|
||||
if (
|
||||
m_pGameInstance->Key_Down(DIK_SPACE)
|
||||
|| m_pGameInstance->Key_Down(DIK_LCONTROL)
|
||||
@@ -86,6 +87,11 @@ HRESULT CPlayer::InputAction()
|
||||
if (m_pGameInstance->Key_Down(DIK_T)) m_pInfoInstance->Key_Input(ENUM_CLASS(KEYINPUT::INPUT_T));
|
||||
return S_OK;
|
||||
}
|
||||
if (m_pGameInstance->Key_Down(DIK_TAB))
|
||||
{
|
||||
if (m_pGameInstance->Key_Down(DIK_TAB)) m_pInfoInstance->Key_Input(ENUM_CLASS(KEYINPUT::INPUT_TAB));
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
@@ -93,7 +99,8 @@ HRESULT CPlayer::InputAction()
|
||||
|
||||
HRESULT CPlayer::InputMove()
|
||||
{
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL))) {
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL) &&
|
||||
m_eUIState != ENUM_CLASS(UI_STATE::QUEST_CANVES))) {
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_W)
|
||||
|| m_pGameInstance->Key_Pressing(DIK_A)
|
||||
@@ -109,7 +116,8 @@ HRESULT CPlayer::InputMove()
|
||||
|
||||
HRESULT CPlayer::InputKeyUpMove()
|
||||
{
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL))) {
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL) &&
|
||||
m_eUIState != ENUM_CLASS(UI_STATE::QUEST_CANVES))) {
|
||||
if (m_pGameInstance->Key_Up(DIK_W)
|
||||
|| m_pGameInstance->Key_Up(DIK_A)
|
||||
|| m_pGameInstance->Key_Up(DIK_S)
|
||||
@@ -123,7 +131,8 @@ HRESULT CPlayer::InputKeyUpMove()
|
||||
|
||||
HRESULT CPlayer::InputSpell()
|
||||
{
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL))) {
|
||||
if ((m_eUIState != ENUM_CLASS(UI_STATE::SPELL) &&
|
||||
m_eUIState != ENUM_CLASS(UI_STATE::QUEST_CANVES))) {
|
||||
if (
|
||||
m_pGameInstance->Key_Down(DIK_1)
|
||||
|| m_pGameInstance->Key_Down(DIK_2)
|
||||
@@ -1625,6 +1634,7 @@ HRESULT CPlayer::Behavior_HitExitCheck()
|
||||
void CPlayer::Behavior_HitExit()
|
||||
{
|
||||
m_pFSM->Disable_State(FSMSTATE::HIT);
|
||||
m_bLookAt = false;
|
||||
}
|
||||
|
||||
void CPlayer::Behavior_Broom_RideEnter()
|
||||
|
||||
@@ -194,7 +194,12 @@ HRESULT CTroll::Render()
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -206,6 +211,8 @@ HRESULT CTroll::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -266,7 +273,12 @@ HRESULT CTroll::Render_OutLine()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -278,6 +290,8 @@ HRESULT CTroll::Render_OutLine()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -299,13 +313,21 @@ HRESULT CTroll::Render_Shadow(SHADOW eType)
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Begin(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(26, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -39,19 +39,24 @@ class CAccio final : public CEffect_Container
|
||||
|
||||
class CTrailObject* m_pRope_Trail = { nullptr };
|
||||
class CEffectParts* m_pWandLight = { nullptr };
|
||||
class CEffectParts* m_pRotate0 = { nullptr };
|
||||
|
||||
_float4 m_vStartPos = { 0.f, 0.f, 0.f, 1.f }; // 현재 발사 된 위치
|
||||
_float4 m_vTargetPos = { 0.f, 0.f, 0.f, 1.f }; // 현재 타게팅 된 위치
|
||||
_float m_fLinearSpeed = 1.5f;
|
||||
_float m_fLinearSpeed = 0.5f;
|
||||
_float3 m_vCameraLook = {};
|
||||
|
||||
_float4x4 m_TrailWorld = {};
|
||||
CCharacter_Controller* m_pEnemyCCT = { nullptr };
|
||||
CCharacter_Controller* m_pEnemyCCT = { nullptr };
|
||||
|
||||
_float m_fAccRotateTime = {};
|
||||
_float m_fTurnSpeed = { 65.f };
|
||||
_float m_fRange = { 1.3f };
|
||||
_float m_fAttenuation = { 35.f };
|
||||
_float m_fRange = { 1.f };
|
||||
_float m_fAttenuation = { 65.f };
|
||||
_bool m_isDissolve = { true };
|
||||
_bool m_isReverse = { false };
|
||||
_int m_iLoopTime = { 5 };
|
||||
|
||||
|
||||
public:
|
||||
static CAccio* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
@@ -74,6 +74,7 @@ class CBroom final : public CUnit
|
||||
|
||||
BroomInput m_Input;
|
||||
class CEffectParts* m_pWindEffect = { nullptr };
|
||||
_float m_fCameraOffset = { 10.f };
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
@@ -97,7 +98,7 @@ class CBroom final : public CUnit
|
||||
_float m_fAmount = { 1.f };
|
||||
_float m_fInputTime = {};
|
||||
_bool m_bRatio = { false };
|
||||
|
||||
|
||||
HRESULT InputAction();
|
||||
HRESULT InputMove();
|
||||
HRESULT InputKeyUpMove();
|
||||
|
||||
@@ -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, 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,END };
|
||||
enum class SHADER_PASS_UIEDITOR {
|
||||
DEFAULT, LOGO, LOGO_TEXT, LOGO_GLOW, ALPHABLEND, CLAMP, CURSOR,
|
||||
LODING, HOLD_ROTATION, MISSION, QUESTTYPE, UVMULT, NINECLICE,
|
||||
|
||||
@@ -27,6 +27,9 @@ class CEffectPool final : public CGameObject
|
||||
public:
|
||||
HRESULT Create_Effect(SKILL_TYPE eType, _uint iNumEffect, _uint iPrototypeLevel, _uint iCloneLevel , function<class CEffect_Container*(_uint , _uint)> AddPrototypeEvent);
|
||||
HRESULT Use_Skill(SKILL_TYPE eType , CGameObject* pOwner, void* pArg = nullptr);
|
||||
#ifdef _DEBUG
|
||||
HRESULT Reset_Pool();
|
||||
#endif
|
||||
private:
|
||||
list<class CEffect_Container*> m_EffectList[ENUM_CLASS(SKILL_TYPE::END)] = {};
|
||||
list<class CEffect_Container*> m_ActiveEffectList = {};
|
||||
|
||||
@@ -29,6 +29,7 @@ class CLand final : public CGameObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Render_Shadow(SHADOW eType) override;
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
|
||||
@@ -15,10 +15,9 @@ class CLevel_Loading final : public CLevel
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual _uint Get_NextLevelID() override { return ENUM_CLASS(m_eNextLevelID); };
|
||||
//virtual void Capture_TerrainPreShadow(SHADOW_LIGHT_DESC& ShadowDesc);
|
||||
virtual void Capture_TerrainPreShadow();
|
||||
|
||||
private:
|
||||
//SHADOW_LIGHT_DESC m_ShadowDesc = {};
|
||||
LEVEL m_eNextLevelID = { LEVEL::END };
|
||||
class CLoader* m_pLoader = { nullptr };
|
||||
|
||||
|
||||
@@ -17,15 +17,18 @@ class CLight_Main final : public CGameObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
virtual HRESULT Capture_PreShadow();
|
||||
|
||||
private:
|
||||
CLight* m_pLightCom = { nullptr };
|
||||
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
_matrix Get_OffCenterProjMatrix(_fmatrix ViewMatrix, vector<_float3>& WorldPositions);
|
||||
|
||||
public:
|
||||
static CLight_Main* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -33,7 +36,6 @@ class CLight_Main final : public CGameObject
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entity() override;
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
@@ -24,6 +24,7 @@ class CPlayer final : public CUnit
|
||||
void Set_SpellHit(_bool bHit) { m_bSpellHit = bHit; }
|
||||
void Set_Shield(_bool bShield) { m_bShield = bShield; }
|
||||
void Start_CameraShake(_float fTime, _float fIntense);
|
||||
_int Get_UIState() { return m_eUIState; }
|
||||
#ifdef _DEBUG
|
||||
void Render_CameraCoordinateSystem();
|
||||
#endif // _DEBUG
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -77,6 +77,13 @@ DepthStencilState DSS_None
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_Less
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = all;
|
||||
DepthFunc = less;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Effect
|
||||
{
|
||||
DepthEnable = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ float g_fFar;
|
||||
float g_fShadowFar_NEAR;
|
||||
float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fPreShadowFar;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
@@ -27,6 +26,7 @@ float g_fFarBlurStart;
|
||||
float g_fFarBlurEnd;
|
||||
float g_fDOFBlurMultiplier;
|
||||
float g_fSSAO_BIAS;
|
||||
float g_fSSAOStrength;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_SSAONoiseTexture;
|
||||
@@ -77,6 +77,7 @@ vector g_vLightSpecular;
|
||||
|
||||
float g_fFogDensity;
|
||||
float g_fFogPow;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
@@ -220,10 +221,10 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
float2 uv = In.vTexcoord;
|
||||
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -279,12 +280,12 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f);
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -302,7 +303,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -343,7 +344,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
@@ -358,7 +359,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -391,13 +392,13 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -415,7 +416,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -471,7 +472,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -519,12 +520,12 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -542,7 +543,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -560,23 +561,23 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (0.f == vDiffuse.a) { discard; }
|
||||
|
||||
vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float4 vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vSpecular.a = 0.f;
|
||||
Out.vBackBuffer = vDiffuse * vShade + vSpecular;
|
||||
|
||||
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
|
||||
vector vPosition, vPreShadowPosition;
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
|
||||
/* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
@@ -607,7 +608,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
@@ -620,20 +621,31 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
// 경계 주변 부드럽게 할 비중
|
||||
float fCascadeBlend_NearToMiddle = smoothstep(g_fCascadeSplitRatioNear - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioNear + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
//float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
// g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
// PreShadow(Static)로 넘어가는 구간(원하는 대로 조절)
|
||||
float fStaticShadowBlendStartRatio = 0.70f;
|
||||
float fStaticShadowBlendEndRatio = 0.95f;
|
||||
|
||||
float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibility_Static, fStaticShadowBlendWeight);
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
//float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static);
|
||||
//float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar;
|
||||
//float fStaticShadowBlendWidthRatio = 0.05f;
|
||||
//float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio);
|
||||
//float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
//float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight);
|
||||
|
||||
// 2번째 방법
|
||||
// Dynamic * Static 항상 최소곱
|
||||
//float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static);
|
||||
|
||||
// 3번째 방법
|
||||
// Dynamic , Static 최소값만 취함
|
||||
float fVisibilityCombined = min(fVisibilityDynamic, fVisibility_Static);
|
||||
|
||||
// 최소 밝기
|
||||
float fMinShadowBrightness = 0.25f;
|
||||
@@ -644,7 +656,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
////////////////////////////
|
||||
// 블러 추가
|
||||
float4 vColor = 0.f;
|
||||
float3 vColor = { 0.f, 0.f, 0.f };
|
||||
|
||||
/* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
|
||||
float2 vTexcoord;
|
||||
@@ -656,10 +668,10 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
Out.vBackBuffer.rgb += vColor;
|
||||
Out.vEnvironment = Out.vBackBuffer;
|
||||
|
||||
return Out;
|
||||
@@ -839,14 +851,15 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(PointSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -880,7 +893,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -890,7 +903,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
|
||||
@@ -902,10 +915,23 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBlurX = float4(vColor, fOriginalAlpha);
|
||||
Out.vBlurWeight = fAcc;
|
||||
|
||||
return Out;
|
||||
@@ -914,14 +940,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(PointSampler, vTexcoord);
|
||||
float4 vXBlur = g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -933,16 +961,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
{
|
||||
// 최소치 이내면 블러 스킵
|
||||
// 최소치 이내면 블러 안함
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
@@ -956,7 +984,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -966,7 +994,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
@@ -974,28 +1002,27 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
float fOriginalLumen = length(vOriginal.rgb);
|
||||
float fBlurLumen = length(vColor.rgb);
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > 1e-4f)
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurMatched = vColor.rgb * fLumenScale;
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 finalColor = lerp(vOriginal.rgb, vBlurMatched, fBlendAmount);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBackBuffer = float4(finalColor.xyz, vOriginal.a);
|
||||
Out.vEnvironment = 0.f;
|
||||
Out.vBackBuffer = float4(vColor, fOriginalAlpha);
|
||||
Out.vEnvironment = fAcc;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1023,26 +1050,30 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vFinalColor;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fRatio;
|
||||
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
float4 vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (true == g_bFogVisible)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fOriginalAlpha = vColor.a;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vFinalColor;
|
||||
float fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
vFinalColor.a = 1.f; // fOriginalAlpha;
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.a = 1.f;
|
||||
Out.vFirstTarget = vColor;
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_BACKBUFFER PS_TONE_MAPPING(PS_IN In)
|
||||
@@ -1127,7 +1158,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In)
|
||||
fIsOccluded *= fRangeCheck;
|
||||
fOcclusion += fIsOccluded;
|
||||
}
|
||||
fOcclusion = (1.f - (fOcclusion / g_iKernelSize) * fRatio);
|
||||
fOcclusion = saturate(1.f - (fOcclusion * g_fSSAOStrength / g_iKernelSize) * fRatio);
|
||||
Out.fOcclusion = fOcclusion ;
|
||||
|
||||
return Out;
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
|
||||
|
||||
Texture2D g_DistortionTexture;
|
||||
Texture2D g_SceneTexture;
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 vBackBuffer : SV_TARGET0;
|
||||
};
|
||||
|
||||
PS_OUT PS_MAIN(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
|
||||
/* 디스토션 렌더타겟 텍스쳐 샘플링 */
|
||||
vector vMtrlDistortion = g_DistortionTexture.Sample(PointSampler, In.vTexcoord);
|
||||
vector vMtrlBackBuffer = g_SceneTexture.Sample(PointSampler, In.vTexcoord);
|
||||
|
||||
/* r 성분을 디스토션할 성분으로 잡아놨으니까, r이 0이라면 리턴. */
|
||||
|
||||
if (vMtrlDistortion.r == 0)
|
||||
{
|
||||
Out.vBackBuffer = vMtrlBackBuffer;
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
// 0 ~ 1 -> -0.5 ~ 0.5
|
||||
float2 vCenteredUV = In.vTexcoord - float2(0.5f, 0.5f);
|
||||
|
||||
|
||||
float fDistortR2 = vMtrlDistortion.r * vMtrlDistortion.r;
|
||||
float fDistortR4 = fDistortR2 * fDistortR2;
|
||||
float fDistortIntensity = vMtrlDistortion.g;
|
||||
float fDistortionFactor = 1.0f + (fDistortIntensity * (fDistortR2 + fDistortR2 * fDistortR4));
|
||||
|
||||
//float fDistortionFactor = 1 + vMtrlDistortion.g * vMtrlDistortion.r * vMtrlDistortion.r;
|
||||
//너무 낮은값 쓰면 찢어지는 효과 남. (같은 픽셀 계속 디스토션 돌려서)
|
||||
//fDistortionFactor = clamp(fDistortionFactor, 0.2f, 2.0f);
|
||||
|
||||
vCenteredUV *= fDistortionFactor;
|
||||
vCenteredUV += float2(0.5f, 0.5f);
|
||||
|
||||
float4 vResult = g_SceneTexture.Sample(MirrorSampler, vCenteredUV);
|
||||
|
||||
Out.vBackBuffer = vResult;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
technique11 DefaultTechnique
|
||||
{
|
||||
pass Distortion
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
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;
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
float PI = 3.141592;
|
||||
|
||||
struct KeyFrame
|
||||
{
|
||||
float3 vScale;
|
||||
@@ -17,104 +15,402 @@ struct Channel
|
||||
|
||||
struct LocalPos
|
||||
{
|
||||
float3 Scale;
|
||||
float pad0;
|
||||
|
||||
float4 Rotation;
|
||||
|
||||
float3 Translation;
|
||||
float pad1;
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 LocalCombined;
|
||||
};
|
||||
|
||||
struct BoneLocal
|
||||
{
|
||||
row_major float4x4 BoneLocal;
|
||||
};
|
||||
|
||||
StructuredBuffer<KeyFrame> g_KeyFrameBuffer : register(t0);
|
||||
StructuredBuffer<Channel> g_ChannelBuffer : register(t1);
|
||||
StructuredBuffer<KeyFrame> g_PrevKeyFrameBuffer : register(t2);
|
||||
StructuredBuffer<Channel> g_PrevChannelBuffer : register(t3);
|
||||
StructuredBuffer<int> g_ParentBuffer : register(t4);
|
||||
StructuredBuffer<BoneLocal> g_BoneLocalBuffer : register(t5);
|
||||
StructuredBuffer<uint> g_BoneRemap : register(t6);
|
||||
|
||||
RWStructuredBuffer<LocalPos> g_LocalPosOutput : register(u0);
|
||||
|
||||
|
||||
cbuffer AnimCB : register(b0)
|
||||
{
|
||||
float CurrentTime;
|
||||
float Duration;
|
||||
float Speed;
|
||||
int MeshBoneCount;
|
||||
int BoneCount;
|
||||
|
||||
int RootBoneIndex;
|
||||
int padding1;
|
||||
float PrevTime;
|
||||
float BlendRatio;
|
||||
|
||||
row_major float4x4 PreTransformMatrix;
|
||||
float4 RootInitRot;
|
||||
};
|
||||
|
||||
float4 quatSlerp(float4 q1, float4 q2, float t)
|
||||
static const float EPS = 1e-6f;
|
||||
|
||||
float4 QuatNormalize(float4 q)
|
||||
{
|
||||
float cosTheta = dot(q1, q2);
|
||||
return q * rsqrt(max(dot(q, q), EPS));
|
||||
}
|
||||
|
||||
float4 QuatSlerp(float4 a, float4 b, float t)
|
||||
{
|
||||
a = QuatNormalize(a);
|
||||
b = QuatNormalize(b);
|
||||
|
||||
float cosTheta = dot(a, b);
|
||||
|
||||
if (cosTheta < 0.0f)
|
||||
{
|
||||
q2 = -q2;
|
||||
b = -b;
|
||||
cosTheta = -cosTheta;
|
||||
}
|
||||
|
||||
if (cosTheta > 0.9995f)
|
||||
return normalize(lerp(q1, q2, t));
|
||||
return QuatNormalize(lerp(a, b, t));
|
||||
|
||||
float theta = acos(cosTheta);
|
||||
float sinTheta = sin(theta);
|
||||
float theta = acos(saturate(cosTheta));
|
||||
float sinTheta = max(sin(theta), EPS);
|
||||
|
||||
float w1 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w2 = sin(t * theta) / sinTheta;
|
||||
float w0 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w1 = sin(t * theta) / sinTheta;
|
||||
|
||||
return q1 * w1 + q2 * w2;
|
||||
return a * w0 + b * w1;
|
||||
}
|
||||
|
||||
float4x4 MakeAffine(float3 scale, float4 rot, float3 trans)
|
||||
{
|
||||
rot = QuatNormalize(rot);
|
||||
|
||||
float xx = rot.x * rot.x;
|
||||
float yy = rot.y * rot.y;
|
||||
float zz = rot.z * rot.z;
|
||||
float xy = rot.x * rot.y;
|
||||
float xz = rot.x * rot.z;
|
||||
float yz = rot.y * rot.z;
|
||||
float wx = rot.w * rot.x;
|
||||
float wy = rot.w * rot.y;
|
||||
float wz = rot.w * rot.z;
|
||||
|
||||
float4x4 M;
|
||||
|
||||
M._11 = (1 - 2 * (yy + zz)) * scale.x;
|
||||
M._12 = (2 * (xy + wz)) * scale.x;
|
||||
M._13 = (2 * (xz - wy)) * scale.x;
|
||||
M._14 = 0;
|
||||
|
||||
M._21 = (2 * (xy - wz)) * scale.y;
|
||||
M._22 = (1 - 2 * (xx + zz)) * scale.y;
|
||||
M._23 = (2 * (yz + wx)) * scale.y;
|
||||
M._24 = 0;
|
||||
|
||||
M._31 = (2 * (xz + wy)) * scale.z;
|
||||
M._32 = (2 * (yz - wx)) * scale.z;
|
||||
M._33 = (1 - 2 * (xx + yy)) * scale.z;
|
||||
M._34 = 0;
|
||||
|
||||
M._41 = trans.x;
|
||||
M._42 = trans.y;
|
||||
M._43 = trans.z;
|
||||
M._44 = 1;
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
uint FindKeyIndexCur(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_KeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_KeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_KeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
uint FindKeyIndexPrev(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_PrevKeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_PrevKeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_PrevKeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
|
||||
float3 GetRow3(float4 v)
|
||||
{
|
||||
uint boneIndex = DTID.x;
|
||||
if (boneIndex >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float time = CurrentTime;
|
||||
|
||||
Channel channel = g_ChannelBuffer[boneIndex];
|
||||
return v.xyz;
|
||||
}
|
||||
|
||||
LocalPos result;
|
||||
|
||||
uint firstIndex = channel.StartIndex;
|
||||
uint keyCount = channel.KeyCount;
|
||||
uint lastIndex = firstIndex + keyCount - 1;
|
||||
float4x4 SampleLocalPrev(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (time >= keyLast.fTrackPosition)
|
||||
if (count == 1)
|
||||
{
|
||||
result.Scale = keyLast.vScale;
|
||||
result.Rotation = keyLast.vRotation;
|
||||
result.Translation = keyLast.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
|
||||
float4x4 SampleLocal(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
void SampleLocalTRS_Cur(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint i = 0; i < keyCount - 1; ++i)
|
||||
{
|
||||
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
|
||||
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
|
||||
{
|
||||
float ratio = (time - Sour.fTrackPosition) /
|
||||
(Dest.fTrackPosition - Sour.fTrackPosition);
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
result.Scale = lerp(Sour.vScale, Dest.vScale, ratio);
|
||||
result.Rotation = quatSlerp(Sour.vRotation, Dest.vRotation, ratio);
|
||||
result.Translation = lerp(Sour.vTranslation, Dest.vTranslation, ratio);
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
g_LocalPosOutput[channel.BoneIndex] = result;
|
||||
return;
|
||||
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float4x4 SampleBlendedLocal(uint bone)
|
||||
{
|
||||
float br = saturate(BlendRatio);
|
||||
|
||||
if (br <= 0.0f)
|
||||
return SampleLocalPrev(bone, PrevTime);
|
||||
if (br >= 1.0f)
|
||||
return SampleLocal(bone, CurrentTime);
|
||||
|
||||
float3 sA, sB, tA, tB;
|
||||
float4 rA, rB;
|
||||
|
||||
SampleLocalTRS_Prev(bone, PrevTime, 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);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
t = 0;
|
||||
r = RootInitRot;
|
||||
}
|
||||
|
||||
return MakeAffine(s, r, t);
|
||||
}
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_MAIN(uint3 DTid : SV_DispatchThreadID)
|
||||
{
|
||||
uint globalBone = DTid.x;
|
||||
if (globalBone >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float4x4 localMat = SampleBlendedLocal(globalBone);
|
||||
g_LocalPosOutput[globalBone].Local = localMat;
|
||||
|
||||
float4x4 combined = localMat;
|
||||
int p = g_ParentBuffer[globalBone];
|
||||
while (p != -1)
|
||||
{
|
||||
combined = mul(combined, SampleBlendedLocal((uint) p));
|
||||
p = g_ParentBuffer[p];
|
||||
}
|
||||
|
||||
combined = mul(combined, PreTransformMatrix);
|
||||
g_LocalPosOutput[globalBone].Combined = combined;
|
||||
|
||||
for (uint local = 0; local < (uint) MeshBoneCount; ++local)
|
||||
{
|
||||
if (g_BoneRemap[local] == globalBone)
|
||||
{
|
||||
g_LocalPosOutput[local].LocalCombined = combined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,16 @@
|
||||
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
struct BoneOut
|
||||
{
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 LocalCombined;
|
||||
|
||||
};
|
||||
float4x4 g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
matrix g_OffsetMatrix[256];
|
||||
|
||||
|
||||
int g_bRimLight;
|
||||
int g_bUseNormalMap;
|
||||
@@ -44,6 +53,7 @@ Texture2D g_Maya_Specular_ColorTexture;
|
||||
Texture2D g_Maya_Specular_RoughnessTexture;
|
||||
Texture2D g_AnisotropyTexture;
|
||||
|
||||
StructuredBuffer<BoneOut> g_BoneBuffer : register(t26);
|
||||
|
||||
Texture2D g_SurfaceParamsTexture;
|
||||
|
||||
@@ -103,13 +113,19 @@ VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix);
|
||||
@@ -135,13 +151,19 @@ VS_OUT VS_MAIN_OUTLINE_READ(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix);
|
||||
@@ -173,12 +195,19 @@ VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In)
|
||||
{
|
||||
VS_OUT_SHADOW Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
matrix BoneMatrix = mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
struct BoneOut
|
||||
{
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 LocalCombined;
|
||||
};
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
matrix g_OffsetMatrix[256];
|
||||
|
||||
int g_bRimLight;
|
||||
int g_bUseNormalMap;
|
||||
@@ -24,41 +32,45 @@ float g_fDisolveEdgeWidth;
|
||||
float4 g_vDisolveEdgeColor;
|
||||
float4 g_vCamPosition;
|
||||
|
||||
Texture2D g_DAOTexture;
|
||||
Texture2D g_THVTexture;
|
||||
Texture2D g_SurfaceParamsTexture;
|
||||
Texture2D g_DeadDisolveTexture;
|
||||
Texture2D g_DeadDisolveBurnTexture;
|
||||
|
||||
float2 g_vSRVFlag;
|
||||
float3 g_vPBR_Flag;
|
||||
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_SpecularTexture;
|
||||
Texture2D g_AmbientTexture;
|
||||
Texture2D g_EmissiveTexture;
|
||||
Texture2D g_MossDiffuseTexture;
|
||||
Texture2D g_NormalTexture;
|
||||
Texture2D g_MossNormalTexture;
|
||||
Texture2D g_NormalBlendTexture;
|
||||
Texture2D g_SROBlendTexture;
|
||||
Texture2D g_MROBlendTexture;
|
||||
Texture2D g_ReflectionTexture;
|
||||
Texture2D g_DiffuseBlend;
|
||||
Texture2D g_MossSROTexture;
|
||||
Texture2D g_MossMROTexture;
|
||||
Texture2D g_MetalnessTexture;
|
||||
Texture2D g_Diffuse_RoughnessTexture;
|
||||
Texture2D g_AmbientOcclusionTexture;
|
||||
Texture2D g_UnknownTexture;
|
||||
Texture2D g_SheenTexture;
|
||||
Texture2D g_ClearcoadTexture;
|
||||
Texture2D g_TransmissionTexture;
|
||||
Texture2D g_Maya_BaseTexture;
|
||||
Texture2D g_Maya_SpecularTexture;
|
||||
Texture2D g_Maya_Specular_ColorTexture;
|
||||
Texture2D g_Maya_Specular_RoughnessTexture;
|
||||
Texture2D g_AnisotropyTexture;
|
||||
Texture2D g_DAOTexture : register(t0);
|
||||
Texture2D g_THVTexture : register(t1);
|
||||
Texture2D g_SurfaceParamsTexture : register(t2);
|
||||
Texture2D g_DeadDisolveTexture : register(t3);
|
||||
Texture2D g_DeadDisolveBurnTexture : register(t4);
|
||||
|
||||
Texture2D g_DiffuseTexture : register(t5);
|
||||
Texture2D g_SpecularTexture : register(t6);
|
||||
Texture2D g_AmbientTexture : register(t7);
|
||||
Texture2D g_EmissiveTexture : register(t8);
|
||||
Texture2D g_MossDiffuseTexture : register(t9);
|
||||
Texture2D g_NormalTexture : register(t10);
|
||||
Texture2D g_MossNormalTexture : register(t11);
|
||||
Texture2D g_NormalBlendTexture : register(t12);
|
||||
Texture2D g_SROBlendTexture : register(t13);
|
||||
Texture2D g_MROBlendTexture : register(t14);
|
||||
Texture2D g_ReflectionTexture : register(t15);
|
||||
Texture2D g_DiffuseBlend : register(t16);
|
||||
Texture2D g_MossSROTexture : register(t17);
|
||||
Texture2D g_MossMROTexture : register(t18);
|
||||
Texture2D g_MetalnessTexture : register(t19);
|
||||
Texture2D g_Diffuse_RoughnessTexture : register(t20);
|
||||
Texture2D g_AmbientOcclusionTexture : register(t21);
|
||||
Texture2D g_UnknownTexture : register(t22);
|
||||
Texture2D g_SheenTexture : register(t23);
|
||||
Texture2D g_ClearcoadTexture : register(t24);
|
||||
Texture2D g_TransmissionTexture : register(t25);
|
||||
Texture2D g_Maya_BaseTexture : register(t26);
|
||||
Texture2D g_Maya_SpecularTexture : register(t27);
|
||||
Texture2D g_Maya_Specular_ColorTexture : register(t28);
|
||||
Texture2D g_Maya_Specular_RoughnessTexture : register(t29);
|
||||
Texture2D g_AnisotropyTexture : register(t30);
|
||||
|
||||
|
||||
StructuredBuffer<BoneOut> g_BoneBuffer : register(t31);
|
||||
|
||||
int g_iBinded_Texture[27];
|
||||
|
||||
@@ -74,6 +86,9 @@ float g_fUsingSurfaceParams;
|
||||
matrix g_BoneMatrices[512];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
@@ -100,35 +115,45 @@ struct VS_OUT
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix);
|
||||
vector vBinormal = mul(vector(In.vBinormal, 0.f), BoneMatrix);
|
||||
vector vTangent = mul(vector(In.vTangent, 0.f), BoneMatrix);
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
|
||||
matrix matWV, matWVP;
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(vPosition, matWVP);
|
||||
Out.vNormal = normalize(mul(vNormal, g_WorldMatrix)).xyz;
|
||||
Out.vBinormal = normalize(mul(vBinormal, g_WorldMatrix)).xyz;
|
||||
Out.vTangent = normalize(mul(vTangent, g_WorldMatrix)).xyz;
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
Out.vWorldPos = mul(vPosition, g_WorldMatrix);
|
||||
Out.vProjPos = Out.vPosition;
|
||||
float4 skinnedPos = mul(float4(In.vPosition, 1.f), BoneMatrix);
|
||||
float3 skinnedNormal = mul(float4(In.vNormal, 0.f), BoneMatrix).xyz;
|
||||
float3 skinnedTangent = mul(float4(In.vTangent, 0.f), BoneMatrix).xyz;
|
||||
float3 skinnedBinormal = mul(float4(In.vBinormal, 0.f), BoneMatrix).xyz;
|
||||
|
||||
matrix matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matrix matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(skinnedPos, matWVP);
|
||||
Out.vWorldPos = mul(skinnedPos, g_WorldMatrix);
|
||||
|
||||
Out.vNormal = normalize(mul(float4(skinnedNormal, 0.f), g_WorldMatrix).xyz);
|
||||
Out.vTangent = normalize(mul(float4(skinnedTangent, 0.f), g_WorldMatrix).xyz);
|
||||
Out.vBinormal = normalize(mul(float4(skinnedBinormal, 0.f), g_WorldMatrix).xyz);
|
||||
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
Out.vProjPos = Out.vPosition;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUT_OUTLINE
|
||||
{
|
||||
float4 vPosition : SV_Position;
|
||||
@@ -144,13 +169,19 @@ VS_OUT_OUTLINE VS_MAIN_OUTLINE(VS_IN In)
|
||||
{
|
||||
VS_OUT_OUTLINE Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
vector vNormal = mul(vector(In.vNormal, 0.f), BoneMatrix);
|
||||
@@ -240,12 +271,26 @@ VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In)
|
||||
{
|
||||
VS_OUT_SHADOW Out;
|
||||
|
||||
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
//float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
|
||||
|
||||
matrix BoneMatrix = mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
//matrix BoneMatrix = mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
|
||||
// mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
|
||||
// mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
|
||||
// mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
|
||||
|
||||
float4 w = In.vBlendWeight;
|
||||
float sumW = max(dot(w, 1.0f), 1e-6f);
|
||||
w /= sumW;
|
||||
|
||||
matrix BoneMatrix =
|
||||
mul(g_OffsetMatrix[In.vBlendIndex.x],
|
||||
g_BoneBuffer[In.vBlendIndex.x].LocalCombined) * w.x
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
|
||||
g_BoneBuffer[In.vBlendIndex.y].LocalCombined) * w.y
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
|
||||
g_BoneBuffer[In.vBlendIndex.z].LocalCombined) * w.z
|
||||
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
|
||||
g_BoneBuffer[In.vBlendIndex.w].LocalCombined) * w.w;
|
||||
|
||||
/* ?ㅽ궎??*/
|
||||
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
|
||||
@@ -567,7 +612,7 @@ technique11 DefaultTechnique
|
||||
pass ShadowPass // 1
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -820,7 +820,7 @@ technique11 MeshTechnique11
|
||||
pass ShadowPass
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -177,6 +177,10 @@ float g_fRimLightPower;
|
||||
float g_fRimLightStrength;
|
||||
float4 g_vRimLightColor;
|
||||
|
||||
/* 모델 디스토션 */
|
||||
|
||||
float g_fModelDistortIntensity;
|
||||
|
||||
|
||||
|
||||
struct VS_IN
|
||||
@@ -557,21 +561,7 @@ float4 DrawEffect(PS_IN In)
|
||||
discard;
|
||||
}
|
||||
|
||||
/* 소프트 이펙트 */
|
||||
|
||||
float2 vTexcoord;
|
||||
|
||||
vTexcoord.x = In.vProjPos.x / In.vProjPos.w * 0.5f + 0.5f;
|
||||
vTexcoord.y = In.vProjPos.y / In.vProjPos.w * -0.5f + 0.5f;
|
||||
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
float fOldViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fDistance = fOldViewZ - In.vProjPos.w;
|
||||
|
||||
vMtrlDiffuse.a = vMtrlDiffuse.a * saturate(fDistance);
|
||||
|
||||
|
||||
return vMtrlDiffuse;
|
||||
}
|
||||
|
||||
@@ -681,6 +671,28 @@ float4 RimLight(PS_IN In)
|
||||
return vRimLight;
|
||||
}
|
||||
|
||||
float4 SoftEffect(PS_IN In, float4 vMtrlDiffuse)
|
||||
{
|
||||
/* 소프트 이펙트 */
|
||||
|
||||
float4 vDiffuse = vMtrlDiffuse;
|
||||
|
||||
float2 vTexcoord;
|
||||
|
||||
vTexcoord.x = In.vProjPos.x / In.vProjPos.w * 0.5f + 0.5f;
|
||||
vTexcoord.y = In.vProjPos.y / In.vProjPos.w * -0.5f + 0.5f;
|
||||
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
float fOldViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fDistance = fOldViewZ - In.vProjPos.w;
|
||||
|
||||
vDiffuse.a = vDiffuse.a * saturate(fDistance);
|
||||
|
||||
return vDiffuse;
|
||||
|
||||
}
|
||||
PS_OUT PS_MAIN(PS_IN In)
|
||||
{
|
||||
|
||||
@@ -689,10 +701,12 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
vMtrlDiffuse.rgb += EmissiveDraw(In, vMtrlDiffuse).rgb;
|
||||
|
||||
vMtrlDiffuse.rgb += RimLight(In).rgb;
|
||||
|
||||
|
||||
Out.vDiffuse = vMtrlDiffuse;
|
||||
|
||||
return Out;
|
||||
@@ -706,6 +720,8 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
int2 iTexel = int2(In.vPosition.xy);
|
||||
|
||||
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(iTexel, 0)).r;
|
||||
@@ -790,7 +806,8 @@ PS_BLUR_OUT PS_BLUR_NOEMISSIVE(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
//// 색깔 추가할 처리 (이미시브)
|
||||
//// 색깔 추가할 처리 (이미시브)
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
vMtrlDiffuse.a *= 5.f;
|
||||
|
||||
@@ -811,6 +828,8 @@ PS_BLUR_OUT PS_BLUR(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
vMtrlDiffuse.a *= 5.f;
|
||||
|
||||
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a);
|
||||
@@ -834,6 +853,7 @@ PS_BLOOM_OUT PS_BLOOM(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
//// 색깔 추가할 처리 (이미시브)
|
||||
|
||||
@@ -869,6 +889,8 @@ PS_BLOOM_OUT PS_BLEND(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
vMtrlDiffuse.rgb += EmissiveDraw(In, vMtrlDiffuse).rgb;
|
||||
|
||||
vMtrlDiffuse += RimLight(In);
|
||||
@@ -886,6 +908,8 @@ PS_BLOOM_OUT PS_WEIGHTED_FOR_BLEND(PS_IN In)
|
||||
|
||||
vMtrlDiffuse = DrawEffect(In);
|
||||
|
||||
vMtrlDiffuse = SoftEffect(In, vMtrlDiffuse);
|
||||
|
||||
vMtrlDiffuse.rgb += EmissiveDraw(In, vMtrlDiffuse).rgb;
|
||||
|
||||
vMtrlDiffuse += RimLight(In);
|
||||
@@ -913,8 +937,38 @@ PS_OUT PS_NO_DEPTH_COMPARE(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_BLOOM_OUT PS_DISTORTION(PS_IN In)
|
||||
{
|
||||
PS_BLOOM_OUT Out;
|
||||
|
||||
vector vMtrlDiffuse;
|
||||
|
||||
|
||||
Out.vDiffuse = DrawEffect(In);
|
||||
|
||||
if (Out.vDiffuse.a == 0.f)
|
||||
discard;
|
||||
|
||||
/* b,a 성분은 0으로 밀어준다. */
|
||||
|
||||
|
||||
|
||||
/* 거리 기반으로 디스토션 할 객체 중점으로부터의 거리 구해냄. */
|
||||
/* 중점이라면 r은 1, 중점에서의 거리가 멀수록 1에서 r 성분의 크기가 줄어드는 형태. */
|
||||
Out.vDiffuse.r = 1 - length(In.vTexcoord - float2(0.5f, 0.5f));
|
||||
|
||||
/* 세기 */
|
||||
Out.vDiffuse.g = g_fModelDistortIntensity * Out.vDiffuse.a;
|
||||
|
||||
Out.vDiffuse.ba = 0.f;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
technique11 DefaultTechnique
|
||||
{
|
||||
//0
|
||||
pass Model
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
@@ -924,7 +978,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
//1
|
||||
pass NON_NOMALMAP
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -934,7 +988,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
|
||||
}
|
||||
|
||||
//2
|
||||
pass Blur
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -944,7 +998,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_BLUR();
|
||||
}
|
||||
|
||||
//3
|
||||
pass WEIGHTBLEND
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -954,7 +1008,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
|
||||
}
|
||||
|
||||
//4
|
||||
pass NO_WORLD
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -964,7 +1018,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
|
||||
}
|
||||
|
||||
//5
|
||||
pass BLUR_NO_WORLD
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -975,7 +1029,7 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_BLUR();
|
||||
}
|
||||
|
||||
|
||||
//6
|
||||
pass BLEND
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -985,7 +1039,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_BLEND();
|
||||
}
|
||||
|
||||
//7
|
||||
pass BLEND_NOWORLD
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -995,7 +1049,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_BLEND();
|
||||
}
|
||||
|
||||
//8
|
||||
pass BLOOM
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1005,7 +1059,7 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_BLOOM();
|
||||
}
|
||||
|
||||
//9
|
||||
pass BLOOM_NOWORLD
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1016,7 +1070,7 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_BLOOM();
|
||||
}
|
||||
|
||||
|
||||
//10
|
||||
pass BLUR_NO_EMMISVE
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1027,6 +1081,8 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_BLUR_NOEMISSIVE();
|
||||
}
|
||||
|
||||
//11
|
||||
|
||||
pass BLUR_NO_WORLD_NO_EMISSIVE
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1037,6 +1093,7 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_BLUR_NOEMISSIVE();
|
||||
}
|
||||
|
||||
//12
|
||||
pass WEIGHTBLEND_FOR_BLEND
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1048,7 +1105,7 @@ technique11 DefaultTechnique
|
||||
}
|
||||
|
||||
|
||||
|
||||
//13
|
||||
pass PARTICLE_DEPTH_STOP
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1059,7 +1116,7 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
|
||||
//14
|
||||
pass WB_CULLING
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
@@ -1070,6 +1127,7 @@ technique11 DefaultTechnique
|
||||
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
|
||||
}
|
||||
|
||||
//15
|
||||
pass SCREEN_FX
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
@@ -1079,6 +1137,16 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_NO_DEPTH_COMPARE();
|
||||
}
|
||||
//16
|
||||
pass DISTORTION
|
||||
{
|
||||
SetRasterizerState(RS_Nocull);
|
||||
SetDepthStencilState(DSS_None, 0);
|
||||
SetBlendState(BS_WB_Acc, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_DISTORTION();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -249,7 +249,7 @@ technique11 NorTexTechnique11
|
||||
pass ShadowPass // 3
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetDepthStencilState(DSS_Default_Less, 0);
|
||||
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
|
||||
VertexShader = compile vs_5_0 VS_MAIN_SHADOW();
|
||||
GeometryShader = NULL;
|
||||
|
||||
@@ -262,7 +262,7 @@ vector Draw_Trail(PS_IN In)
|
||||
|
||||
if (g_isDissolve)
|
||||
{
|
||||
vMtrlDiffuse.a *= g_vDissolveTime.x / g_vDissolveTime.y;
|
||||
vMtrlDiffuse.a *= saturate((0.96f - g_vDissolveTime.x / g_vDissolveTime.y));
|
||||
}
|
||||
|
||||
return vMtrlDiffuse;
|
||||
|
||||
@@ -430,11 +430,11 @@ void CEditEffect::Describe_Entity()
|
||||
//여기서 모델, 텍스쳐, 선택할 수 있도록 함
|
||||
|
||||
const char* pLerp[] = { "Linear" , "EaseInQuad", "EaseOutQuad", "EaseInCubic" , "EaseOutCubic" , "EaseInOutSin" , "EaseInBack" , "Expo" , "Circle" };
|
||||
const char* pRenderNames[] = { "PRIORITY" , "SHADOW_NEAR", "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" , "WB_CULLING", "SCREEN_FX"};
|
||||
const char* pBloomType[] = { "NONE" , "BASIC" , "MUILTY"};
|
||||
const char* pRenderNames[] = { "PRIORITY" , "SHADOW_NEAR", "NONBLEND", "DECAL", "BLUR" , "NONLIGHT" ,"EFFECT", "BLEND" ,"BLOOM", "DISTORTION" , "UI", "OCCLUSION" , "SHADOW_MIDDLE", "SHADOW_FAR" , "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" , "WB_CULLING", "SCREEN_FX" , "DISTORTION"};
|
||||
const char* pBloomType[] = { "NONE" , "BASIC" , "MUILTY"};
|
||||
_int iCurrentItem = static_cast<_int>(m_EffectInfo.eRenderOrder);
|
||||
_int iCurrentType = static_cast<_int>(m_EffectInfo.eEffectType);
|
||||
_int iCurrentBloomType = static_cast<_int>(m_EffectInfo.eBloomType);
|
||||
@@ -488,6 +488,9 @@ void CEditEffect::Describe_Entity()
|
||||
GUI::Checkbox("Bloom", &m_EffectInfo.isBloom);
|
||||
GUI::Checkbox("Blur", &m_EffectInfo.isBlur);
|
||||
GUI::Checkbox("RimLight", &m_EffectInfo.isRimLight);
|
||||
|
||||
|
||||
|
||||
|
||||
if (GUI::Checkbox("Billboard", &m_EffectInfo.isBillboard))
|
||||
{
|
||||
@@ -502,6 +505,8 @@ void CEditEffect::Describe_Entity()
|
||||
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
|
||||
|
||||
if (m_EffectInfo.isBlur)
|
||||
{
|
||||
if (GUI::TreeNode("BLUR"))
|
||||
@@ -553,7 +558,12 @@ void CEditEffect::Describe_Entity()
|
||||
GUI::TreePop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (GUI::TreeNode("MODEL DISTORTION"))
|
||||
{
|
||||
GUI::DragFloat("Distortion Intensity", &m_EffectInfo.fModelDistortIntensity, 0.005f, 0.f, 1.f);
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
if (GUI::TreeNode("EMISSIVE"))
|
||||
{
|
||||
|
||||
@@ -1013,6 +1013,12 @@ HRESULT CEffectObject::Bind_ShaderResources()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fModelDistortIntensity", &m_EffectInfo.fModelDistortIntensity, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (m_pDiffuse_TextureCom != nullptr)
|
||||
{
|
||||
|
||||
@@ -146,10 +146,14 @@ HRESULT CGoblin::Render()
|
||||
}
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -158,6 +162,8 @@ HRESULT CGoblin::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -198,13 +204,20 @@ HRESULT CGoblin::Render_Shadow(SHADOW eType)
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::SHADOW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,12 @@ HRESULT CGoblin_Spector::Render()
|
||||
_uint iShaderPass = ENUM_CLASS(SHADER_PASS_ANIM::SPECTOR);
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -128,6 +133,8 @@ HRESULT CGoblin_Spector::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -155,17 +155,25 @@ HRESULT CPlayer::Render()
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,12 @@ HRESULT CTroll::Render()
|
||||
}
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
if (FAILED(m_pShaderCom->Bind_Matrices(
|
||||
"g_OffsetMatrix",
|
||||
m_pModelCom->Get_OffsetMatrix(i).data(),
|
||||
(_int)m_pModelCom->Get_OffsetMatrix(i).size()
|
||||
)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -201,6 +206,8 @@ HRESULT CTroll::Render()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pModelCom->Bind_OutPut_SRV_VS(31, 0);
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
@@ -43,16 +43,7 @@ HRESULT CWand::Initialize(void* pArg)
|
||||
|
||||
void CWand::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
_matrix socketMatrix = {};
|
||||
|
||||
socketMatrix = XMLoadFloat4x4(m_pSocketMatrices);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]);
|
||||
}
|
||||
|
||||
m_pTransformCom->Set_WorldMatrix(socketMatrix * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()));
|
||||
XMStoreFloat4x4(&m_pWandTipMatrix, XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("Effect")) * m_pTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
@@ -68,6 +59,17 @@ void CWand::Update(_float fTimeDelta)
|
||||
|
||||
void CWand::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
_matrix socketMatrix = {};
|
||||
|
||||
socketMatrix = XMLoadFloat4x4(m_pSocketMatrices);
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
socketMatrix.r[i] = XMVector3Normalize(socketMatrix.r[i]);
|
||||
}
|
||||
|
||||
m_pTransformCom->Set_WorldMatrix(socketMatrix * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()));
|
||||
XMStoreFloat4x4(&m_pWandTipMatrix, XMLoadFloat4x4(m_pModelCom->Get_BoneMatrixPtr("Effect")) * m_pTransformCom->Get_XMWorldMatrix());
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Editor
|
||||
SPELL_HEADER_LINE, SPELL_DRAG, CAMERA_LOCKON, LODING_SCREEN,
|
||||
ENEMY_HPBAR, BOSS_HPBAR, QUEST_BORDER, QUEST_INFO, QUEST_STATUS, BROOMSTICK,
|
||||
ENEMY_DETECTION, INTERACTION_OBJECT, 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 ,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 ,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 };
|
||||
|
||||
enum class QUESTTYPE { MAIN, SUB, END };
|
||||
|
||||
@@ -106,8 +106,8 @@ class CEffectObject abstract : public CPartObject
|
||||
|
||||
_float3 vDissolveValue = {};
|
||||
|
||||
|
||||
_float2 vPadding0 = {};
|
||||
_float fModelDistortIntensity = {};
|
||||
_float vPadding0 = {};
|
||||
|
||||
_float fLightDeley = {};
|
||||
_float fLightIntensity = {};
|
||||
|
||||
@@ -77,6 +77,13 @@ DepthStencilState DSS_None
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_Less
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = all;
|
||||
DepthFunc = less;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Effect
|
||||
{
|
||||
DepthEnable = true;
|
||||
|
||||
@@ -11,7 +11,6 @@ float g_fFar;
|
||||
float g_fShadowFar_NEAR;
|
||||
float g_fShadowFar_MIDDDLE;
|
||||
float g_fShadowFar_FAR;
|
||||
float g_fPreShadowFar;
|
||||
float g_fCascadeSplitRatioNear;
|
||||
float g_fCascadeSplitRatioFar;
|
||||
uint g_iMaxShadowWidth;
|
||||
@@ -27,6 +26,7 @@ float g_fFarBlurStart;
|
||||
float g_fFarBlurEnd;
|
||||
float g_fDOFBlurMultiplier;
|
||||
float g_fSSAO_BIAS;
|
||||
float g_fSSAOStrength;
|
||||
|
||||
Texture2D g_Texture;
|
||||
Texture2D g_SSAONoiseTexture;
|
||||
@@ -77,6 +77,7 @@ vector g_vLightSpecular;
|
||||
|
||||
float g_fFogDensity;
|
||||
float g_fFogPow;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
@@ -220,10 +221,10 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
float2 uv = In.vTexcoord;
|
||||
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -279,12 +280,12 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir.xyz) * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient));
|
||||
Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f);
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -302,7 +303,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -343,7 +344,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
if (g_bUsePowerLightAttenuation)
|
||||
{
|
||||
@@ -358,7 +359,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -391,13 +392,13 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -415,7 +416,7 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -430,7 +431,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
|
||||
float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f);
|
||||
float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
|
||||
float fAmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
float fSSAO_AmbientOcclusion = g_SSAOInputTexture.Sample(DefaultSampler, uv).r;
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
@@ -471,7 +472,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -482,7 +483,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -519,12 +520,12 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fAmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vToLight * -1.f, vNormal), 0.f) + (fSSAO_AmbientOcclusion * g_vLightAmbient * g_vMtrlAmbient)));
|
||||
Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(vToView * -1.f, vToLight), 0.f), 50.f));
|
||||
|
||||
Out.vSpecular.a = 0.f;
|
||||
return Out;
|
||||
}
|
||||
float fTotalOcclusion = saturate(fOcclusion * fAmbientOcclusion);
|
||||
float fTotalOcclusion = saturate(fOcclusion * fSSAO_AmbientOcclusion);
|
||||
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
@@ -542,7 +543,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float3 vFinalSpecular = PBR_Out.vSpecular * g_vLightSpecular.rgb;
|
||||
|
||||
Out.vShade = float4(vFinalDiffuse, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 1.f);
|
||||
Out.vSpecular = float4(vFinalSpecular, 0.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -560,23 +561,23 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
if (0.f == vDiffuse.a) { discard; }
|
||||
|
||||
vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float4 vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vSpecular.a = 0.f;
|
||||
Out.vBackBuffer = vDiffuse * vShade + vSpecular;
|
||||
|
||||
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
|
||||
vector vPosition, vPreShadowPosition;
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
|
||||
/* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
@@ -607,7 +608,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
/* 광원의 NDC에서 샘플링 */
|
||||
float fVisibility_Dynamic_Near = ShadowVisibility_hwPCF(g_ShadowNearTexture, vNearShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.x);
|
||||
float fVisibility_Dynamic_Middle = ShadowVisibility_hwPCF(g_ShadowMiddleTexture, vMiddleShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.y);
|
||||
float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
//float fVisibility_Dynamic_Far = ShadowVisibility_hwPCF(g_ShadowFarTexture, vFarShadowPos, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.z);
|
||||
float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), g_vShadowBias.w);
|
||||
|
||||
////////////////////////////
|
||||
@@ -620,20 +621,31 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
// 경계 주변 부드럽게 할 비중
|
||||
float fCascadeBlend_NearToMiddle = smoothstep(g_fCascadeSplitRatioNear - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioNear + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
//float fCascadeBlend_MiddleToFar = smoothstep(g_fCascadeSplitRatioFar - fShadowCascadeBlendWidthRatio,
|
||||
// g_fCascadeSplitRatioFar + fShadowCascadeBlendWidthRatio, fDepthRatio);
|
||||
|
||||
// Near -> Middle
|
||||
float fVisibilityDynamic = lerp(fVisibility_Dynamic_Near, fVisibility_Dynamic_Middle, fCascadeBlend_NearToMiddle);
|
||||
// Middle -> Far 경계 부드럽게
|
||||
fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
// PreShadow(Static)로 넘어가는 구간(원하는 대로 조절)
|
||||
float fStaticShadowBlendStartRatio = 0.70f;
|
||||
float fStaticShadowBlendEndRatio = 0.95f;
|
||||
|
||||
float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibility_Static, fStaticShadowBlendWeight);
|
||||
//fVisibilityDynamic = lerp(fVisibilityDynamic, fVisibility_Dynamic_Far, fCascadeBlend_MiddleToFar);
|
||||
|
||||
|
||||
// 1번째 방법
|
||||
// Dynamic->Static 부드럽게 전환
|
||||
//float fVisibilityCombinedLogical = min(fVisibilityDynamic, fVisibility_Static);
|
||||
//float fStaticShadowBlendStartRatio = g_fCascadeSplitRatioFar;
|
||||
//float fStaticShadowBlendWidthRatio = 0.05f;
|
||||
//float fStaticShadowBlendEndRatio = min(1.0f, fStaticShadowBlendStartRatio + fStaticShadowBlendWidthRatio);
|
||||
//float fStaticShadowBlendWeight = smoothstep(fStaticShadowBlendStartRatio, fStaticShadowBlendEndRatio, fDepthRatio);
|
||||
//float fVisibilityCombined = lerp(fVisibilityDynamic, fVisibilityCombinedLogical, fStaticShadowBlendWeight);
|
||||
|
||||
// 2번째 방법
|
||||
// Dynamic * Static 항상 최소곱
|
||||
//float fVisibilityCombined = saturate(fVisibilityDynamic * fVisibility_Static);
|
||||
|
||||
// 3번째 방법
|
||||
// Dynamic , Static 최소값만 취함
|
||||
float fVisibilityCombined = min(fVisibilityDynamic, fVisibility_Static);
|
||||
|
||||
// 최소 밝기
|
||||
float fMinShadowBrightness = 0.25f;
|
||||
@@ -644,7 +656,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
|
||||
////////////////////////////
|
||||
// 블러 추가
|
||||
float4 vColor = 0.f;
|
||||
float3 vColor = { 0.f, 0.f, 0.f };
|
||||
|
||||
/* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
|
||||
float2 vTexcoord;
|
||||
@@ -656,10 +668,10 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
Out.vBackBuffer.rgb += vColor;
|
||||
Out.vEnvironment = Out.vBackBuffer;
|
||||
|
||||
return Out;
|
||||
@@ -839,14 +851,15 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(PointSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -880,7 +893,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -890,7 +903,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
|
||||
@@ -902,10 +915,23 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBlurX = float4(vColor, fOriginalAlpha);
|
||||
Out.vBlurWeight = fAcc;
|
||||
|
||||
return Out;
|
||||
@@ -914,14 +940,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float4 vDepthDesc = float4(0.f, 0.f, 0.f, 1.f);
|
||||
float3 vColor = float3(0.f, 0.f, 0.f);
|
||||
float2 vTexcoord = In.vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(PointSampler, vTexcoord);
|
||||
float4 vXBlur = g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
float fOriginalAlpha = vOriginal.a;
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
@@ -933,16 +961,16 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
{
|
||||
// 최소치 이내면 블러 스킵
|
||||
// 최소치 이내면 블러 안함
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
@@ -956,7 +984,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
if (false == AlmostEqual3(vDepthDesc.w, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
@@ -966,7 +994,7 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord);
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(BorderZeroSampler, vTexcoord).rgb;
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
@@ -974,28 +1002,27 @@ PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
vColor /= fAcc;
|
||||
}
|
||||
|
||||
float fOriginalLumen = length(vOriginal.rgb);
|
||||
float fBlurLumen = length(vColor.rgb);
|
||||
float fOriginalLumen = length(vOriginal.rgb); // 원본 빛양을 보존
|
||||
float fBlurLumen = length(vColor);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > 1e-4f)
|
||||
if (fBlurLumen > FLT_EPSILON3)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurMatched = vColor.rgb * fLumenScale;
|
||||
float3 vBlurAdjusted = vColor * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 finalColor = lerp(vOriginal.rgb, vBlurMatched, fBlendAmount);
|
||||
float3 vFinalColor = lerp(vOriginal.rgb, vBlurAdjusted, fBlendAmount);
|
||||
|
||||
Out.vBackBuffer = float4(finalColor.xyz, vOriginal.a);
|
||||
Out.vEnvironment = 0.f;
|
||||
Out.vBackBuffer = float4(vColor, fOriginalAlpha);
|
||||
Out.vEnvironment = fAcc;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1023,26 +1050,30 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
vector vFinalColor;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float fRatio;
|
||||
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
float4 vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
if (true == g_bFogVisible)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
float4 vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fOriginalAlpha = vColor.a;
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vFinalColor;
|
||||
float fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
}
|
||||
vFinalColor.a = 1.f; // fOriginalAlpha;
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.a = 1.f;
|
||||
Out.vFirstTarget = vColor;
|
||||
}
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_BACKBUFFER PS_TONE_MAPPING(PS_IN In)
|
||||
@@ -1127,7 +1158,7 @@ PS_OUT_SSAO_AMBIENT_OCCLUSION PS_SSAO_AMBIENT_OCCLUSION(PS_IN In)
|
||||
fIsOccluded *= fRangeCheck;
|
||||
fOcclusion += fIsOccluded;
|
||||
}
|
||||
fOcclusion = (1.f - (fOcclusion / g_iKernelSize) * fRatio);
|
||||
fOcclusion = saturate(1.f - (fOcclusion * g_fSSAOStrength / g_iKernelSize) * fRatio);
|
||||
Out.fOcclusion = fOcclusion ;
|
||||
|
||||
return Out;
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
|
||||
|
||||
|
||||
Texture2D g_DistortionTexture;
|
||||
Texture2D g_SceneTexture;
|
||||
|
||||
struct VS_IN
|
||||
{
|
||||
float3 vPosition : POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VS_OUT
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
|
||||
matrix matWV, matWVP;
|
||||
|
||||
matWV = mul(g_WorldMatrix, g_ViewMatrix);
|
||||
matWVP = mul(matWV, g_ProjMatrix);
|
||||
|
||||
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
|
||||
Out.vTexcoord = In.vTexcoord;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
struct PS_IN
|
||||
{
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PS_OUT
|
||||
{
|
||||
float4 vBackBuffer : SV_TARGET0;
|
||||
};
|
||||
|
||||
PS_OUT PS_MAIN(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
|
||||
/* 디스토션 렌더타겟 텍스쳐 샘플링 */
|
||||
vector vMtrlDistortion = g_DistortionTexture.Sample(PointSampler, In.vTexcoord);
|
||||
vector vMtrlBackBuffer = g_SceneTexture.Sample(PointSampler, In.vTexcoord);
|
||||
|
||||
/* r 성분을 디스토션할 성분으로 잡아놨으니까, r이 0이라면 리턴. */
|
||||
|
||||
if (vMtrlDistortion.r == 0)
|
||||
{
|
||||
Out.vBackBuffer = vMtrlBackBuffer;
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
// 0 ~ 1 -> -0.5 ~ 0.5
|
||||
float2 vCenteredUV = In.vTexcoord - float2(0.5f, 0.5f);
|
||||
|
||||
|
||||
float fDistortR2 = vMtrlDistortion.r * vMtrlDistortion.r;
|
||||
float fDistortR4 = fDistortR2 * fDistortR2;
|
||||
float fDistortIntensity = vMtrlDistortion.g;
|
||||
float fDistortionFactor = 1.0f + (fDistortIntensity * (fDistortR2 + fDistortR2 * fDistortR4));
|
||||
|
||||
//float fDistortionFactor = 1 + vMtrlDistortion.g * vMtrlDistortion.r * vMtrlDistortion.r;
|
||||
//너무 낮은값 쓰면 찢어지는 효과 남. (같은 픽셀 계속 디스토션 돌려서)
|
||||
//fDistortionFactor = clamp(fDistortionFactor, 0.2f, 2.0f);
|
||||
|
||||
vCenteredUV *= fDistortionFactor;
|
||||
vCenteredUV += float2(0.5f, 0.5f);
|
||||
|
||||
float4 vResult = g_SceneTexture.Sample(MirrorSampler, vCenteredUV);
|
||||
|
||||
Out.vBackBuffer = vResult;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
technique11 DefaultTechnique
|
||||
{
|
||||
pass Distortion
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
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;
|
||||
PixelShader = compile ps_5_0 PS_MAIN();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
float PI = 3.141592;
|
||||
|
||||
struct KeyFrame
|
||||
{
|
||||
float3 vScale;
|
||||
@@ -17,104 +15,402 @@ struct Channel
|
||||
|
||||
struct LocalPos
|
||||
{
|
||||
float3 Scale;
|
||||
float pad0;
|
||||
|
||||
float4 Rotation;
|
||||
|
||||
float3 Translation;
|
||||
float pad1;
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 LocalCombined;
|
||||
};
|
||||
|
||||
struct BoneLocal
|
||||
{
|
||||
row_major float4x4 BoneLocal;
|
||||
};
|
||||
|
||||
StructuredBuffer<KeyFrame> g_KeyFrameBuffer : register(t0);
|
||||
StructuredBuffer<Channel> g_ChannelBuffer : register(t1);
|
||||
StructuredBuffer<KeyFrame> g_PrevKeyFrameBuffer : register(t2);
|
||||
StructuredBuffer<Channel> g_PrevChannelBuffer : register(t3);
|
||||
StructuredBuffer<int> g_ParentBuffer : register(t4);
|
||||
StructuredBuffer<BoneLocal> g_BoneLocalBuffer : register(t5);
|
||||
StructuredBuffer<uint> g_BoneRemap : register(t6);
|
||||
|
||||
RWStructuredBuffer<LocalPos> g_LocalPosOutput : register(u0);
|
||||
|
||||
|
||||
cbuffer AnimCB : register(b0)
|
||||
{
|
||||
float CurrentTime;
|
||||
float Duration;
|
||||
float Speed;
|
||||
int MeshBoneCount;
|
||||
int BoneCount;
|
||||
|
||||
int RootBoneIndex;
|
||||
int padding1;
|
||||
float PrevTime;
|
||||
float BlendRatio;
|
||||
|
||||
row_major float4x4 PreTransformMatrix;
|
||||
float4 RootInitRot;
|
||||
};
|
||||
|
||||
float4 quatSlerp(float4 q1, float4 q2, float t)
|
||||
static const float EPS = 1e-6f;
|
||||
|
||||
float4 QuatNormalize(float4 q)
|
||||
{
|
||||
float cosTheta = dot(q1, q2);
|
||||
return q * rsqrt(max(dot(q, q), EPS));
|
||||
}
|
||||
|
||||
float4 QuatSlerp(float4 a, float4 b, float t)
|
||||
{
|
||||
a = QuatNormalize(a);
|
||||
b = QuatNormalize(b);
|
||||
|
||||
float cosTheta = dot(a, b);
|
||||
|
||||
if (cosTheta < 0.0f)
|
||||
{
|
||||
q2 = -q2;
|
||||
b = -b;
|
||||
cosTheta = -cosTheta;
|
||||
}
|
||||
|
||||
if (cosTheta > 0.9995f)
|
||||
return normalize(lerp(q1, q2, t));
|
||||
return QuatNormalize(lerp(a, b, t));
|
||||
|
||||
float theta = acos(cosTheta);
|
||||
float sinTheta = sin(theta);
|
||||
float theta = acos(saturate(cosTheta));
|
||||
float sinTheta = max(sin(theta), EPS);
|
||||
|
||||
float w1 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w2 = sin(t * theta) / sinTheta;
|
||||
float w0 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w1 = sin(t * theta) / sinTheta;
|
||||
|
||||
return q1 * w1 + q2 * w2;
|
||||
return a * w0 + b * w1;
|
||||
}
|
||||
|
||||
float4x4 MakeAffine(float3 scale, float4 rot, float3 trans)
|
||||
{
|
||||
rot = QuatNormalize(rot);
|
||||
|
||||
float xx = rot.x * rot.x;
|
||||
float yy = rot.y * rot.y;
|
||||
float zz = rot.z * rot.z;
|
||||
float xy = rot.x * rot.y;
|
||||
float xz = rot.x * rot.z;
|
||||
float yz = rot.y * rot.z;
|
||||
float wx = rot.w * rot.x;
|
||||
float wy = rot.w * rot.y;
|
||||
float wz = rot.w * rot.z;
|
||||
|
||||
float4x4 M;
|
||||
|
||||
M._11 = (1 - 2 * (yy + zz)) * scale.x;
|
||||
M._12 = (2 * (xy + wz)) * scale.x;
|
||||
M._13 = (2 * (xz - wy)) * scale.x;
|
||||
M._14 = 0;
|
||||
|
||||
M._21 = (2 * (xy - wz)) * scale.y;
|
||||
M._22 = (1 - 2 * (xx + zz)) * scale.y;
|
||||
M._23 = (2 * (yz + wx)) * scale.y;
|
||||
M._24 = 0;
|
||||
|
||||
M._31 = (2 * (xz + wy)) * scale.z;
|
||||
M._32 = (2 * (yz - wx)) * scale.z;
|
||||
M._33 = (1 - 2 * (xx + yy)) * scale.z;
|
||||
M._34 = 0;
|
||||
|
||||
M._41 = trans.x;
|
||||
M._42 = trans.y;
|
||||
M._43 = trans.z;
|
||||
M._44 = 1;
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
uint FindKeyIndexCur(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_KeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_KeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_KeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
uint FindKeyIndexPrev(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_PrevKeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_PrevKeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_PrevKeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
|
||||
float3 GetRow3(float4 v)
|
||||
{
|
||||
uint boneIndex = DTID.x;
|
||||
if (boneIndex >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float time = CurrentTime;
|
||||
|
||||
Channel channel = g_ChannelBuffer[boneIndex];
|
||||
return v.xyz;
|
||||
}
|
||||
|
||||
LocalPos result;
|
||||
|
||||
uint firstIndex = channel.StartIndex;
|
||||
uint keyCount = channel.KeyCount;
|
||||
uint lastIndex = firstIndex + keyCount - 1;
|
||||
float4x4 SampleLocalPrev(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (time >= keyLast.fTrackPosition)
|
||||
if (count == 1)
|
||||
{
|
||||
result.Scale = keyLast.vScale;
|
||||
result.Rotation = keyLast.vRotation;
|
||||
result.Translation = keyLast.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
|
||||
float4x4 SampleLocal(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
void SampleLocalTRS_Cur(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint i = 0; i < keyCount - 1; ++i)
|
||||
{
|
||||
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
|
||||
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
|
||||
{
|
||||
float ratio = (time - Sour.fTrackPosition) /
|
||||
(Dest.fTrackPosition - Sour.fTrackPosition);
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
result.Scale = lerp(Sour.vScale, Dest.vScale, ratio);
|
||||
result.Rotation = quatSlerp(Sour.vRotation, Dest.vRotation, ratio);
|
||||
result.Translation = lerp(Sour.vTranslation, Dest.vTranslation, ratio);
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
g_LocalPosOutput[channel.BoneIndex] = result;
|
||||
return;
|
||||
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float4x4 SampleBlendedLocal(uint bone)
|
||||
{
|
||||
float br = saturate(BlendRatio);
|
||||
|
||||
if (br <= 0.0f)
|
||||
return SampleLocalPrev(bone, PrevTime);
|
||||
if (br >= 1.0f)
|
||||
return SampleLocal(bone, CurrentTime);
|
||||
|
||||
float3 sA, sB, tA, tB;
|
||||
float4 rA, rB;
|
||||
|
||||
SampleLocalTRS_Prev(bone, PrevTime, 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);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
t = 0;
|
||||
r = RootInitRot;
|
||||
}
|
||||
|
||||
return MakeAffine(s, r, t);
|
||||
}
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_MAIN(uint3 DTid : SV_DispatchThreadID)
|
||||
{
|
||||
uint globalBone = DTid.x;
|
||||
if (globalBone >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float4x4 localMat = SampleBlendedLocal(globalBone);
|
||||
g_LocalPosOutput[globalBone].Local = localMat;
|
||||
|
||||
float4x4 combined = localMat;
|
||||
int p = g_ParentBuffer[globalBone];
|
||||
while (p != -1)
|
||||
{
|
||||
combined = mul(combined, SampleBlendedLocal((uint) p));
|
||||
p = g_ParentBuffer[p];
|
||||
}
|
||||
|
||||
combined = mul(combined, PreTransformMatrix);
|
||||
g_LocalPosOutput[globalBone].Combined = combined;
|
||||
|
||||
for (uint local = 0; local < (uint) MeshBoneCount; ++local)
|
||||
{
|
||||
if (g_BoneRemap[local] == globalBone)
|
||||
{
|
||||
g_LocalPosOutput[local].LocalCombined = combined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -641,6 +641,7 @@ call Update_Lib.bat
|
||||
<None Include="..\Public\fMod\fmod_errors.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Distortion.hlsl" />
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Instance_Compute.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
|
||||
@@ -1323,5 +1323,8 @@
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Instance_Compute.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Distortion.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -34,7 +34,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3])
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3], _int RootBoneIndex)
|
||||
{
|
||||
m_fTempTrack += fTimeDelta * m_fAnimSpeed;
|
||||
m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
@@ -50,24 +50,16 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
Depart_Animation();
|
||||
m_fCurrentTrackPosition = m_fProgress;
|
||||
m_fTempTrack = 0.f;
|
||||
ResetRootMotion();
|
||||
ProgressAnimation(Bones, pLocalPosArray, bIsSpine, BoneMask, vector);
|
||||
ProgressAnimation(Bones, bIsSpine, BoneMask, vector, RootBoneIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ProgressAnimation(Bones, pLocalPosArray, bIsSpine, BoneMask, vector);
|
||||
ProgressAnimation(Bones, bIsSpine, BoneMask, vector, RootBoneIndex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CAnimation::ResetRootMotion()
|
||||
{
|
||||
for (auto& pChannel : m_Channels){
|
||||
pChannel->ResetRootMotion();
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimation::Depart_Animation()
|
||||
{
|
||||
m_fCurrentTrackPosition = 0.f;
|
||||
@@ -346,7 +338,6 @@ void CAnimation::CreateGPUData(ID3D11Device* pDevice)
|
||||
|
||||
CreateKeyFrameBuffer(pDevice, keyframes);
|
||||
CreateChannelBuffer(pDevice, channels);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -429,14 +420,14 @@ HRESULT CAnimation::Initialize(const vector<CBone*>& Bones, const CModel* pModel
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsSpine,vector<_uint>BoneMask,_vector vector[3])
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, _bool bIsSpine,vector<_uint>BoneMask,_vector vector[3], _int RootBoneIndex)
|
||||
{
|
||||
_uint iIndex = {};
|
||||
if (m_vBoneTransformationMatrix.size() > 0) {
|
||||
m_vBoneTransformationMatrix.clear();
|
||||
}
|
||||
for (auto& pChannel : m_Channels) {
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], bIsSpine, BoneMask, vector);
|
||||
pChannel->Update_TransformationMatirx(Bones, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], bIsSpine, BoneMask, vector,RootBoneIndex);
|
||||
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
|
||||
}
|
||||
}
|
||||
@@ -474,7 +465,7 @@ HRESULT CAnimation::CreateKeyFrameBuffer(ID3D11Device* pDevice,vector<KEYFRAME_D
|
||||
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = m_iKeyframeCount;
|
||||
@@ -490,7 +481,7 @@ HRESULT CAnimation::CreateChannelBuffer(ID3D11Device* pDevice, vector<CHANNEL_DE
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = (_int)sizeof(CHANNEL_DESC) * m_iChannelCount;
|
||||
desc.ByteWidth = (_int)sizeof(CHANNEL_DESC) * m_iBoneCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = (_int)sizeof(CHANNEL_DESC);
|
||||
@@ -503,10 +494,10 @@ HRESULT CAnimation::CreateChannelBuffer(ID3D11Device* pDevice, vector<CHANNEL_DE
|
||||
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = m_iChannelCount;
|
||||
srvDesc.Buffer.NumElements = m_iBoneCount;
|
||||
|
||||
if (FAILED(pDevice->CreateShaderResourceView(m_pChannelBuffer, &srvDesc, &m_pChannelSrv)))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -113,115 +113,92 @@ HRESULT CChannel::Initialize(const vector<CBone*>& Bones, _uint iIndex)
|
||||
|
||||
void CChannel::Update_TransformationMatirx(
|
||||
const vector<CBone*>& Bones,
|
||||
LOCALPOS_DESC** pLocalPosArray,
|
||||
_float fCurrentTrackPosition,
|
||||
_uint* pCurrentKeyFrameIndex,
|
||||
_bool bIsSpine,
|
||||
vector<_uint> BoneMask,
|
||||
_vector vector[3])
|
||||
_vector vector[3],
|
||||
_int RootBoneIndex)
|
||||
{
|
||||
|
||||
if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
if (m_iBoneIndex == RootBoneIndex ||Bones[m_iBoneIndex]->IsCPUEvaluated())
|
||||
{
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition)
|
||||
++*pCurrentKeyFrameIndex;
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
_float3 vSourScale{}, vDestScale{};
|
||||
_float4 vSourRotation{}, vDestRotation{};
|
||||
_float3 vSourTranslation{}, vDestTranslation{};
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
vSourScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
|
||||
vDestScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
|
||||
|
||||
vSourRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
|
||||
vDestRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
|
||||
|
||||
vSourTranslation = m_KeyFrames[*pCurrentKeyFrameIndex].vTranslation;
|
||||
vDestTranslation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vTranslation;
|
||||
|
||||
_float fRatio = (fCurrentTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition) /
|
||||
(m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition);
|
||||
|
||||
vScale = XMVectorLerp(XMLoadFloat3(&vSourScale), XMLoadFloat3(&vDestScale), fRatio);
|
||||
vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSourRotation), XMLoadFloat4(&vDestRotation), fRatio);
|
||||
vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSourTranslation), XMLoadFloat3(&vDestTranslation), fRatio), 1.f);
|
||||
|
||||
}
|
||||
if (!bIsSpine)
|
||||
{
|
||||
m_IsUpper = BoneMask[m_iBoneIndex];
|
||||
m_ilayerIndex = m_IsUpper ? 1 : 0;
|
||||
//LocalPos = pLocalPosArray[m_ilayerIndex][m_iBoneIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
//LocalPos = pLocalPosArray[0][m_iBoneIndex];
|
||||
}
|
||||
|
||||
/*_vector vScale = XMLoadFloat3(&LocalPos.Scale);
|
||||
_vector vRotation = XMLoadFloat4(&LocalPos.Rotation);
|
||||
_vector vTranslation = XMVectorSet(
|
||||
LocalPos.Translation.x,
|
||||
LocalPos.Translation.y,
|
||||
LocalPos.Translation.z,
|
||||
1.f);*/
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference")|| Bones[m_iBoneIndex]->Compare_Name("root"))
|
||||
{
|
||||
if (vector)
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsSpine)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition)
|
||||
++*pCurrentKeyFrameIndex;
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ilayerIndex == 1)
|
||||
_float3 vSourScale{}, vDestScale{};
|
||||
_float4 vSourRotation{}, vDestRotation{};
|
||||
_float3 vSourTranslation{}, vDestTranslation{};
|
||||
|
||||
vSourScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
|
||||
vDestScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
|
||||
|
||||
vSourRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
|
||||
vDestRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
|
||||
|
||||
vSourTranslation = m_KeyFrames[*pCurrentKeyFrameIndex].vTranslation;
|
||||
vDestTranslation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vTranslation;
|
||||
|
||||
_float fRatio = (fCurrentTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition) /
|
||||
(m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition);
|
||||
|
||||
vScale = XMVectorLerp(XMLoadFloat3(&vSourScale), XMLoadFloat3(&vDestScale), fRatio);
|
||||
vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSourRotation), XMLoadFloat4(&vDestRotation), fRatio);
|
||||
vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSourTranslation), XMLoadFloat3(&vDestTranslation), fRatio), 1.f);
|
||||
|
||||
}
|
||||
if (!bIsSpine)
|
||||
{
|
||||
m_IsUpper = BoneMask[m_iBoneIndex];
|
||||
m_ilayerIndex = m_IsUpper ? 1 : 0;
|
||||
}
|
||||
if (m_iBoneIndex == RootBoneIndex)
|
||||
{
|
||||
if (vector)
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsSpine)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ilayerIndex == 1)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CChannel::ResetRootMotion()
|
||||
{
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
|
||||
m_bInitialRootRotSaved = false;
|
||||
m_bInitialRootPos = false;
|
||||
}
|
||||
|
||||
|
||||
KEYFRAME* CChannel::Get_Frame(_uint iIndex)
|
||||
{
|
||||
return &m_KeyFrames[iIndex];
|
||||
|
||||
@@ -113,6 +113,34 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
return StagingSubResources;
|
||||
}
|
||||
|
||||
void CComputeShader::Dispatch_ExternalSRV_UAV(
|
||||
_uint srvStartSlot, _uint uavStartSlot,
|
||||
const _float3& groupCount,
|
||||
ID3D11ShaderResourceView** ppSRVs, _uint srvCount,
|
||||
ID3D11UnorderedAccessView** ppUAVs, _uint uavCount,
|
||||
ID3D11Buffer* pConstantBuffer)
|
||||
{
|
||||
m_pContext->CSSetShader(m_pComputeShader, nullptr, 0);
|
||||
if (pConstantBuffer)
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &pConstantBuffer);
|
||||
|
||||
m_pContext->CSSetShaderResources(srvStartSlot, srvCount, ppSRVs);
|
||||
m_pContext->CSSetUnorderedAccessViews(uavStartSlot, uavCount, ppUAVs, nullptr);
|
||||
|
||||
m_pContext->Dispatch((UINT)groupCount.x, (UINT)groupCount.y, (UINT)groupCount.z);
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV[16] = {};
|
||||
ID3D11UnorderedAccessView* nullUAV[8] = {};
|
||||
m_pContext->CSSetShaderResources(srvStartSlot, srvCount, nullSRV);
|
||||
m_pContext->CSSetUnorderedAccessViews(uavStartSlot, uavCount, nullUAV, nullptr);
|
||||
|
||||
ID3D11Buffer* nullCB = nullptr;
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &nullCB);
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CComputeShader::Bind_SRV(_uint iIndex)
|
||||
{
|
||||
m_pContext->CSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
|
||||
@@ -24,6 +24,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader)
|
||||
pShader->Bind_RawValue("g_fFogDensity", &m_fFogDensity, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &m_fFogPow, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &m_vFogColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -32,11 +33,13 @@ HRESULT CFog::Bind_FogValue(CShader* pShader)
|
||||
pShader->Bind_RawValue("g_fFogDensity", &fValue, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &fValue, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &vColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
}
|
||||
#else
|
||||
pShader->Bind_RawValue("g_fFogDensity", &m_fFogDensity, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_fFogPow", &m_fFogPow, sizeof(_float));
|
||||
pShader->Bind_RawValue("g_vFogColor", &m_vFogColor, sizeof(_float4));
|
||||
pShader->Bind_RawValue("g_bFogVisible", &m_bVisible, sizeof(_bool));
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -679,9 +679,14 @@ HRESULT CGameInstance::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRender
|
||||
return m_pRenderer->Add_RenderGroup(eRenderGroup, pRenderObject);
|
||||
}
|
||||
|
||||
void CGameInstance::Render_PreShadow()
|
||||
void CGameInstance::Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix)
|
||||
{
|
||||
return m_pRenderer->Render_PreShadow();
|
||||
return m_pRenderer->Render_PreShadow(ViewMatrix, ProjMatrix);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Bind_PreShadowMatrix(CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
return m_pRenderer->Bind_PreShadowMatrix(pShader, pConstants, eType);
|
||||
}
|
||||
|
||||
void CGameInstance::Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix)
|
||||
@@ -1074,65 +1079,110 @@ ID3D11ShaderResourceView* CGameInstance::Add_Resource(const _char* pFilePath)
|
||||
|
||||
bool CGameInstance::Key_Pressing(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Pressing(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Pressing(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
bool CGameInstance::Key_Up(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Up(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Up(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
bool CGameInstance::Key_Down(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Key_Down(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Key_Down(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Pressing(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Pressing(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Pressing(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Up(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Up(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Up(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Down(int _iKey)
|
||||
{
|
||||
//if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Down(_iKey);
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Down(_iKey);
|
||||
//}
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_StartMove()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_StartMove();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_StartMove();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_Moving()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_Moving();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_Moving();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_bool CGameInstance::Mouse_StopMove()
|
||||
{
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow))) {
|
||||
#ifndef _DEBUG
|
||||
return m_pKey_Manager->Mouse_StopMove();
|
||||
#endif // !_DEBUG
|
||||
#ifdef _DEBUG
|
||||
if (false == (GUI::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)OPTIONAL_TRUE_KEYINPUTGUICHECK)) {
|
||||
return m_pKey_Manager->Mouse_StopMove();
|
||||
}
|
||||
#endif // _DEBUG
|
||||
return false;
|
||||
}
|
||||
_float3 CGameInstance::Get_MouseMove()
|
||||
|
||||
@@ -23,8 +23,9 @@ HRESULT CMesh::Bind_BoneMatrices(const vector<class CBone*>& Bones, CShader* pSh
|
||||
|
||||
for (size_t i = 0; i < m_iNumBones; ++i) {
|
||||
XMStoreFloat4x4(&m_pBoneMatrices[i],
|
||||
XMLoadFloat4x4(&m_offsetMatrices[i]) * Bones[m_BoneIndices[i]]->Get_CombinedTransformationMatrix());
|
||||
/*XMLoadFloat4x4(&m_offsetMatrices[i]) **/ Bones[m_BoneIndices[i]]->Get_CombinedTransformationMatrix());
|
||||
}
|
||||
|
||||
if (0 == m_iNumBones) {
|
||||
return S_OK;
|
||||
}
|
||||
@@ -341,6 +342,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
pVertices[i].vTexcoord = _float2(0.f, 0.f);
|
||||
}
|
||||
|
||||
|
||||
m_iNumBones = (_uint)_SaveMesh->Bones.size();
|
||||
|
||||
m_offsetMatrices.reserve(m_iNumBones);
|
||||
@@ -363,6 +365,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
if (-1 == iBoneIndex)
|
||||
return E_FAIL;
|
||||
|
||||
m_BoneRemap.push_back((_uint)iBoneIndex);
|
||||
m_BoneIndices.push_back(iBoneIndex);
|
||||
m_offsetMatrices.push_back(OffsetMatrix);
|
||||
|
||||
@@ -409,12 +412,43 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitialVBData, &m_pVB)))
|
||||
return E_FAIL;
|
||||
|
||||
Create_BoneRemapBuffer();
|
||||
|
||||
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMesh::Create_BoneRemapBuffer()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_uint) * (_uint)m_BoneRemap.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = sizeof(_uint);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
init.pSysMem = m_BoneRemap.data();
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pBoneRemapBuffer);
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_BoneRemap.size();
|
||||
|
||||
m_pDevice->CreateShaderResourceView(
|
||||
m_pBoneRemapBuffer,
|
||||
&srvDesc,
|
||||
&m_pBoneRemapSRV);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CMesh::Initialize(void* pArg)
|
||||
{
|
||||
@@ -642,6 +676,8 @@ void CMesh::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pBoneRemapBuffer);
|
||||
SAFE_RELEASE(m_pBoneRemapSRV);
|
||||
Safe_Delete_Array(m_pBoneMatrices);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -146,14 +146,6 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
_bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
{
|
||||
/*if (m_bLoopRestarted)
|
||||
{
|
||||
m_vPrevRootPos = { 0,0,0 };
|
||||
m_bLoopRestarted = false;
|
||||
}*/
|
||||
|
||||
//ComputeAnimation(m_iCurrentAnimIndex);
|
||||
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
{
|
||||
m_fBlendTime += fTimeDelta;
|
||||
@@ -165,9 +157,7 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
CAnimation* pCurAnim = m_Animations[m_iCurrentAnimIndex];
|
||||
CAnimation* pPreAnim = m_Animations[m_iPreAnimIndex];
|
||||
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio);
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector,m_iRootBoneIndex);
|
||||
|
||||
if (m_fRatio >= 1.f)
|
||||
{
|
||||
@@ -177,11 +167,17 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector, m_iRootBoneIndex);
|
||||
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
|
||||
|
||||
for (_uint i = 0; i < Get_NumMeshes(); i++)
|
||||
{
|
||||
ComputeAnimation(m_iCurrentAnimIndex, i);
|
||||
}
|
||||
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
if (m_bIsLoop)
|
||||
@@ -208,25 +204,29 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
m_bInitialRootRotSaved = false;
|
||||
}
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
m_Bones[m_iRootBoneIndex]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
|
||||
for (_uint i = 0; i < m_Bones.size(); ++i)
|
||||
{
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
if (m_Bones[i]->IsCPUEvaluated())
|
||||
{
|
||||
if (i == m_iRootBoneIndex)
|
||||
continue;
|
||||
|
||||
m_Bones[i]->Update_CombinedTransformationMatrix(
|
||||
m_Bones,
|
||||
XMLoadFloat4x4(&m_PreTransformMatrix)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
BeginFrame();
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
_bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
{
|
||||
/*if (m_bLoopRestarted)
|
||||
{
|
||||
m_vPrevRootPos = { 0,0,0 };
|
||||
m_bLoopRestarted = false;
|
||||
}*/
|
||||
|
||||
//ComputeAnimation(m_iCurrentAnimIndex);
|
||||
//ComputeAnimation_Second(m_iCurrSecondAnimIndex);
|
||||
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
{
|
||||
m_fBlendTime += fTimeDelta;
|
||||
@@ -242,12 +242,10 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
CAnimation* pSecondAnim = m_Animations[m_iCurrSecondAnimIndex];
|
||||
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio);
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector, m_iRootBoneIndex);
|
||||
|
||||
m_bIsSecondFinishedAnim = pSecondAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_bIsSecondFinishedAnim = pSecondAnim->Update_TransformationMatrices(m_Bones, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask,nullptr, m_iRootBoneIndex);
|
||||
|
||||
pSecondAnim->InterpSecondAnim(pCurAnim, m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
if (m_fRatio >= 1.f)
|
||||
{
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
@@ -275,9 +273,9 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
|
||||
m_bIsSecondFinishedAnim = m_Animations[m_iCurrSecondAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_bIsSecondFinishedAnim = m_Animations[m_iCurrSecondAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_Animations[m_iCurrSecondAnimIndex]->InterpSecondAnim(m_Animations[m_iCurrentAnimIndex], m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
|
||||
@@ -338,11 +336,20 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
}
|
||||
|
||||
m_Bones[m_iRootBoneIndex]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
for (_uint i = 0; i < m_Bones.size(); ++i)
|
||||
{
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
if (m_Bones[i]->IsCPUEvaluated())
|
||||
{
|
||||
if (i == m_iRootBoneIndex)
|
||||
continue;
|
||||
|
||||
m_Bones[i]->Update_CombinedTransformationMatrix(
|
||||
m_Bones,
|
||||
XMLoadFloat4x4(&m_PreTransformMatrix)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
@@ -364,8 +371,8 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop, _float fAmount, _boo
|
||||
{
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(1.f);
|
||||
/* m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(1.f);*/
|
||||
}
|
||||
|
||||
m_fBlendTime = 0.f;
|
||||
@@ -562,19 +569,47 @@ void CModel::Initialize_RootBone()
|
||||
}
|
||||
}
|
||||
|
||||
const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName) const
|
||||
void CModel::BeginFrame()
|
||||
{
|
||||
vector<CBone*>::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool
|
||||
{
|
||||
if (true == pBone->Compare_Name(pBoneName))
|
||||
return true;
|
||||
fill(m_CPUBoneMask.begin(), m_CPUBoneMask.end(), false);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
vector<_float4x4> CModel::Get_OffsetMatrix(_int iIndex)
|
||||
{
|
||||
return m_Meshes[iIndex]->Get_OffsetMatrix();
|
||||
}
|
||||
|
||||
void CModel::Apply_CPUMask_ToBones()
|
||||
{
|
||||
for (size_t i = 0; i < m_Bones.size(); ++i)
|
||||
m_Bones[i]->SetCPUEvaluated(m_CPUBoneMask[i]);
|
||||
}
|
||||
|
||||
|
||||
return (*iter)->Get_CombinedTransformationMatrixPtr();
|
||||
void CModel::Mark_CPUChain(_int boneIdx)
|
||||
{
|
||||
while (boneIdx >= 0)
|
||||
{
|
||||
if (m_CPUBoneMask[boneIdx])
|
||||
break;
|
||||
|
||||
m_CPUBoneMask[boneIdx] = true;
|
||||
boneIdx = m_Parent[boneIdx];
|
||||
}
|
||||
}
|
||||
|
||||
const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName)
|
||||
{
|
||||
_int boneIdx = Get_BoneIndex(pBoneName);
|
||||
|
||||
if (boneIdx < 0)
|
||||
return nullptr;
|
||||
|
||||
Mark_CPUChain(boneIdx);
|
||||
|
||||
Apply_CPUMask_ToBones();
|
||||
|
||||
return m_Bones[boneIdx]->Get_CombinedTransformationMatrixPtr();
|
||||
}
|
||||
|
||||
_matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
@@ -587,7 +622,6 @@ _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
return (*iter)->Get_CombinedTransformationMatrix();
|
||||
}
|
||||
|
||||
@@ -1334,37 +1368,6 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
|
||||
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
|
||||
|
||||
void CModel::Create_Temp()
|
||||
{
|
||||
for (auto& anim : m_Animations)
|
||||
{
|
||||
anim->CreateGPUData(m_pDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void CModel::Create_LocalPosVB()
|
||||
{
|
||||
_uint iCount = (_uint)m_Bones.size();
|
||||
_uint iStride = sizeof(LOCALPOS_DESC);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = iStride * iCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = iStride;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
HRESULT hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pLocalPosBuffer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CModel::InItialize_BoneIndex()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
@@ -1428,14 +1431,57 @@ void CModel::Initialize_BoneMasks()
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ComputeShader()
|
||||
{
|
||||
_uint CS_InputStrides[] = {
|
||||
sizeof(KEYFRAME_DESC), // 키프레임
|
||||
sizeof(CHANNEL_DESC), // 채널
|
||||
sizeof(KEYFRAME_DESC), // 이전애님 키프레임
|
||||
sizeof(CHANNEL_DESC), // 이전애님 채널
|
||||
sizeof(int), // 부모 인덱스
|
||||
sizeof(_float4x4), // 로컬좌표
|
||||
sizeof(_uint)
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
sizeof(BONE_DESC),
|
||||
};
|
||||
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
CS_Desc.iNumElement = (_uint)m_Bones.size();
|
||||
CS_Desc.iNumInputBuffer = 7;
|
||||
CS_Desc.iNumOutputBuffer = 1;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pComputeShader = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("CS_Model"), &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pComputeShader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_Temp()
|
||||
{
|
||||
for (auto& anim : m_Animations)
|
||||
{
|
||||
anim->CreateGPUData(m_pDevice);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ParentVB()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = (_int)sizeof(PARENT_DESC) * (_uint)m_Bones.size();
|
||||
desc.ByteWidth = sizeof(_int) * (_uint)m_Bones.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = (_int)sizeof(PARENT_DESC);
|
||||
desc.StructureByteStride = sizeof(_int);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
@@ -1443,9 +1489,189 @@ HRESULT CModel::Create_ParentVB()
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pParentBuffer);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneLocalVB()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_float4x4) * (_uint)m_Bones.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = sizeof(_float4x4);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
init.pSysMem = m_BoneLocal.data();
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pBoneLocalBuffer);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneMatrixVB()
|
||||
{
|
||||
_uint iCount = (_uint)m_Bones.size();
|
||||
_uint iStride = sizeof(BONE_DESC);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = iStride * iCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = iStride;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
HRESULT hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pBoneMatrixBuffer);
|
||||
|
||||
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc{};
|
||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uavDesc.Buffer.FirstElement = 0;
|
||||
uavDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
m_pDevice->CreateUnorderedAccessView(
|
||||
m_pBoneMatrixBuffer,
|
||||
&uavDesc,
|
||||
&m_pBoneMatrixUAV
|
||||
);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Create_Const()
|
||||
{
|
||||
|
||||
D3D11_BUFFER_DESC cbDesc = {};
|
||||
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbDesc.ByteWidth = sizeof(ANIMSTATE_DESC);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA CBInitialDesc = {};
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ParentSrv()
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pParentBuffer, &srvDesc, &m_pParentSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc1 = {};
|
||||
srvDesc1.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc1.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc1.Buffer.FirstElement = 0;
|
||||
srvDesc1.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneMatrixBuffer, &srvDesc1, &m_pBoneMatrixSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneLocalSrv()
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneLocalBuffer, &srvDesc, &m_pBoneLocalSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CModel::ComputeAnimation(_uint AnimIndex,_uint MeshIndex)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
{
|
||||
ANIMSTATE_DESC* pDesc = static_cast<ANIMSTATE_DESC*>(ConstantSubResource.pData);
|
||||
|
||||
auto* anim = m_Animations[AnimIndex];
|
||||
pDesc->CurrentTime = anim->Get_CurrentTrackPosition();
|
||||
pDesc->Duration = anim->Get_Duration();
|
||||
pDesc->MeshBoneCount = m_Meshes[MeshIndex]->Get_NumBone();
|
||||
pDesc->BoneCount = (_uint)m_Bones.size();
|
||||
pDesc->RootBoneIndex = m_iRootBoneIndex;
|
||||
pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition();
|
||||
pDesc->BlendRatio = m_fRatio;
|
||||
pDesc->PreTransformMatrix = m_PreTransformMatrix;
|
||||
pDesc->RootInitRot = m_vInitialRootRot;
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
return;
|
||||
|
||||
_uint iGroupCountX = (_uint)(m_Bones.size() + 255) / 256;
|
||||
|
||||
ID3D11Buffer* CSBuffers[] =
|
||||
{
|
||||
m_Animations[AnimIndex]->Get_KeyFrameBuffer(),
|
||||
m_Animations[AnimIndex]->Get_ChannelBuffer(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_KeyFrameBuffer(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelBuffer(),
|
||||
m_pParentBuffer,
|
||||
m_pBoneLocalBuffer,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapBuffer()
|
||||
};
|
||||
|
||||
auto* anim = m_Animations[AnimIndex];
|
||||
ID3D11ShaderResourceView* srvs[] =
|
||||
{
|
||||
anim->Get_KeyFrameSrv(),
|
||||
anim->Get_ChannelSrv(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_KeyFrameSrv(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelSrv(),
|
||||
m_pParentSRV,
|
||||
m_pBoneLocalSRV,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapSRV()
|
||||
};
|
||||
|
||||
ID3D11UnorderedAccessView* uavs[] =
|
||||
{
|
||||
m_pBoneMatrixUAV
|
||||
};
|
||||
|
||||
m_pComputeShader->Dispatch_ExternalSRV_UAV(
|
||||
0,
|
||||
0,
|
||||
_float3((_float)iGroupCountX, 1.f, 1.f),
|
||||
srvs,
|
||||
7,
|
||||
uavs,
|
||||
1,
|
||||
m_pConstantBuffer
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void CModel::Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex)
|
||||
{
|
||||
m_pContext->VSSetShaderResources(iIndex,
|
||||
1, // 버퍼 개수
|
||||
&m_pBoneMatrixSRV);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix)
|
||||
{
|
||||
@@ -1878,23 +2104,33 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
|
||||
if (m_eType == MODEL::ANIM || m_eType == MODEL::PBR_ANIM || m_eType == MODEL::ANIM_LOCAL)
|
||||
{
|
||||
m_CPUBoneMask.resize(m_Bones.size(), false);
|
||||
Initialize_RootBone();
|
||||
InItialize_BoneIndex();
|
||||
Initialize_BoneMasks();
|
||||
|
||||
/*Create_Temp();
|
||||
m_Parent.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
m_Parent[i].ParentIndex = m_Bones[i]->Get_ParentBoneIndex();
|
||||
m_Parent[i] = m_Bones[i]->Get_ParentBoneIndex();
|
||||
}
|
||||
|
||||
if (FAILED(Create_CS()))
|
||||
return E_FAIL;
|
||||
m_BoneLocal.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
m_BoneLocal[i] = m_Bones[i]->Get_TransformationMatrix();
|
||||
}
|
||||
|
||||
Create_Con();
|
||||
Create_LocalPosVB();
|
||||
Create_ParentVB();*/
|
||||
Create_Const();
|
||||
Create_Temp();
|
||||
Create_BoneMatrixVB();
|
||||
Create_ParentVB();
|
||||
Create_BoneLocalVB();
|
||||
Create_ParentSrv();
|
||||
Create_BoneLocalSrv();
|
||||
|
||||
if (FAILED(Create_ComputeShader()))
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
@@ -2005,7 +2241,12 @@ void CModel::Free()
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pParentBuffer);
|
||||
SAFE_RELEASE(m_pLocalPosBuffer);
|
||||
SAFE_RELEASE(m_pBoneLocalBuffer);
|
||||
SAFE_RELEASE(m_pBoneMatrixBuffer);
|
||||
SAFE_RELEASE(m_pParentSRV);
|
||||
SAFE_RELEASE(m_pBoneLocalSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixUAV);
|
||||
|
||||
for (auto& pAnimation : m_Animations) {
|
||||
SAFE_RELEASE(pAnimation);
|
||||
|
||||
@@ -74,21 +74,20 @@ pair<_bool, _ubyte> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _fl
|
||||
// 월드 센터를 셰도우뷰 센터로 바꿈
|
||||
_vector vShadowViewCenter = XMVectorSetW(XMVector3Rotate(vWorldCenter, XMLoadFloat4(&m_vShadowInvDirectionalRPYQuat)), 1.f);
|
||||
|
||||
_float fSafeRadius = fRadius; // 인스턴싱된 객체 고려해서 좀 더 넓게 탐색
|
||||
_float fSafeRadius = (fRadius + m_fSafe_RadiusMargin) * m_fSafe_RadiusMultiplier; // 그림자임을 고려해서 객체 부피보다 좀 더 넓게 탐색
|
||||
|
||||
for (_uint iCascadeIndex = 0; iCascadeIndex < ENUM_CLASS(SHADOW::END); ++iCascadeIndex) {
|
||||
const _float4* pTargetPlanes = nullptr;
|
||||
if (iCascadeIndex == 2) {
|
||||
continue;
|
||||
// 게임 특성 상 Far가 너무 멀어서 프리베이크랑 차이가 안남
|
||||
pTargetPlanes = m_vFarShadowViewBoxPlane;
|
||||
}
|
||||
if (iCascadeIndex == 0) {
|
||||
pTargetPlanes = m_vNearShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
if (iCascadeIndex == 1) {
|
||||
pTargetPlanes = m_vMiddleShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
if (iCascadeIndex == 2) {
|
||||
pTargetPlanes = m_vFarShadowViewBoxPlane;
|
||||
fSafeRadius = fRadius;
|
||||
}
|
||||
|
||||
_bool bIsInside = true;
|
||||
@@ -171,6 +170,9 @@ HRESULT CPipeLine::Bind_Shadow_Resource(CShader* pShader, const _char* pConstant
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_FAR)) {
|
||||
iPass = 2;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_PRE)) {
|
||||
return m_pGameInstance->Bind_PreShadowMatrix(pShader, pConstantName, eType);
|
||||
}
|
||||
assert(iPass != UINT_MAX);
|
||||
|
||||
return pShader->Bind_Matrix(pConstantName, &m_ShadowTransformStateMatrices[iPass][ENUM_CLASS(eType)]);
|
||||
@@ -303,6 +305,15 @@ void CPipeLine::Make_LightBoxes()
|
||||
if (iIndex == 1) targetPlanes = m_vMiddleShadowViewBoxPlane;
|
||||
if (iIndex == 2) targetPlanes = m_vFarShadowViewBoxPlane;
|
||||
|
||||
fMinX += m_vShadowBoxMarginMin.x;
|
||||
fMaxX += m_vShadowBoxMarginMax.x;
|
||||
fMinY += m_vShadowBoxMarginMin.y;
|
||||
fMaxY += m_vShadowBoxMarginMax.y;
|
||||
fMinZ += m_vShadowBoxMarginMin.z;
|
||||
fMaxZ += m_vShadowBoxMarginMax.z;
|
||||
|
||||
Adjust_ShadowTexcel(fMinX, fMinY, fMaxX, fMaxY, g_iMaxShadowWidth, g_iMaxShadowHeight);
|
||||
|
||||
targetPlanes[0] = _float4(-1.f, 0.f, 0.f, fMinX); // Left
|
||||
targetPlanes[1] = _float4(1.f, 0.f, 0.f, -fMaxX); // Right
|
||||
targetPlanes[2] = _float4(0.f, -1.f, 0.f, fMinY); // Bottom
|
||||
@@ -310,7 +321,6 @@ void CPipeLine::Make_LightBoxes()
|
||||
targetPlanes[4] = _float4(0.f, 0.f, -1.f, fMinZ); // Near
|
||||
targetPlanes[5] = _float4(0.f, 0.f, 1.f, -fMaxZ); // Far
|
||||
|
||||
|
||||
XMStoreFloat4x4(&m_ShadowTransformStateMatrices[iIndex][ENUM_CLASS(D3DTS::VIEW)], ViewMatrix);
|
||||
XMStoreFloat4x4(&m_ShadowTransformStateMatrices[iIndex][ENUM_CLASS(D3DTS::VIEW_INV)], ViewInvMatrix);
|
||||
|
||||
@@ -376,6 +386,31 @@ void CPipeLine::Update_ShadowDepthNdcZ()
|
||||
}
|
||||
}
|
||||
|
||||
// Out으로 _float4를 새롭게 메모리로 받고 다시 밖에서 할당할 바에 레퍼런스로 쓰는게 더 나은듯
|
||||
// 카메라 미세 흔들림으로 인한 그림자 튐 보정
|
||||
void CPipeLine::Adjust_ShadowTexcel(_float& fMinX, _float& fMinY, _float& fMaxX, _float& fMaxY, _uint iShadowWidth, _uint iShadowHeight)
|
||||
{
|
||||
_float fCascadeWidth = (fMaxX - fMinX);
|
||||
_float fCascadeHeight = (fMaxY - fMinY);
|
||||
|
||||
_float fTexelSizeX = fCascadeWidth / (_float)(iShadowWidth);
|
||||
_float fTexelSizeY = fCascadeHeight / (_float)(iShadowHeight);
|
||||
|
||||
// 박스 xy 중심
|
||||
_float fCascadeCenterX = (fMinX + fMaxX) * 0.5f;
|
||||
_float fCascadeCenterY = (fMinY + fMaxY) * 0.5f;
|
||||
{
|
||||
fCascadeCenterX = floorf(fCascadeCenterX / fTexelSizeX) * fTexelSizeX;
|
||||
fCascadeCenterY = floorf(fCascadeCenterY / fTexelSizeY) * fTexelSizeY;
|
||||
}
|
||||
|
||||
// 박스 중심으로 min/max 보정
|
||||
fMinX = fCascadeCenterX - fCascadeWidth * 0.5f;
|
||||
fMaxX = fCascadeCenterX + fCascadeWidth * 0.5f;
|
||||
fMinY = fCascadeCenterY - fCascadeHeight * 0.5f;
|
||||
fMaxY = fCascadeCenterY + fCascadeHeight * 0.5f;
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* CPipeLine::Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV)
|
||||
{
|
||||
auto iter = m_mapGlobalSRV.find(wszKeyGlobalSRV);
|
||||
@@ -415,22 +450,42 @@ void CPipeLine::Describe_Entity()
|
||||
_bool bModified = { false };
|
||||
_float fNear = m_fShadowNearBoxRatio;
|
||||
_float fFar = m_fShadowFarBoxRatio;
|
||||
_float fSafe_RadiusMultiplier = m_fSafe_RadiusMultiplier;
|
||||
_float fSafe_RadiusMargin = m_fSafe_RadiusMargin;
|
||||
_float4 vShadowBias = m_vShadowBias;
|
||||
_float3 vShadowBoxMarginMin = m_vShadowBoxMarginMin;
|
||||
_float3 vShadowBoxMarginMax = m_vShadowBoxMarginMax;
|
||||
if (GUI::DragFloat("m_fShadowNearBoxRatio", &fNear, 0.01f, 0.01f, 0.999f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fShadowFarBoxRatio", &fFar, 0.01f, 0.01f, 0.999f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fSafe_RadiusMultiplier", &fSafe_RadiusMultiplier, 0.01f, 1.f, 3.f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::DragFloat("m_fSafe_RadiusMargin", &fSafe_RadiusMargin, 1.f, 10.f, 40.f, "%.2f")) {
|
||||
bModified = true;
|
||||
}
|
||||
GUI::PushItemWidth(150.f);
|
||||
if (GUI::DragFloat4("ShadowBiasNMFS", (_float*)&vShadowBias, 0.0001f, 0.0001f, 1.f, "%.4f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::SliderFloat3("fShadowBoxMarginMin", (_float*)&vShadowBoxMarginMin, -100.F, 100.f, "%.1f")) {
|
||||
bModified = true;
|
||||
}
|
||||
if (GUI::SliderFloat3("fShadowBoxMarginMax", (_float*)&vShadowBoxMarginMax, -100.F, 100.f, "%.1f")) {
|
||||
bModified = true;
|
||||
}
|
||||
GUI::PushItemWidth(80.f);
|
||||
if (true == bModified) {
|
||||
m_fShadowNearBoxRatio = fNear;
|
||||
m_fShadowFarBoxRatio = fFar;
|
||||
m_vShadowBias = vShadowBias;
|
||||
m_fSafe_RadiusMultiplier = fSafe_RadiusMultiplier;
|
||||
m_fSafe_RadiusMargin = fSafe_RadiusMargin;
|
||||
m_vShadowBoxMarginMin = vShadowBoxMarginMin;
|
||||
m_vShadowBoxMarginMax = vShadowBoxMarginMax;
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
|
||||
@@ -126,6 +126,13 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, FX_DISTORTION,
|
||||
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_Distortion.hlsl"),
|
||||
VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
#pragma region COMPUTE_SHADER
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_EFFECT,
|
||||
@@ -142,6 +149,13 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("CS_Model"),
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -216,6 +216,7 @@ HRESULT CRenderTarget_Manager::Bind_CS_RenderTarget(_uint iIndex, const _wstring
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CRenderTarget_Manager::Accumulate_RenderTarget(CVIBuffer_Rect* pVIBuffer, CShader* pShader,
|
||||
const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB,
|
||||
const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass)
|
||||
|
||||
@@ -26,6 +26,8 @@ void CRenderer::Render()
|
||||
Render_Occlusion();
|
||||
Render_EnvironmentPostProcess();
|
||||
Render_Fog();
|
||||
Render_Distortion();
|
||||
Render_DistortionAcc();
|
||||
Render_Effect();
|
||||
Render_NonLight();
|
||||
Render_Blend();
|
||||
@@ -56,17 +58,14 @@ void CRenderer::Render()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRenderer::Render_PreShadow()
|
||||
void CRenderer::Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_PreShadow"), m_pPreShadowDSV))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const _float4x4* pMatrices = m_pGameInstance->Get_ShadowMatricesPtr(0);
|
||||
m_PreShadowFar = m_pGameInstance->Get_ShadowBoxFar(0);
|
||||
for (int i = 0; i < ENUM_CLASS(D3DTS::END); ++i) {
|
||||
m_PreShadowMatrices[i] = pMatrices[i];
|
||||
}
|
||||
m_PreShadowView = ViewMatrix;
|
||||
m_PreShadowProj = ProjMatrix;
|
||||
|
||||
D3D11_VIEWPORT ViewPortOldDesc;
|
||||
D3D11_VIEWPORT ViewPortDesc;
|
||||
@@ -76,8 +75,8 @@ void CRenderer::Render_PreShadow()
|
||||
{
|
||||
ViewPortDesc.TopLeftX = 0;
|
||||
ViewPortDesc.TopLeftY = 0;
|
||||
ViewPortDesc.Width = (_float)g_iMaxShadowWidth;
|
||||
ViewPortDesc.Height = (_float)g_iMaxShadowHeight;
|
||||
ViewPortDesc.Width = (_float)g_iPreShadowWidth;
|
||||
ViewPortDesc.Height = (_float)g_iPreShadowHeight;
|
||||
ViewPortDesc.MinDepth = 0.f;
|
||||
ViewPortDesc.MaxDepth = 1.f;
|
||||
}
|
||||
@@ -87,7 +86,7 @@ void CRenderer::Render_PreShadow()
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRESHADOW)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::END))) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_PRE))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -103,6 +102,20 @@ void CRenderer::Render_PreShadow()
|
||||
m_pContext->RSSetViewports(iNumViewOldPort, &ViewPortOldDesc);
|
||||
}
|
||||
|
||||
HRESULT CRenderer::Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
if (D3DTS::VIEW == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_PreShadowView))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
} else if (D3DTS::PROJ == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_PreShadowProj))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Occlusion");
|
||||
@@ -385,13 +398,10 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_FAR", D3DTS::PROJ, SHADOW::SHADOW_FAR))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fPreShadowFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightViewMatrix", &m_PreShadowView))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightViewMatrix", &m_PreShadowMatrices[ENUM_CLASS(D3DTS::VIEW)]))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightProjMatrix", &m_PreShadowMatrices[ENUM_CLASS(D3DTS::PROJ)]))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_PreShadowLightProjMatrix", &m_PreShadowProj))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -445,7 +455,7 @@ void CRenderer::Render_Combined()
|
||||
void CRenderer::Render_EnvironmentPostProcess()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_EnvironmentPostProcess");
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_ENV_Blur_X")))) {
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_ENV_Blur_X")))) { // Target_ENV_Blur_X
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -517,7 +527,9 @@ void CRenderer::Render_Fog()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Fog");
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
|
||||
m_pGameInstance->Bind_FogValue(m_pShader);
|
||||
if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_OriginalTexture"))) {
|
||||
return;
|
||||
@@ -537,12 +549,11 @@ void CRenderer::Render_Fog()
|
||||
void CRenderer::Render_Effect()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Effect");
|
||||
|
||||
if (FAILED(m_pGameInstance->Begin_MRT_NO_DepthStencil(TEXT("MRT_WB")))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::EFFECT)])
|
||||
{
|
||||
if (nullptr != pRenderObject)
|
||||
@@ -705,6 +716,11 @@ void CRenderer::Render_SSAO()
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fSSAOStrength", &m_fSSAOStrength, sizeof(_float)))) {
|
||||
assert(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
// Bind_Targets
|
||||
@@ -854,6 +870,66 @@ void CRenderer::Render_Bloom()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Bloom");
|
||||
}
|
||||
|
||||
void CRenderer::Render_Distortion()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Distortion");
|
||||
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Distortion")))) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::DISTORTION)])
|
||||
{
|
||||
if (nullptr != pRenderObject)
|
||||
pRenderObject->Render();
|
||||
|
||||
SAFE_RELEASE(pRenderObject);
|
||||
}
|
||||
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::DISTORTION)].clear();
|
||||
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
}
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Distortion");
|
||||
}
|
||||
|
||||
void CRenderer::Render_DistortionAcc()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_DistortionAcc");
|
||||
// Bind_Resorces
|
||||
|
||||
ID3D11Texture2D* pBackBufferTexture2D = { nullptr };
|
||||
|
||||
m_pGameInstance->Get_BackBufferPTR(&pBackBufferTexture2D);
|
||||
|
||||
if (FAILED(m_pGameInstance->Paste_RenderTarget(TEXT("Target_PreEffect"), pBackBufferTexture2D))) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pDistortionShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Distortion"), m_pDistortionShader, "g_DistortionTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_PreEffect"), m_pDistortionShader, "g_SceneTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pDistortionShader->Begin(0);
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
|
||||
SAFE_RELEASE(pBackBufferTexture2D);
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_DistortionAcc");
|
||||
}
|
||||
|
||||
void CRenderer::Render_UI()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_UI");
|
||||
|
||||
@@ -234,15 +234,6 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_ENV_Blur */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_Weight"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_ENV_Blur_X */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_X"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
@@ -253,6 +244,11 @@ HRESULT CRenderer::Initialize()
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
/* Target_ENV_Blur_Weight */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_ENV_Blur_Weight"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_SSAO_AmbientOcclusion */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_SSAO_AmbientOcclusion"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
@@ -336,11 +332,23 @@ HRESULT CRenderer::Initialize()
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Bloom_2x2_2"), (_uint)(Viewport.Width * 0.5f), (_uint)(Viewport.Height * 0.5f),
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Distortion"), (_uint)(Viewport.Width), (_uint)(Viewport.Height),
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_PreEffect"), (_uint)(Viewport.Width), (_uint)(Viewport.Height),
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (FAILED(Ready_ShadowDepthStencilView(g_iMaxShadowWidth, g_iMaxShadowHeight))) {
|
||||
return E_FAIL;
|
||||
@@ -414,14 +422,6 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_ENV_Blur */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_ENV_Blur"), TEXT("Target_ENV_Blur")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_ENV_Blur"), TEXT("Target_ENV_Blur_Weight")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_Bloom */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Bloom"), TEXT("Target_Bloom_Input")))) {
|
||||
return E_FAIL;
|
||||
@@ -465,6 +465,18 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_Fog")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_ENV_Blur_Weight")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* MRT_Distortion */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Distortion"), TEXT("Target_Distortion")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -485,6 +497,14 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pDistortionShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_DISTORTION, nullptr, nullptr);
|
||||
|
||||
if (nullptr == m_pDistortionShader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
m_pVIBuffer = CVIBuffer_Rect::Create(m_pDevice, m_pContext);
|
||||
if (nullptr == m_pVIBuffer) {
|
||||
return E_FAIL;
|
||||
@@ -541,6 +561,7 @@ void CRenderer::Free()
|
||||
SAFE_RELEASE(m_pShader);
|
||||
SAFE_RELEASE(m_pLastColorShader);
|
||||
SAFE_RELEASE(m_pWeightBlendShader);
|
||||
SAFE_RELEASE(m_pDistortionShader);
|
||||
SAFE_RELEASE(m_pVIBuffer);
|
||||
SAFE_RELEASE(m_pDevice);
|
||||
SAFE_RELEASE(m_pContext);
|
||||
@@ -551,7 +572,6 @@ void CRenderer::Describe_Entitiy()
|
||||
{
|
||||
GUI::Begin("SYSTEM", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("RENDERER")) {
|
||||
GUI::PushItemWidth(80);
|
||||
if (GUI::CollapsingHeader("PostProcessing_Bloom"))
|
||||
{
|
||||
GUI::BeginChild("PostProcessing_Bloom");
|
||||
@@ -586,6 +606,7 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::BeginChild("SSAO_Setting", ImVec2(0, 0), true);
|
||||
GUI::DragFloat("fSSAORadius ", &m_fSSAO_Radius, 0.001f, -3.f, 3.f, "%.5f");
|
||||
GUI::DragFloat("fSSAO_BIAS", &m_fSSAO_BIAS, 0.001f, -2.f, 2.f, "%.5f");
|
||||
GUI::DragFloat("fSSAOStrength", &m_fSSAOStrength, 0.01f, 1.f, 4.f, "%.5f");
|
||||
GUI::EndChild();
|
||||
}
|
||||
if (GUI::CollapsingHeader("ToneMapping")) {
|
||||
@@ -594,6 +615,8 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::SliderFloat("m_fExposure", &m_fExposure, 0.5f, 2.f, "%.3f");
|
||||
GUI::EndChild();
|
||||
}
|
||||
if (GUI::CollapsingHeader("End_Padding")) {
|
||||
}
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
@@ -221,16 +221,19 @@ void CTrail::Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix)
|
||||
|
||||
void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float fDamping, _float fLength , _float fMass , _fmatrix EndWorldMatrix)
|
||||
{
|
||||
|
||||
if (m_isFix == false)
|
||||
{
|
||||
if (m_iNumCount > 2)
|
||||
{
|
||||
memmove(m_pVertices + 2, m_pVertices, sizeof(VTXPOSTEX) * (m_iNumCount - 2));
|
||||
memmove(m_pOldPosition + 2, m_pOldPosition, sizeof(_float3) * (m_iNumCount - 2));
|
||||
}
|
||||
|
||||
if (m_iNumCount >= m_iNumVertices)
|
||||
m_iNumCount -= 2;
|
||||
}
|
||||
|
||||
|
||||
m_pOldPosition[0] = m_pVertices[0].vPosition;
|
||||
m_pOldPosition[1] = m_pVertices[1].vPosition;
|
||||
|
||||
@@ -265,6 +268,9 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount - 2].vPosition, vEndLow);
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount - 1].vPosition, vEndHigh);
|
||||
|
||||
m_pOldPosition[m_iNumCount - 2] = m_pVertices[m_iNumCount - 2].vPosition;
|
||||
m_pOldPosition[m_iNumCount - 1] = m_pVertices[m_iNumCount - 1].vPosition;
|
||||
|
||||
for (_uint i = 2; i < m_iNumCount; i++) /* 고정점은 연산에서 제외 0 , 1*/
|
||||
{
|
||||
|
||||
@@ -293,7 +299,7 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
for (_uint k = 0; k < m_iNumCount - 2; k += 2) {
|
||||
|
||||
/* Low , High */
|
||||
@@ -316,14 +322,14 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
_float fLowDiff = (fLength - fLowDist) / fLowDist;
|
||||
_float fHighDiff = (fLength - fHighDist) / fHighDist;
|
||||
|
||||
// 각 점을 절반씩 밀거나 당겨서 거리 맞춤
|
||||
// 각 점을 절반씩 밀거나 당겨서 거리 맞춤
|
||||
// 손잡이(Pinned)는 움직이지 않도록 질량 비율 조절 가능 (여기선 0.5씩)
|
||||
|
||||
_vector vLowOffset = vDeltaLow * (fMass * fLowDiff);
|
||||
_vector vHighOffset = vDeltaHigh * (fMass * fHighDiff);
|
||||
|
||||
// k!=0 (즉, 움직이는 마디)일 때만 vFirst를 움직임
|
||||
if (k != 0)
|
||||
if (k != 0)
|
||||
{
|
||||
vFirst[0] -= vLowOffset;
|
||||
vFirst[1] -= vHighOffset;
|
||||
@@ -344,10 +350,18 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
vNext[1] += vHighOffset;
|
||||
}
|
||||
|
||||
if (k == m_iNumCount - 4)
|
||||
{
|
||||
|
||||
vFirst[0] -= vLowOffset;
|
||||
vFirst[1] -= vHighOffset;
|
||||
}
|
||||
|
||||
// --- 3. 결과 저장 ---
|
||||
|
||||
// vFirst 저장 (k=0 일 때는 vFirst가 vLow/vHigh의 값을 가지지만,
|
||||
// 움직이지 않았으므로 저장해도 무방. 하지만 명확성을 위해 조건부 저장 가능)
|
||||
|
||||
if (k != 0)
|
||||
{
|
||||
XMStoreFloat3(&m_pVertices[k].vPosition, vFirst[0]);
|
||||
@@ -360,6 +374,9 @@ void CTrail::Rope_Trail_Update(_fmatrix WorldMatrix, _float fTimeDelta, _float f
|
||||
}
|
||||
}
|
||||
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount - 2].vPosition, vEndLow);
|
||||
XMStoreFloat3(&m_pVertices[m_iNumCount - 1].vPosition, vEndHigh);
|
||||
|
||||
for (_uint i = 0; i < m_iNumCount; i += 2)
|
||||
{
|
||||
|
||||
|
||||
@@ -488,12 +488,14 @@ void CTransform::Describe_Entity()
|
||||
GUI::DragFloat4("Look", (_float*)(&m_WorldMatrix._31), 1.f, 0.f, 0.f, "%.3f");
|
||||
GUI::DragFloat4("Pos", (_float*)(&m_WorldMatrix._41), 1.f, 0.f, 0.f, "%.3f");
|
||||
|
||||
|
||||
|
||||
_vector vRotRPY = Get_RollPitchYawVector();
|
||||
static _float3 s_vRotation = {};
|
||||
|
||||
if(GUI::InputFloat3("Rotation", (_float*)&s_vRotation))
|
||||
XMStoreFloat3(&s_vRotation, vRotRPY);
|
||||
_float3 vDegrees = { XMConvertToDegrees(s_vRotation.x),XMConvertToDegrees(s_vRotation.y),XMConvertToDegrees(s_vRotation.z) };
|
||||
if(GUI::InputFloat3("Rotation", (_float*)&vDegrees))
|
||||
{
|
||||
Rotation(s_vRotation.x, s_vRotation.y, s_vRotation.z);
|
||||
Rotation(XMConvertToRadians(vDegrees.x), XMConvertToRadians(vDegrees.y), XMConvertToRadians(vDegrees.z));
|
||||
}
|
||||
|
||||
GUI::TreePop();
|
||||
|
||||
@@ -11,9 +11,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
CAnimation(const CAnimation& rhs);
|
||||
virtual ~CAnimation() = default;
|
||||
public:
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3] = nullptr);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones,LOCALPOS_DESC** pLocalPosArray, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3]);
|
||||
void ResetRootMotion();
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3] = nullptr, _int RootBoneIndex = -1);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3], _int RootBoneIndex);
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
_float Get_AnimProgressRatio();
|
||||
@@ -38,6 +37,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
_float Get_AnimSpeed() { return m_fAnimSpeed; }
|
||||
|
||||
_uint Get_ChannelCount() { return m_iNumChannels; }
|
||||
_uint Get_KeyFrameCount() { return m_iKeyframeCount; }
|
||||
_float Get_Duration() { return m_fDuration; }
|
||||
|
||||
ID3D11Buffer* Get_KeyFrameBuffer() { return m_pKeyFrameBuffer; }
|
||||
|
||||
@@ -30,12 +30,16 @@ class ENGINE_DLL CBone final : public CBase
|
||||
void Set_TransformationMatrix(_fmatrix TransformationMatrix); // 애니메이션에서 현재 로컬 매트릭스를 변경할 때 사용된다
|
||||
_float4x4 Get_TransformationMatrix() { return m_TransformationMatrix; }
|
||||
_int Get_ParentBoneIndex() { return m_iParentBoneIndex; }
|
||||
void SetCPUEvaluated(bool Evaluat) { m_bCPUEvaluated = Evaluat; }
|
||||
_bool IsCPUEvaluated() const { return m_bCPUEvaluated; }
|
||||
|
||||
private:
|
||||
_string m_strName = {};
|
||||
_float4x4 m_TransformationMatrix = {}; // 본의 현재 로컬 매트릭스
|
||||
_float4x4 m_CombinedTransformationMatrix = {}; // 본의 루트노드로부터 상대적인 복합매트릭스 ( 부모노드는 PreTranformMatrix와 월드좌표로부터 상대적임 )
|
||||
_float4x4 m_matInitial = {};
|
||||
_int m_iParentBoneIndex = { -1 }; // 부모본의 인덱스 ( 모델에 있는 본벡터의 인덱스 ) ( 부모는 인덱스 -1 고정 )
|
||||
_bool m_bCPUEvaluated = false;
|
||||
private:
|
||||
HRESULT Initialize(HANDLE hFile, DWORD& dwByte);
|
||||
// 바이너리
|
||||
|
||||
@@ -23,10 +23,9 @@ class ENGINE_DLL CChannel : public CBase
|
||||
CHANNEL_DESC Fill_GPU_ChannelDesc();
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3]);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3], _int RootBoneIndex);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion();
|
||||
_matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; }
|
||||
|
||||
KEYFRAME* Get_Frame(_uint iIndex);
|
||||
@@ -58,13 +57,8 @@ class ENGINE_DLL CChannel : public CBase
|
||||
vector<KEYFRAME> m_KeyFrames; // 키프레임 벡터
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
_int m_ilayerIndex = 0;
|
||||
_float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
|
||||
_float4 m_vInitialRootRot = {};
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
LOCALPOS_DESC LocalPos = {};
|
||||
vector<KEYFRAME_DESC> m_KeyFrameDesc;
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = { false };
|
||||
_bool m_IsUpper = false;
|
||||
public:
|
||||
// 바이너리
|
||||
|
||||
@@ -26,10 +26,12 @@ class ENGINE_DLL CComputeShader final : public CComponent
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
public:
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
|
||||
void Dispatch_ExternalSRV_UAV(_uint srvStartSlot, _uint uavStartSlot, const _float3& groupCount, ID3D11ShaderResourceView** ppSRVs, _uint srvCount, ID3D11UnorderedAccessView** ppUAVs, _uint uavCount, ID3D11Buffer* pConstantBuffer);
|
||||
void Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
ID3D11ComputeShader* Get_Compute() { return m_pComputeShader; }
|
||||
ID3D11UnorderedAccessView* GetOutputUAV(_uint iIndex) const;
|
||||
ID3D11Buffer* Get_OutputBuffer(_int iIndex) {return m_pOutputBuffer[iIndex]; }
|
||||
private:
|
||||
void Bind_SRV(_uint iIndex);
|
||||
void Bind_UAV(_uint iIndex);
|
||||
|
||||
@@ -5,7 +5,7 @@ NS_BEGIN(Engine)
|
||||
enum class STATE { RIGHT, UP, LOOK, POSITION, END };
|
||||
enum class LIGHT { DIRECTIONAL, POINT, SPOT, END };
|
||||
enum class COLLIDER { AABB, OBB, SPHERE, END };
|
||||
enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, UI, OCCLUSION, SHADOW_MIDDLE, SHADOW_FAR, PRESHADOW, UI_OVERLAY, END };
|
||||
enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, UI, OCCLUSION, SHADOW_MIDDLE, SHADOW_FAR, PRESHADOW, UI_OVERLAY ,END };
|
||||
enum class RAY { LOCAL, WORLD, END };
|
||||
enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END };
|
||||
enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,END};
|
||||
@@ -15,7 +15,9 @@ enum class SHADOW : _ubyte {
|
||||
SHADOW_NEAR = 1 << 0
|
||||
, SHADOW_MIDDLE = 1 << 1
|
||||
, SHADOW_FAR = 1 << 2
|
||||
, END = 3
|
||||
, SHADOW_PRE = 1 << 3
|
||||
////////////////
|
||||
, END = 3 // 케스케이드 셰도우 한정
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -21,24 +21,32 @@
|
||||
#define ASSERT_JINHO(expression)
|
||||
#define ASSERT_HYUNBIN(expression)
|
||||
#define ASSERT_INHYUK(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK
|
||||
|
||||
#ifdef 기무리
|
||||
#undef ASSERT_NURI
|
||||
#define ASSERT_NURI(expression) assert(expression)
|
||||
//#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif 진우
|
||||
#undef ASSERT_JINWOO
|
||||
#define ASSERT_JINWOO(expression) assert(expression)
|
||||
//#undef OPTIONAL_TRUE_KEYINPUTGUICHECK
|
||||
//#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif gimch
|
||||
#undef ASSERT_JINHO
|
||||
#define ASSERT_JINHO(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif Bin
|
||||
#undef ASSERT_HYUNBIN
|
||||
#define ASSERT_HYUNBIN(expression) assert(expression)
|
||||
//#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif 인혁
|
||||
#undef ASSERT_INHYUK
|
||||
#define ASSERT_INHYUK(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#endif
|
||||
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -80,8 +88,9 @@
|
||||
#define FX_DEFERRED TEXT("FX_DEFERRED")
|
||||
#define FX_LASTCOLOR TEXT("FX_LASTCOLOR")
|
||||
#define FX_WEIGHTBELND TEXT("FX_WEIGHTBELND")
|
||||
#define FX_DISTORTION TEXT("FX_DISTORTION")
|
||||
|
||||
#define CS_EFFECT TEXT("CS_EFFECT")
|
||||
#define CS_EFFECT TEXT("CS_EFFECT")
|
||||
#define CS_INSTANCE_MODEL TEXT("CS_INSTANCE_MODEL")
|
||||
|
||||
#define SAFE_ADDREF(pInstance) Safe_AddRef(pInstance)
|
||||
@@ -100,6 +109,9 @@
|
||||
#define SSAO_SAMPLE_NUMBER 64
|
||||
#define TIMER_SHORT_LERP 0.16f
|
||||
|
||||
constexpr unsigned int g_iPreShadowWidth = 16384;
|
||||
constexpr unsigned int g_iPreShadowHeight = 9216;
|
||||
|
||||
constexpr unsigned int g_iMaxShadowWidth = 16384;
|
||||
constexpr unsigned int g_iMaxShadowHeight = 9216;
|
||||
//constexpr unsigned int g_iMaxShadowWidth = 4096;
|
||||
|
||||
@@ -415,26 +415,14 @@ typedef struct tagChannelDesc
|
||||
//_uint Padding;
|
||||
}CHANNEL_DESC;
|
||||
|
||||
|
||||
typedef struct tagParentDesc
|
||||
{
|
||||
_int ParentIndex;
|
||||
}PARENT_DESC;
|
||||
|
||||
typedef struct tagLocalPos
|
||||
{
|
||||
_float3 Scale;
|
||||
_float pad0;
|
||||
_float4 Rotation;
|
||||
_float3 Translation;
|
||||
_float pad1;
|
||||
}LOCALPOS_DESC;
|
||||
|
||||
typedef struct tagBoneDesc
|
||||
typedef struct tagBoneMatrix
|
||||
{
|
||||
_float4x4 Local;
|
||||
_float4x4 Combined;
|
||||
_float4x4 LocalCombined;
|
||||
}BONE_DESC;
|
||||
|
||||
|
||||
typedef struct tagSSAO_Geometry_Hemisphere {
|
||||
_float3 SamplePos[SSAO_SAMPLE_NUMBER];
|
||||
}SSAO_GEOMETRY_HEMISPHERE;
|
||||
|
||||
@@ -101,7 +101,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
|
||||
#pragma region RENDERER
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow();
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ASSET_MANAGER
|
||||
|
||||
@@ -18,15 +18,16 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
void SeT_MaterialIndex(_uint iMaterialIndex) { m_iMaterialIndex = iMaterialIndex; }
|
||||
|
||||
const _char* Get_Name() const { return m_strName.c_str(); }
|
||||
_int Get_NumBone() { return m_iNumBones; }
|
||||
HRESULT Bind_BoneMatrices(const vector<class CBone*>& Bones, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype(MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_NonAnim(const aiMesh* pAIMesh, _fmatrix PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_Anim(vector<class CBone*>& Bones, const aiMesh* pAIMesh);
|
||||
|
||||
public:
|
||||
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
||||
#endif // EDITOR_PROJECT
|
||||
@@ -38,13 +39,16 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
virtual HRESULT Render_Instance(_uint iNumInstance);
|
||||
|
||||
_uint Get_Vertex() { return m_iNumVertices; }
|
||||
vector<_float4x4> Get_OffsetMatrix() { return m_offsetMatrices; }
|
||||
ID3D11ShaderResourceView* Get_BoneRemapSRV() { return m_pBoneRemapSRV; }
|
||||
ID3D11Buffer* Get_BoneRemapBuffer() { return m_pBoneRemapBuffer; }
|
||||
private:
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
// 바이너리
|
||||
virtual HRESULT Initialize_Prototype(MODEL eType, const class CModel* pModel, SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_NonAnim(SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_Anim(const class CModel* pModel, SaveMesh* _SaveMesh);
|
||||
|
||||
HRESULT Create_BoneRemapBuffer();
|
||||
private:
|
||||
_string m_strName = { };
|
||||
_uint m_iMaterialIndex = {};
|
||||
@@ -54,6 +58,11 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
vector<_int> m_BoneIndices;
|
||||
_float4x4* m_pBoneMatrices = { nullptr };
|
||||
vector<_float4x4> m_offsetMatrices;
|
||||
vector<_uint> m_BoneRemap;
|
||||
ID3D11ShaderResourceView* m_pBoneRemapSRV = nullptr;
|
||||
ID3D11Buffer* m_pBoneRemapBuffer = nullptr;
|
||||
|
||||
|
||||
|
||||
// 바이너리
|
||||
std::vector<_uint> m_Indices;
|
||||
|
||||
@@ -11,10 +11,15 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
{
|
||||
_float CurrentTime;
|
||||
_float Duration;
|
||||
_float Speed;
|
||||
_int MeshBoneCount;
|
||||
_int BoneCount;
|
||||
_float4x4 PreTransformMatrix;
|
||||
|
||||
_int RootBoneIndex;
|
||||
_int Padding;
|
||||
_float PrevTime;
|
||||
_float BlendRatio;
|
||||
_float4x4 PreTransformMatrix;
|
||||
_float4 RootInitRot;
|
||||
}ANIMSTATE_DESC;
|
||||
|
||||
private:
|
||||
@@ -59,28 +64,32 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
void Set_BlendDuration(_float Duration) { m_fBlendDuration = Duration; }
|
||||
#pragma endregion
|
||||
#pragma region Mesh
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
void BeginFrame();
|
||||
vector<_float4x4> Get_OffsetMatrix(_int iIndex);
|
||||
void Apply_CPUMask_ToBones();
|
||||
void Mark_CPUChain(_int boneIdx);
|
||||
#pragma endregion
|
||||
#pragma region Bone
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName);
|
||||
_matrix Get_BoneMatrix(const _char* pBoneName) const;
|
||||
_matrix Get_BoneLocalMatrix(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
HRESULT Begin(_uint iMeshIndex, class CShader* pShader, _bool OutLine = false);
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation(_uint AnimIndex, _uint MeshIndex);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
|
||||
@@ -146,8 +155,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 };
|
||||
vector<vector<_uint>> m_BoneMask;
|
||||
|
||||
|
||||
vector<_bool> m_CPUBoneMask;
|
||||
|
||||
// 바이너리
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
@@ -161,18 +169,19 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
_float4 m_vInitialRootRot = {};
|
||||
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_vector m_vector[3];
|
||||
|
||||
vector<_uint> m_iBoneMask;
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = { false };
|
||||
_bool m_bLoopRestarted = false;
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bRatio = { false };
|
||||
_bool m_bRootBone = {};
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bRatio = { false };
|
||||
_bool m_bRootBone = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
|
||||
private:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -184,26 +193,37 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
#pragma region Compute
|
||||
|
||||
private:
|
||||
HRESULT Create_ComputeShader();
|
||||
HRESULT Create_ParentVB();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
HRESULT Create_BoneLocalVB();
|
||||
HRESULT Create_Temp();
|
||||
HRESULT Create_BoneMatrixVB();
|
||||
HRESULT Create_Const();
|
||||
HRESULT Create_ParentSrv();
|
||||
HRESULT Create_BoneLocalSrv();
|
||||
|
||||
_uint m_iNumBuffer = {};
|
||||
_uint m_iNumBuffer = {};
|
||||
|
||||
vector<_int> m_Parent = {};
|
||||
vector<_float4x4> m_BoneLocal = {};
|
||||
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = { nullptr };
|
||||
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneMatrixBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneLocalBuffer = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pParentSRV = {};
|
||||
ID3D11ShaderResourceView* m_pBoneLocalSRV = {};
|
||||
ID3D11ShaderResourceView* m_pBoneMatrixSRV = {};
|
||||
ID3D11UnorderedAccessView* m_pBoneMatrixUAV = {};
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
|
||||
// 바이너리
|
||||
virtual HRESULT Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix);
|
||||
void LoadAdditionalAnimations(const char* ModelFilePath);
|
||||
|
||||
@@ -57,7 +57,12 @@ class CPipeLine final : public CBase
|
||||
_float4 m_vCamPosition = {};
|
||||
|
||||
_float m_fShadowNearBoxRatio = { 0.07f };
|
||||
_float m_fShadowFarBoxRatio = { 0.60f };
|
||||
_float m_fShadowFarBoxRatio = { 0.15f };
|
||||
_float m_fSafe_RadiusMultiplier = { 2.3f };
|
||||
_float m_fSafe_RadiusMargin = { 10.f };
|
||||
_float3 m_vShadowBoxMarginMin = { 0.f, 0.f, -25.f };
|
||||
_float3 m_vShadowBoxMarginMax = { 0.f, 0.f, 25.f };
|
||||
|
||||
_float4 m_vShadowBias = { 0.0018f, 0.0018f, 0.0018f, 0.0018f };
|
||||
|
||||
_float4 m_vOriginalRenderFrustumPoints[8] = {};
|
||||
@@ -84,6 +89,7 @@ class CPipeLine final : public CBase
|
||||
void Make_LightBoxes();
|
||||
void Get_CascadePoints8(const _float4* shadowViewPoints16, _uint cascadeIndex, _float4* outPoints8); //
|
||||
void Update_ShadowDepthNdcZ();
|
||||
void Adjust_ShadowTexcel(_float& fMinX, _float& fMinY, _float& fMaxX, _float& fMaxY, _uint iShadowWidth, _uint iShadowHeight);
|
||||
ID3D11ShaderResourceView* Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV);
|
||||
|
||||
public:
|
||||
|
||||
@@ -13,7 +13,8 @@ class CRenderer final : public CBase
|
||||
public:
|
||||
void Render();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow();
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
@@ -33,6 +34,7 @@ class CRenderer final : public CBase
|
||||
class CShader* m_pShader = { nullptr };
|
||||
class CShader* m_pLastColorShader = { nullptr };
|
||||
class CShader* m_pWeightBlendShader = { nullptr };
|
||||
class CShader* m_pDistortionShader = { nullptr };
|
||||
class CVIBuffer_Rect* m_pVIBuffer = { nullptr };
|
||||
|
||||
private:
|
||||
@@ -48,11 +50,11 @@ class CRenderer final : public CBase
|
||||
ID3D11Texture2D* m_pSSAO_NoiseTexture = { nullptr };
|
||||
ID3D11Buffer* m_pGlobalStaticCB = { nullptr };
|
||||
|
||||
_float m_PreShadowFar = {};
|
||||
_float4x4 m_PreShadowMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
_float4x4 m_PreShadowView = {};
|
||||
_float4x4 m_PreShadowProj = {};
|
||||
|
||||
/* TunningParam */
|
||||
_int m_iToneMappingType = { 0 };
|
||||
_int m_iToneMappingType = { 2 };
|
||||
_float m_fExposure = { 0.7f };
|
||||
|
||||
// Bloom
|
||||
@@ -62,13 +64,14 @@ class CRenderer final : public CBase
|
||||
// DOF Environment
|
||||
_float m_fDOF_ENV_CutThreshold = { 0.1350f };
|
||||
_float m_fDOF_ENV_FocusDistance = { 31.1f };
|
||||
_float m_fDOF_ENV_StartDistance = { 53.1f };
|
||||
_float m_fDOF_ENV_MaxEnd = { 360.f };
|
||||
_float m_fDOF_ENV_StartDistance = { 130.f };
|
||||
_float m_fDOF_ENV_MaxEnd = { 350.f };
|
||||
_float m_fDOF_ENV_AmountRadius = { 1.f };
|
||||
|
||||
// SSAO
|
||||
_float m_fSSAO_Radius = { 1.6300f };
|
||||
_float m_fSSAO_BIAS = { 0.234f };
|
||||
_float m_fSSAO_Radius = { 1.6300f };
|
||||
_float m_fSSAO_BIAS = { 0.234f };
|
||||
_float m_fSSAOStrength = { 2.83f };
|
||||
|
||||
SSAO_GEOMETRY_HEMISPHERE m_tagSSAOGeometry = {};
|
||||
SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL m_tagSSAOGeometryDirections = {};
|
||||
@@ -89,6 +92,8 @@ class CRenderer final : public CBase
|
||||
void Render_NonLight();
|
||||
void Render_Blend();
|
||||
void Render_Bloom();
|
||||
void Render_Distortion();
|
||||
void Render_DistortionAcc();
|
||||
void Render_LastColor();
|
||||
void Render_Tone_Mapping();
|
||||
void Render_UI();
|
||||
|
||||
@@ -73,7 +73,7 @@ class ENGINE_DLL CTransform final :
|
||||
void Rotation(_float3& vRadian);
|
||||
void Rotation(_fvector vRPY);
|
||||
|
||||
// Up, Down 벡터를 바라보게 하면 터짐
|
||||
// Up, Down 벡터를 바라보게 하면 터짐, w에 1 있어야함
|
||||
void LookAt(_fvector vAt);
|
||||
void LookAt_Lerp(_fvector vAt, _float fTimeDelta, _float fSpeed);
|
||||
void LookAt_Horizontal(_fvector vAt);
|
||||
|
||||
Reference in New Issue
Block a user