[add] SHADOW 매개변수 받게끔 변경
This commit is contained in:
@@ -556,11 +556,6 @@ PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In)
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
@@ -724,7 +724,7 @@ _bool CGameInstance::IsIn_LocalFrustum(_fvector vLocalPos, _float fRadius)
|
||||
return m_pPipeLine->IsIn_LocalFrustum(vLocalPos, fRadius);
|
||||
}
|
||||
|
||||
pair<_bool, _uint> CGameInstance::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius)
|
||||
pair<_bool, _ubyte> CGameInstance::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius)
|
||||
{
|
||||
return m_pPipeLine->IsIn_ShadowViewFrustum(vWorldCenter, fRadius);
|
||||
}
|
||||
@@ -754,9 +754,9 @@ HRESULT CGameInstance::Ready_Shadow_Light(const _float4& vShadowDirRPYQuat)
|
||||
return m_pPipeLine->Ready_Shadow_Light(vShadowDirRPYQuat);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Bind_Shadow_Resource(CShader* pShader, const _char* pConstantName, D3DTS eType, _uint iShadowBoxIndex) const
|
||||
HRESULT CGameInstance::Bind_Shadow_Resource(CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const
|
||||
{
|
||||
return m_pPipeLine->Bind_Shadow_Resource(pShader, pConstantName, eType, iShadowBoxIndex);
|
||||
return m_pPipeLine->Bind_Shadow_Resource(pShader, pConstantName, eType, eShadowType);
|
||||
}
|
||||
|
||||
const _float4x4* CGameInstance::Get_ShadowMatricesPtr(_uint iShadowBoxIndex)
|
||||
|
||||
@@ -96,27 +96,23 @@ _float CGameObject::Get_Depth()
|
||||
return m_fCamDepth;
|
||||
}
|
||||
|
||||
void CGameObject::Set_Shadow(pair<_bool, _uint> shadowResult)
|
||||
void CGameObject::Set_Shadow(pair<_bool, _ubyte> shadowResult)
|
||||
{
|
||||
if (true == shadowResult.first) {
|
||||
m_eShadow = SHADOW(shadowResult.second);
|
||||
switch (m_eShadow)
|
||||
{
|
||||
case SHADOW::SHADOW_NEAR:
|
||||
m_iShadow = shadowResult.second;
|
||||
|
||||
if (0 < (m_iShadow & (_ubyte)SHADOW::SHADOW_NEAR)) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::SHADOW_NEAR, this);
|
||||
break;
|
||||
case SHADOW::SHADOW_MIDDLE:
|
||||
}
|
||||
if (0 < (m_iShadow & (_ubyte)SHADOW::SHADOW_MIDDLE)) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::SHADOW_MIDDLE, this);
|
||||
break;
|
||||
case SHADOW::SHADOW_FAR:
|
||||
}
|
||||
if (0 < (m_iShadow & (_ubyte)SHADOW::SHADOW_FAR)) {
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::SHADOW_FAR, this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
m_eShadow = SHADOW::END;
|
||||
m_iShadow = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,15 +68,15 @@ _bool CPipeLine::IsIn_LocalFrustum(_fvector vLocalPos, _float fRadius)
|
||||
return true;
|
||||
}
|
||||
|
||||
pair<_bool, _uint> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius)
|
||||
pair<_bool, _ubyte> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius)
|
||||
{
|
||||
pair<_bool, _uint> pairResult = { false, UINT_MAX };
|
||||
pair<_bool, _ubyte> pairResult = { false, 0 };
|
||||
// 월드 센터를 셰도우뷰 센터로 바꿈
|
||||
_vector vShadowViewCenter = XMVectorSetW(XMVector3Rotate(vWorldCenter, XMLoadFloat4(&m_vShadowInvDirectionalRPYQuat)), 1.f);
|
||||
|
||||
_float fSafeRadius = fRadius; // 인스턴싱된 객체 고려해서 좀 더 넓게 탐색
|
||||
|
||||
for (_uint iCascadeIndex = 0; iCascadeIndex < 3; ++iCascadeIndex) {
|
||||
for (_uint iCascadeIndex = 0; iCascadeIndex < ENUM_CLASS(SHADOW::END); ++iCascadeIndex) {
|
||||
const _float4* pTargetPlanes = nullptr;
|
||||
if (iCascadeIndex == 0) {
|
||||
pTargetPlanes = m_vNearShadowViewBoxPlane;
|
||||
@@ -92,7 +92,6 @@ pair<_bool, _uint> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _flo
|
||||
}
|
||||
|
||||
_bool bIsInside = true;
|
||||
|
||||
for (_uint planeIndex = 0; planeIndex < 6; ++planeIndex) {
|
||||
_vector vPlane = XMLoadFloat4(&pTargetPlanes[planeIndex]);
|
||||
_float fDistance = XMVectorGetX(XMPlaneDotCoord(vPlane, vShadowViewCenter));
|
||||
@@ -103,8 +102,7 @@ pair<_bool, _uint> CPipeLine::IsIn_ShadowViewFrustum(_fvector vWorldCenter, _flo
|
||||
}
|
||||
if (true == bIsInside) {
|
||||
pairResult.first = true;
|
||||
pairResult.second = iCascadeIndex;
|
||||
break;
|
||||
pairResult.second |= 1 << iCascadeIndex;
|
||||
}
|
||||
}
|
||||
return pairResult;
|
||||
@@ -161,9 +159,21 @@ HRESULT CPipeLine::Ready_Shadow_Light(const _float4& vShadowDirRPYQuat)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPipeLine::Bind_Shadow_Resource(CShader* pShader, const _char* pConstantName, D3DTS eType, _uint iShadowBoxIndex) const
|
||||
HRESULT CPipeLine::Bind_Shadow_Resource(CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const
|
||||
{
|
||||
return pShader->Bind_Matrix(pConstantName, &m_ShadowTransformStateMatrices[iShadowBoxIndex][ENUM_CLASS(eType)]);
|
||||
_uint iPass = UINT_MAX;
|
||||
if (0 < ((_ubyte)eShadowType | (_ubyte)SHADOW::SHADOW_NEAR)) {
|
||||
iPass = 0;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType | (_ubyte)SHADOW::SHADOW_MIDDLE)) {
|
||||
iPass = 1;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType | (_ubyte)SHADOW::SHADOW_FAR)) {
|
||||
iPass = 2;
|
||||
}
|
||||
assert(iPass != UINT_MAX);
|
||||
|
||||
return pShader->Bind_Matrix(pConstantName, &m_ShadowTransformStateMatrices[iPass][ENUM_CLASS(eType)]);
|
||||
}
|
||||
|
||||
const _float4x4* CPipeLine::Get_ShadowMatricesPtr(_uint iShadowBoxIndex)
|
||||
|
||||
@@ -87,7 +87,7 @@ void CRenderer::Render_PreShadow()
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRESHADOW)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow())) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::END))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void CRenderer::Render_Shadow()
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_NEAR)]) {
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow())) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ void CRenderer::Render_Shadow()
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_MIDDLE)]) {
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow())) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -255,7 +255,7 @@ void CRenderer::Render_Shadow()
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_FAR)]) {
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow())) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_FAR))) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -367,34 +367,22 @@ void CRenderer::Render_Combined()
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return;
|
||||
}
|
||||
_float fShadowFar = m_pGameInstance->Get_ShadowBoxFar(0);
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fShadowFar_NEAR", &fShadowFar, sizeof(_float)))) {
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_NEAR", D3DTS::VIEW, SHADOW::SHADOW_NEAR))) {
|
||||
return;
|
||||
}
|
||||
fShadowFar = m_pGameInstance->Get_ShadowBoxFar(1);
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fShadowFar_MIDDDLE", &fShadowFar, sizeof(_float)))) {
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_NEAR", D3DTS::PROJ, SHADOW::SHADOW_NEAR))) {
|
||||
return;
|
||||
}
|
||||
fShadowFar = m_pGameInstance->Get_ShadowBoxFar(2);
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fShadowFar_FAR", &fShadowFar, sizeof(_float)))) {
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_MIDDLE", D3DTS::VIEW, SHADOW::SHADOW_MIDDLE))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_NEAR", D3DTS::VIEW, 0))) {
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_MIDDLE", D3DTS::PROJ, SHADOW::SHADOW_MIDDLE))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_NEAR", D3DTS::PROJ, 0))) {
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_FAR", D3DTS::VIEW, SHADOW::SHADOW_FAR))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_MIDDLE", D3DTS::VIEW, 1))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_MIDDLE", D3DTS::PROJ, 1))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightViewMatrix_FAR", D3DTS::VIEW, 2))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_Shadow_Resource(m_pShader, "g_LightProjMatrix_FAR", D3DTS::PROJ, 2))) {
|
||||
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)))) {
|
||||
|
||||
@@ -11,7 +11,12 @@ 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};
|
||||
enum class STAT { NAME, CURRENTHP, MAXHP, TARGETHP, MELEE, MAGIC, DEFENSE, SPEED, AGILITY, LEVEL, EXPERIENCE, MAX_EXPERIENCE, GOLD, END };
|
||||
//enum class CONDITION { POISON, HPREGENERATION, PANIC, GRAP, END };
|
||||
enum class SHADOW { SHADOW_NEAR, SHADOW_MIDDLE, SHADOW_FAR, END };
|
||||
enum class SHADOW : _ubyte {
|
||||
SHADOW_NEAR = 1 << 0
|
||||
, SHADOW_MIDDLE = 1 << 1
|
||||
, SHADOW_FAR = 1 << 2
|
||||
, END = 3
|
||||
};
|
||||
|
||||
|
||||
enum class TEXTURE_LOAD_TYPE {
|
||||
|
||||
@@ -139,14 +139,14 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse);
|
||||
_bool IsIn_WorldFrustum(_fvector vWorldPos, _float fRadius);
|
||||
_bool IsIn_LocalFrustum(_fvector vLocalPos, _float fRadius);
|
||||
pair<_bool, _uint> IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius);
|
||||
pair<_bool, _ubyte> IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius);
|
||||
HRESULT Bind_CascadeSplitRatio(class CShader* pShader, const _char* pConstantName, _bool bNear);
|
||||
HRESULT Bind_CascadeBias(class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Bind_GlobalSRV(class CShader* pShader, const _tchar* wszKeyGlobalSRV, const _char* pConstantName);
|
||||
HRESULT Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::path pathSRVFolder);
|
||||
|
||||
HRESULT Ready_Shadow_Light(const _float4& vShadowDirRPYQuat);
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, _uint iShadowBoxIndex) const;
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const;
|
||||
const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex);
|
||||
_float Get_ShadowBoxFar(_uint iShadowBoxIndex);
|
||||
#pragma endregion
|
||||
|
||||
@@ -20,7 +20,7 @@ class ENGINE_DLL CGameObject abstract
|
||||
virtual void Late_Update(_float fTimeDelta);
|
||||
|
||||
virtual HRESULT Render();
|
||||
virtual HRESULT Render_Shadow() { return S_OK; }
|
||||
virtual HRESULT Render_Shadow(SHADOW eType) { return S_OK; }
|
||||
virtual HRESULT Render_Blur() { return S_OK; }
|
||||
virtual HRESULT Render_Bloom() { return S_OK; }
|
||||
virtual HRESULT Render_OutLine() { return S_OK; }
|
||||
@@ -108,9 +108,9 @@ class ENGINE_DLL CGameObject abstract
|
||||
_bool m_bDead = { false };
|
||||
_bool m_bVisible = { true };
|
||||
_bool m_bCloned = { false };
|
||||
SHADOW m_eShadow = { SHADOW::SHADOW_NEAR };
|
||||
_ubyte m_iShadow = { 0 };
|
||||
protected:
|
||||
void Set_Shadow(pair<_bool, _uint> shadowResult);
|
||||
void Set_Shadow(pair<_bool, _ubyte> shadowResult);
|
||||
virtual HRESULT Bind_ShaderResources()PURE;
|
||||
virtual HRESULT Ready_Components(void* pArg);
|
||||
public:
|
||||
|
||||
@@ -35,7 +35,7 @@ class CPipeLine final : public CBase
|
||||
_bool IsIn_WorldFrustum(_fvector vWorldPos, _float fRadius);
|
||||
_bool IsIn_LocalFrustum(_fvector vLocalPos, _float fRadius);
|
||||
|
||||
pair<_bool, _uint> IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius);
|
||||
pair<_bool, _ubyte> IsIn_ShadowViewFrustum(_fvector vWorldCenter, _float fRadius);
|
||||
|
||||
HRESULT Bind_CascadeSplitRatio(class CShader* pShader, const _char* pConstantName, _bool bNear);
|
||||
HRESULT Bind_CascadeBias(class CShader* pShader, const _char* pConstantName);
|
||||
@@ -44,7 +44,7 @@ class CPipeLine final : public CBase
|
||||
HRESULT Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::path pathSRVFolder);
|
||||
|
||||
HRESULT Ready_Shadow_Light(const _float4& vShadowDirRPYQuat);
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, _uint iShadowBoxIndex) const;
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const;
|
||||
const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex);
|
||||
_float Get_ShadowBoxFar(_uint iShadowBoxIndex);
|
||||
public:
|
||||
@@ -56,9 +56,9 @@ class CPipeLine final : public CBase
|
||||
_float4x4 m_ShadowTransformStateMatrices[3][ENUM_CLASS(D3DTS::END)] = {};
|
||||
_float4 m_vCamPosition = {};
|
||||
|
||||
_float m_fShadowNearBoxRatio = { 0.17f };
|
||||
_float m_fShadowNearBoxRatio = { 0.07f };
|
||||
_float m_fShadowFarBoxRatio = { 0.60f };
|
||||
_float4 m_vShadowBias = { 0.005f, 0.005f, 0.005f, 0.005f };
|
||||
_float4 m_vShadowBias = { 0.0041f, 0.005f, 0.005f, 0.005f };
|
||||
|
||||
_float4 m_vOriginalRenderFrustumPoints[8] = {};
|
||||
_float4 m_vOriginalShadowFrustumPoints[16] = {};// 3개로 나눈 절두체의 부분을 나타내는 16개의 점
|
||||
|
||||
Reference in New Issue
Block a user