[add] MapContainerObject
[add] MapPartObject
This commit is contained in:
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Land>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Ext_Awning_Trim.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Ext_DoorFrameSide.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_MERGED_Entry_Base_Stones.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_MERGED_Side_Stone_Steps.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Icicles.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_MERGED_Winter_Kit_Snow.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Roof_Debris_A_Decal.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Roof_Debris_B_Decal.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Roof_Snow_Winter.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Window_Glass.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Wood_Steps_B.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_Wood_Steps_C.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_walls.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_wood_A.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_wood_B.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_wood_Stairs.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_windows.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_walls.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
<Model>
|
||||
<PrototypeTag>Prototype_GameObject_SM_HM_3Broom_int_Stairs_Upper_Floors.mo</PrototypeTag>
|
||||
<Position x="0" y="0" z="0"/>
|
||||
<Scale x="1" y="1" z="1"/>
|
||||
<Rotation x="0" y="0" z="0"/>
|
||||
</Model>
|
||||
</Land>
|
||||
@@ -0,0 +1,100 @@
|
||||
#include "pch.h"
|
||||
#include "BuildingContainer.h"
|
||||
#include "PartObject.h"
|
||||
|
||||
CBuildingContainer::CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CMapContainer(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CBuildingContainer::CBuildingContainer(const CBuildingContainer& rhs)
|
||||
:CMapContainer(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
void CBuildingContainer::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CBuildingContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CBuildingContainer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Render()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CBuildingContainer::Bind_ShaderResources()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CBuildingContainer* CBuildingContainer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CBuildingContainer* pInstance = new CBuildingContainer(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CBuildingContainer");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CBuildingContainer::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CBuildingContainer* pInstance = new CBuildingContainer(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CBuildingContainer");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CBuildingContainer::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
|
||||
void CBuildingContainer::Describe_Entity()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
#include "pch.h"
|
||||
#include "MapContainer.h"
|
||||
#include "PartObject.h"
|
||||
|
||||
CMapContainer::CMapContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CContainerObject(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CMapContainer::CMapContainer(const CMapContainer& rhs)
|
||||
:CContainerObject(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CMapContainer::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapContainer::Initialize(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapContainer::Ready_Components(void* pArg)
|
||||
{
|
||||
if (FAILED(__super::Ready_Components(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMapContainer::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Priority_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CMapContainer::Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Update(fTimeDelta);
|
||||
}
|
||||
|
||||
void CMapContainer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
HRESULT CMapContainer::Render()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMapContainer::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
#include "pch.h"
|
||||
#include "MapObject_LOD.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
#include "DebugCamera.h"
|
||||
#include "Layer.h"
|
||||
#include "Terrain.h"
|
||||
#include "VIBuffer_Terrain.h"
|
||||
|
||||
CMapObject_LOD::CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CMapObject(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CMapObject_LOD::CMapObject_LOD(const CMapObject_LOD& Prototype)
|
||||
: CMapObject(Prototype), m_iLodIndex{ 0 }
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Initialize(void* pArg)
|
||||
{
|
||||
MAPOBJECT_LOD_DESC* pDesc = static_cast<MAPOBJECT_LOD_DESC*>(pArg);
|
||||
|
||||
m_iMaxLodLevel = pDesc->iMaxLodLevel;
|
||||
|
||||
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
|
||||
{
|
||||
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
|
||||
}
|
||||
|
||||
if (FAILED(__super::Initialize(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Ready_Components()))
|
||||
return E_FAIL;
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_bSelected = false;
|
||||
m_vPosition = _float3(0.f, 0.f, 0.f);
|
||||
m_vRotation = _float3(0.f, 0.f, 0.f);
|
||||
m_vScale = _float3(1.f, 1.f, 1.f);
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bSelected = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Update(_float fTimeDelta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (m_bSelected)
|
||||
{
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
|
||||
m_pTransformCom->Set_Scale(m_vScale);
|
||||
m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z));
|
||||
}
|
||||
#endif
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Render()
|
||||
{
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
_uint iNumMeshes = m_pModelComs[0]->Get_NumMeshes();
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_wstring CMapObject_LOD::Get_PrototypeTag(_uint iLodIndex)
|
||||
{
|
||||
if (m_iMaxLodLevel < iLodIndex)
|
||||
return m_ModelPrototypeTags[0];
|
||||
|
||||
return m_ModelPrototypeTags[iLodIndex];
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Add_LodModel(const _tchar* pModelPrototypeTag)
|
||||
{
|
||||
CModel* pModel = { nullptr };
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pModelPrototypeTag,
|
||||
reinterpret_cast<CComponent**>(&pModel))))
|
||||
return E_FAIL;
|
||||
|
||||
++m_iMaxLodLevel;
|
||||
m_pModelComs.push_back(pModel);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Ready_Components()
|
||||
{
|
||||
__super::Ready_Components();
|
||||
|
||||
for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i)
|
||||
{
|
||||
CModel* pModel = { nullptr };
|
||||
|
||||
/* Com_Model */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_ModelPrototypeTags[i],
|
||||
reinterpret_cast<CComponent**>(&pModel))))
|
||||
return E_FAIL;
|
||||
|
||||
m_pModelComs.push_back(pModel);
|
||||
}
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_LOD::Bind_ShaderResources()
|
||||
{
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CMapObject_LOD* CMapObject_LOD::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CMapObject_LOD* pInstance = new CMapObject_LOD(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMapObject_LOD");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CMapObject_LOD::Clone(void* pArg, CGameObject * pOwner)
|
||||
{
|
||||
CMapObject_LOD* pInstance = new CMapObject_LOD(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CMapObject_LOD");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
|
||||
for(auto& pModel : m_pModelComs)
|
||||
Safe_Release(pModel);
|
||||
m_pModelComs.clear();
|
||||
}
|
||||
|
||||
void CMapObject_LOD::Describe_Entity()
|
||||
{
|
||||
if (m_bDead)
|
||||
return;
|
||||
if (nullptr == m_pGameInstance)
|
||||
return;
|
||||
|
||||
GUI::Text(CMyTools::ToString(m_ModelPrototypeTags[m_iLodIndex]).c_str());
|
||||
GUI::InputInt("Lod Level", (_int*)(&m_iLodIndex));
|
||||
m_iLodIndex = max(0, m_iLodIndex);
|
||||
m_iLodIndex = min(m_iMaxLodLevel, m_iLodIndex);
|
||||
GUI::Text("----- Transfrom ----");
|
||||
GUI::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f);
|
||||
GUI::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f);
|
||||
GUI::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f);
|
||||
|
||||
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
|
||||
{
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GUI::Text("----- Rotation ----");
|
||||
GUI::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f);
|
||||
GUI::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f);
|
||||
GUI::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f);
|
||||
|
||||
GUI::Text("----- Scale ----");
|
||||
GUI::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f);
|
||||
GUI::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f);
|
||||
GUI::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f);
|
||||
|
||||
m_vScale.x = max(0.01f, m_vScale.x);
|
||||
m_vScale.y = max(0.01f, m_vScale.y);
|
||||
m_vScale.z = max(0.01f, m_vScale.z);
|
||||
|
||||
|
||||
if (GUI::Button("Delete"))
|
||||
m_bDead = true;
|
||||
|
||||
m_bSelected = true;
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
#include "pch.h"
|
||||
#include "MapObject_Static.h"
|
||||
|
||||
#include "GameInstance.h"
|
||||
#include "DebugCamera.h"
|
||||
#include "Layer.h"
|
||||
#include "Terrain.h"
|
||||
#include "VIBuffer_Terrain.h"
|
||||
|
||||
CMapObject_Static::CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CMapObject(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CMapObject_Static::CMapObject_Static(const CMapObject_Static& Prototype)
|
||||
: CMapObject(Prototype)
|
||||
{
|
||||
}
|
||||
|
||||
void CMapObject_Static::Priority_Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_bSelected = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CMapObject_Static::Update(_float fTimeDelta)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CMapObject_Static::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if (m_bSelected)
|
||||
{
|
||||
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
|
||||
m_pTransformCom->Set_Scale(m_vScale);
|
||||
m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z));
|
||||
}
|
||||
#endif
|
||||
|
||||
_float4 vPos;
|
||||
XMStoreFloat4(&vPos, Get_WorldPostion());
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this, vPos, 20.f);
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Static::Render()
|
||||
{
|
||||
if (FAILED(Bind_ShaderResources())) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
|
||||
|
||||
for (_uint i = 0; i < iNumMeshes; i++)
|
||||
{
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Static::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Static::Initialize(void* pArg)
|
||||
{
|
||||
MAPOBJECT_STATIC_DESC* pDesc = static_cast<MAPOBJECT_STATIC_DESC*>(pArg);
|
||||
|
||||
m_strModelPrototypeTag = pDesc->pModelPrototypeTag;
|
||||
|
||||
if (FAILED(__super::Initialize(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Ready_Components()))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_bSelected = false;
|
||||
m_vPosition = _float3(0.f, 0.f, 0.f);
|
||||
m_vRotation = _float3(0.f, 0.f, 0.f);
|
||||
m_vScale = _float3(1.f, 1.f, 1.f);
|
||||
#endif // _DEBUG
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_wstring CMapObject_Static::Get_PrototypeTag(_uint iLodIndex)
|
||||
{
|
||||
return m_strModelPrototypeTag;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Static::Ready_Components()
|
||||
{
|
||||
__super::Ready_Components();
|
||||
|
||||
/* Com_Model */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag,
|
||||
reinterpret_cast<CComponent**>(&m_pModelCom))))
|
||||
return E_FAIL;
|
||||
|
||||
/* Com_Shader */
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
|
||||
reinterpret_cast<CComponent**>(&m_pShaderCom))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Static::Bind_ShaderResources()
|
||||
{
|
||||
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_bRimLight", &m_bRimLight, sizeof(_bool)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimStrength", &m_fRimLightStrength, sizeof(_float)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_fRimPower", &m_fRimLightPower, sizeof(_float)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
//if (FAILED(m_pShaderCom->Bind_RawValue("g_vRimColor", &m_vRimLightColor, sizeof(_float3)))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
CMapObject_Static* CMapObject_Static::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CMapObject_Static* pInstance = new CMapObject_Static(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CMapObject_Static");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CGameObject* CMapObject_Static::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CMapObject_Static* pInstance = new CMapObject_Static(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CMapObject_Static");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CMapObject_Static::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
Safe_Release(m_pShaderCom);
|
||||
Safe_Release(m_pModelCom);
|
||||
}
|
||||
|
||||
void CMapObject_Static::Describe_Entity()
|
||||
{
|
||||
if (m_bDead)
|
||||
return;
|
||||
if (nullptr == m_pGameInstance)
|
||||
return;
|
||||
|
||||
//ImGui::Text(CMyTools::ToString(m_strModelPrototypeTag).c_str());
|
||||
ImGui::Text("----- Transfrom ----");
|
||||
ImGui::InputFloat("X##Position", &m_vPosition.x, 0.1f, 1.f);
|
||||
ImGui::InputFloat("Y##Position", &m_vPosition.y, 0.1f, 1.f);
|
||||
ImGui::InputFloat("Z##Position", &m_vPosition.z, 0.1f, 1.f);
|
||||
|
||||
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
|
||||
{
|
||||
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object<CTerrain>();
|
||||
if (nullptr != pTerrain)
|
||||
{
|
||||
pTerrain->Get_Component<CVIBuffer_Terrain>()->Picking(pTerrain->Get_Component<CTransform>(), m_vPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ImGui::Text("----- Rotation ----");
|
||||
ImGui::InputFloat("X##Rotation", &m_vRotation.x, 10.f, 45.f);
|
||||
ImGui::InputFloat("Y##Rotation", &m_vRotation.y, 10.f, 45.f);
|
||||
ImGui::InputFloat("Z##Rotation", &m_vRotation.z, 10.f, 45.f);
|
||||
|
||||
ImGui::Text("----- Scale ----");
|
||||
ImGui::InputFloat("X##Scale", &m_vScale.x, 0.1f, 1.f);
|
||||
ImGui::InputFloat("Y##Scale", &m_vScale.y, 0.1f, 1.f);
|
||||
ImGui::InputFloat("Z##Scale", &m_vScale.z, 0.1f, 1.f);
|
||||
|
||||
m_vScale.x = max(0.01f, m_vScale.x);
|
||||
m_vScale.y = max(0.01f, m_vScale.y);
|
||||
m_vScale.z = max(0.01f, m_vScale.z);
|
||||
|
||||
|
||||
if (ImGui::Button("Delete"))
|
||||
m_bDead = true;
|
||||
|
||||
m_bSelected = true;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "MapContainer.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CBuildingContainer final : public CMapContainer
|
||||
{
|
||||
public:
|
||||
CBuildingContainer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CBuildingContainer(const CBuildingContainer& rhs);
|
||||
~CBuildingContainer() = 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;
|
||||
|
||||
public:
|
||||
template<typename T>
|
||||
HRESULT Add_Part(const _string& strPartKey, _uint iPrototypeLevelIndex, T** ppOut, void* pArg = nullptr) {
|
||||
return Add_PartObject<T>(strPartKey, iPrototypeLevelIndex, ppOut, pArg);
|
||||
}
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
virtual HRESULT Bind_ShaderResources()override;
|
||||
|
||||
public:
|
||||
static CBuildingContainer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner = nullptr)override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity()override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "ContainerObject.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CMapContainer abstract : public CContainerObject
|
||||
{
|
||||
public:
|
||||
CMapContainer(ID3D11Device * pDevice, ID3D11DeviceContext * pContext);
|
||||
CMapContainer(const CMapContainer& rhs);
|
||||
~CMapContainer() = 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;
|
||||
|
||||
protected:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual HRESULT Ready_Components(void* pArg) override;
|
||||
|
||||
public:
|
||||
virtual void Free() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CMapObject_LOD final : public CMapObject
|
||||
{
|
||||
public:
|
||||
typedef struct tagMapObjectLodDesc : public PARTOBJECT_DESC
|
||||
{
|
||||
_uint iMaxLodLevel{};
|
||||
vector<const _tchar*> ModelPrototypeTags;
|
||||
}MAPOBJECT_LOD_DESC;
|
||||
|
||||
private:
|
||||
CMapObject_LOD(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CMapObject_LOD(const CMapObject_LOD& Prototype);
|
||||
virtual ~CMapObject_LOD() = default;
|
||||
|
||||
public:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
virtual void Priority_Update(_float fTimeDelta) override;
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
public:
|
||||
virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0);
|
||||
HRESULT Add_LodModel(const _tchar* pModelPrototypeTag);
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
vector<CModel*> m_pModelComs = { nullptr };
|
||||
|
||||
_uint m_iMaxLodLevel = {};
|
||||
_uint m_iLodIndex = {};
|
||||
|
||||
vector<_wstring> m_ModelPrototypeTags;
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
|
||||
public:
|
||||
static CMapObject_LOD* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include "Editor_Define.h"
|
||||
#include "MapObject.h"
|
||||
|
||||
NS_BEGIN(Editor)
|
||||
|
||||
class CMapObject_Static final : public CMapObject
|
||||
{
|
||||
public:
|
||||
typedef struct tagMapObjectStaticDesc : public PARTOBJECT_DESC
|
||||
{
|
||||
_uint iMaxLodLevel{};
|
||||
const _tchar* pModelPrototypeTag;
|
||||
}MAPOBJECT_STATIC_DESC;
|
||||
|
||||
private:
|
||||
CMapObject_Static(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CMapObject_Static(const CMapObject_Static& Prototype);
|
||||
virtual ~CMapObject_Static() = 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;
|
||||
|
||||
public:
|
||||
virtual _wstring Get_PrototypeTag(_uint iLodIndex = 0);
|
||||
|
||||
private:
|
||||
CShader* m_pShaderCom = { nullptr };
|
||||
CModel* m_pModelCom = { nullptr };
|
||||
|
||||
_wstring m_strModelPrototypeTag;
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
|
||||
public:
|
||||
static CMapObject_Static* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
virtual void Describe_Entity() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
Reference in New Issue
Block a user