[remove] 맵 모델 리소스 정리
[add] MapElement 렌더링 수정
This commit is contained in:
@@ -232,10 +232,12 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
float fOcclusion = 1.f;
|
||||
float fAttenuation = 1.f;
|
||||
|
||||
float3 vFinalLightPosition = g_vLightPos.xyz + g_vLightPosOffset.xyz;
|
||||
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(g_vLightPos.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(vFinalLightPosition - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
float3 vToLight = normalize(vFinalLightPosition - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
|
||||
fAttenuation = saturate((g_fLightRange - fLightDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f)
|
||||
|
||||
@@ -264,9 +264,9 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount,_bool bRatio)
|
||||
void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop, _float fAmount, _bool bRatio)
|
||||
{
|
||||
if (m_iCurrentAnimIndex == iIndex){
|
||||
if (m_iCurrentAnimIndex == iIndex) {
|
||||
return;
|
||||
}
|
||||
if (iIndex >= 0 && iIndex < m_iNumAnimations)
|
||||
@@ -288,7 +288,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop,_float fAmount,_bool
|
||||
}
|
||||
}
|
||||
|
||||
void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex,_bool isLoop)
|
||||
void CModel::Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop)
|
||||
{
|
||||
if (m_iCurrSecondAnimIndex == iIndex) {
|
||||
return;
|
||||
@@ -326,7 +326,7 @@ void CModel::Update_RootBone(_float Amount)
|
||||
_float dy = XMVectorGetY(vDeltaAdjusted);
|
||||
_float dz = XMVectorGetZ(vDeltaAdjusted);
|
||||
|
||||
_vector vDeltaWorld = vRight * dx + (vUp * dz) + (-vLook * dy);
|
||||
_vector vDeltaWorld = vRight * dx + (vUp * dz) + (-vLook * dy);
|
||||
|
||||
vDeltaWorld *= 0.01f;
|
||||
vDeltaWorld *= Amount;
|
||||
@@ -457,7 +457,7 @@ void CModel::Set_AnimSpeed(_float fSpeed)
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(fSpeed);
|
||||
}
|
||||
|
||||
HRESULT CModel::Anim_Event(_float fRatio,_uint AnimIndex,function<void()> Event)
|
||||
HRESULT CModel::Anim_Event(_float fRatio, _uint AnimIndex, function<void()> Event)
|
||||
{
|
||||
if (AnimIndex == m_iCurrentAnimIndex)
|
||||
{
|
||||
@@ -1308,7 +1308,7 @@ HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _
|
||||
m_eType = eType;
|
||||
|
||||
LoadData(pModelFilePath);
|
||||
|
||||
|
||||
m_pSaveModel = m_pGameInstance->Load_SaveModel(pModelFilePath);
|
||||
|
||||
LoadAdditionalAnimations(pModelFilePath);
|
||||
@@ -1611,9 +1611,9 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
m_pTransform = m_pOwner->Get_Component<CTransform>();
|
||||
SAFE_ADDREF(m_pTransform);
|
||||
|
||||
|
||||
|
||||
if (m_eType == MODEL::ANIM)
|
||||
{
|
||||
{
|
||||
Initialize_RootBone();
|
||||
InItialize_BoneIndex();
|
||||
Initialize_BoneMasks();
|
||||
@@ -1633,7 +1633,7 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
Create_ParentVB();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1696,7 +1696,7 @@ HRESULT CModel::Ready_Animations(const vector<CBone*>& Bones)
|
||||
|
||||
for (size_t i = 0; i < m_iNumAnimations; i++)
|
||||
{
|
||||
CAnimation* pAnimation = CAnimation::Create(Bones,this, &m_pSaveModel->Animations[i]);
|
||||
CAnimation* pAnimation = CAnimation::Create(Bones, this, &m_pSaveModel->Animations[i]);
|
||||
if (nullptr == pAnimation)
|
||||
return E_FAIL;
|
||||
|
||||
@@ -1790,7 +1790,7 @@ void CModel::Describe_Entity()
|
||||
|
||||
_string name = {};
|
||||
for (_uint i = 0; i < m_iNumAnimations; ++i) {
|
||||
|
||||
|
||||
name.clear();
|
||||
name.append(m_Animations[i]->Get_SZName());
|
||||
|
||||
@@ -1800,7 +1800,7 @@ void CModel::Describe_Entity()
|
||||
name = name.substr(pos);
|
||||
name = to_string(i) + '\t' + name + '\n';
|
||||
name.shrink_to_fit();
|
||||
WriteFile(hFile, name.data(),(DWORD) name.length(), nullptr, nullptr);
|
||||
WriteFile(hFile, name.data(), (DWORD)name.length(), nullptr, nullptr);
|
||||
}
|
||||
|
||||
CloseHandle(hFile);
|
||||
|
||||
@@ -18,6 +18,7 @@ class ENGINE_DLL CLight final : public CComponent
|
||||
public:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
const LIGHT_DESC* Get_LightDesc() { return &m_LightDesc; }
|
||||
void Set_Color(_float4& vDiffuse, _float4& vAmbient, _float4& vSpecular);
|
||||
|
||||
@@ -25,8 +25,8 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
public:
|
||||
#pragma region Model
|
||||
_float Get_Radius() const { return m_fRadius; }
|
||||
_float3& Get_RadiusOffset() { return m_vRadiusOffset; }
|
||||
_float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
|
||||
_float3& Get_RadiusOffset() { return m_vRadiusOffset; }
|
||||
_float4x4* Get_PreTransformMatrixPtr() { return &m_PreTransformMatrix; }
|
||||
_float4x4 Get_PreTransformMatrix() const { return m_PreTransformMatrix; };
|
||||
virtual HRESULT Render(_uint iMeshIndex);
|
||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
@@ -36,7 +36,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_bool Play_Anim(_float fTimeDelta, CTransform* pTransform);
|
||||
_bool Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform);
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false);
|
||||
void Set_Second_AnimationIndex(_uint iIndex,_uint BoneIndex,_bool isLoop = false);
|
||||
void Set_Second_AnimationIndex(_uint iIndex, _uint BoneIndex, _bool isLoop = false);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
_bool IsFinishedSecondAnim() const { return m_bIsSecondFinishedAnim; }
|
||||
_bool IsLoopAnim() const { return m_bIsLoop; }
|
||||
@@ -58,29 +58,29 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
#pragma region Mesh
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount =1.f);
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
#pragma endregion
|
||||
#pragma region Bone
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
|
||||
void Initialize_BoneMasks();
|
||||
void Initialize_BoneMasks();
|
||||
|
||||
public:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -144,10 +144,10 @@ void Combined_BoneMatrix();
|
||||
class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼
|
||||
|
||||
_float m_fRatio = {};
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = {-1,-1,-1,-1,-1,-1};
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 };
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
vector<vector<_uint>> m_BoneMask;
|
||||
|
||||
|
||||
@@ -175,26 +175,26 @@ void Combined_BoneMatrix();
|
||||
#pragma region Compute
|
||||
|
||||
private:
|
||||
HRESULT Create_ParentVB();
|
||||
HRESULT Create_CS();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
void Create_Con();
|
||||
void UpdateAnimationCS(_uint AnimIndex);
|
||||
HRESULT Create_ParentVB();
|
||||
HRESULT Create_CS();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
void Create_Con();
|
||||
void UpdateAnimationCS(_uint AnimIndex);
|
||||
|
||||
_uint m_iNumBuffer = {};
|
||||
_uint m_iNumBuffer = {};
|
||||
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = {nullptr};
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = { nullptr };
|
||||
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user