[add] Camera_Debug

This commit is contained in:
kimnuri
2026-02-09 20:33:53 +09:00
parent 87aac428da
commit e5e3f2ddcd
10 changed files with 129 additions and 89 deletions
@@ -130,11 +130,18 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
if (FAILED(m_pGameInstance->IsBinded_Camera(CAMERA_SHOULDER))) {
return;
}
#ifdef _DEBUG
Describe_Entity();
#endif // _DEBUG
#ifdef RELEASE_DEBUGGER
static _bool m_bRenderSystem = false;
if (m_pGameInstance->Key_Up(DIK_F6)) {
m_bRenderSystem = !m_bRenderSystem;
}
if (true == m_bRenderSystem) {
Describe_Entity();
}
#endif // RELEASE_DEBUGGER
#ifndef _DEBUG
#ifndef DEBUG_CAMERAS
if (dynamic_cast<CPlayer*>(m_pOwner)->Get_UIState() == UI_STATE::GAMEPLAYER)
{
m_bMovable = true;
@@ -142,6 +149,7 @@ void CCamPosition_Shoulder::Update(_float fTimeDelta)
else {
m_bMovable = false;
}
#endif // DEBUG_CAMERAS
#endif // _DEBUG
if (m_pGameInstance->Key_Up(DIK_PGDN)) {
@@ -207,10 +215,30 @@ void CCamPosition_Shoulder::Late_Update(_float fTimeDelta)
}
m_pGameInstance->Add_RenderGroup(RENDER::UI_OVERLAY, this);
}
#ifdef DEBUG_CAMERAS
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
#endif // DEBUG_CAMERAS
}
HRESULT CCamPosition_Shoulder::Render()
{
RENDER eType = m_pGameInstance->Get_CurrentRenderPass();
if (RENDER::NONLIGHT == eType) {
m_Batch->Begin();
_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x0000ff, 1.f);
if (m_bRenderLookPos) {
m_pSubShape->Draw(m_pLookTransform->Get_XMWorldMatrix(), ViewMatrix, ProjMatrix, vColor, nullptr, true);
}
if (m_bRenderHeadPos) {
vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0xff0000, 1.f);
_vector vDestPos = Calc_DampingParentPos();
_vector vHeadPos = vDestPos + XMVectorSet(0.f, m_fHeadHeight, 0.f, 0.f);
m_pSubShape->Draw(XMMatrixTranslationFromVector(vHeadPos), ViewMatrix, ProjMatrix, vColor, nullptr, true);
}
m_Batch->End();
}
return S_OK;
}
@@ -278,7 +306,23 @@ _vector CCamPosition_Shoulder::Calc_BestPosition(_fvector vCastingPosition, _gve
_bool bHit = m_pGameInstance->SphereCast(0.25f, vCastingPosition, vCastingDirection, fZeroSafeDistance,
PSX::PxHitFlag::eDEFAULT, PSX::PxQueryFlag::eSTATIC/*|PSX::PxQueryFlag::eDYNAMIC*/, m_BufferHit);
// 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋
static _float fCameraSurfaceOffset = 0.20f; // 높이면 카메라가 벽으로부터 좀 더 안정적으로 띄워지지만 벽에 바짝 붙은 플레이어를 감당불가
static _float fCameraMinDistance = 0.71f; // 높이면
#ifdef DEBUG_CAMERAS
GUI::Begin("CAMERA");
if (GUI::TreeNode("MinSurfaceOffset")) {
GUI::DragFloat("fMinDistance", &fCameraMinDistance, 0.01f, 0.01f, 1.f);
GUI::DragFloat("fSurfaceOffset", &fCameraSurfaceOffset, 0.01f, 0.01f, 1.f);
GUI::TreePop();
}
GUI::End();
#endif // DEBUG_CAMERAS
if (false == bHit) {
m_fFocalRatioTargetValue = m_vFocalRatio.y;
return vCastingPosition + vCastingDirection * fZeroSafeDistance;
}
@@ -299,20 +343,6 @@ _vector CCamPosition_Shoulder::Calc_BestPosition(_fvector vCastingPosition, _gve
}
CMyTools::SortHitsByDistance(sweepHits);
// 벽면에서 팔로우 타겟을 살짝 띄우는 오프셋
static _float fCameraSurfaceOffset = 0.20f; // 높이면 카메라가 벽으로부터 좀 더 안정적으로 띄워지지만 벽에 바짝 붙은 플레이어를 감당불가
static _float fCameraMinDistance = 0.71f; // 높이면
#ifdef _DEBUG
GUI::Begin("CAMERA");
if (GUI::TreeNode("MinSurfaceOffset")) {
GUI::DragFloat("fCameraMinDistance", &fCameraMinDistance, 0.01f, 0.01f, 1.f);
GUI::DragFloat("fCameraSurfaceOffset", &fCameraSurfaceOffset, 0.01f, 0.01f, 1.f);
GUI::TreePop();
}
GUI::End();
#endif // _DEBUG
_float fDistance = { };
_float fFinalTargetDistance = fZeroSafeDistance;
@@ -468,6 +498,10 @@ HRESULT CCamPosition_Shoulder::Ready_SubParts()
return E_FAIL;
}
#ifdef DEBUG_CAMERAS
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.25f, 12, false, false));
m_Batch = make_unique<PrimitiveBatch<VertexPositionColor>>(m_pContext);
#endif // DEBUG_CAMERAS
return S_OK;
}
@@ -503,7 +537,7 @@ void CCamPosition_Shoulder::Free()
SAFE_RELEASE(m_pTarget_LookPart);
SAFE_RELEASE(m_pTarget_FollowPart);
}
#ifdef _DEBUG
#ifdef RELEASE_DEBUGGER
void CCamPosition_Shoulder::Describe_Entity()
{
@@ -512,16 +546,19 @@ void CCamPosition_Shoulder::Describe_Entity()
m_pTransformCom->Describe_Entity();
GUI::PushItemWidth(IMGUI_GLOBAL_ITEM_WIDTH);
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::Text("%.2f", XMConvertToDegrees(m_pBinded_Camera->Get_Fov()));
GUI::SliderFloat("FollowTarget_IncludedAngle", &m_fFollowTargetIncludedAngleDegree, -360.f, 360.f, "%.1f");
GUI::SliderFloat("CameraBackToFrontRatio", &m_fDefaultCameraBackToFrontRatio, -1.f, 1.f);
GUI::SliderFloat("FocalRatio", &m_vFocalRatio.x, 0.f, 1.f);
GUI::SliderFloat("CameraFowardDistance", &m_fCameraFowardDistance, 0.f, 4.f);
GUI::Text("FOV %.2f", XMConvertToDegrees(m_pBinded_Camera->Get_Fov()));
GUI::Checkbox("RenderLookPos", &m_bRenderLookPos);
GUI::Checkbox("RenderHeadPos", &m_bRenderHeadPos);
#ifdef _DEBUG
GUI::Text("%d", m_bSpellFovLerp);
GUI::SliderFloat3("m_vSpellFovLerpTimer", (_float*)&m_vSpellFovLerpTimer, 0.f, 5.f);
GUI::SliderFloat3("m_vSpellFovLerpDegree", (_float*)&m_vSpellFovLerpDegree, 1.f, 60.f);
GUI::SliderFloat3("m_vSpellFovLerpTimer", (_float*)&m_vSpellFovLerpTimer, 0.f, 5.f);
GUI::SliderFloat3("m_vSpellFovLerpDegree", (_float*)&m_vSpellFovLerpDegree, 1.f, 60.f);
if (GUI::TreeNode("AnimList")) {
for (_int i = 0; i < m_pModelCom->Get_AnimSize(); i++)
{
@@ -534,9 +571,10 @@ void CCamPosition_Shoulder::Describe_Entity()
GUI::TreePop();
}
#endif // _DEBUG
m_pBinded_Camera->Describe_Entity();
}
GUI::End();
}
#endif // _DEBUG
#endif // RELEASE_DEBUGGER
@@ -44,18 +44,13 @@ void CCamera_Cinematic::Update(_float fTimeDelta)
}
void CCamera_Cinematic::Late_Update(_float fTimeDelta)
{
if (false == m_bActive) {
#ifdef _DEBUG
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
#endif // _DEBUG
return;
}
else {
}
#ifdef DEBUG_CAMERAS
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
#endif // DEBUG_CAMERAS
}
HRESULT CCamera_Cinematic::Render() {
#ifdef _DEBUG
#ifdef DEBUG_CAMERAS
if (FAILED(Bind_ShaderResources())) {
return E_FAIL;
}
@@ -96,7 +91,7 @@ HRESULT CCamera_Cinematic::Render() {
}
#endif // _DEBUG
#endif // DEBUG_CAMERAS
return S_OK;
}
@@ -253,11 +248,11 @@ HRESULT CCamera_Cinematic::Initialize(void* pArg)
}
#ifdef _DEBUG
#ifdef DEBUG_CAMERAS
m_pSubShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.25f, 12, false, false));
m_Batch = make_unique<PrimitiveBatch<VertexPositionColor>>(m_pContext);
#endif // _DEBUG
#endif // DEBUG_CAMERAS
return S_OK;
}
HRESULT CCamera_Cinematic::Ready_Components(void* pArg)
@@ -265,7 +260,7 @@ HRESULT CCamera_Cinematic::Ready_Components(void* pArg)
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
#ifdef _DEBUG
#ifdef DEBUG_CAMERAS
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Camera_Model"),
reinterpret_cast<CComponent**>(&m_pModelCom)))) {
return E_FAIL;
@@ -276,7 +271,7 @@ HRESULT CCamera_Cinematic::Ready_Components(void* pArg)
reinterpret_cast<CComponent**>(&m_pShaderCom)))) {
return E_FAIL;
}
#endif // _DEBUG
#endif // DEBUG_CAMERAS
return S_OK;
}
@@ -299,7 +294,7 @@ HRESULT CCamera_Cinematic::Ready_SubPart()
HRESULT CCamera_Cinematic::Bind_ShaderResources()
{
#ifdef _DEBUG
#ifdef DEBUG_CAMERAS
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
return E_FAIL;
}
@@ -312,7 +307,7 @@ HRESULT CCamera_Cinematic::Bind_ShaderResources()
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
return E_FAIL;
}
#endif // _DEBUG
#endif // DEBUG_CAMERAS
return S_OK;
}
@@ -93,9 +93,11 @@ void CCamera_Debug::Priority_Update(_float fTimeDelta)
void CCamera_Debug::Update(_float fTimeDelta)
{
#ifdef _DEBUG
#ifdef RELEASE_DEBUGGER
#ifdef DEBUG_CAMERAS
Describe_Entity();
#endif // _DEBUG
#endif // DEBUG_CAMERAS
#endif // RELEASE_DEBUGGER
}
void CCamera_Debug::Late_Update(_float fTimeDelta)
@@ -183,11 +185,12 @@ void CCamera_Debug::Free()
{
__super::Free();
}
#ifdef _DEBUG
#ifdef RELEASE_DEBUGGER
void CCamera_Debug::Describe_Entity()
{
_float3 vPosition = {};
#ifdef _DEBUG
GUI::Begin("PickingPos");
if (m_pGameInstance->Key_Pressing(DIK_Y))
{
@@ -197,6 +200,7 @@ void CCamera_Debug::Describe_Entity()
}
}
GUI::End();
#endif // _DEBUG
GUI::Begin("CAMERA");
_int iPriority = m_iPriority;
size_t iAddress = (size_t)this;
@@ -214,4 +218,4 @@ void CCamera_Debug::Describe_Entity()
GUI::End();
}
#endif // _DEBUG
#endif // RELEASE_DEBUGGER
+22 -27
View File
@@ -53,10 +53,6 @@ void CCamera_Gaze::Update(_float fTimeDelta)
}
Transition(fTimeDelta);
Update_LerpTimer(fTimeDelta);
#ifdef _DEBUG
Describe_Entity();
#endif // _DEBUG
}
void CCamera_Gaze::Update_LerpTimer(Engine::_float fTimeDelta)
@@ -242,7 +238,7 @@ void CCamera_Gaze::Free()
__super::Free();
}
#ifdef _DEBUG
#ifdef RELEASE_DEBUGGER
void CCamera_Gaze::Describe_Entity()
{
@@ -259,32 +255,31 @@ void CCamera_Gaze::Describe_Entity()
m_fFovy = XMConvertToRadians(fFovYDegree);
}
m_pTransformCom->Describe_Entity();
GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z);
GUI::Text("LOOK_DST %.2f, %.2f, %.2f", m_vLookPos_Dest.x, m_vLookPos_Dest.y, m_vLookPos_Dest.z);
GUI::Text("FOLLOW_SRC %.2f, %.2f, %.2f", m_vFollowPos_Src.x, m_vFollowPos_Src.y, m_vFollowPos_Src.z);
GUI::Text("FOLLOW_DST %.2f, %.2f, %.2f", m_vFollowPos_Dest.x, m_vFollowPos_Dest.y, m_vFollowPos_Dest.z);
//GUI::Text("LOOK_SRC %.2f, %.2f, %.2f", m_vLookPos_Src.x, m_vLookPos_Src.y, m_vLookPos_Src.z);
//GUI::Text("LOOK_DST %.2f, %.2f, %.2f", m_vLookPos_Dest.x, m_vLookPos_Dest.y, m_vLookPos_Dest.z);
//GUI::Text("FOLLOW_SRC %.2f, %.2f, %.2f", m_vFollowPos_Src.x, m_vFollowPos_Src.y, m_vFollowPos_Src.z);
//GUI::Text("FOLLOW_DST %.2f, %.2f, %.2f", m_vFollowPos_Dest.x, m_vFollowPos_Dest.y, m_vFollowPos_Dest.z);
GUI::DragFloat2("VerticalAngle", (_float*)&m_vAccRotDegree_VerticalLocks, 1.f, 0.f, 89.f);
GUI::Checkbox("TransitionLerp", &m_bEnable_TransitionLerp);
if (true == m_bEnable_TransitionLerp) {
GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vTransitionTime.x, m_vTransitionTime.y);
GUI::SliderFloat("TranslationTime", &m_vTransitionTime.y, 0.1f, 3.f, "%.1f");
}
//GUI::DragFloat2("VerticalAngle", (_float*)&m_vAccRotDegree_VerticalLocks, 1.f, 0.f, 89.f);
//GUI::Checkbox("TransitionLerp", &m_bEnable_TransitionLerp);
//if (true == m_bEnable_TransitionLerp) {
// GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vTransitionTime.x, m_vTransitionTime.y);
// GUI::SliderFloat("TranslationTime", &m_vTransitionTime.y, 0.1f, 3.f, "%.1f");
//}
GUI::Checkbox("LookLerp", &m_bEnable_LookLerp);
if (true == m_bEnable_LookLerp) {
GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vLookLerpTime.x, m_vLookLerpTime.y);
GUI::SliderFloat("LookTime", &m_vLookLerpTime.y, 0.1f, 3.f, "%.1f");
}
GUI::Checkbox("FollowLerp", &m_bEnable_FollowLerp);
if (true == m_bEnable_FollowLerp) {
GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vFollowLerpTime.x, m_vFollowLerpTime.y);
GUI::SliderFloat("FollowTime", &m_vFollowLerpTime.y, 0.1f, 3.f, "%.1f");
}
//GUI::Checkbox("LookLerp", &m_bEnable_LookLerp);
//if (true == m_bEnable_LookLerp) {
// GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vLookLerpTime.x, m_vLookLerpTime.y);
// GUI::SliderFloat("LookTime", &m_vLookLerpTime.y, 0.1f, 3.f, "%.1f");
//}
//GUI::Checkbox("FollowLerp", &m_bEnable_FollowLerp);
//if (true == m_bEnable_FollowLerp) {
// GUI::SameLine(); GUI::Text("Translation : %.1f %.1f", m_vFollowLerpTime.x, m_vFollowLerpTime.y);
// GUI::SliderFloat("FollowTime", &m_vFollowLerpTime.y, 0.1f, 3.f, "%.1f");
//}
}
GUI::End();
}
#endif // _DEBUG
#endif // RELEASE_DEBUGGER
@@ -228,9 +228,11 @@ HRESULT CPlayer::Behavior_IdleExitCheck(_float fTimeDelta)
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
#ifndef DEBUG_SHADOW
#ifndef DEBUG_CAMERAS
else if (m_pGameInstance->Mouse_Down(DIM_LBUTTON)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
}
#endif // !DEBUG_CAMERAS
#endif // !DEBUG_SHADOW
else if (m_pGameInstance->Key_Down(DIK_V)) {
m_pFSM->Change_State(FSMSTATE::COMBAT);
@@ -96,15 +96,20 @@ class CCamPosition_Shoulder final : public CCamPosition
CCamPosition_Target* m_pTarget_FollowPart = { nullptr };
class CCamera_Gaze* m_pBinded_Camera = { nullptr };
class CModel* m_pModelCom = { nullptr };
#ifdef DEBUG_CAMERAS
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
unique_ptr<PrimitiveBatch<VertexPositionColor>> m_Batch = { nullptr };
_bool m_bRenderHeadPos = { false };
_bool m_bRenderLookPos = { false };
#endif // DEBUG_CAMERAS
public:
static CCamPosition_Shoulder* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CCamPosition_Shoulder* Clone(void* pArg, class CGameObject* pOWner) override;
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#endif // _DEBUG
#ifdef RELEASE_DEBUGGER
void Describe_Entity();
#endif // RELEASE_DEBUGGER
};
@@ -91,12 +91,12 @@ class CCamera_Cinematic final : public CCamera
_float2 m_vCameraShakeTimer = { 0.f, TIMER_SHORT_LERP };
_float m_fCameraShakeTime = TIMER_SHORT_LERP;
_float m_fCameraShakeIntense = 5.f;
#ifdef _DEBUG
#ifdef DEBUG_CAMERAS
unique_ptr<GeometricPrimitive> m_pSubShape = { nullptr };
unique_ptr<PrimitiveBatch<VertexPositionColor>> m_Batch = { nullptr };
class CModel* m_pModelCom = { nullptr };
class CShader* m_pShaderCom = { nullptr };
#endif // _DEBUG
#endif // DEBUG_CAMERAS
public:
static CCamera_Cinematic* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+3 -3
View File
@@ -40,9 +40,9 @@ class CCamera_Debug final : public CCamera
static CCamera_Debug* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner) override;
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#endif // _DEBUG
#ifdef RELEASE_DEBUGGER
void Describe_Entity();
#endif // RELEASE_DEBUGGER
};
+3 -3
View File
@@ -48,10 +48,10 @@ class CCamera_Gaze final : public CCamera
virtual void Free() override;
#ifdef _DEBUG
void Describe_Entity() override;
#ifdef RELEASE_DEBUGGER
void Describe_Entity();
#endif // _DEBUG
#endif // RELEASE_DEBUGGER
};
NS_END
+2 -1
View File
@@ -25,7 +25,8 @@
#ifdef 기무리
//#define DEBUG_MOTIONBLUR
//#define DEBUG_SSAO
#define DEBUG_SHADOW
//#define DEBUG_SHADOW
#define DEBUG_CAMERAS
#endif // 기무리