Merge branch 'Develope' into Effect
This commit is contained in:
@@ -168,6 +168,7 @@ call Update_Resources.bat
|
||||
<ClInclude Include="..\Public\CallBack_Ranrok_HitReport.h" />
|
||||
<ClInclude Include="..\Public\Ranrok_Breath.h" />
|
||||
<ClInclude Include="..\Public\Ranrok_FireBall.h" />
|
||||
<ClInclude Include="..\Public\CamPosition_AI.h" />
|
||||
<ClInclude Include="..\public\Dialogue.h" />
|
||||
<ClInclude Include="..\public\Dialogue_Font.h" />
|
||||
<ClInclude Include="..\public\NPCInteraction.h" />
|
||||
@@ -409,6 +410,7 @@ call Update_Resources.bat
|
||||
<ClCompile Include="..\Private\CallBack_Ranrok_HitReport.cpp" />
|
||||
<ClCompile Include="..\Private\Ranrok_Breath.cpp" />
|
||||
<ClCompile Include="..\Private\Ranrok_FireBall.cpp" />
|
||||
<ClCompile Include="..\Private\CamPosition_AI.cpp" />
|
||||
<ClCompile Include="..\private\Dialogue.cpp" />
|
||||
<ClCompile Include="..\private\Dialogue_Font.cpp" />
|
||||
<ClCompile Include="..\private\NPCInteraction.cpp" />
|
||||
|
||||
@@ -742,6 +742,9 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Ranrok_Breath.h">
|
||||
<Filter>02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\CamPosition_AI.h">
|
||||
<Filter>02.GameObjects\Cameras\CameraPosition\AI</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -1544,6 +1547,9 @@
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath">
|
||||
<UniqueIdentifier>{a3b5e707-dbb3-47da-a77b-b0ca62b89e99}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.GameObjects\Cameras\CameraPosition\AI">
|
||||
<UniqueIdentifier>{a24f4687-f540-44e5-ae47-fe176c4c9042}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@@ -2234,6 +2240,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Ranrok_Breath.cpp">
|
||||
<Filter>02.GameObjects\Effect\MonsterEffect\Ranrok\Ranrok_Breath</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\CamPosition_AI.cpp">
|
||||
<Filter>02.GameObjects\Cameras\CameraPosition\AI</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -35,8 +35,6 @@ HRESULT CBroom::Initialize(void* pArg)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Add_FSM();
|
||||
|
||||
Set_Anim();
|
||||
@@ -50,7 +48,7 @@ HRESULT CBroom::Initialize(void* pArg)
|
||||
m_pFSM->Change_State(FSMSTATE::IDLE);
|
||||
}
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 10.f, 0.f, 1.f));
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f,-100.f, 0.f, 1.f));
|
||||
|
||||
m_pParentUnit = dynamic_cast<CUnit*>(m_pOwner);
|
||||
|
||||
@@ -62,8 +60,10 @@ HRESULT CBroom::Initialize(void* pArg)
|
||||
|
||||
m_pWindEffect->Get_Effect_Info()->isBillboard = false;
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
m_fAISeed = m_pGameInstance->Real_Random_Float(0.f, XM_2PI);
|
||||
m_fAICondition = 1.f;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
@@ -85,8 +85,15 @@ void CBroom::Update(_float fTimeDelta)
|
||||
else {
|
||||
m_bHoverToggle = m_Input.bHoverToggle;
|
||||
m_bTurbo = m_Input.bTurbo;
|
||||
}
|
||||
|
||||
m_fAITime += fTimeDelta;
|
||||
|
||||
_float target = 1.f + sinf(m_fAITime * 0.3f + m_fAISeed) * 0.15f;
|
||||
|
||||
m_fAICondition += (target - m_fAICondition) * fTimeDelta * 0.3f;
|
||||
|
||||
m_fAICondition = clamp(m_fAICondition, 0.85f, 1.15f);
|
||||
}
|
||||
if (!m_bRide)
|
||||
{
|
||||
m_bHoverToggle = true;
|
||||
@@ -122,7 +129,7 @@ void CBroom::Update(_float fTimeDelta)
|
||||
return;
|
||||
}
|
||||
|
||||
m_pWindEffect->Set_Visible(true);
|
||||
m_pWindEffect->Set_Visible(false);
|
||||
m_pWindEffect->Get_Component<CInstance_Model>()->Set_TimeMult(0.5f + m_fSpeed / 20.f);
|
||||
m_pWindEffect->Get_Effect_Info()->fBlurIntensity = m_fSpeed / 30.f;
|
||||
|
||||
@@ -287,15 +294,19 @@ void CBroom::PlayerInput()
|
||||
|
||||
if (m_pGameInstance->Key_Up(DIK_LSHIFT))
|
||||
{
|
||||
m_Input.bHoverToggle = !m_Input.bHoverToggle;
|
||||
m_bHoverToggle = m_Input.bHoverToggle;
|
||||
m_bHoverToggle = !m_bHoverToggle;
|
||||
}
|
||||
|
||||
|
||||
m_Input.bTurbo = m_pGameInstance->Mouse_Pressing(DIM_LBUTTON);
|
||||
m_bTurbo = m_Input.bTurbo;
|
||||
}
|
||||
|
||||
void CBroom::Set_AISpeed(_float speedMul, _float accelMul)
|
||||
{
|
||||
m_fAISpeedMul = speedMul;
|
||||
m_fAIAccelMul = accelMul;
|
||||
}
|
||||
|
||||
|
||||
CBroom* CBroom::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
#include "GameInstance.h"
|
||||
#include "RaceRing.h"
|
||||
#include "Layer.h"
|
||||
#include "BroomRacerAI.h"
|
||||
#include "Player.h"
|
||||
#include "Broom.h"
|
||||
|
||||
CBroomRaceManager::CBroomRaceManager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject(pDevice, pContext)
|
||||
@@ -30,10 +33,6 @@ HRESULT CBroomRaceManager::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_pGripShape = (GeometricPrimitive::CreateSphere(m_pContext, 1.f, 10, false, false));
|
||||
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 1.2f, 10, false, false));
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -41,13 +40,25 @@ HRESULT CBroomRaceManager::Initialize(void* pArg)
|
||||
void CBroomRaceManager::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
switch (m_eRaceState)
|
||||
{
|
||||
case ENUM_CLASS(RACE_STATE::COUNTDOWN):
|
||||
Update_Countdown(fTimeDelta);
|
||||
break;
|
||||
case ENUM_CLASS(RACE_STATE::RACING):
|
||||
Check_RingPassed();
|
||||
break;
|
||||
}
|
||||
|
||||
Check_RingPassed();
|
||||
}
|
||||
|
||||
void CBroomRaceManager::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
@@ -56,8 +67,15 @@ void CBroomRaceManager::Update(_float fTimeDelta)
|
||||
void CBroomRaceManager::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI, this);
|
||||
}
|
||||
|
||||
HRESULT CBroomRaceManager::Render()
|
||||
{
|
||||
m_pGameInstance->Render_Text(TEXT("Font_size20"), ToolTip.c_str(), _float2(g_iWinSizeX*0.5f, g_iWinSizeY*0.5f),XMVectorSet(1.f,1.f,1.f,1.f),5.f);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBroomRaceManager::Ready_Components()
|
||||
{
|
||||
@@ -123,64 +141,201 @@ void CBroomRaceManager::Free()
|
||||
|
||||
void CBroomRaceManager::Describe_Entity()
|
||||
{
|
||||
if (GUI::Button("Race Start"))
|
||||
{
|
||||
m_eRaceState = ENUM_CLASS(RACE_STATE::READY);
|
||||
const _float SPAWN_DISTANCE = 80.f;
|
||||
|
||||
for (auto& racer : m_Racers)
|
||||
{
|
||||
CTransform* pRingTransform =
|
||||
m_pRaceRings[0]->Get_Component<CTransform>();
|
||||
|
||||
_vector ringPos = pRingTransform->Get_State(STATE::POSITION);
|
||||
_vector ringLook = pRingTransform->Get_State(STATE::RIGHT);
|
||||
ringLook = XMVector3Normalize(ringLook);
|
||||
|
||||
_vector spawnPos = ringPos - ringLook * SPAWN_DISTANCE;
|
||||
|
||||
if (racer.pAI)
|
||||
{
|
||||
CTransform* pBroomTransform =
|
||||
racer.pAI->Get_Broom()->Get_Component<CTransform>();
|
||||
_float fRand = m_pGameInstance->Real_Random_Float(-10.f, 10.f);
|
||||
spawnPos.m128_f32[2] += fRand;
|
||||
|
||||
pBroomTransform->Set_State(STATE::POSITION, spawnPos);
|
||||
pBroomTransform->LookAt(pRingTransform->Get_State(STATE::POSITION));
|
||||
racer.pAI->Get_Broom()->Set_Move(false);
|
||||
}
|
||||
else if (racer.pRacer)
|
||||
{
|
||||
CTransform* pTransform =
|
||||
racer.pRacer->Get_Component<CTransform>();
|
||||
spawnPos.m128_f32[1] -= 2.f;
|
||||
pTransform->Set_State(STATE::POSITION,spawnPos);
|
||||
pTransform->LookAt(pRingTransform->Get_State(STATE::POSITION));
|
||||
racer.pRacer->Get_Component<CFSM>()->Change_State(FSMSTATE::BROOM_RIDE);
|
||||
racer.pRacer->Get_Broom()->Set_Move(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_eRaceState == ENUM_CLASS(RACE_STATE::READY))
|
||||
{
|
||||
if (GUI::Button("Countdown"))
|
||||
{
|
||||
m_eRaceState = ENUM_CLASS(RACE_STATE::COUNTDOWN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
void CBroomRaceManager::Update_Countdown(_float fTimeDelta)
|
||||
{
|
||||
m_fCountTimer += fTimeDelta;
|
||||
|
||||
if (m_fCountTimer >= 1.f)
|
||||
{
|
||||
m_fCountTimer = 0.f;
|
||||
--m_iCount;
|
||||
|
||||
if (m_iCount > 0)
|
||||
{
|
||||
ToolTip = to_wstring(m_iCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolTip = to_wstring(0);
|
||||
StartRaceMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CBroomRaceManager::StartRaceMove()
|
||||
{
|
||||
for (auto& racer : m_Racers)
|
||||
{
|
||||
if (racer.pAI)
|
||||
{
|
||||
racer.pAI->Get_Broom()->Set_Move(true);
|
||||
}
|
||||
else if (racer.pRacer)
|
||||
{
|
||||
racer.pRacer->Get_Broom()->Set_Move(true);
|
||||
}
|
||||
}
|
||||
|
||||
m_eRaceState = ENUM_CLASS(RACE_STATE::RACING);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CBroomRaceManager::Check_RingPassed()
|
||||
{
|
||||
const float PASS_RADIUS = 5.f;
|
||||
|
||||
for (auto& racer : m_Racers)
|
||||
{
|
||||
CRaceRing* pRing = m_pRaceRings[racer.curRing];
|
||||
_vector ringPos = pRing->Get_WorldPostion();
|
||||
_vector broomPos = racer.pRacer->Get_WorldPostion();
|
||||
|
||||
_vector ringFwd =pRing->Get_Component<CTransform>()->Get_State(STATE::LOOK);
|
||||
_vector ringPos = pRing->Get_WorldPostion();
|
||||
|
||||
_vector ringFwd =
|
||||
pRing->Get_Component<CTransform>()->Get_State(STATE::RIGHT);
|
||||
ringFwd = XMVector3Normalize(ringFwd);
|
||||
|
||||
_float prevSide = XMVectorGetX(XMVector3Dot(ringFwd, racer.prevPos - ringPos));
|
||||
_float currSide = XMVectorGetX(XMVector3Dot(ringFwd, broomPos - ringPos));
|
||||
|
||||
_float dist = XMVectorGetX(XMVector3Length(broomPos - ringPos));
|
||||
_vector currPos = racer.pAI ? racer.pAI->Get_WorldPostion() : racer.pRacer->Get_WorldPostion();
|
||||
|
||||
const _float PASS_RADIUS = 50.f;
|
||||
|
||||
GUI::Text("CurRing %d", racer.curRing);
|
||||
_vector prevPos = racer.prevPos;
|
||||
|
||||
_float d0 = XMVectorGetX(
|
||||
XMVector3Dot(prevPos - ringPos, ringFwd));
|
||||
_float d1 = XMVectorGetX(
|
||||
XMVector3Dot(currPos - ringPos, ringFwd));
|
||||
#ifdef _DEBUG
|
||||
m_pGripShape->Draw(m_pTransformCom->Get_XMWorldMatrix(), m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), DirectX::Colors::Green, nullptr, true);
|
||||
m_pSubShape->Draw(pRing->Get_Component<CTransform>()->Get_XMWorldMatrix(), m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW), m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ), DirectX::Colors::Purple, nullptr, true);
|
||||
GUI::Text("%s", racer.pAI ? "AI" : "Player");
|
||||
GUI::SameLine();
|
||||
GUI::Text("CurRing %d", racer.curRing);
|
||||
GUI::Text("PrevSide %.2f", d0);
|
||||
GUI::Text("CurrSide %.2f", d1);
|
||||
#endif // _DEBUG
|
||||
|
||||
if (prevSide < 0.f && currSide >= 0.f && dist < PASS_RADIUS)
|
||||
if (d0 * d1 <= 0.f && fabs(d0 - d1) > 1e-4f)
|
||||
{
|
||||
racer.curRing++;
|
||||
if (racer.curRing >= m_pRaceRings.size())
|
||||
racer.curRing = 0;
|
||||
_float t = d0 / (d0 - d1);
|
||||
t = std::clamp(t, 0.f, 1.f);
|
||||
|
||||
_vector hitPos =
|
||||
prevPos + (currPos - prevPos) * t;
|
||||
|
||||
_vector v = hitPos - ringPos;
|
||||
_float side = XMVectorGetX(XMVector3Dot(v, ringFwd));
|
||||
_vector proj = hitPos - ringFwd * side;
|
||||
|
||||
_float dist =
|
||||
XMVectorGetX(XMVector3Length(proj - ringPos));
|
||||
|
||||
if (dist <= PASS_RADIUS)
|
||||
{
|
||||
if(racer.pRacer){
|
||||
pRing->Set_Target(false);
|
||||
}
|
||||
|
||||
|
||||
racer.curRing = (racer.curRing + 1) % m_pRaceRings.size();
|
||||
|
||||
if (racer.pRacer) {
|
||||
m_pRaceRings[racer.curRing]->Set_Target(true);
|
||||
}
|
||||
|
||||
racer.pAI ? SetTargetRing(racer.pAI) : SetTargetRing(racer.pRacer);
|
||||
}
|
||||
}
|
||||
|
||||
racer.prevPos = broomPos;
|
||||
racer.prevPos = currPos;
|
||||
}
|
||||
}
|
||||
|
||||
CRaceRing* CBroomRaceManager::GetTargetRing(CGameObject* pRacer)
|
||||
{
|
||||
|
||||
void CBroomRaceManager::SetTargetRing(CGameObject*pRacer)
|
||||
{
|
||||
for (auto& racer : m_Racers)
|
||||
{
|
||||
if (racer.pRacer == pRacer)
|
||||
return m_pRaceRings[racer.curRing];
|
||||
if (racer.pAI)
|
||||
{
|
||||
if (racer.pAI == pRacer)
|
||||
{
|
||||
if (racer.pAI)
|
||||
{
|
||||
racer.pAI->Set_RaceRing(m_pRaceRings[racer.curRing]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (racer.pRacer)
|
||||
{
|
||||
if (racer.pRacer == pRacer)
|
||||
{
|
||||
racer.pRacer->Set_RaceRing(m_pRaceRings[racer.curRing]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CBroomRaceManager::Push_BroomRacer(RacerInfo Info)
|
||||
{
|
||||
RacerInfo info;
|
||||
info.pRacer = Info.pRacer;
|
||||
info.pAI = Info.pAI;
|
||||
info.curRing = Info.curRing;
|
||||
info.prevPos = Info.prevPos;
|
||||
|
||||
if(Info.pAI)
|
||||
info.pAI->Set_RaceRing(m_pRaceRings[info.curRing]);
|
||||
else if(Info.pRacer)
|
||||
info.pRacer->Set_RaceRing(m_pRaceRings[info.curRing]);
|
||||
|
||||
m_Racers.push_back(info);
|
||||
SAFE_ADDREF(Info.pRacer);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "GameInstance.h"
|
||||
#include "Broom.h"
|
||||
#include "RaceRing.h"
|
||||
#include "CamPosition_Shoulder.h"
|
||||
#include "CamPosition_AI.h"
|
||||
#include "BroomRaceManager.h"
|
||||
|
||||
#pragma region STATE
|
||||
@@ -71,10 +71,11 @@ HRESULT CBroomRacerAI::Initialize(void* pArg)
|
||||
}
|
||||
|
||||
_float X = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
|
||||
_float Y = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
|
||||
_float Z = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
|
||||
_float Y = m_pGameInstance->Real_Random_Float(-5.f, 5.f);
|
||||
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(-200.f, Y, 0.f, 1.f));
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(X, Y, Z, 1.f));
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_BasicEffect = make_unique<BasicEffect>(m_pDevice);
|
||||
@@ -85,20 +86,30 @@ HRESULT CBroomRacerAI::Initialize(void* pArg)
|
||||
m_Batch = make_unique<PrimitiveBatch<VertexPositionColor>>(m_pContext);
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
|
||||
m_pBroom->Set_Ride(true);
|
||||
|
||||
m_pBroomRaceManager = static_cast<CBroomRaceManager*>(pArg);
|
||||
|
||||
CBroomRaceManager::RacerInfo Info;
|
||||
|
||||
Info.pRacer = this;
|
||||
Info.pAI = this;
|
||||
Info.curRing = 0;
|
||||
Info.prevPos = Get_WorldPostion();
|
||||
|
||||
m_pBroomRaceManager->Push_BroomRacer(Info);
|
||||
|
||||
m_LaneOffsetX = m_pGameInstance->Real_Random_Float(-3.f, 3.f);
|
||||
m_LaneOffsetY = m_pGameInstance->Real_Random_Float(-3.f, 3.f);
|
||||
|
||||
m_TurnGain = m_pGameInstance->Real_Random_Float(0.85f, 1.15f);
|
||||
m_HeightGain = m_pGameInstance->Real_Random_Float(0.85f, 1.15f);
|
||||
|
||||
m_pBroom->Set_AISpeed(
|
||||
m_pGameInstance->Real_Random_Float(0.8f, 1.2f),
|
||||
m_pGameInstance->Real_Random_Float(0.8f, 1.2f)
|
||||
);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -106,11 +117,13 @@ void CBroomRacerAI::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
|
||||
m_pRaceRing = m_pBroomRaceManager->GetTargetRing(this);
|
||||
|
||||
}
|
||||
|
||||
void CBroomRacerAI::Update(_float fTimeDelta)
|
||||
{
|
||||
Set_Input(fTimeDelta);
|
||||
|
||||
m_pFSM->Update_State(fTimeDelta);
|
||||
|
||||
m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom);
|
||||
@@ -125,7 +138,6 @@ void CBroomRacerAI::Update(_float fTimeDelta)
|
||||
|
||||
void CBroomRacerAI::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
Set_Input(fTimeDelta);
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius()));
|
||||
@@ -189,6 +201,7 @@ HRESULT CBroomRacerAI::Render()
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CBroomRacerAI::Render_Shadow(SHADOW eType)
|
||||
@@ -247,8 +260,22 @@ HRESULT CBroomRacerAI::Ready_Components()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_strModelPrototypeTag = TEXT("Prototype_Component_VictorRookWood_Model");
|
||||
//m_strModelPrototypeTag = TEXT("Prototype_Component_Npc_Model");
|
||||
_int iRand = m_pGameInstance->Real_Random_Int(0, 2);
|
||||
|
||||
switch (iRand)
|
||||
{
|
||||
case 0:
|
||||
m_strModelPrototypeTag = TEXT("Prototype_Component_VictorRookWood_Model");
|
||||
break;
|
||||
case 1:
|
||||
m_strModelPrototypeTag = TEXT("Prototype_Component_Npc_Model");
|
||||
break;
|
||||
case 2:
|
||||
m_strModelPrototypeTag = TEXT("Prototype_Component_Ghost_Peeves_Model");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* Com_Model */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag,
|
||||
@@ -310,6 +337,10 @@ HRESULT CBroomRacerAI::Bind_ShaderResources()
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
_float Intensity = 0.f;
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fMBIntensity", &Intensity, sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -368,41 +399,59 @@ HRESULT CBroomRacerAI::Bind_ShaderParameters(_uint iMeshOrder)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_vector CBroomRacerAI::Get_RingForwardTarget()
|
||||
{
|
||||
_vector ringPos = m_pRaceRing->Get_WorldPostion();
|
||||
_vector ringFwd = m_pRaceRing->Get_Component<CTransform>()->Get_State(STATE::RIGHT);
|
||||
ringFwd = XMVector3Normalize(ringFwd);
|
||||
|
||||
_vector targetPos = ringPos + ringFwd;
|
||||
targetPos = XMVectorSet(targetPos.m128_f32[0] + m_LaneOffsetX, targetPos.m128_f32[1] + m_LaneOffsetY, targetPos.m128_f32[2], 1.f);
|
||||
|
||||
return targetPos;
|
||||
}
|
||||
|
||||
_float CBroomRacerAI::ComputeTurnToRing()
|
||||
{
|
||||
_vector toRing = m_pRaceRing->Get_WorldPostion() - m_pBroom->Get_WorldPostion();
|
||||
toRing = XMVector3Normalize(XMVectorSetY(toRing, 0.f));
|
||||
_vector targetPos = Get_RingForwardTarget();
|
||||
|
||||
_vector toTarget = targetPos - m_pBroom->Get_WorldPostion();
|
||||
toTarget = XMVector3Normalize(XMVectorSetY(toTarget, 0.f));
|
||||
|
||||
_vector myLook = m_pBroom->Get_Component<CTransform>()->Get_State(STATE::LOOK);
|
||||
myLook = XMVector3Normalize(XMVectorSetY(myLook, 0.f));
|
||||
|
||||
_vector cross = XMVector3Cross(myLook, toRing);
|
||||
_float turn = XMVectorGetY(cross);
|
||||
_float turn = XMVectorGetY(XMVector3Cross(myLook, toTarget));
|
||||
|
||||
_float DEAD = 0.05f;
|
||||
if (fabsf(turn) < DEAD)
|
||||
_float dist = XMVectorGetX(XMVector3Length(targetPos - m_pBroom->Get_WorldPostion()));
|
||||
|
||||
_float atten = clamp(dist / 40.f, 0.f, 1.f);
|
||||
|
||||
if (fabsf(turn) < 0.02f)
|
||||
return 0.f;
|
||||
|
||||
return clamp(turn, -1.f, 1.f);
|
||||
return clamp(turn * atten, -1.f, 1.f);
|
||||
}
|
||||
|
||||
|
||||
_float CBroomRacerAI::ComputeHeightAdjust()
|
||||
{
|
||||
_float dy = (XMVectorGetY(m_pRaceRing->Get_WorldPostion()) + 15.f)
|
||||
- XMVectorGetY(m_pBroom->Get_WorldPostion());
|
||||
_vector targetPos = Get_RingForwardTarget();
|
||||
_vector broomPos = m_pBroom->Get_WorldPostion();
|
||||
|
||||
_float DEAD = 5.f;
|
||||
_float RANGE = 40.f;
|
||||
_float dy = XMVectorGetY(targetPos) - XMVectorGetY(broomPos);
|
||||
|
||||
if (fabsf(dy) < DEAD)
|
||||
_float dist = XMVectorGetX(XMVector3Length(targetPos - broomPos));
|
||||
|
||||
_float atten = clamp(dist / 40.f, 0.f, 1.f);
|
||||
|
||||
if (fabsf(dy) < 1.f)
|
||||
return 0.f;
|
||||
|
||||
return clamp(dy / RANGE, -1.f, 1.f);
|
||||
return clamp((dy / 20.f) * atten, -1.f, 1.f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
CBroomRacerAI* CBroomRacerAI::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CBroomRacerAI* pInstance = new CBroomRacerAI(pDevice, pContext);
|
||||
@@ -435,7 +484,7 @@ void CBroomRacerAI::Free()
|
||||
SAFE_RELEASE(m_pBroomModel);
|
||||
SAFE_RELEASE(m_pBroomTransform);
|
||||
SAFE_RELEASE(m_pBroom);
|
||||
SAFE_RELEASE(m_pCamPosition_ShoulderPart);
|
||||
SAFE_RELEASE(m_pCamPosition_AIPart);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -493,9 +542,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_HoverExitCheck(_float fTimeDelta)
|
||||
if (!m_pBroom->Get_Hover())
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CBroomRacerAI::Behavior_Broom_HoverExit()
|
||||
@@ -520,34 +570,19 @@ HRESULT CBroomRacerAI::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
if (!m_pBroom->Get_Hover())
|
||||
{
|
||||
|
||||
if (Y > 0.f)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
}
|
||||
else if (Y < 0.f)
|
||||
{
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
}
|
||||
|
||||
_float ax = fabsf(X);
|
||||
_float ay = fabsf(Y);
|
||||
_float az = fabsf(Z);
|
||||
|
||||
if (ay > ax && ay > az)
|
||||
{
|
||||
if (Y > 0)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
}
|
||||
else if (ax >= az)
|
||||
{
|
||||
if (ay >= ax)
|
||||
{
|
||||
if (Y > 0)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
}
|
||||
else {
|
||||
if (X < 0)
|
||||
@@ -561,13 +596,7 @@ HRESULT CBroomRacerAI::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Y > 0)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else if (Y< 0)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
else {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
}
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
}
|
||||
|
||||
|
||||
@@ -577,9 +606,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
if (m_pBroom->Get_Hover())
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CBroomRacerAI::Behavior_Broom_FlyExit()
|
||||
@@ -606,9 +636,10 @@ HRESULT CBroomRacerAI::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
if (m_pBroom->Get_Hover())
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::BROOM_RIDE_MOVE);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CBroomRacerAI::Behavior_Broom_TurboFlyExit()
|
||||
@@ -741,18 +772,24 @@ void CBroomRacerAI::Set_Input(_float fTimeDelta)
|
||||
_float targetX = ComputeTurnToRing();
|
||||
_float targetY = ComputeHeightAdjust();
|
||||
|
||||
_float SMOOTH = 6.f;
|
||||
CBroom::BroomInput InputDesc{};
|
||||
|
||||
m_fSmoothX += (targetX - m_fSmoothX) * SMOOTH * fTimeDelta;
|
||||
m_fSmoothY += (targetY - m_fSmoothY) * SMOOTH * fTimeDelta;
|
||||
InputDesc.X = 0.f;
|
||||
InputDesc.Y = 0.f;
|
||||
InputDesc.Z = 0.f;
|
||||
|
||||
/*if (m_bMove)
|
||||
{*/
|
||||
InputDesc.Z = 1.f;
|
||||
InputDesc.X = targetX*m_TurnGain;
|
||||
InputDesc.Y = targetY*m_HeightGain;
|
||||
//}
|
||||
|
||||
InputDesc.bHoverToggle = (m_pBroomRaceManager->Get_RaceState() != ENUM_CLASS(CBroomRaceManager::RACE_STATE::RACING));
|
||||
|
||||
CBroom::BroomInput InputDesc;
|
||||
InputDesc.Z = 1.f;
|
||||
InputDesc.X = m_fSmoothX;
|
||||
InputDesc.Y = m_fSmoothY;
|
||||
InputDesc.bHoverToggle = false;
|
||||
InputDesc.bTurbo = false;
|
||||
|
||||
m_pBroom->Set_Input(InputDesc);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -123,6 +123,9 @@ void CBroom::Behavior_MoveEnter()
|
||||
|
||||
HRESULT CBroom::Behavior_MoveExitCheck(_float fTimeDelta)
|
||||
{
|
||||
if (false == m_bMove)
|
||||
return S_OK;
|
||||
|
||||
pair<_uint, _bool> pairAnimInfo = {};
|
||||
_uint iCurrentAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
|
||||
@@ -183,6 +186,8 @@ void CBroom::Behavior_Broom_HoverEnter()
|
||||
|
||||
HRESULT CBroom::Behavior_Broom_HoverExitCheck(_float fTimeDelta)
|
||||
{
|
||||
if (false == m_bMove)
|
||||
return S_OK;
|
||||
pair<_uint, _bool> pairAnimInfo = {};
|
||||
_uint iCurrentAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
_bool bFwd = m_Input.Z > 0.f;
|
||||
@@ -317,15 +322,6 @@ HRESULT CBroom::Behavior_Broom_HoverExitCheck(_float fTimeDelta)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_HOVER_STOP_B];
|
||||
}
|
||||
|
||||
if (bShift)
|
||||
{
|
||||
m_bHoverToggle = false;
|
||||
}
|
||||
if (bTurbo)
|
||||
{
|
||||
m_bTurbo = true;
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false);
|
||||
}
|
||||
|
||||
@@ -376,6 +372,7 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
|
||||
if (SUCCEEDED(InputAction()) || SUCCEEDED(InputMove()))
|
||||
{
|
||||
|
||||
if (bFwd) {
|
||||
m_fTargetSpeed = m_fFlyMaxSpeed;
|
||||
}
|
||||
@@ -387,7 +384,13 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
m_fTargetSpeed = m_fFlyMaxSpeed;
|
||||
}
|
||||
|
||||
m_fSpeed += (m_fTargetSpeed - m_fSpeed) * fTimeDelta * m_fFlyAccel;
|
||||
if (m_pParentUnit->IsAI())
|
||||
{
|
||||
m_fTargetSpeed *= m_fAICondition;
|
||||
m_fTargetSpeed *= m_fAISpeedMul;
|
||||
}
|
||||
|
||||
m_fSpeed += (m_fTargetSpeed - m_fSpeed) * fTimeDelta * m_fFlyAccel* m_fAIAccelMul;
|
||||
m_pTransformCom->Go_LerpStraight(m_fSpeed, fTimeDelta);
|
||||
|
||||
_float fTargetVertSpeed = 0.f;
|
||||
@@ -495,15 +498,6 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
}
|
||||
}
|
||||
|
||||
if (bShift)
|
||||
{
|
||||
m_bHoverToggle = true;
|
||||
}
|
||||
if (bTurbo)
|
||||
{
|
||||
m_bTurbo = true;
|
||||
}
|
||||
|
||||
if (m_bHoverToggle)
|
||||
{
|
||||
m_fTargetSpeed = 0.f;
|
||||
@@ -515,17 +509,17 @@ HRESULT CBroom::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_HOVER_STOP_B];
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false);
|
||||
|
||||
if (bShift && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first)
|
||||
/*if (bShift && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first)
|
||||
{
|
||||
m_bHoverToggle = false;
|
||||
}
|
||||
}*/
|
||||
if (SUCCEEDED(InputAction()) || SUCCEEDED(InputMove()))
|
||||
{
|
||||
if (fRatio >= 0.5f && iCurrentAnimIndex == m_Animation[STATEANIM::BROOM_HOVER_STOP_B].first)
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::HOVER);
|
||||
return E_FAIL;
|
||||
}
|
||||
return E_FAIL;
|
||||
}
|
||||
if (m_pModelCom->IsFinishedAnim())
|
||||
{
|
||||
@@ -573,19 +567,6 @@ HRESULT CBroom::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
_bool bShift = m_Input.bHoverToggle;
|
||||
_bool bTurbo = m_Input.bTurbo;
|
||||
|
||||
if (bShift)
|
||||
{
|
||||
m_bHoverToggle = true;
|
||||
}
|
||||
|
||||
if (bTurbo)
|
||||
{
|
||||
m_bTurbo = true;
|
||||
}
|
||||
else {
|
||||
m_bTurbo = false;
|
||||
}
|
||||
|
||||
if (!m_bHoverToggle)
|
||||
{
|
||||
if (SUCCEEDED(InputMove()))
|
||||
@@ -649,20 +630,20 @@ HRESULT CBroom::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
{
|
||||
if (vInput.z <= 0.f)
|
||||
{
|
||||
Camera_InterpTurn(fTimeDelta * 0.3f);
|
||||
Camera_InterpTurn(fTimeDelta * 0.35f);
|
||||
}
|
||||
else {
|
||||
Camera_InterpTurn(fTimeDelta * 0.15f);
|
||||
Camera_InterpTurn(fTimeDelta * 0.2f);
|
||||
}
|
||||
}
|
||||
else if (vInput.x > 0.f)
|
||||
{
|
||||
if (vInput.z <= 0.f)
|
||||
{
|
||||
Camera_InterpTurn(fTimeDelta * 0.3f);
|
||||
Camera_InterpTurn(fTimeDelta * 0.35f);
|
||||
}
|
||||
else {
|
||||
Camera_InterpTurn(fTimeDelta * 0.15f);
|
||||
Camera_InterpTurn(fTimeDelta * 0.2f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -837,7 +818,7 @@ void CBroom::Add_FSM()
|
||||
Desc.funcExitCheck = [this](_float fTimedelta) { return Behavior_MoveExitCheck(fTimedelta); };
|
||||
Desc.funcExitEvent = [this]() { Behavior_MoveExit(); };
|
||||
Desc.funcPriorityUpdate = [this](_float fTimeDelta) {
|
||||
if (m_bHoverToggle)
|
||||
if (m_bHoverToggle && m_bMove)
|
||||
{
|
||||
_float3 fMove = m_pGameInstance->Get_MouseMove();
|
||||
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta * fMove.x * 0.02f);
|
||||
@@ -900,15 +881,6 @@ void CBroom::Set_Anim()
|
||||
m_Animation[STATEANIM::BROOM_FLY_LEFT_B] = { 15,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_RIGHT_B] = { 16,true };
|
||||
m_Animation[STATEANIM::BROOM_FLY_UP_B] = { 17,true };
|
||||
//Mount 29
|
||||
//호버 스탑 6
|
||||
//호버 제자리 24
|
||||
//플라이 업 17 다운 13 왼쪽15 오른쪽 16
|
||||
|
||||
//호버 다운 25
|
||||
//호버 왼쪽 26
|
||||
// 호버 오른쪽 27
|
||||
//호버 업 28
|
||||
}
|
||||
#pragma endregion State
|
||||
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
#include "pch.h"
|
||||
#include "CamPosition_AI.h"
|
||||
#include "CamPosition_Target.h"
|
||||
#include "GameInstance.h"
|
||||
#include "Camera_Gaze.h"
|
||||
#include "Player.h"
|
||||
|
||||
CCamPosition_AI::CCamPosition_AI(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CCamPosition(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
CCamPosition_AI::CCamPosition_AI(const CCamPosition_AI& rhs)
|
||||
: CCamPosition(rhs)
|
||||
{
|
||||
}
|
||||
HRESULT CCamPosition_AI::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CCamPosition_AI::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Ready_SubParts())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
CAMERA_AI_DESC* pDesc = static_cast<CAMERA_AI_DESC*>(pArg);
|
||||
{
|
||||
m_pLookTransform = m_pTarget_LookPart->Get_Component<CTransform>();
|
||||
m_pFollowTransform = m_pTarget_FollowPart->Get_Component<CTransform>();
|
||||
m_pParentPos = m_pParentTransformCom->Get_StatePtr(STATE::POSITION);
|
||||
m_vDampingStartPosition = *m_pParentPos;
|
||||
m_vDampingDestPosition = *m_pParentPos;
|
||||
m_vDampingLerpTimer.x = m_vDampingLerpTimer.y;
|
||||
m_vFocalRatio.x = m_vFocalRatio.y;
|
||||
m_fFocalRatioTargetValue = m_vFocalRatio.y;
|
||||
|
||||
_vector vLookTargetPos = Calc_LookTargetPos();
|
||||
m_pLookTransform->Set_State(STATE::POSITION, vLookTargetPos);
|
||||
m_pFollowTransform->Set_State(STATE::POSITION, Calc_FollowTargetPos(vLookTargetPos) + XMVectorSet(0.f, 0.f, 1.f, 0.f));
|
||||
}
|
||||
m_bDampingParentPos = true;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CCamPosition_AI::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_AI))) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (false == m_bDampingParentPos) {
|
||||
m_vDampingLerpTimer.x = 0.f;
|
||||
m_vDampingStartPosition = *m_pParentPos;
|
||||
m_vDampingDestPosition = *m_pParentPos;
|
||||
}
|
||||
else {
|
||||
m_vDampingLerpTimer.x += fTimeDelta;
|
||||
if (m_vDampingLerpTimer.x >= m_vDampingLerpTimer.y) {
|
||||
XMStoreFloat4(&m_vDampingStartPosition, Calc_DampingParentPos());
|
||||
m_vDampingLerpTimer.x = max(m_vDampingLerpTimer.x - m_vDampingLerpTimer.y, 0.f);
|
||||
m_vDampingDestPosition = *m_pParentPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true == m_bMovable) {
|
||||
m_vAccRotDegrees.y += m_pGameInstance->Get_MouseMove().x * m_fMouseSensor;
|
||||
m_vAccRotDegrees.x += m_pGameInstance->Get_MouseMove().y * m_fMouseSensor;
|
||||
CMyTools::AdjustAccumulateDegreePitchYawDegree(m_vAccRotDegrees);
|
||||
}
|
||||
{
|
||||
_vector vLookTargetPos = Calc_LookTargetPos();
|
||||
m_pLookTransform->Set_State(STATE::POSITION, vLookTargetPos);
|
||||
m_pFollowTransform->Set_State(STATE::POSITION, Calc_FollowTargetPos(vLookTargetPos));
|
||||
|
||||
_float focalRatioLerpAlpha = fTimeDelta * m_fFocalRatioLerpSpeed;
|
||||
if (focalRatioLerpAlpha > 1.f)
|
||||
{
|
||||
focalRatioLerpAlpha = 1.f;
|
||||
}
|
||||
|
||||
m_vFocalRatio.x = CMyTools::Lerp_f1D(m_vFocalRatio.x, m_fFocalRatioTargetValue, focalRatioLerpAlpha);
|
||||
}
|
||||
}
|
||||
|
||||
void CCamPosition_AI::Update(_float fTimeDelta)
|
||||
{
|
||||
if (m_pGameInstance->Key_Up(DIK_HOME)) {
|
||||
|
||||
m_pBinded_Camera->Toggle_AIPriority();
|
||||
}
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_AI))) {
|
||||
return;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
}
|
||||
|
||||
void CCamPosition_AI::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_AI))) {
|
||||
return;
|
||||
}
|
||||
if (true == m_bShoulderLerp)
|
||||
{
|
||||
m_vShoulderLerpTimer.x += fTimeDelta;
|
||||
|
||||
_float fLerpRatio = m_vShoulderLerpTimer.x/m_vShoulderLerpTimer.y;
|
||||
if (fLerpRatio >= 1.f) {
|
||||
fLerpRatio = 1.f;
|
||||
m_bShoulderLerp = false;
|
||||
}
|
||||
if (false == m_bShoulderLerp) {
|
||||
m_vShoulderLerpTimer.x = 0.f;
|
||||
m_fFollowTargetIncludedAngleDegree = m_vShoulderLerpDegree.y;
|
||||
} else {
|
||||
m_fFollowTargetIncludedAngleDegree = CMyTools::Lerp_f1D(m_vShoulderLerpDegree.x, m_vShoulderLerpDegree.y, fLerpRatio);
|
||||
}
|
||||
}
|
||||
if (true == m_bStartGame) {
|
||||
m_vStartLerpTimer.x += fTimeDelta;
|
||||
if (m_vStartLerpTimer.x >= m_vStartLerpTimer.y) {
|
||||
m_vStartLerpTimer.x = 0.f;
|
||||
m_bDampingParentPos = true;
|
||||
m_bStartGame = false;
|
||||
}
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::UI_OVERLAY, this);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CCamPosition_AI::Render()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_vector CCamPosition_AI::Get_WorldPostion()
|
||||
{
|
||||
return m_pTransformCom->Get_State(STATE::POSITION);
|
||||
}
|
||||
|
||||
_vector CCamPosition_AI::Calc_LookTargetPos()
|
||||
{
|
||||
_vector vDestPos = Calc_DampingParentPos();
|
||||
|
||||
_vector vFoward = { 0.f, 0.f, 1.f, 0.f };
|
||||
_vector vRotCameraq = XMQuaternionRotationRollPitchYaw(XMConvertToRadians(m_vAccRotDegrees.x + m_vAccRealDegrees.x), XMConvertToRadians(m_vAccRotDegrees.y + m_vAccRealDegrees.y), 0.f);
|
||||
vFoward = XMVector3Normalize(XMVector3Rotate(vFoward, vRotCameraq));
|
||||
|
||||
_vector vHeadPos = vDestPos + XMVectorSet(0.f, m_fHeadHeight, 0.f, 0.f);
|
||||
_vector vFowardPos = vHeadPos + vFoward * m_fCameraFowardDistance;
|
||||
|
||||
return XMVectorLerp(vHeadPos, vFowardPos, m_vFocalRatio.x);
|
||||
}
|
||||
_vector CCamPosition_AI::Calc_FollowTargetPos(_vector vLookTargetWorldPos)
|
||||
{
|
||||
_float fBestFollowTargetDistance = m_fCameraBarrelLength * (1.f - m_fDefaultCameraBackToFrontRatio);
|
||||
|
||||
_vector fRotQ = XMQuaternionRotationAxis(XMVectorSet(0.f, 1.f, 0.f, 0.f), XMConvertToRadians(-m_fFollowTargetIncludedAngleDegree));
|
||||
_vector vDestPos = Calc_DampingParentPos();
|
||||
_vector vHeadPos = vDestPos + XMVectorSet(0.f, m_fHeadHeight, 0.f, 0.f);
|
||||
_vector vDir = vHeadPos - vLookTargetWorldPos;
|
||||
_float fLengthSQ = XMVectorGetX(XMVector3LengthSq(vDir));
|
||||
|
||||
if (fLengthSQ < FLT_EPSILON)
|
||||
{
|
||||
vDir = XMVectorSet(0.f, 0.f, 1.f, 0.f);
|
||||
vDir = XMVector3Rotate(vDir, fRotQ);
|
||||
}
|
||||
else
|
||||
{
|
||||
vDir = XMVector3Normalize(vDir);
|
||||
vDir = XMVector3Rotate(vDir, fRotQ);
|
||||
}
|
||||
|
||||
m_BufferHit = {};
|
||||
_bool bHit = m_pGameInstance->SphereCast( 0.25f, vLookTargetWorldPos, vDir, fBestFollowTargetDistance,
|
||||
PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eSTATIC/*|PSX::PxQueryFlag::eDYNAMIC*/, m_BufferHit);
|
||||
|
||||
if (false == bHit) {
|
||||
return vLookTargetWorldPos + vDir * fBestFollowTargetDistance;
|
||||
}
|
||||
|
||||
vector<PSX::PxSweepHit> sweepHits;
|
||||
_uint iTouchCount = m_BufferHit.getNbTouches();
|
||||
|
||||
if (true == m_BufferHit.hasBlock) {
|
||||
sweepHits.reserve(iTouchCount + 1);
|
||||
sweepHits.emplace_back(m_BufferHit.block);
|
||||
}
|
||||
else {
|
||||
sweepHits.reserve(iTouchCount);
|
||||
}
|
||||
|
||||
auto* touches = m_BufferHit.getTouches();
|
||||
for (_uint index = 0; index < iTouchCount; ++index) {
|
||||
sweepHits.emplace_back(touches[index]);
|
||||
}
|
||||
CMyTools::SortHitsByDistance(sweepHits);
|
||||
|
||||
// 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋
|
||||
_float fCameraSurfaceOffset = 0.05f;
|
||||
_float fCameraMinDistance = 0.20f;
|
||||
_float fDistance = { };
|
||||
_float fFinalTargetDistance = fBestFollowTargetDistance;
|
||||
for (auto& hit : sweepHits)
|
||||
{
|
||||
fDistance = hit.distance - fCameraSurfaceOffset;
|
||||
if (fDistance < fFinalTargetDistance) {
|
||||
if (fDistance < fCameraMinDistance) {
|
||||
fDistance = fCameraMinDistance;
|
||||
}
|
||||
fFinalTargetDistance = fDistance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_float fSafeDistance = fBestFollowTargetDistance;
|
||||
if (fSafeDistance < FLT_EPSILON3)
|
||||
{
|
||||
fSafeDistance = FLT_EPSILON3;
|
||||
}
|
||||
|
||||
_float fBestFocalRatio = m_vFocalRatio.y * fFinalTargetDistance / fSafeDistance;
|
||||
|
||||
if (fBestFocalRatio < m_fFocalRatioMin) {
|
||||
fBestFocalRatio = m_fFocalRatioMin;
|
||||
} else if (fBestFocalRatio > m_vFocalRatio.y) {
|
||||
fBestFocalRatio = m_vFocalRatio.y;
|
||||
}
|
||||
|
||||
m_fFocalRatioTargetValue = fBestFocalRatio;
|
||||
|
||||
return vLookTargetWorldPos + vDir * fFinalTargetDistance;
|
||||
}
|
||||
_vector CCamPosition_AI::Calc_DampingParentPos()
|
||||
{
|
||||
_float duration = max(m_vDampingLerpTimer.y, FLT_EPSILON);
|
||||
_float fTime = m_vDampingLerpTimer.x / duration;
|
||||
fTime = CMyTools::Saturate(fTime); // 0~1
|
||||
|
||||
return XMVectorLerp(XMLoadFloat4(&m_vDampingStartPosition), XMLoadFloat4(&m_vDampingDestPosition), fTime);
|
||||
}
|
||||
void CCamPosition_AI::Set_CameraShake(_float fXShock, _float fYShock)
|
||||
{
|
||||
m_vAccRealDegrees.x = fXShock;
|
||||
m_vAccRealDegrees.y = fYShock;
|
||||
}
|
||||
_vector CCamPosition_AI::Get_ShoulderGlobalPos()
|
||||
{
|
||||
// Right/Left 숄더를 로컬 X 부호로 결정
|
||||
_float shoulderSideSign = (true == m_bRightShoulderActive) ? 1.f : -1.f;
|
||||
|
||||
_float3 shoulderLocalPosition = m_vShoulderLocalPos;
|
||||
shoulderLocalPosition.x *= shoulderSideSign;
|
||||
|
||||
_vector shoulderLocalOffset = XMLoadFloat3(&shoulderLocalPosition);
|
||||
|
||||
// 카메라 회전(현재 마우스로 누적된 pitch/yaw)
|
||||
_vector cameraRotationQuaternion = XMQuaternionRotationRollPitchYaw(
|
||||
XMConvertToRadians(m_vAccRotDegrees.x + m_vAccRealDegrees.x),
|
||||
XMConvertToRadians(m_vAccRotDegrees.y + m_vAccRealDegrees.y), 0.f
|
||||
);
|
||||
|
||||
// 카메라 로컬 오프셋을 카메라 회전에 맞춰 월드로 회전
|
||||
_vector shoulderWorldOffset = XMVector3Rotate(shoulderLocalOffset, cameraRotationQuaternion);
|
||||
|
||||
return shoulderWorldOffset;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CCamPosition_AI::Ready_Components(void* pArg)
|
||||
{
|
||||
CTransform::TRANSFORM_DESC DescTransfrom = {};
|
||||
DescTransfrom.fRadius = 30.f;
|
||||
DescTransfrom.fRotationPerSec = 0.f;
|
||||
DescTransfrom.fSpeedPerSec = 0.f;
|
||||
if (FAILED(__super::Ready_Components(&DescTransfrom))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CCamPosition_AI::Ready_SubParts()
|
||||
{
|
||||
{
|
||||
CCamPosition_Target::CAMERAPOSITION_TARGET_DESC Desc{};
|
||||
Desc.pParentTransform = m_pTransformCom;
|
||||
m_pTarget_LookPart = m_pGameInstance->Clone_Prototype< CCamPosition_Target>(g_iStaticLevel, &Desc);
|
||||
m_pTarget_LookPart->Get_Component<CTransform>()->Set_State(STATE::POSITION, XMVectorSet(-34.f, 5, -10.4f, 1.f));
|
||||
m_pTarget_FollowPart = m_pGameInstance->Clone_Prototype< CCamPosition_Target>(g_iStaticLevel, &Desc);
|
||||
m_pTarget_FollowPart->Get_Component<CTransform>()->Set_State(STATE::POSITION, XMVectorSet(-34.f, 5, -11.4f, 1.f));
|
||||
}
|
||||
|
||||
CCamera_Gaze::CAMERA_GAZE_DESC CameraDesc{};
|
||||
CameraDesc.fFovy = XMConvertToRadians(60.0f);
|
||||
CameraDesc.fNear = 0.1f;
|
||||
CameraDesc.fFar = 500.f;
|
||||
CameraDesc.fSpeedPerSec = 5.f;
|
||||
CameraDesc.fRotationPerSec = XMConvertToRadians(90.f);
|
||||
CameraDesc.pFollowTarget = m_pTarget_FollowPart;
|
||||
CameraDesc.pLookTarget = m_pTarget_LookPart;
|
||||
CameraDesc.iPriority = 102;
|
||||
CameraDesc.pCameraKey = CAMERA_AI;
|
||||
CameraDesc.bEnableTransitionLerp = true;
|
||||
CameraDesc.bEnableFollowLerp = false;
|
||||
CameraDesc.bEnableLookLerp = false;
|
||||
CameraDesc.vTransitionTime = { 0.f, 1.f };
|
||||
CameraDesc.vFollowLerpTime = { 0.f, TIMER_SHORT_LERP };
|
||||
CameraDesc.vLookLerpTime = { 0.f, TIMER_SHORT_LERP };
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CCamera_Gaze>(g_iStaticLevel, NEXT_LEVEL, LAYER_CAMERA, &CameraDesc, nullptr, &m_pBinded_Camera)))
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pGameInstance->Add_Camera(NEXT_LEVEL, m_pBinded_Camera, CAMERA_AI);
|
||||
if (FAILED(m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_AI, true))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CCamPosition_AI* CCamPosition_AI::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CCamPosition_AI* pInstance = new CCamPosition_AI(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CCamPosition_AI");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
CCamPosition_AI* CCamPosition_AI::Clone(void* pArg, class CGameObject* pOWner)
|
||||
{
|
||||
CCamPosition_AI* pInstance = new CCamPosition_AI(*this);
|
||||
pInstance->m_pOwner = pOWner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CCamPosition_AI");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
void CCamPosition_AI::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pTarget_LookPart);
|
||||
SAFE_RELEASE(m_pTarget_FollowPart);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CCamPosition_AI::Describe_Entity()
|
||||
{
|
||||
GUI::Begin("CAMERA", 0, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("Cam_Shoulder")) {
|
||||
m_pTransformCom->Describe_Entity();
|
||||
|
||||
GUI::Text("fMouseSensor : %.1f", m_fMouseSensor);
|
||||
GUI::SliderFloat("m_fFollowTargetIncludedAngleDegree", &m_fFollowTargetIncludedAngleDegree, -360.f, 360.f, "%.1f");
|
||||
GUI::SliderFloat("m_fDefaultCameraBackToFrontRatio", &m_fDefaultCameraBackToFrontRatio, -1.f, 1.f);
|
||||
GUI::SliderFloat("m_vFocalRatio", &m_vFocalRatio.x, 0.f, 1.f);
|
||||
GUI::SliderFloat("m_fCameraFowardDistance", &m_fCameraFowardDistance, 0.f, 4.f);
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
@@ -95,6 +95,10 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
|
||||
|
||||
m_pBinded_Camera->Toggle_Priority();
|
||||
}
|
||||
if (m_pGameInstance->Key_Up(DIK_HOME)) {
|
||||
|
||||
m_pBinded_Camera->Toggle_AIPriority();
|
||||
}
|
||||
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_SHOULDER))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,17 @@ void CCamera_Gaze::Toggle_Priority()
|
||||
}
|
||||
}
|
||||
|
||||
void CCamera_Gaze::Toggle_AIPriority()
|
||||
{
|
||||
if (m_iPriority == 55) {
|
||||
m_iPriority = 102;
|
||||
}
|
||||
else {
|
||||
m_iPriority = 55;
|
||||
m_pGameInstance->Bind_Camera(NEXT_LEVEL, CAMERA_SHOULDER, false);
|
||||
}
|
||||
}
|
||||
|
||||
void CCamera_Gaze::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
if (false == m_bActive) {
|
||||
|
||||
@@ -279,7 +279,10 @@ void CDialogue::Free()
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CDialogue::Describe_Entity()
|
||||
{
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
|
||||
@@ -577,6 +577,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag)
|
||||
CPlayer::PLAYERDESC playerDesc = {};
|
||||
playerDesc.vPos = _float4(-21.f, 0.f, -14.f, 1.f);
|
||||
playerDesc.vRotQ = _float4(0.f, 0.f, 0.f, 1.f);
|
||||
playerDesc.pBroomRaceManager = m_pBroomRaceManager;
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &playerDesc))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -603,7 +604,7 @@ HRESULT CLevel_GamePlay::Ready_Layer_Player(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_GamePlay::Ready_Layer_BroomRacerAI(const _wstring& strLayerTag)
|
||||
{
|
||||
for (_uint i = 0; i < 1; ++i) {
|
||||
for (_uint i = 0; i < 10; ++i) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CBroomRacerAI>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -618,8 +619,12 @@ HRESULT CLevel_GamePlay::Ready_Layer_Item(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_GamePlay::Ready_Layer_RaceRing(const _wstring& strLayerTag)
|
||||
{
|
||||
for (_uint i = 0; i < 1; ++i) {
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRaceRing>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, m_pBroomRaceManager))) {
|
||||
for (_uint i = 0; i < 10; ++i) {
|
||||
|
||||
CRaceRing::RACERING_DESC RaceRingDesc {};
|
||||
RaceRingDesc.pBroomRaceManager = m_pBroomRaceManager;
|
||||
RaceRingDesc.iIndex = i;
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRaceRing>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &RaceRingDesc))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include "CamPosition_Shoulder.h"
|
||||
#include "CamPosition_Socket.h"
|
||||
#include "CamPosition_Target.h"
|
||||
#include "CamPosition_AI.h"
|
||||
#include "SkyBox.h"
|
||||
#include "Troll_Weapon.h"
|
||||
#include "Troll_Rock.h"
|
||||
@@ -1529,7 +1530,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_INSTANCE_PROP_MODEL,
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_INSTANCE_PROP_MODEL,
|
||||
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_VtxWorldModelInstance.hlsl"),
|
||||
VTX_MODEL_INSTANCE_MODEL::Elements, VTX_MODEL_INSTANCE_MODEL::iNumElements)))) {
|
||||
return E_FAIL;
|
||||
@@ -1697,7 +1698,6 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
Desc1.vLocalTranslation = { 0.f, 0.f, 0.f };
|
||||
}
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_HEAVY_WALL"), CRigidBody_Dynamic::Create(m_pDevice, m_pContext, Desc)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -1765,11 +1765,6 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_VictorRookWood_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Goblin_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/Goblin.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){
|
||||
return E_FAIL;
|
||||
@@ -1793,6 +1788,16 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_VictorRookWood_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/VictorRookWood/VictorRookWood.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Ghost_Peeves_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Troll_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/SubTroll/troll.bin", XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity())))){
|
||||
return E_FAIL;
|
||||
@@ -1816,7 +1821,7 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_RaceRing_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/RaceRing/SM_BRR_RaceRing_01.bin", XMMatrixIdentity()))))
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/RaceRing/SM_BRR_RaceRing_01.bin", XMMatrixRotationX(XMConvertToRadians(90.f)) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Broom_Model"),
|
||||
@@ -2754,6 +2759,10 @@ HRESULT CLoader::Loading_For_GamePlay()
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CCamPosition_Shoulder>(g_iStaticLevel, CCamPosition_Shoulder::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_CamPosition_AI */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CCamPosition_AI>(g_iStaticLevel, CCamPosition_AI::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
/* For.Prototype_GameObject_CamPosition_Target */
|
||||
if (FAILED(m_pGameInstance->Add_Prototype<CCamPosition_Target>(g_iStaticLevel, CCamPosition_Target::Create(m_pDevice, m_pContext))))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -310,7 +310,10 @@ void CNPCInteraction::Free()
|
||||
SAFE_RELEASE(m_pShaderCom);
|
||||
SAFE_RELEASE(m_pVIBufferCom);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CNPCInteraction::Describe_Entity()
|
||||
{
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
#include "Monster.h"
|
||||
#include "Broom.h"
|
||||
#include "MapElement_Interactable.h"
|
||||
#include "BroomRaceManager.h"
|
||||
#include "RaceRing.h"
|
||||
|
||||
#pragma region STATE
|
||||
#include "State_Idle.h"
|
||||
@@ -102,6 +104,19 @@ HRESULT CPlayer::Initialize(void* pArg)
|
||||
m_pCharacter_Controller->Set_Position(vPos);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, vPos);
|
||||
m_pTransformCom->Rotation(vRotQ);
|
||||
|
||||
m_pBroomRaceManager = pDesc->pBroomRaceManager;
|
||||
|
||||
if (m_pBroomRaceManager)
|
||||
{
|
||||
CBroomRaceManager::RacerInfo Info;
|
||||
|
||||
Info.pRacer = this;
|
||||
Info.curRing = 0;
|
||||
Info.prevPos = Get_WorldPostion();
|
||||
|
||||
m_pBroomRaceManager->Push_BroomRacer(Info);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
@@ -123,6 +138,9 @@ HRESULT CPlayer::Initialize(void* pArg)
|
||||
|
||||
m_pModelCom->Set_Temp(true);
|
||||
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -726,6 +744,7 @@ void CPlayer::Free()
|
||||
SAFE_RELEASE(m_pBroomModel);
|
||||
SAFE_RELEASE(m_pBroomTransform);
|
||||
SAFE_RELEASE(m_pBroom);
|
||||
SAFE_RELEASE(m_pRaceRing);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ void CPlayer::Behavior_MoveEnter()
|
||||
_bool bRight = m_pGameInstance->Key_Pressing(DIK_D);
|
||||
_bool bBackward = m_pGameInstance->Key_Pressing(DIK_S);
|
||||
m_pFSM->Enable_State(FSMSTATE::MOVE);
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE | FSMSTATE::DODGE | FSMSTATE::LAND)) {
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE | FSMSTATE::DODGE | FSMSTATE::LAND | FSMSTATE::DISMOUNT)) {
|
||||
|
||||
if (m_pFSM->IsEnable_Previous(FSMSTATE::IDLE))
|
||||
{
|
||||
@@ -2142,6 +2142,8 @@ void CPlayer::Behavior_Broom_HoverExit()
|
||||
void CPlayer::Behavior_Broom_FlyEnter()
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::FLY);
|
||||
m_fNeutralTime = 0.f;
|
||||
m_fNoInputTime = 0.f;
|
||||
}
|
||||
|
||||
HRESULT CPlayer::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
@@ -2159,6 +2161,7 @@ HRESULT CPlayer::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
{
|
||||
if (SUCCEEDED(InputBroom()) || SUCCEEDED(InputMove()))
|
||||
{
|
||||
m_fNoInputTime = 0.f;
|
||||
_float3 vInput = { 0.f, 0.f, 0.f };
|
||||
|
||||
if (bFwd) vInput.z += 1.f;
|
||||
@@ -2188,43 +2191,96 @@ HRESULT CPlayer::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
|
||||
if (ay > ax && ay > az)
|
||||
{
|
||||
if (vInput.y > 0)
|
||||
if (vInput.y > 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else if (vInput.y < 0)
|
||||
|
||||
}
|
||||
else if (vInput.y < 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
}
|
||||
}
|
||||
else if (ax >= az)
|
||||
{
|
||||
if (ay >= ax)
|
||||
{
|
||||
if (vInput.y > 0)
|
||||
if (vInput.y > 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else if (vInput.y < 0)
|
||||
|
||||
}
|
||||
else if (vInput.y < 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_IDLE];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (vInput.x < 0)
|
||||
if (vInput.x < 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_LEFT];
|
||||
else if (vInput.x > 0)
|
||||
|
||||
}
|
||||
else if (vInput.x > 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_RIGHT];
|
||||
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_IDLE];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vInput.y > 0)
|
||||
if (vInput.y > 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_UP];
|
||||
else if (vInput.y < 0)
|
||||
|
||||
}
|
||||
else if (vInput.y < 0) {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_DOWN];
|
||||
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_FWD];
|
||||
}
|
||||
}
|
||||
|
||||
_bool bNeutralAnim =
|
||||
(pairAnimInfo.first == m_Animation[STATEANIM::BROOM_FWD].first ||
|
||||
pairAnimInfo.first == m_Animation[STATEANIM::BROOM_IDLE].first);
|
||||
|
||||
if (!bNeutralAnim)
|
||||
{
|
||||
m_fNeutralTime = 0.f;
|
||||
if (iCurrAnimIndex != pairAnimInfo.first)
|
||||
{
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fNeutralTime += fTimeDelta;
|
||||
|
||||
if (m_fNeutralTime > 0.2f)
|
||||
{
|
||||
if (iCurrAnimIndex != pairAnimInfo.first)
|
||||
{
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_IDLE);
|
||||
m_fNoInputTime += fTimeDelta;
|
||||
|
||||
if (m_fNoInputTime > 0.2f)
|
||||
{
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_IDLE);
|
||||
|
||||
if (iCurrAnimIndex != pairAnimInfo.first)
|
||||
{
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pGameInstance->Key_Down(DIK_R))
|
||||
@@ -2234,9 +2290,8 @@ HRESULT CPlayer::Behavior_Broom_FlyExitCheck(_float fTimeDelta)
|
||||
[this]() {
|
||||
m_pEffectPool->Use_Skill(SKILL_TYPE::REVELIO, this);
|
||||
}, 0.2f);
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second);
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true,0.8f);
|
||||
}
|
||||
|
||||
if (iCurrAnimIndex == m_Animation[STATEANIM::BROOM_REVELIO].first)
|
||||
@@ -2281,6 +2336,8 @@ void CPlayer::Behavior_Broom_FlyExit()
|
||||
void CPlayer::Behavior_Broom_TurboFlyEnter()
|
||||
{
|
||||
m_pFSM->Enable_State(FSMSTATE::TURBOFLY);
|
||||
m_fNeutralTime = 0.f;
|
||||
m_fNoInputTime = 0.f;
|
||||
}
|
||||
|
||||
HRESULT CPlayer::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
@@ -2298,6 +2355,7 @@ HRESULT CPlayer::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
{
|
||||
if (SUCCEEDED(InputBroom()) || SUCCEEDED(InputMove()))
|
||||
{
|
||||
m_fNoInputTime = 0.f;
|
||||
_float3 vInput = { 0.f, 0.f, 0.f };
|
||||
|
||||
if (bFwd) vInput.z += 1.f;
|
||||
@@ -2361,15 +2419,39 @@ HRESULT CPlayer::Behavior_Broom_TurboFlyExitCheck(_float fTimeDelta)
|
||||
pairAnimInfo = m_Animation[STATEANIM::BROOM_TURBO_FWD];
|
||||
}
|
||||
}
|
||||
|
||||
_bool bNeutralAnim =
|
||||
(pairAnimInfo.first == m_Animation[STATEANIM::BROOM_TURBO_FWD].first);
|
||||
|
||||
if (!bNeutralAnim)
|
||||
{
|
||||
m_fNeutralTime = 0.f;
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,1.f,true,1.f,false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fNeutralTime += fTimeDelta;
|
||||
|
||||
if (m_fNeutralTime > 0.2f)
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_TURBO_FWD);
|
||||
|
||||
m_fNoInputTime += fTimeDelta;
|
||||
|
||||
if (m_fNoInputTime > 0.2f)
|
||||
{
|
||||
pairAnimInfo = Get_AnimInfo(STATEANIM::BROOM_TURBO_FWD);
|
||||
|
||||
if (iCurrAnimIndex != pairAnimInfo.first)
|
||||
{
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second, 1.f, true, 1.f, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(pairAnimInfo.first, pairAnimInfo.second,1.f,true,1.f,false);
|
||||
}
|
||||
|
||||
|
||||
if (m_pGameInstance->Key_Pressing(DIK_N))
|
||||
{
|
||||
auto flags = m_pCharacter_Controller->Get_CollisionFlags();
|
||||
@@ -2434,8 +2516,11 @@ HRESULT CPlayer::Behavior_Broom_DismountExitCheck(_float fTimeDelta)
|
||||
{
|
||||
m_pBroomTransform->Set_Scale(m_BroomScale);
|
||||
}
|
||||
if (fRatio >= 0.85f) {
|
||||
if (fRatio >= 0.5f) {
|
||||
m_BroomScale = { 0.f,0.f,0.f };
|
||||
m_pBroomTransform->Set_State(STATE::POSITION,XMVectorSet(XMVectorGetX(m_pTransformCom->Get_State(STATE::POSITION)),
|
||||
200.f,
|
||||
XMVectorGetZ(m_pTransformCom->Get_State(STATE::POSITION)), 1.f));
|
||||
if (SUCCEEDED(InputMove()))
|
||||
{
|
||||
m_pFSM->Change_State(FSMSTATE::MOVE);
|
||||
@@ -3039,7 +3124,7 @@ void CPlayer::Add_FSM()
|
||||
_uint iCurrAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
if (!m_bOnce) {
|
||||
m_pBroomTransform->Set_WorldMatrix(m_pTransformCom->Get_XMWorldMatrix());
|
||||
m_pBroomTransform->Set_State(STATE::POSITION, m_pBroomTransform->Get_State(STATE::POSITION) + XMVectorSet(0.f,2.f,0.f,0.f));
|
||||
m_pBroomTransform->Set_State(STATE::POSITION, m_pTransformCom->Get_State(STATE::POSITION) + XMVectorSet(0.f,2.f,0.f,0.f));
|
||||
_float3 vScale = { 0.3f,0.3f,0.3f };
|
||||
m_pBroomTransform->Set_Scale(vScale);
|
||||
m_bOnce = true;
|
||||
@@ -3249,7 +3334,7 @@ void CPlayer::Set_Anim()
|
||||
m_Animation[STATEANIM::BROOM_MOUNT] = { 735,false };
|
||||
m_Animation[STATEANIM::BROOM_MOUNT_END] = { 738,false };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_START] = { 700,false };
|
||||
m_Animation[STATEANIM::BROOM_DISMOUNT] = { 739,false };
|
||||
m_Animation[STATEANIM::BROOM_DISMOUNT] = { 676,false };
|
||||
|
||||
m_Animation[STATEANIM::BROOM_HOVER_IDLE] = { 704,true };
|
||||
m_Animation[STATEANIM::BROOM_HOVER_FWD] = { 701,true };
|
||||
|
||||
@@ -30,25 +30,21 @@ HRESULT CRaceRing::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pBroomRaceManager = static_cast<RACERING_DESC*>(pArg)->pBroomRaceManager;
|
||||
m_iIndex = static_cast<RACERING_DESC*>(pArg)->iIndex;
|
||||
_float X = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
|
||||
_float Y = m_pGameInstance->Real_Random_Float(-5.f, 5.f);
|
||||
_float Z = m_pGameInstance->Real_Random_Float(-200.f, 200.f);
|
||||
_float Y = m_pGameInstance->Real_Random_Float(15.f, 60.f);
|
||||
_float Z = m_pGameInstance->Real_Random_Float(-50.f, 50.f);
|
||||
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(X, Y, Z, 1.f));
|
||||
|
||||
m_pBroomRaceManager = static_cast<CBroomRaceManager*>(pArg);
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet((_float)m_iIndex *100.f, Y, Z, 1.f));
|
||||
|
||||
m_pBroomRaceManager->Push_RaceRing(this);
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CRaceRing::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
|
||||
@@ -146,6 +142,7 @@ HRESULT CRaceRing::Bind_ShaderResources()
|
||||
}
|
||||
|
||||
|
||||
|
||||
CRaceRing* CRaceRing::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CRaceRing* pInstance = new CRaceRing(pDevice, pContext);
|
||||
|
||||
@@ -440,8 +440,6 @@ void CRanrok::Behavior_FireBallEnter()
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
else if (m_ePhase == ENUM_CLASS(RANROK_PHASE::PHASE_GROUND))
|
||||
{
|
||||
|
||||
@@ -35,6 +35,8 @@ class CBroom final : public CUnit
|
||||
_bool Get_Turbo() { return m_bTurbo; }
|
||||
|
||||
void Set_Input(BroomInput broomInput) { m_Input = broomInput; }
|
||||
void Set_AISpeed(_float speedMul, _float accelMul);
|
||||
void Set_Move(_bool bMove) { m_bMove = bMove; }
|
||||
HRESULT Ready_Child();
|
||||
private:
|
||||
CInfoInstance* m_pInfoInstance = { nullptr };
|
||||
@@ -60,13 +62,23 @@ class CBroom final : public CUnit
|
||||
_float m_fTurnDecel = 0.3f;
|
||||
_float m_fVerticalSpeed = 0.f;
|
||||
|
||||
|
||||
_float m_fFlyAccel = 1.f;
|
||||
_float m_fFlyDecel = 1.f;
|
||||
|
||||
_float m_fTurboAccel = 1.3f;
|
||||
_float m_fTurboDecel = 0.6f;
|
||||
|
||||
_bool m_bMove = { true };
|
||||
|
||||
#pragma region AI
|
||||
_float m_fAISpeedMul = 1.f;
|
||||
_float m_fAIAccelMul = 1.f;
|
||||
|
||||
_float m_fAICondition = 1.f;
|
||||
_float m_fAISeed = 0.f;
|
||||
_float m_fAITime = 0.f;
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
_float3 m_vCameraLookDir = { 0.f, 0.f, 1.f, };
|
||||
@@ -75,6 +87,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();
|
||||
@@ -98,6 +111,7 @@ class CBroom final : public CUnit
|
||||
_float m_fAmount = { 1.f };
|
||||
_float m_fInputTime = {};
|
||||
_bool m_bRatio = { false };
|
||||
|
||||
|
||||
HRESULT InputAction();
|
||||
HRESULT InputMove();
|
||||
|
||||
@@ -10,11 +10,23 @@ class CBroomRaceManager final : public CGameObject
|
||||
public:
|
||||
struct RacerInfo
|
||||
{
|
||||
CGameObject* pRacer = nullptr;
|
||||
class CPlayer* pRacer = nullptr;
|
||||
class CBroomRacerAI* pAI = nullptr;
|
||||
_uint curRing = 0;
|
||||
_vector prevPos = XMVectorZero();
|
||||
};
|
||||
|
||||
enum class RACE_STATE
|
||||
{
|
||||
READY,
|
||||
COUNTDOWN,
|
||||
START,
|
||||
RACING,
|
||||
FINISH,
|
||||
END
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
CBroomRaceManager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CBroomRaceManager(const CBroomRaceManager& Prototype);
|
||||
@@ -24,23 +36,25 @@ class CBroomRaceManager final : public CGameObject
|
||||
virtual void Priority_Update(_float fTimeDelta) override;
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
class CRaceRing* GetTargetRing(CGameObject* pRacer);
|
||||
virtual HRESULT Render() override;
|
||||
void SetTargetRing(CGameObject* pRacer);
|
||||
void Push_BroomRacer(RacerInfo Info);
|
||||
void Push_RaceRing(CRaceRing* Ring);
|
||||
void Push_RaceRing(class CRaceRing* Ring);
|
||||
_int Get_RaceState() const { return m_eRaceState; }
|
||||
private:
|
||||
vector<class CRaceRing*> m_pRaceRings = {};
|
||||
vector<RacerInfo> m_Racers = {};
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pGripShape = { nullptr };
|
||||
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
|
||||
#endif // _DEBUG
|
||||
_float m_fCountTimer = {};
|
||||
_int m_iCount = { 3 };
|
||||
_int m_eRaceState = { ENUM_CLASS(RACE_STATE::END) };
|
||||
_wstring ToolTip;
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources() override;
|
||||
void Update_Countdown(_float fTimeDelta);
|
||||
void StartRaceMove();
|
||||
void Check_RingPassed();
|
||||
|
||||
public:
|
||||
|
||||
@@ -39,6 +39,9 @@ class CBroomRacerAI final : public CUnit
|
||||
virtual HRESULT Render_Shadow(SHADOW eType) override;
|
||||
virtual void OnCollision(CGameObject* pOther = nullptr, void* pDesc = nullptr)override;
|
||||
virtual void OnHit(CGameObject* pOther, CGameObject* pCaller = nullptr)override;
|
||||
void Set_RaceRing(class CRaceRing* pRaceRing) {m_pRaceRing = pRaceRing;}
|
||||
class CBroom* Get_Broom() { return m_pBroom; }
|
||||
void Set_Move(_bool bMove) { m_bMove = bMove; }
|
||||
private:
|
||||
CLight* m_pLightCom = { nullptr };
|
||||
LIGHT_DESC LightDesc = {};
|
||||
@@ -48,7 +51,7 @@ class CBroomRacerAI final : public CUnit
|
||||
class CBroom* m_pBroom = { nullptr };
|
||||
class CRaceRing* m_pRaceRing = { nullptr };
|
||||
class CBroomRaceManager* m_pBroomRaceManager = { nullptr };
|
||||
class CCamPosition_Shoulder* m_pCamPosition_ShoulderPart = { nullptr };
|
||||
class CCamPosition_AI* m_pCamPosition_AIPart = { nullptr };
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
@@ -57,6 +60,8 @@ class CBroomRacerAI final : public CUnit
|
||||
HRESULT Bind_ShaderResources();
|
||||
HRESULT Bind_ShaderParameters(_uint iMeshOrder);
|
||||
|
||||
_vector Get_RingForwardTarget();
|
||||
|
||||
_float ComputeTurnToRing();
|
||||
_float ComputeHeightAdjust();
|
||||
#ifdef _DEBUG
|
||||
@@ -95,8 +100,11 @@ class CBroomRacerAI final : public CUnit
|
||||
_float m_fScaleSmoothSpeed = 2.5f;
|
||||
_float m_fAnimTime = {};
|
||||
_bool m_bTurbo = {};
|
||||
_float m_fSmoothX = {};
|
||||
_float m_fSmoothY = {};
|
||||
_bool m_bMove = {};
|
||||
_float m_LaneOffsetX = 0.f;
|
||||
_float m_LaneOffsetY = 0.f;
|
||||
_float m_TurnGain = 1.f;
|
||||
_float m_HeightGain =1.f;
|
||||
|
||||
void Behavior_Broom_Ride_MoveEnter();
|
||||
HRESULT Behavior_Broom_Ride_MoveExitCheck(_float fTimeDelta);
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
#include "Client_Define.h"
|
||||
#include "CamPosition.h"
|
||||
#include "CamPosition_Target.h"
|
||||
|
||||
NS_BEGIN(Client)
|
||||
|
||||
class CCamPosition_AI final : public CCamPosition
|
||||
{
|
||||
public:
|
||||
typedef struct tagCameraAI_Desc : public CCamPosition::CAMERAPOSITION_DESC
|
||||
{
|
||||
}CAMERA_AI_DESC;
|
||||
private:
|
||||
CCamPosition_AI(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CCamPosition_AI(const CCamPosition_AI& rhs);
|
||||
virtual ~CCamPosition_AI() = default;
|
||||
|
||||
public:
|
||||
virtual void Priority_Update(_float fTimeDelta) override;
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
virtual _vector Get_WorldPostion() override;
|
||||
_vector Get_ShoulderGlobalPos();
|
||||
void Set_CameraShake(_float fXShock, _float fYShock);
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
HRESULT Ready_Components(void* pArg);
|
||||
HRESULT Ready_SubParts();
|
||||
_vector Calc_LookTargetPos();
|
||||
_vector Calc_FollowTargetPos(_vector vLookTargetWorldPos);
|
||||
_vector Calc_DampingParentPos();
|
||||
|
||||
#pragma region Base
|
||||
_float m_fMouseSensor = { 0.1f };
|
||||
_float m_fCameraFowardDistance = { 3.45f };
|
||||
_float m_fCameraBarrelLength = { 10.f };
|
||||
_float2 m_vFocalRatio = { 0.f, 0.467f };
|
||||
_float m_fHeadHeight = { 1.61f };
|
||||
_float m_fFollowTargetIncludedAngleDegree = { 20.f };
|
||||
_float m_fDefaultCameraBackToFrontRatio = { 0.61f };
|
||||
_float2 m_vAccRotDegrees = { 0.f, 0.f };
|
||||
_float2 m_vAccRealDegrees = { 0.f, 0.f };
|
||||
_float3 m_vShoulderLocalPos = { 1.f, 2.f, 2.f };
|
||||
#pragma endregion
|
||||
#pragma region Lerp
|
||||
_bool m_bStartGame = { true };
|
||||
_bool m_bDampingParentPos = { true };
|
||||
_bool m_bShoulderLerp = { false };
|
||||
_bool m_bRightShoulderActive = { true };
|
||||
_float2 m_vShoulderLerpTimer = { 0.f, 0.30f };
|
||||
_float2 m_vDampingLerpTimer = { 0.f, 0.10f };
|
||||
_float2 m_vStartLerpTimer = { 0.f, 0.30f };
|
||||
|
||||
_float2 m_vShoulderLerpDegree = { };
|
||||
_float2 m_vShoulderLerpIncludedAngleDegree = { -20.f, 20.f };
|
||||
_float4 m_vDampingStartPosition = { };
|
||||
_float4 m_vDampingDestPosition = { };
|
||||
|
||||
_float m_fFocalRatioTargetValue = 0.f;
|
||||
_float m_fFocalRatioLerpSpeed = 6.f;
|
||||
_float m_fFocalRatioMin = 0.05f;
|
||||
|
||||
_float2 m_vMoveLerpPositions = { };
|
||||
_float2 m_vMoveLerpTimer = { 0.f, TIMER_SHORT_LERP };
|
||||
#pragma endregion
|
||||
_float2 m_vCameraShakeTimer = { 0.f, 0.3f };
|
||||
|
||||
PSX::PxSweepBuffer m_BufferHit = {};
|
||||
|
||||
_bool m_bZoomIn = { false };
|
||||
_bool m_bMovable = { true };
|
||||
|
||||
const _float4* m_pParentPos = { nullptr };
|
||||
CTransform* m_pLookTransform = { nullptr };
|
||||
CTransform* m_pFollowTransform = { nullptr };
|
||||
CCamPosition_Target* m_pTarget_LookPart = { nullptr };
|
||||
CCamPosition_Target* m_pTarget_FollowPart = { nullptr };
|
||||
class CCamera_Gaze* m_pBinded_Camera = { nullptr };
|
||||
|
||||
public:
|
||||
static CCamPosition_AI* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CCamPosition_AI* Clone(void* pArg, class CGameObject* pOWner) override;
|
||||
virtual void Free() override;
|
||||
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -23,6 +23,7 @@ class CCamera_Gaze final : public CCamera
|
||||
void Enable_FollowLerp();
|
||||
void Enable_LookLerp();
|
||||
void Toggle_Priority();
|
||||
void Toggle_AIPriority();
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Client {
|
||||
|
||||
#define CAMERA_DEBUG TEXT("CAMERA_DEBUG")
|
||||
#define CAMERA_SHOULDER TEXT("CAMERA_SHOULDER")
|
||||
#define CAMERA_HEAD TEXT("CAMERA_HEAD")
|
||||
#define CAMERA_AI TEXT("CAMERA_AI")
|
||||
#pragma endregion
|
||||
#pragma region COMPONENT
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@ class CDialogue final : public CElementObject
|
||||
static CDialogue* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -66,7 +66,11 @@ class CNPCInteraction final : public CGameObject
|
||||
static CNPCInteraction* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // DEBUG
|
||||
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -30,6 +30,7 @@ class CPlayer final : public CUnit
|
||||
typedef struct tagPlayerInitDesc {
|
||||
_float4 vPos;
|
||||
_float4 vRotQ;
|
||||
class CBroomRaceManager* pBroomRaceManager;
|
||||
}PLAYERDESC;
|
||||
private:
|
||||
CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -49,6 +50,8 @@ class CPlayer final : public CUnit
|
||||
void Set_Shield(_bool bShield) { m_bShield = bShield; }
|
||||
void Start_CameraShake(_float fTime, _float fIntense);
|
||||
_int Get_UIState() { return m_eUIState; }
|
||||
void Set_RaceRing(class CRaceRing* pRaceRing) { m_pRaceRing = pRaceRing; }
|
||||
class CBroom* Get_Broom() { return m_pBroom; }
|
||||
#ifdef _DEBUG
|
||||
void Render_CameraCoordinateSystem();
|
||||
#endif // _DEBUG
|
||||
@@ -89,6 +92,9 @@ class CPlayer final : public CUnit
|
||||
class CTransform* m_pBroomTransform = { nullptr };
|
||||
class CBroom* m_pBroom = { nullptr };
|
||||
CStat* m_pStat = { nullptr };
|
||||
|
||||
class CBroomRaceManager* m_pBroomRaceManager = { nullptr };
|
||||
class CRaceRing* m_pRaceRing = { nullptr };
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
@@ -163,6 +169,10 @@ class CPlayer final : public CUnit
|
||||
_float m_fMoveTime = {};
|
||||
_float m_fCross = 0.f;
|
||||
_float m_fabsDir = 0.f;
|
||||
_float m_fNoInputTime = 0.f;
|
||||
_float m_fNeutralTime = 0.f;
|
||||
|
||||
|
||||
/* 무적 불 변수*/
|
||||
#ifdef _DEBUG
|
||||
_bool m_isDebugMode = { false };
|
||||
|
||||
@@ -7,6 +7,12 @@ NS_BEGIN(Client)
|
||||
|
||||
class CRaceRing final : public CGameObject
|
||||
{
|
||||
public:
|
||||
typedef struct RaceRingDesc
|
||||
{
|
||||
class CBroomRaceManager* pBroomRaceManager = { nullptr };
|
||||
_int iIndex = { 0 };
|
||||
}RACERING_DESC;
|
||||
private:
|
||||
CRaceRing(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRaceRing(const CRaceRing& Prototype);
|
||||
@@ -19,13 +25,14 @@ class CRaceRing final : public CGameObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
void Set_Target(_bool bTarget){ m_bTarget = bTarget; }
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
class CBroomRaceManager* m_pBroomRaceManager = { nullptr };
|
||||
|
||||
|
||||
class CBroomRaceManager* m_pBroomRaceManager = { nullptr };
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
_bool m_bTarget = { false };
|
||||
_int m_iIndex = {};
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 69 B |
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,237 @@
|
||||
<Material>
|
||||
<MI_Ghost_P ShaderIndex = "8" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Ghost_Peeves_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Ghost_Peeves_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Ghost_Peeves_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_Ghost_P>
|
||||
<MI_GHO_M_Hair_GHOHair03_Peeves ShaderIndex = "4" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Ghost_Peeves_Hair_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Ghost_Peeves_Hair_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Ghost_Peeves_Hair_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_GHO_M_Hair_GHOHair03_Peeves>
|
||||
<MI_HUM_M_Body_PeevesArms ShaderIndex = "1" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Ghost_Peeves_Arms_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Adult_M_Arms_Ivory_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Ghost_Peeves_Arms_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_HUM_M_Body_PeevesArms>
|
||||
|
||||
<MI_HUM_N_Heads_Eyelash ShaderIndex = "0" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Ghost_Peeves_Hair_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Ghost_Peeves_Hair_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Ghost_Peeves_Hair_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_HUM_N_Heads_Eyelash>
|
||||
|
||||
<MI_HUM_N_Heads_Teeth_2_Poltergiest ShaderIndex = "1" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_HUM_Head_Teeth_Decay5_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_HUM_Head_Teeth_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="T_HUM_Head_Teeth_SRXO" Extension=".dds"/>
|
||||
</MI_HUM_N_Heads_Teeth_2_Poltergiest>
|
||||
<MI_Adult_M_Peeves ShaderIndex = "6" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Old_M_Head_Peeves_D" Extension=".dds"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Old_M_Head_Peeves_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Old_M_Head_Peeves_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_Adult_M_Peeves>
|
||||
<MI_HUM_N_Heads_EyeOcclusion ShaderIndex = "3" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_DefaultGrey_D" Extension=".png"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="" Extension=""/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="BaseFlattenNormalMap" Extension=".png"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_HUM_N_Heads_EyeOcclusion>
|
||||
<MI_HUM_M_Heads_Eye_PoltergiestTEst ShaderIndex = "2" OutLineWrite="0">
|
||||
<aiTextureType_NONE Index="0" Filename="" Extension=""/>
|
||||
<aiTextureType_DIFFUSE Index="1" Filename="T_Poltergeist_Eye_D" Extension=".png"/>
|
||||
<aiTextureType_SPECULAR Index="2" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT Index="3" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSIVE Index="4" Filename="T_Poltergeist_Eye_E" Extension=".dds"/>
|
||||
<aiTextureType_HEIGHT Index="5" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMALS Index="6" Filename="T_Eye_Wetness_N" Extension=".dds"/>
|
||||
<aiTextureType_SHININESS Index="7" Filename="" Extension=""/>
|
||||
<aiTextureType_OPACITY Index="8" Filename="" Extension=""/>
|
||||
<aiTextureType_DISPLACEMENT Index="9" Filename="" Extension=""/>
|
||||
<aiTextureType_LIGHTMAP Index="10" Filename="" Extension=""/>
|
||||
<aiTextureType_REFLECTION Index="11" Filename="" Extension=""/>
|
||||
<aiTextureType_BASE_COLOR Index="12" Filename="" Extension=""/>
|
||||
<aiTextureType_NORMAL_CAMERA Index="13" Filename="" Extension=""/>
|
||||
<aiTextureType_EMISSION_COLOR Index="14" Filename="" Extension=""/>
|
||||
<aiTextureType_METALNESS Index="15" Filename="T_Poltergeist_Eye_MRO" Extension=".dds"/>
|
||||
<aiTextureType_DIFFUSE_ROUGHNESS Index="16" Filename="" Extension=""/>
|
||||
<aiTextureType_AMBIENT_OCCLUSION Index="17" Filename="" Extension=""/>
|
||||
<aiTextureType_UNKNOWN Index="18" Filename="" Extension=""/>
|
||||
<aiTextureType_SHEEN Index="19" Filename="" Extension=""/>
|
||||
<aiTextureType_CLEARCOAT Index="20" Filename="" Extension=""/>
|
||||
<aiTextureType_TRANSMISSION Index="21" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_BASE Index="22" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR Index="23" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_COLOR Index="24" Filename="" Extension=""/>
|
||||
<aiTextureType_MAYA_SPECULAR_ROUGHNESS Index="25" Filename="" Extension=""/>
|
||||
<aiTextureType_ANISOTROPY Index="26" Filename="" Extension=""/>
|
||||
</MI_HUM_M_Heads_Eye_PoltergiestTEst>
|
||||
|
||||
</Material>
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
|
After Width: | Height: | Size: 415 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 371 KiB |
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -94,6 +94,9 @@ float g_fFogPow;
|
||||
float g_fFogHeightValue;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
float g_fDepthPackExponent;
|
||||
|
||||
Texture3D g_VolumeTexture;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
{
|
||||
@@ -1142,6 +1145,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float3 vVolumeUV = float3(In.vTexcoord.xy, pow(vDepthDesc.y, g_fDepthPackExponent));
|
||||
|
||||
if (0.f == g_fFogPow)
|
||||
{
|
||||
if (1 == vDepthDesc.y)
|
||||
@@ -1151,9 +1156,10 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float4 vVolumeValue = g_VolumeTexture.Sample(DefaultSampler, vVolumeUV);
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
float4 vPosition;
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
vPosition.y = In.vTexcoord.y * -2.f + 1.f;
|
||||
vPosition.z = vDepthDesc.x;
|
||||
@@ -1174,14 +1180,19 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
vVolumeValue.r = vVolumeValue.r < 1.413f ? pow(abs(vVolumeValue.r * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.r);
|
||||
vVolumeValue.g = vVolumeValue.g < 1.413f ? pow(abs(vVolumeValue.g * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.g);
|
||||
vVolumeValue.b = vVolumeValue.b < 1.413f ? pow(abs(vVolumeValue.b * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.b);
|
||||
vVolumeValue.a = saturate(1.f - vVolumeValue.a);
|
||||
vFinalColor = float4(lerp(vColor.rgb, vVolumeValue.rgb, vVolumeValue.a), 1.f);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
vFinalColor = float4(vVolumeValue.rgb, 1.f);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
|
||||
|
||||
Out.vFirstTarget = vVolumeValue;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ row_major float4x4 SampleBlendedLocal(uint bone)
|
||||
|
||||
|
||||
|
||||
SampleLocalTRS_Prev(bone, PrevTime, sA, rA, tA);
|
||||
SampleLocalTRS_Prev(bone, prevT, sA, rA, tA);
|
||||
SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB);
|
||||
|
||||
float3 S = lerp(sA, sB, br);
|
||||
|
||||
@@ -27,6 +27,8 @@ float g_fOutLinePower;
|
||||
float g_fUsingSurfaceParams;
|
||||
float g_fEtherealRatio;
|
||||
float g_fMixerFactor;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
|
||||
|
||||
Texture2D g_DiffuseTexture : register(t00);
|
||||
@@ -326,7 +328,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE_READ(PS_IN In)
|
||||
(In.vProjPos.w / g_fFar), // 酉??ㅽ럹?댁뒪 Z
|
||||
(float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, // ?쒗럹?댁뒪 ?뚮씪誘명꽣
|
||||
1.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -367,7 +369,7 @@ PS_OUT PS_EYELASH_DAOTHV_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -395,7 +397,7 @@ PS_OUT PS_TEETH_SRXO_ToSRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSRXO_MASK.r, vSRXO_MASK.g, vSRXO_MASK.a, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -422,7 +424,7 @@ PS_OUT PS_EYE_DN_SRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(0.5f, 0.5f, 1.f, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -472,7 +474,7 @@ PS_OUT PS_FACIAL_HAIR_DAOTHV_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -514,7 +516,7 @@ PS_OUT PS_HEAD_HAIR_DAOTHV_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -541,7 +543,7 @@ PS_OUT PS_HEADwtHAND_DSRXON_ToSRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSRXO_Mask.r, vSRXO_Mask.g, vSRXO_Mask.a, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -569,7 +571,7 @@ PS_OUT PS_LOWER_DSRON_ToSRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSRO_Mask.r, vSRO_Mask.g, vSRO_Mask.b, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -597,7 +599,7 @@ PS_OUT PS_UPPER_DMRON_ToMRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// MRO
|
||||
return Out;
|
||||
}
|
||||
@@ -625,7 +627,7 @@ PS_OUT PS_GLASSES_DMRON_ToMRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -654,7 +656,7 @@ PS_OUT PS_EmissiveMetalness_DENMRO_ToMRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -683,7 +685,7 @@ PS_OUT PS_DNMRO_ToMRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO_Mask.r, vMRO_Mask.g, vMRO_Mask.b, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -712,7 +714,7 @@ PS_OUT PS_MI_ClothSim_DSEN_ToSRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSpecular_Mask.r, 0.5f, 1.f, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -747,7 +749,7 @@ PS_OUT PS_MI_DANSROMRO_ToSRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSRO_Mask.r, Roughness, Occlusion, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -783,7 +785,7 @@ PS_OUT PS_Troll_Club_DAENMROSRXO_ToMROX(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO_MASK.r, Roughness, Occlusion, vSRXO_Mask.b);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -826,7 +828,7 @@ PS_OUT PS_Player_EyeLash_DAOTHV_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(lerp(0.1f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT PS_Player_Eye_ToMRO(PS_IN In)
|
||||
@@ -851,7 +853,7 @@ PS_OUT PS_Player_Eye_ToMRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMROColor.r, vMROColor.g, vMROColor.b, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT PS_Player_Robe_ToMRO(PS_IN In)
|
||||
@@ -878,7 +880,7 @@ PS_OUT PS_Player_Robe_ToMRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMROColor.r, vMROColor.g, vMROColor.b, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In)
|
||||
@@ -903,7 +905,7 @@ PS_OUT PS_Player_Suit_DSRON_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vSROColor.r, vSROColor.g, vSROColor.b, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In)
|
||||
@@ -947,7 +949,7 @@ PS_OUT PS_Player_HairDAOTHV_ToSRO(PS_IN In)
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(lerp(0.7f, 0.3f, SpecMask), SpecMask * 0.5f, AoMask_Dao * AoMask_Thv, 0.f);
|
||||
// SRO
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -1017,7 +1019,7 @@ PS_OUT PS_Dragon_Body(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
@@ -1050,7 +1052,7 @@ PS_OUT PS_Dragon_Wings(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(vMRO, 0.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
// SRO
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float DensityScale = 0.01f;
|
||||
|
||||
Texture3D<float4> g_VolumeSRV : register(t0);
|
||||
|
||||
RWTexture3D<float4> g_AccVolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float SliceTickness(float ndcZ, uint dimZ);
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness);
|
||||
// 볼륨 텍스쳐 밀도, 산란 누적 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
uint3 Position = uint3(DispatchThreadID.xy, 0);
|
||||
|
||||
[loop]
|
||||
for (uint i = 0; i < dims.z; ++i)
|
||||
{
|
||||
Position.z = i;
|
||||
float4 slice = g_VolumeSRV[Position];
|
||||
float tickness = SliceTickness((float)i / dims.z, dims.z);
|
||||
|
||||
accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness);
|
||||
g_AccVolumeUAV[Position] = accumulatedColor;
|
||||
}
|
||||
}
|
||||
|
||||
float SliceTickness (float ndcZ, uint dimZ)
|
||||
{
|
||||
return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ);
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness)
|
||||
{
|
||||
sliceDensity = max(sliceDensity, 0.000001f);
|
||||
sliceDensity *= DensityScale;
|
||||
float sliceTransmittance = exp(-sliceDensity * tickness);
|
||||
|
||||
// Frostbite의 누적 방식
|
||||
float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity;
|
||||
|
||||
accumulatedLight += sliceLightIntegral * accumulatedTransmittance;
|
||||
accumulatedTransmittance *= sliceTransmittance;
|
||||
|
||||
return float4(accumulatedLight, accumulatedTransmittance);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float EPSILON = 1e-6f;
|
||||
|
||||
struct LightData
|
||||
{
|
||||
uint itype;
|
||||
float3 vDirection;
|
||||
|
||||
float3 vPosition;
|
||||
float fRange;
|
||||
|
||||
float4 vColor;
|
||||
};
|
||||
|
||||
//StructuredBuffer<LightData> g_LightBuffer : register(t1);
|
||||
|
||||
RWTexture3D<float4> g_VolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims);
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth);
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims);
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy);
|
||||
|
||||
// 볼륨 텍스쳐 밀도, 산란 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims);
|
||||
float3 toCamera = normalize(vCameraPosition - worldPosition);
|
||||
|
||||
float3 lighting = vLightColor.rgb * vLightColor.a;
|
||||
float3 lightDir = normalize(vLightDirection);
|
||||
float3 toLight = -lightDir;
|
||||
|
||||
float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter);
|
||||
|
||||
lighting += vLightColor.rgb * vLightColor.rgb * phase;
|
||||
|
||||
g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity);
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = id + 0.5f;
|
||||
|
||||
ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z);
|
||||
ndc += float3(-1.0f, 1.0f, 0.0f);
|
||||
|
||||
return ndc;
|
||||
}
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth)
|
||||
{
|
||||
float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix);
|
||||
vViewRay /= vViewRay.w;
|
||||
vViewRay /= vViewRay.z;
|
||||
float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix);
|
||||
return worldPosition.xyz;
|
||||
}
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = ConvertThreadIdToNdc(id, dims);
|
||||
float depth = ConvertNdcZToDepth(ndc.z);
|
||||
return ConvertToWorldPosition(ndc, depth);
|
||||
}
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter)
|
||||
{
|
||||
float cosTheta = dot(vInputDir, vOutputDir);
|
||||
|
||||
float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f);
|
||||
return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON));
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float DensityScale = 0.01f;
|
||||
|
||||
Texture3D<float4> g_VolumeSRV : register(t0);
|
||||
|
||||
RWTexture3D<float4> g_AccVolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float SliceTickness(float ndcZ, uint dimZ);
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness);
|
||||
// 볼륨 텍스쳐 밀도, 산란 누적 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
uint3 Position = uint3(DispatchThreadID.xy, 0);
|
||||
|
||||
[loop]
|
||||
for (uint i = 0; i < dims.z; ++i)
|
||||
{
|
||||
Position.z = i;
|
||||
float4 slice = g_VolumeSRV[Position];
|
||||
float tickness = SliceTickness((float)i / dims.z, dims.z);
|
||||
|
||||
accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness);
|
||||
g_AccVolumeUAV[Position] = accumulatedColor;
|
||||
}
|
||||
}
|
||||
|
||||
float SliceTickness (float ndcZ, uint dimZ)
|
||||
{
|
||||
return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ);
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness)
|
||||
{
|
||||
sliceDensity = max(sliceDensity, 0.000001f);
|
||||
sliceDensity *= DensityScale;
|
||||
float sliceTransmittance = exp(-sliceDensity * tickness);
|
||||
|
||||
// Frostbite의 누적 방식
|
||||
float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity;
|
||||
|
||||
accumulatedLight += sliceLightIntegral * accumulatedTransmittance;
|
||||
accumulatedTransmittance *= sliceTransmittance;
|
||||
|
||||
return float4(accumulatedLight, accumulatedTransmittance);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float EPSILON = 1e-6f;
|
||||
|
||||
struct LightData
|
||||
{
|
||||
uint itype;
|
||||
float3 vDirection;
|
||||
|
||||
float3 vPosition;
|
||||
float fRange;
|
||||
|
||||
float4 vColor;
|
||||
};
|
||||
|
||||
//StructuredBuffer<LightData> g_LightBuffer : register(t1);
|
||||
|
||||
RWTexture3D<float4> g_VolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims);
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth);
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims);
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy);
|
||||
|
||||
// 볼륨 텍스쳐 밀도, 산란 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims);
|
||||
float3 toCamera = normalize(vCameraPosition - worldPosition);
|
||||
|
||||
float3 lighting = vLightColor.rgb * vLightColor.a;
|
||||
float3 lightDir = normalize(vLightDirection);
|
||||
float3 toLight = -lightDir;
|
||||
|
||||
float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter);
|
||||
|
||||
lighting += vLightColor.rgb * vLightColor.rgb * phase;
|
||||
|
||||
g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity);
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = id + 0.5f;
|
||||
|
||||
ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z);
|
||||
ndc += float3(-1.0f, 1.0f, 0.0f);
|
||||
|
||||
return ndc;
|
||||
}
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth)
|
||||
{
|
||||
float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix);
|
||||
vViewRay /= vViewRay.w;
|
||||
vViewRay /= vViewRay.z;
|
||||
float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix);
|
||||
return worldPosition.xyz;
|
||||
}
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = ConvertThreadIdToNdc(id, dims);
|
||||
float depth = ConvertNdcZToDepth(ndc.z);
|
||||
return ConvertToWorldPosition(ndc, depth);
|
||||
}
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter)
|
||||
{
|
||||
float cosTheta = dot(vInputDir, vOutputDir);
|
||||
|
||||
float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f);
|
||||
return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON));
|
||||
}
|
||||
@@ -29,6 +29,7 @@ float g_fOutLinePower;
|
||||
float g_fDisolveRatio;
|
||||
float g_fDisolveAmount;
|
||||
float g_fDisolveEdgeWidth;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
float4 g_vDisolveEdgeColor;
|
||||
float4 g_vCamPosition;
|
||||
@@ -416,7 +417,7 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -480,7 +481,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE(PS_IN_OUTLINE In)
|
||||
(In.vProjPos.w / g_fFar), // 뷰 스페이스 Z
|
||||
(float) AI_TEXTURE_TYPE_METALNESS / (float) AI_TEXTURE_TYPE_MAX, // 서페이스 파라미터
|
||||
1.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ vector g_vCamPosition;
|
||||
uint g_iIndexU;
|
||||
uint g_iIndexV;
|
||||
float2 g_vTime;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
float g_fDisolveRatio;
|
||||
float g_fUsingSurfaceParams;
|
||||
@@ -442,7 +443,7 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -478,7 +479,7 @@ PS_OUT PS_GLASS(PS_IN In)
|
||||
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 15.f / 27.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = float2(0.5f, 0.5f);
|
||||
//CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
//CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -507,7 +508,7 @@ PS_OUT PS_GLASS_CUBE(PS_IN In)
|
||||
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 15.f / 27.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = float2(0.5f, 0.5f);
|
||||
//CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
//CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -697,7 +698,7 @@ PS_OUT_OUTLINE PS_MAIN_OUTLINE(PS_IN_OUTLINE In)
|
||||
(In.vProjPos.w / g_fFar), // 뷰 스페이스 Z
|
||||
AI_TEXTURE_TYPE_METALNESS, // 서페이스 파라미터
|
||||
1.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -762,7 +763,7 @@ PS_OUT PS_LAKE(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -798,7 +799,7 @@ PS_OUT PS_LAND(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -826,7 +827,7 @@ PS_OUT PS_NONMRO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = g_vSurfaceColor;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -868,7 +869,7 @@ PS_OUT PS_SPECTOR_WEAPON_MAIN(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -920,7 +921,7 @@ PS_OUT PS_LEVIOSO(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1037,7 +1038,6 @@ PS_OUT_DELCAL PS_MAIN_DECAL(PS_IN_DECAL In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
technique11 MeshTechnique11
|
||||
{
|
||||
pass MeshPass // 0
|
||||
|
||||
@@ -75,6 +75,7 @@ Texture2D g_SurfaceParamsTexture : register(t10);
|
||||
float4 g_vCamPosition;
|
||||
float g_fFar;
|
||||
float g_fUsingSurfaceParams;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
/* 디퓨즈 */
|
||||
vector g_vColor;
|
||||
@@ -942,7 +943,7 @@ PS_NOMAL_OUT PS_MAIN(PS_BLUR_MESH_IN In)
|
||||
|
||||
vSurface.b = 0.5f;
|
||||
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
Out.vAlbedo = vMtrlDiffuse;
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
|
||||
@@ -9,6 +9,7 @@ float g_fUsingSurfaceParams;
|
||||
float g_fDiffuseMultiplier;
|
||||
float g_fSurfaceMultiplier;
|
||||
float g_fNormalMultiplier;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_NormalTexture;
|
||||
@@ -131,7 +132,7 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
1.f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -190,7 +191,7 @@ PS_OUT PS_MAIN_TERRAIN_ANISO(PS_IN In)
|
||||
(1.f / 255.f)); // 지형은 1
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = vSurface;
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ Texture2D g_SurfaceParamsTexture;
|
||||
float4 g_vCamPosition;
|
||||
float g_fFar;
|
||||
float g_fUsingSurfaceParams;
|
||||
float g_fMBIntensity = 1.f;
|
||||
|
||||
|
||||
struct VS_IN
|
||||
@@ -112,7 +113,7 @@ PS_OUT PS_MAIN(PS_IN In)
|
||||
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, g_fUsingSurfaceParams, 0.0f);
|
||||
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSurface = float4(g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord).xy, 1.f, 1.f);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos);
|
||||
Out.vVelocityUV = CalcVelocityUV(In.vProjPos, In.vPrevProjPos, g_fMBIntensity);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -2385,10 +2385,10 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
vector<future<pair<_wstring, CModel*>*>> futures = {};
|
||||
|
||||
|
||||
//if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SK_ConjuredDragon_Model"),
|
||||
// CModel::Create(m_pDevice, m_pContext, MODEL::ANIM_LOCAL, "C:/MeshTable\\Game\\RiggedObjects\\Props\\Wands\\CharacterWands\\SK_Wands_Amit.fbx", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity())))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SK_ConjuredDragon_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM_LOCAL, "C:/MeshTable\\Game\\Environment\\BroomFlight\\Meshes\\SM_BRR_RaceRing_01.fbx", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity())))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#pragma region MONSTER
|
||||
|
||||
@@ -2431,17 +2431,10 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
));
|
||||
|
||||
futures.emplace_back(Deferred_ModelLoad(
|
||||
MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/EleazarFig/Professor_EleazarFig_Anim.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(),
|
||||
TEXT("Prototype_Component_Professor_EleazarFig_Model")
|
||||
MODEL::PBR_ANIM, "../Bin/Resources/Models/Human/Npc/Ghost_Peeves/Ghost_Peeves.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationY(XMConvertToRadians(180.f)) * XMMatrixIdentity(),
|
||||
TEXT("Prototype_Component_Ghost_Peeves_Model")
|
||||
));
|
||||
|
||||
//if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_ConjuredDragon_Model"),
|
||||
// CModel::Create(m_pDevice, m_pContext, MODEL::PBR_ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon.bin", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixRotationZ(XMConvertToRadians(180.f))* XMMatrixIdentity()))))
|
||||
// return E_FAIL;
|
||||
futures.emplace_back(Deferred_ModelLoad(
|
||||
MODEL::ANIM, "../Bin/Resources/Models/Monster/ConjuredDragon/ConjuredDragon_Anim.bin", XMMatrixIdentity(),
|
||||
TEXT("Prototype_Component_ConjuredDragon_Anim_Model")
|
||||
));
|
||||
|
||||
#pragma endregion
|
||||
|
||||
|
||||
@@ -94,6 +94,9 @@ float g_fFogPow;
|
||||
float g_fFogHeightValue;
|
||||
bool g_bFogVisible;
|
||||
vector g_vFogColor;
|
||||
float g_fDepthPackExponent;
|
||||
|
||||
Texture3D g_VolumeTexture;
|
||||
|
||||
float g_fWeights_32[32] =
|
||||
{
|
||||
@@ -1142,6 +1145,8 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
vector vColor = g_OriginalTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float3 vVolumeUV = float3(In.vTexcoord.xy, pow(vDepthDesc.y, g_fDepthPackExponent));
|
||||
|
||||
if (0.f == g_fFogPow)
|
||||
{
|
||||
if (1 == vDepthDesc.y)
|
||||
@@ -1151,9 +1156,10 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float4 vVolumeValue = g_VolumeTexture.Sample(DefaultSampler, vVolumeUV);
|
||||
float fViewZ = vDepthDesc.y * g_fFar;
|
||||
|
||||
float4 vPosition, vPreShadowPosition;
|
||||
float4 vPosition;
|
||||
vPosition.x = In.vTexcoord.x * 2.f - 1.f;
|
||||
vPosition.y = In.vTexcoord.y * -2.f + 1.f;
|
||||
vPosition.z = vDepthDesc.x;
|
||||
@@ -1174,14 +1180,19 @@ PS_OUT_FLT4_SINGLE PS_MAIN_FOG(PS_IN In)
|
||||
|
||||
fRatio = pow(1.f - saturate(exp(-1.f * vDepthDesc.y * g_fFogDensity)), g_fFogPow);
|
||||
|
||||
vFinalColor = lerp(vColor, g_vFogColor, fRatio);
|
||||
vFinalColor.a = 1.f;
|
||||
vVolumeValue.r = vVolumeValue.r < 1.413f ? pow(abs(vVolumeValue.r * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.r);
|
||||
vVolumeValue.g = vVolumeValue.g < 1.413f ? pow(abs(vVolumeValue.g * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.g);
|
||||
vVolumeValue.b = vVolumeValue.b < 1.413f ? pow(abs(vVolumeValue.b * 0.38317f), 1.f / 2.2f) : 1.f - exp(-vVolumeValue.b);
|
||||
vVolumeValue.a = saturate(1.f - vVolumeValue.a);
|
||||
vFinalColor = float4(lerp(vColor.rgb, vVolumeValue.rgb, vVolumeValue.a), 1.f);
|
||||
|
||||
if (1.f == vDepthDesc.y)
|
||||
{
|
||||
vFinalColor = float4(g_vFogColor);
|
||||
vFinalColor = float4(vVolumeValue.rgb, 1.f);
|
||||
}
|
||||
Out.vFirstTarget = vFinalColor;
|
||||
|
||||
|
||||
Out.vFirstTarget = vVolumeValue;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -317,7 +317,7 @@ row_major float4x4 SampleBlendedLocal(uint bone)
|
||||
|
||||
|
||||
|
||||
SampleLocalTRS_Prev(bone, PrevTime, sA, rA, tA);
|
||||
SampleLocalTRS_Prev(bone, prevT, sA, rA, tA);
|
||||
SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB);
|
||||
|
||||
float3 S = lerp(sA, sB, br);
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float DensityScale = 0.01f;
|
||||
|
||||
Texture3D<float4> g_VolumeSRV : register(t0);
|
||||
|
||||
RWTexture3D<float4> g_AccVolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float SliceTickness(float ndcZ, uint dimZ);
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness);
|
||||
// 볼륨 텍스쳐 밀도, 산란 누적 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_AccVolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float4 accumulatedColor = float4(0.f, 0.f, 0.f, 1.f);
|
||||
uint3 Position = uint3(DispatchThreadID.xy, 0);
|
||||
|
||||
[loop]
|
||||
for (uint i = 0; i < dims.z; ++i)
|
||||
{
|
||||
Position.z = i;
|
||||
float4 slice = g_VolumeSRV[Position];
|
||||
float tickness = SliceTickness((float)i / dims.z, dims.z);
|
||||
|
||||
accumulatedColor = ScatterStep(accumulatedColor.rgb, accumulatedColor.a, slice.rgb, slice.a, tickness);
|
||||
g_AccVolumeUAV[Position] = accumulatedColor;
|
||||
}
|
||||
}
|
||||
|
||||
float SliceTickness (float ndcZ, uint dimZ)
|
||||
{
|
||||
return ConvertNdcZToDepth(ndcZ + 1.f / float(dimZ)) - ConvertNdcZToDepth(ndcZ);
|
||||
}
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
|
||||
float4 ScatterStep(float3 accumulatedLight, float accumulatedTransmittance, float3 sliceLight, float sliceDensity, float tickness)
|
||||
{
|
||||
sliceDensity = max(sliceDensity, 0.000001f);
|
||||
sliceDensity *= DensityScale;
|
||||
float sliceTransmittance = exp(-sliceDensity * tickness);
|
||||
|
||||
// Frostbite의 누적 방식
|
||||
float3 sliceLightIntegral = sliceLight * (1.f - sliceTransmittance) / sliceDensity;
|
||||
|
||||
accumulatedLight += sliceLightIntegral * accumulatedTransmittance;
|
||||
accumulatedTransmittance *= sliceTransmittance;
|
||||
|
||||
return float4(accumulatedLight, accumulatedTransmittance);
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
#include "Engine_Shader_Functions.hlsli"
|
||||
#include "Engine_Shader_Defines.hlsli"
|
||||
|
||||
static const float EPSILON = 1e-6f;
|
||||
|
||||
struct LightData
|
||||
{
|
||||
uint itype;
|
||||
float3 vDirection;
|
||||
|
||||
float3 vPosition;
|
||||
float fRange;
|
||||
|
||||
float4 vColor;
|
||||
};
|
||||
|
||||
//StructuredBuffer<LightData> g_LightBuffer : register(t1);
|
||||
|
||||
RWTexture3D<float4> g_VolumeUAV : register(u0);
|
||||
|
||||
cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐이더 바인딩할때 인덱스가 동일해야함
|
||||
{
|
||||
uint3 VolumeSize;
|
||||
float fDepthPackExponent;
|
||||
|
||||
float fTemporalAccum;
|
||||
float fFrameIndex;
|
||||
float fNear;
|
||||
float fFar;
|
||||
|
||||
float3 vCameraPosition;
|
||||
float fDensity;
|
||||
|
||||
float fLightIntensity;
|
||||
float3 vLightDirection;
|
||||
|
||||
float4 vLightColor;
|
||||
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims);
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth);
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims);
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy);
|
||||
|
||||
// 볼륨 텍스쳐 밀도, 산란 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
{
|
||||
uint3 dims;
|
||||
g_VolumeUAV.GetDimensions(dims.x, dims.y, dims.z);
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims);
|
||||
float3 toCamera = normalize(vCameraPosition - worldPosition);
|
||||
|
||||
float3 lighting = vLightColor.rgb * vLightColor.a;
|
||||
float3 lightDir = normalize(vLightDirection);
|
||||
float3 toLight = -lightDir;
|
||||
|
||||
float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter);
|
||||
|
||||
lighting += vLightColor.rgb * vLightColor.rgb * phase;
|
||||
|
||||
g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity);
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = id + 0.5f;
|
||||
|
||||
ndc *= float3(2.0f / dims.x, -2.0f / dims.y, 1.0f / dims.z);
|
||||
ndc += float3(-1.0f, 1.0f, 0.0f);
|
||||
|
||||
return ndc;
|
||||
}
|
||||
float ConvertNdcZToDepth(float ndcZ)
|
||||
{
|
||||
float t = pow(ndcZ, fDepthPackExponent);
|
||||
return t * (fFar - fNear) + fNear;
|
||||
}
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth)
|
||||
{
|
||||
float4 vViewRay = mul(float4(ndc, 1.f), InvProjMatrix);
|
||||
vViewRay /= vViewRay.w;
|
||||
vViewRay /= vViewRay.z;
|
||||
float4 worldPosition = mul(float4(vViewRay.xyz * depth, 1.f), InvViewMatrix);
|
||||
return worldPosition.xyz;
|
||||
}
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims)
|
||||
{
|
||||
float3 ndc = ConvertThreadIdToNdc(id, dims);
|
||||
float depth = ConvertNdcZToDepth(ndc.z);
|
||||
return ConvertToWorldPosition(ndc, depth);
|
||||
}
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAsymmetryParameter)
|
||||
{
|
||||
float cosTheta = dot(vInputDir, vOutputDir);
|
||||
|
||||
float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f);
|
||||
return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON));
|
||||
}
|
||||
@@ -331,6 +331,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\VIBuffer_Rect.cpp" />
|
||||
<ClCompile Include="..\private\VIBuffer_UI_Instance.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Terrain.cpp" />
|
||||
<ClCompile Include="..\private\Volumetric.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Animation.h" />
|
||||
@@ -570,6 +571,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\VIBuffer_Rect.h" />
|
||||
<ClInclude Include="..\public\VIBuffer_UI_Instance.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Terrain.h" />
|
||||
<ClInclude Include="..\public\Volumetric.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Engine_Shader_Samplers.hlsli">
|
||||
@@ -647,6 +649,8 @@ call Update_Lib.bat
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Volumetric_Accumulate.hlsl" />
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Volumetric_Compute.hlsl" />
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_WeightBlend.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
|
||||
@@ -313,6 +313,9 @@
|
||||
<Filter Include="02.Element\02.Component\13.NPCStat">
|
||||
<UniqueIdentifier>{a564976c-cade-4f34-85c8-891b28d96b93}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="01.Utility\08.Volumetric">
|
||||
<UniqueIdentifier>{950977f0-f3c9-42f1-83f1-270b4bebf7ef}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -597,6 +600,9 @@
|
||||
<ClCompile Include="..\private\NPCStat.cpp">
|
||||
<Filter>02.Element\02.Component\13.NPCStat</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\Volumetric.cpp">
|
||||
<Filter>01.Utility\08.Volumetric</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1247,6 +1253,9 @@
|
||||
<ClInclude Include="..\public\NPCStat.h">
|
||||
<Filter>02.Element\02.Component\13.NPCStat</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\Volumetric.h">
|
||||
<Filter>01.Utility\08.Volumetric</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
@@ -1341,5 +1350,11 @@
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Local_Compute.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Volumetric_Compute.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Volumetric_Accumulate.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -173,8 +173,6 @@ ID3D11UnorderedAccessView* CComputeShader::GetOutputUAV(_uint iIndex) const
|
||||
return m_pOutputUAV[iIndex];
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CComputeShader::Reset()
|
||||
{
|
||||
//다음 랜더링 패스에 연관되지 않도록 초기화
|
||||
|
||||
@@ -33,6 +33,7 @@ HRESULT CFog::Bind_FogValue(CShader* pShader)
|
||||
pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_bool));
|
||||
pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
pShader->Bind_SRV("g_VolumeTexture", m_pGameInstance->Get_VolumeSRV());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Fog.h"
|
||||
#include "Resource_Manager.h"
|
||||
#include "Font_Manager.h"
|
||||
#include "Volumetric.h"
|
||||
|
||||
IMPLEMENT_SINGLETON(CGameInstance)
|
||||
|
||||
@@ -115,6 +116,11 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pVolumetric = CVolumetric::Create(*ppDevice, *ppContext);
|
||||
if (nullptr == m_pVolumetric) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_pFont_Manager = CFont_Manager::Create(*ppDevice, *ppContext);
|
||||
if (nullptr == m_pFont_Manager) {
|
||||
return E_FAIL;
|
||||
@@ -150,6 +156,8 @@ void CGameInstance::Update_Engine(_float fTimeDelta)
|
||||
|
||||
m_pObject_Manager->Late_Update(fExcuteTimeDelta);
|
||||
|
||||
m_pVolumetric->Dispatch();
|
||||
|
||||
m_pLevel_Manager->Update(fExcuteTimeDelta);
|
||||
m_pObject_Manager->Clear_DeadObj();
|
||||
|
||||
@@ -939,6 +947,10 @@ _float CGameInstance::Get_CameraFov()
|
||||
{
|
||||
return m_pCamera_Manager->Get_CameraFov();
|
||||
}
|
||||
_float CGameInstance::Get_CameraNear()
|
||||
{
|
||||
return m_pCamera_Manager->Get_CameraNear();
|
||||
}
|
||||
const _float* CGameInstance::Get_CurrentCameraFar()
|
||||
{
|
||||
return m_pCamera_Manager->Get_CurrentCameraFar();
|
||||
@@ -1284,6 +1296,16 @@ _float CGameInstance::FontSizeX(const _wstring& strFontTag, const _tchar* pText)
|
||||
return m_pFont_Manager->FontSizeX(strFontTag, pText);
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* CGameInstance::Get_VolumeSRV()
|
||||
{
|
||||
return m_pVolumetric->Get_VolumeSRV();
|
||||
}
|
||||
|
||||
_float* CGameInstance::Get_DepthPackExponentPtr()
|
||||
{
|
||||
return m_pVolumetric->Get_DepthPackExponentPtr();
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
void CGameInstance::Release_Engine()
|
||||
@@ -1302,6 +1324,7 @@ void CGameInstance::Release_Engine()
|
||||
SAFE_RELEASE(m_pKey_Manager);
|
||||
SAFE_RELEASE(m_pMouse_Manager);
|
||||
SAFE_RELEASE(m_pTimer_Manager);
|
||||
SAFE_RELEASE(m_pVolumetric);
|
||||
SAFE_RELEASE(m_pRenderer);
|
||||
SAFE_RELEASE(m_pObject_Manager);
|
||||
SAFE_RELEASE(m_pPhysX_Manager);
|
||||
|
||||
@@ -1405,7 +1405,7 @@ HRESULT CModel::Create_ComputeShader()
|
||||
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);
|
||||
m_pComputeShader = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, CS_MODEL, &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pComputeShader) {
|
||||
return E_FAIL;
|
||||
@@ -1439,7 +1439,7 @@ HRESULT CModel::Create_ComputeShaderLocal()
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pCS_AnimLocal = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("CS_Local"), &CS_Desc, nullptr);
|
||||
m_pCS_AnimLocal = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, CS_LOCAL, &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pCS_AnimLocal) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -62,9 +62,9 @@ void CNPCStat::Free()
|
||||
void CNPCStat::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
CNPCStat::NPCINFO CNPCStat::Get_Stat()
|
||||
{
|
||||
return m_NpcInfo;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
@@ -150,14 +150,14 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("CS_Model"),
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_MODEL,
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("CS_Local"),
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_LOCAL,
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl", "CS_LOCAL")))) {
|
||||
return E_FAIL;
|
||||
|
||||
@@ -563,16 +563,23 @@ void CRenderer::Render_Fog()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Fog");
|
||||
EVENTSCOPE_("Render_Fog");
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_Texture"))) {
|
||||
return;
|
||||
}
|
||||
m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::DEBUG));
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fDepthPackExponent", m_pGameInstance->Get_DepthPackExponentPtr(), sizeof(_float));
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_FogValue(m_pShader))) { // 여기서 포그에서 쓰는 상수들 바인딩 해줌
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Fog"), m_pShader, "g_OriginalTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,355 @@
|
||||
#include "pch.h"
|
||||
#include "Volumetric.h"
|
||||
#include "GameInstance.h"
|
||||
#include "RenderEventDebugger.h"
|
||||
|
||||
CVolumetric::CVolumetric(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: m_pDevice{ pDevice }
|
||||
, m_pContext{ pContext }
|
||||
, m_pGameInstance{ CGameInstance::GetInstance() }
|
||||
{
|
||||
SAFE_ADDREF(m_pDevice);
|
||||
SAFE_ADDREF(m_pContext);
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::Initialize()
|
||||
{
|
||||
if (FAILED(CreateBlob()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateComputeShader()))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(CreateBuffers()))
|
||||
return E_FAIL;
|
||||
|
||||
if(FAILED(CreateResourceViews()))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CVolumetric::Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CVolumetric::Cumpute_Volume()
|
||||
{
|
||||
EVENTSCOPE_("Render_Cumpute_Volume");
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (FAILED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
{
|
||||
MSG_BOX("Failed to Map : CVolumetric");
|
||||
}
|
||||
else
|
||||
{
|
||||
CS_VOLUME_CONSTANT_DESC* pDesc = static_cast<CS_VOLUME_CONSTANT_DESC*>(ConstantSubResource.pData);
|
||||
|
||||
pDesc->VolumeSize = { 160, 90, 128 };
|
||||
pDesc->fDepthPackExponent = m_fDepthPackExponent;
|
||||
|
||||
pDesc->fTemporalAccum = 0.f;
|
||||
pDesc->fFrameIndex = 0.f;
|
||||
|
||||
pDesc->fNear = m_pGameInstance->Get_CameraNear();
|
||||
pDesc->fFar = *(m_pGameInstance->Get_CurrentCameraFar());
|
||||
|
||||
memcpy(&pDesc->vCameraPosition, m_pGameInstance->Get_CamPosition(), sizeof(_float3));
|
||||
pDesc->fDensity = m_fDensity;
|
||||
pDesc->fLightIntensity = m_fLightIntensity;
|
||||
|
||||
const LIGHT_DESC* pLightDesc = m_pGameInstance->Get_Light_Info(m_pGameInstance->Get_CurrentLevelID(), 0);
|
||||
if(nullptr != pLightDesc)
|
||||
{
|
||||
memcpy(&pDesc->vLightDirection, pLightDesc->pDirection, sizeof(_float3));
|
||||
pDesc->vLightColor = pLightDesc->vDiffuse;
|
||||
}
|
||||
else
|
||||
pDesc->vLightDirection = _float3(-0.5f, -0.5f, 0.f);
|
||||
|
||||
XMStoreFloat4x4(&pDesc->InvProjMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ_INV));
|
||||
XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
|
||||
pDesc->fAsymmetryParameter = m_fAsymmetryParameter;
|
||||
pDesc->padding0 = 0.f;
|
||||
pDesc->padding1 = 0.f;
|
||||
pDesc->padding2 = 0.f;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
//컴퓨트 쉐이더 바인딩
|
||||
m_pContext->CSSetShader(m_pCSVolumeCalculate, nullptr, 0);
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &m_pConstantBuffer);
|
||||
|
||||
//SRV, UAV 바인딩
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, &m_pVolumeUAV, nullptr);
|
||||
|
||||
//컴퓨트 쉐이더 실행
|
||||
XMUINT3 vGroupCount = { (160 + 7) / 8, (90 + 7) / 8, (128 + 3) / 4 };
|
||||
m_pContext->Dispatch((_uint)vGroupCount.x, (_uint)vGroupCount.y, (_uint)vGroupCount.z);
|
||||
|
||||
//m_pContext->CopyResource(ppBuffers[i], m_pOutputBuffer[i]);
|
||||
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV = { nullptr };
|
||||
ID3D11UnorderedAccessView* nullUAV = { nullptr };
|
||||
// Reset
|
||||
//m_pContext->CSSetShaderResources(0, 1, &nullSRV);
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, &nullUAV, nullptr);
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
void CVolumetric::Accumulate_Volume()
|
||||
{
|
||||
EVENTSCOPE_("Render_Accumulate_Volume");
|
||||
|
||||
//컴퓨트 쉐이더 바인딩
|
||||
m_pContext->CSSetShader(m_pCSVolumeAccumulate, nullptr, 0);
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &m_pConstantBuffer);
|
||||
|
||||
//SRV, UAV 바인딩
|
||||
m_pContext->CSSetShaderResources(0, 1, &m_pVolumeSRV);
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, &m_pAccVolumeUAV, nullptr);
|
||||
|
||||
//컴퓨트 쉐이더 실행
|
||||
XMUINT3 vGroupCount = { (160 + 7) / 8, (90 + 7) / 8, (128 + 3) / 4 };
|
||||
m_pContext->Dispatch((_uint)vGroupCount.x, (_uint)vGroupCount.y, (_uint)vGroupCount.z);
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV = { nullptr };
|
||||
ID3D11UnorderedAccessView* nullUAV = { nullptr };
|
||||
// Reset
|
||||
m_pContext->CSSetShaderResources(0, 1, &nullSRV);
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, &nullUAV, nullptr);
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::Dispatch()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
|
||||
Cumpute_Volume();
|
||||
|
||||
Accumulate_Volume();
|
||||
|
||||
return S_OK;
|
||||
|
||||
}
|
||||
|
||||
CVolumetric* CVolumetric::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CVolumetric* pInstance = new CVolumetric(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CVolumetric");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CVolumetric::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pLightInfoBuffer);
|
||||
|
||||
SAFE_RELEASE(m_pAccVolumeUAV);
|
||||
SAFE_RELEASE(m_pAccVolumeSRV);
|
||||
SAFE_RELEASE(m_pVolumeUAV);
|
||||
SAFE_RELEASE(m_pVolumeSRV);
|
||||
SAFE_RELEASE(m_pTexture3D);
|
||||
SAFE_RELEASE(m_pAccumulateTexture3D);
|
||||
|
||||
SAFE_RELEASE(m_pCSBlobCalculate);
|
||||
SAFE_RELEASE(m_pCSVolumeCalculate);
|
||||
SAFE_RELEASE(m_pCSVolumeAccumulate);
|
||||
SAFE_RELEASE(m_pCSBlobAccumulate);
|
||||
|
||||
SAFE_RELEASE(m_pDevice);
|
||||
SAFE_RELEASE(m_pContext);
|
||||
SAFE_RELEASE(m_pGameInstance);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CVolumetric::Describe_Entity()
|
||||
{
|
||||
_bool open = true;
|
||||
GUI::Begin("SYSTEM", &open, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("VOLUMETRIC")) {
|
||||
GUI::SliderFloat("Density", &m_fDensity,0.01f, 5.f);
|
||||
GUI::SliderFloat("LightIntensity", &m_fLightIntensity, 0.01f, 5.f);
|
||||
GUI::SliderFloat("AsymmetryParameter", &m_fAsymmetryParameter, 0.01f, 5.f);
|
||||
GUI::SliderFloat("DepthPackExponent", &m_fDepthPackExponent, 0.01f, 5.f);
|
||||
}
|
||||
GUI::End();
|
||||
|
||||
|
||||
}
|
||||
#endif // _DEBUG
|
||||
|
||||
HRESULT CVolumetric::CreateComputeShader()
|
||||
{
|
||||
if (FAILED(m_pDevice->CreateComputeShader(
|
||||
m_pCSBlobCalculate->GetBufferPointer(), // 컴파일된 쉐이더 코드
|
||||
m_pCSBlobCalculate->GetBufferSize(), // 코드 길이
|
||||
nullptr, // 클래스 인스턴스 (없음)
|
||||
&m_pCSVolumeCalculate // 컴퓨트 쉐이더 객체
|
||||
)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pDevice->CreateComputeShader(
|
||||
m_pCSBlobAccumulate->GetBufferPointer(),
|
||||
m_pCSBlobAccumulate->GetBufferSize(),
|
||||
nullptr,
|
||||
&m_pCSVolumeAccumulate
|
||||
)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::CreateBlob()
|
||||
{
|
||||
UINT HLSLFlags = {};
|
||||
#ifdef _DEBUG
|
||||
HLSLFlags |= D3DCOMPILE_DEBUG | D3DCOMPILE_SKIP_OPTIMIZATION;
|
||||
#else
|
||||
HLSLFlags = D3DCOMPILE_OPTIMIZATION_LEVEL1;
|
||||
#endif // _DEBUG
|
||||
|
||||
if(FAILED(D3DCompileFromFile(TEXT("../Bin/Resources/ShaderFiles/Shader_Volumetric_Compute.hlsl"),
|
||||
nullptr,
|
||||
D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"CS_MAIN",
|
||||
"cs_5_0",
|
||||
HLSLFlags,
|
||||
0,
|
||||
&m_pCSBlobCalculate,
|
||||
nullptr)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(D3DCompileFromFile(TEXT("../Bin/Resources/ShaderFiles/Shader_Volumetric_Accumulate.hlsl"),
|
||||
nullptr,
|
||||
D3D_COMPILE_STANDARD_FILE_INCLUDE,
|
||||
"CS_MAIN",
|
||||
"cs_5_0",
|
||||
HLSLFlags,
|
||||
0,
|
||||
&m_pCSBlobAccumulate,
|
||||
nullptr)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::CreateBuffers()
|
||||
{
|
||||
//컨스턴트 버퍼 생성
|
||||
D3D11_BUFFER_DESC cbDesc = {};
|
||||
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbDesc.ByteWidth = sizeof(CS_VOLUME_CONSTANT_DESC);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA CBInitialDesc = {};
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (FAILED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
{
|
||||
MSG_BOX("Failed to Map : CVolumetric");
|
||||
}
|
||||
else
|
||||
{
|
||||
CS_VOLUME_CONSTANT_DESC* pDesc = static_cast<CS_VOLUME_CONSTANT_DESC*>(ConstantSubResource.pData);
|
||||
|
||||
pDesc->VolumeSize = { 160, 90, 128 };
|
||||
pDesc->fDepthPackExponent = m_fDepthPackExponent;
|
||||
|
||||
pDesc->fTemporalAccum = 0.f;
|
||||
pDesc->fFrameIndex = 0.f;
|
||||
|
||||
pDesc->fNear = m_pGameInstance->Get_CameraNear();
|
||||
pDesc->fFar = *(m_pGameInstance->Get_CurrentCameraFar());
|
||||
|
||||
memcpy(&pDesc->vCameraPosition, m_pGameInstance->Get_CamPosition(), sizeof(_float3));
|
||||
pDesc->fDensity = m_fDensity;
|
||||
pDesc->fLightIntensity = m_fLightIntensity;
|
||||
|
||||
// GetLingtInfo ....................
|
||||
pDesc->vLightDirection = _float3(0.f, 0.577f, 0.f);
|
||||
pDesc->vLightColor = _float4(1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
XMStoreFloat4x4(&pDesc->InvProjMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ_INV));
|
||||
XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
|
||||
pDesc->fAsymmetryParameter = 0.0f;
|
||||
pDesc->padding0 = 0.f;
|
||||
pDesc->padding1 = 0.f;
|
||||
pDesc->padding2 = 0.f;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::CreateResourceViews()
|
||||
{
|
||||
D3D11_TEXTURE3D_DESC TextureDesc{};
|
||||
|
||||
TextureDesc.Width = 160;
|
||||
TextureDesc.Height = 90;
|
||||
TextureDesc.Depth = 128; // 64 or 128
|
||||
TextureDesc.MipLevels = 1;
|
||||
TextureDesc.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
TextureDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
TextureDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
TextureDesc.CPUAccessFlags = 0;
|
||||
TextureDesc.MiscFlags = 0;
|
||||
|
||||
if (FAILED(m_pDevice->CreateTexture3D(&TextureDesc, nullptr, &m_pTexture3D))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateTexture3D(&TextureDesc, nullptr, &m_pAccumulateTexture3D))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pTexture3D, nullptr, &m_pVolumeSRV))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pAccumulateTexture3D, nullptr, &m_pAccVolumeSRV))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC UAV_Decs{};
|
||||
|
||||
UAV_Decs.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE3D;
|
||||
UAV_Decs.Format = DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
UAV_Decs.Texture3D.FirstWSlice = 0;
|
||||
UAV_Decs.Texture3D.MipSlice = 0;
|
||||
UAV_Decs.Texture3D.WSize = TextureDesc.Depth;
|
||||
|
||||
if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pTexture3D, &UAV_Decs, &m_pVolumeUAV)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pAccumulateTexture3D, &UAV_Decs, &m_pAccVolumeUAV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ class CCamera_Manager final : public CBase
|
||||
HRESULT IsBinded_Camera(const _wstring& wstrCameraKey);
|
||||
_vector Get_CameraLook();
|
||||
_float Get_CameraFov();
|
||||
_float Get_CameraNear() const { return m_fNear; }
|
||||
|
||||
|
||||
void Force_CamPosition(_fvector vPos);
|
||||
@@ -35,6 +36,7 @@ class CCamera_Manager final : public CBase
|
||||
_wstring m_wstrCurrentCameraKey = {};
|
||||
|
||||
_float m_fFar = 500.f;
|
||||
_float m_fNear = 0.1f;
|
||||
|
||||
private:
|
||||
HRESULT Initialize(_uint iLevelNumber);
|
||||
|
||||
@@ -124,6 +124,7 @@ enum class PXOBJECT : _uint {
|
||||
#pragma endregion
|
||||
#pragma region PLAYER
|
||||
PLAYER = 10,
|
||||
AI,
|
||||
#pragma endregion
|
||||
#pragma region MONSTER
|
||||
MONSTER = 30,
|
||||
@@ -183,6 +184,7 @@ enum class PXOBJECT : _uint {
|
||||
DOOR,
|
||||
BUILDING,
|
||||
BOX,
|
||||
RACERING,
|
||||
#pragma endregion
|
||||
#pragma region NPC
|
||||
NPC = 500,
|
||||
|
||||
@@ -96,6 +96,9 @@
|
||||
|
||||
#define CS_EFFECT TEXT("CS_EFFECT")
|
||||
#define CS_INSTANCE_MODEL TEXT("CS_INSTANCE_MODEL")
|
||||
#define CS_MODEL TEXT("CS_MODEL")
|
||||
#define CS_LOCAL TEXT("CS_LOCAL")
|
||||
|
||||
|
||||
#define SAFE_ADDREF(pInstance) Safe_AddRef(pInstance)
|
||||
#define SAFE_RELEASE(pInstance) Safe_Release(pInstance)
|
||||
|
||||
@@ -196,6 +196,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT IsBinded_Camera(const _wstring& strCameraKey);
|
||||
_vector Get_CameraLook();
|
||||
_float Get_CameraFov();
|
||||
_float Get_CameraNear();
|
||||
const _float* Get_CurrentCameraFar();
|
||||
void Force_CamPosition(_fvector vPos);
|
||||
#pragma endregion
|
||||
@@ -265,6 +266,11 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
_float FontSizeX(const _wstring& strFontTag, const _tchar* pText);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region VOLUMETRIC
|
||||
ID3D11ShaderResourceView* Get_VolumeSRV();
|
||||
_float* Get_DepthPackExponentPtr();
|
||||
#pragma endregion
|
||||
|
||||
|
||||
public:
|
||||
void Add_ModelToMap(const _char* filePath, CModel* pModel);
|
||||
@@ -304,6 +310,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
class CFog* m_pFog = { nullptr };
|
||||
class CResource_Manager* m_pResource_Manager = { nullptr };
|
||||
class CFont_Manager* m_pFont_Manager = { nullptr };
|
||||
class CVolumetric* m_pVolumetric = { nullptr };
|
||||
|
||||
mt19937 m_Rng{ random_device{}() };
|
||||
_float2 m_vViewPortSize = {};
|
||||
|
||||
@@ -169,32 +169,32 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
vector<_bool> m_CPUBoneMask;
|
||||
|
||||
// 바이너리
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
//
|
||||
|
||||
|
||||
vector<_float4x4> m_BoneMatrix;
|
||||
vector<_float4x4> m_BoneMatrix;
|
||||
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
_float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
_float4 m_vInitialRootRot = {};
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
_float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
_float4 m_vInitialRootRot = {};
|
||||
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_int m_iIndexAnimPlayableMesh = { -1 };
|
||||
_vector m_vector[3];
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_int m_iIndexAnimPlayableMesh = { -1 };
|
||||
_vector m_vector[3];
|
||||
|
||||
vector<_uint> m_iBoneMask;
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = { false };
|
||||
_bool m_bLoopRestarted = false;
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bRatio = { false };
|
||||
_bool m_bRootBone = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
_bool m_bTemp = {false};
|
||||
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 = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
_bool m_bTemp = {false};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@@ -31,6 +31,7 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
_bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
_bool SphereCast(_float fRadius, _fvector vStartPos, _gvector vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
// _bool Overlap(_float fRadius, _fvector vStartPos, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
_bool RayCast(_float3 _vStartPos, _float3 _vDir, _float fDistance, PSX::PxRaycastHit* pRayHitArray, _uint iMaxHitCapacity, _uint& iOutHitCount);
|
||||
_bool RayCast(_fvector _vStartPos, _fvector _vDir, _float fDistance, PSX::PxRaycastHit* pRayHitArray, _uint iMaxHitCapacity, _uint& iOutHitCount);
|
||||
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
|
||||
#include "Base.h"
|
||||
#include "RenderEventDebugger.h"
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class CVolumetric final : public CBase
|
||||
{
|
||||
typedef struct tagCSVolumeConstantDesc
|
||||
{
|
||||
XMUINT3 VolumeSize;
|
||||
_float fDepthPackExponent; // 깊이 비선형 분포 지수 2.0 정도
|
||||
|
||||
_float fTemporalAccum; // Temporal 사용 여부 off :0 /On: 1
|
||||
_float fFrameIndex;
|
||||
_float fNear;
|
||||
_float fFar;
|
||||
|
||||
_float3 vCameraPosition;
|
||||
_float fDensity;
|
||||
|
||||
_float fLightIntensity;
|
||||
_float3 vLightDirection;
|
||||
|
||||
_float4 vLightColor;
|
||||
|
||||
_float4x4 InvProjMatrix;
|
||||
_float4x4 InvViewMatrix;
|
||||
|
||||
_float fAsymmetryParameter;
|
||||
_float padding0;
|
||||
_float padding1;
|
||||
_float padding2;
|
||||
}CS_VOLUME_CONSTANT_DESC;
|
||||
|
||||
|
||||
private:
|
||||
CVolumetric(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual ~CVolumetric() = default;
|
||||
|
||||
public:
|
||||
HRESULT Initialize();
|
||||
void Update();
|
||||
void Cumpute_Volume();
|
||||
void Accumulate_Volume();
|
||||
HRESULT Dispatch();
|
||||
|
||||
ID3D11ShaderResourceView* Get_VolumeSRV() { return m_pAccVolumeSRV; }
|
||||
_float* Get_DepthPackExponentPtr() { return &m_fDepthPackExponent; }
|
||||
private:
|
||||
class CGameInstance* m_pGameInstance = { nullptr };
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
ID3D11DeviceContext* m_pContext = { nullptr };
|
||||
ID3D11Texture3D* m_pTexture3D = { nullptr };
|
||||
ID3D11Texture3D* m_pAccumulateTexture3D = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pVolumeSRV = {nullptr};
|
||||
ID3D11UnorderedAccessView* m_pVolumeUAV = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pAccVolumeSRV = {nullptr};
|
||||
ID3D11UnorderedAccessView* m_pAccVolumeUAV = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLightInfoBuffer = { nullptr };
|
||||
|
||||
ID3D11ComputeShader* m_pCSVolumeCalculate = { nullptr };
|
||||
ID3DBlob* m_pCSBlobCalculate = { nullptr };
|
||||
|
||||
ID3D11ComputeShader* m_pCSVolumeAccumulate = { nullptr };
|
||||
ID3DBlob* m_pCSBlobAccumulate = { nullptr };
|
||||
|
||||
_float m_fDensity = { 0.5f };
|
||||
_float m_fLightIntensity = { 1.f };
|
||||
_float m_fAsymmetryParameter = { 0.2f };
|
||||
_float m_fDepthPackExponent = { 2.f };
|
||||
|
||||
#ifdef _DEBUG
|
||||
class CRenderEventDebugger m_AnnotationHelper = {};
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
private:
|
||||
HRESULT CreateComputeShader();
|
||||
HRESULT CreateBlob();
|
||||
HRESULT CreateBuffers();
|
||||
HRESULT CreateResourceViews();
|
||||
|
||||
public:
|
||||
static CVolumetric* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual void Free();
|
||||
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity();
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
Reference in New Issue
Block a user