Merge pull request #439 from SpicyGangjeong/Develope

Follow
This commit is contained in:
hyunbin14
2025-12-12 13:13:10 +09:00
committed by GitHub
35 changed files with 2059 additions and 15 deletions
@@ -198,6 +198,7 @@ call Update_Resources.bat
<ClInclude Include="..\Public\NPC_Ollivander.h" />
<ClInclude Include="..\Public\Box_Splesh.h" />
<ClInclude Include="..\Public\StunEffect.h" />
<ClInclude Include="..\public\MapElement_Door.h" />
<ClInclude Include="..\Public\State_Broom_Dismount.h" />
<ClInclude Include="..\Public\State_Shield.h" />
<ClInclude Include="..\Public\State_Broom_Fly.h" />
@@ -372,6 +373,7 @@ call Update_Resources.bat
<ClCompile Include="..\Private\Logo_Glow.cpp" />
<ClCompile Include="..\Private\Logo_Text.cpp" />
<ClCompile Include="..\Private\NPC_Ollivander.cpp" />
<ClCompile Include="..\private\MapElement_Door.cpp" />
<ClCompile Include="..\Private\State_Broom_Dismount.cpp" />
<ClCompile Include="..\Private\State_Broom_Fly.cpp" />
<ClCompile Include="..\Private\State_Broom_Hover.cpp" />
@@ -551,6 +551,9 @@
<ClInclude Include="..\Public\State_Shield.h">
<Filter>04.Mechanic\State\State_Combat\State_Shield</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Door.h">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="Client.ico">
@@ -1164,6 +1167,9 @@
<Filter Include="02.GameObjects\NPC\Ally\Shopper">
<UniqueIdentifier>{02cb243a-f63e-4e55-9d55-b47e31a4c13e}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Environment\03.MapElement\Door">
<UniqueIdentifier>{b09f9ada-6cf4-41a4-ad28-f00855509825}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Client.cpp">
@@ -1659,6 +1665,9 @@
<ClCompile Include="..\Private\NPC_Ollivander.cpp">
<Filter>02.GameObjects\NPC\Ally\Shopper</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Door.cpp">
<Filter>02.GameObjects\Environment\03.MapElement\Door</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\Private\Goblin_States.cpp">
@@ -123,6 +123,10 @@ HRESULT CInfoInstance::Load_WaterElemet(const _char* pFileName)
{
return m_pMapInfo->Load_WaterElemet(pFileName);
}
HRESULT CInfoInstance::Load_DoorElemet(const _char* pFileName)
{
return m_pMapInfo->Load_DoorElemet(pFileName);
}
#pragma endregion
#pragma region SPELL_INFO
@@ -260,14 +260,14 @@ HRESULT CLevel_GamePlay::Ready_Background()
else
{
/* 전체 맵 */
//CInfoInstance::GetInstance()->Load_MapObjects("Hogsmeade_MapContainer_Data");
CInfoInstance::GetInstance()->Load_MapObjects("Hogsmeade_MapContainer_Data");
/* 물 오브젝트 */
if (FAILED(CInfoInstance::GetInstance()->Load_WaterElemet("Element_Water_Info")))
return E_FAIL;
/* 조명 오브젝트 */
/*CInfoInstance::GetInstance()->Load_LightElements("LightElement");*/
/*CInfoInstance::GetInstance()->Load_LightElements("LightElement"); */
/* 상호작용 오브젝트 */
CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_Barrel");
@@ -276,6 +276,10 @@ HRESULT CLevel_GamePlay::Ready_Background()
CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopTable");
CInfoInstance::GetInstance()->Load_InteractableElements("E_INTER_TeaShopChair");
/* Doors */
CInfoInstance::GetInstance()->Load_DoorElemet("Element_Door_Info");
if (FAILED(Ready_IntstanceProp()))
return E_FAIL;
}
@@ -162,6 +162,7 @@
#include "MapElement_Light.h"
#include "MapElement_Interactable.h"
#include "MapElement_Lake.h"
#include "MapElement_Door.h"
#include "Land.h"
#include "Unified.h"
@@ -2110,6 +2111,10 @@ HRESULT CLoader::Loading_For_GamePlay()
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Interactable>(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Door */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Door>(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_Unified */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Lake>(g_iStaticLevel, CMapElement_Lake::Create(m_pDevice, m_pContext))))
return E_FAIL;
@@ -0,0 +1,205 @@
#include "pch.h"
#include "MapElement_Door.h"
#include "GameInstance.h"
#include "Terrain.h"
#include "Layer.h"
#include "VIBuffer_Terrain.h"
CMapElement_Door::CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CMapElement{ pDevice, pContext }
{
}
CMapElement_Door::CMapElement_Door(const CMapElement_Door& rhs)
: CMapElement(rhs)
{
}
HRESULT CMapElement_Door::Initialize_Prototype()
{
return S_OK;
}
HRESULT CMapElement_Door::Initialize(void* pArg)
{
ELEMENT_DOOR_DESC* pDesc = static_cast<ELEMENT_DOOR_DESC*>(pArg);
m_iMaxLodLevel = pDesc->iMaxLodLevel;
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
{
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
//m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]);
}
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPosition), 1.f));
m_pTransformCom->Set_Scale(pDesc->vScale);
m_pTransformCom->Rotation(XMConvertToRadians(pDesc->vRotation.x), XMConvertToRadians(pDesc->vRotation.y), XMConvertToRadians(pDesc->vRotation.z));
m_vBoxSize = _float3(1.f, 1.f, 1.f);/*
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize);
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition);*/
return S_OK;
}
void CMapElement_Door::Priority_Update(_float fTimeDelta)
{
}
void CMapElement_Door::Update(_float fTimeDelta)
{
}
void CMapElement_Door::Late_Update(_float fTimeDelta)
{
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
}
HRESULT CMapElement_Door::Render()
{
if (FAILED(Bind_ShaderResources()))
return E_FAIL;
_uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
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;
}
}
#ifdef _DEBUG
//if (FAILED(m_pRigidBody->Render())) {
// return E_FAIL;
//}
#endif // _DEBUG
return S_OK;
}
HRESULT CMapElement_Door::Ready_Components(void* pArg)
{
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
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;
ELEMENT_DOOR_DESC* pPhysXDummyDesc = static_cast<ELEMENT_DOOR_DESC*>(pArg);
//// RIGID_BODY
//CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
//Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind;
//if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
// return E_FAIL;
//}
return S_OK;
}
HRESULT CMapElement_Door::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
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;
}
CMapElement_Door* CMapElement_Door::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CMapElement_Door* pInstance = new CMapElement_Door(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CMapElement_Door");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CMapElement_Door::Clone(void* pArg, CGameObject* pOwner)
{
CMapElement_Door* pInstance = new CMapElement_Door(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMapElement_Door");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CMapElement_Door::Free()
{
if (nullptr != m_pRigidBody) {
m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor());
}
__super::Free();
//SAFE_RELEASE(m_pRigidBody);
SAFE_RELEASE(m_pShaderCom);
for (auto& pModel : m_pModelComs)
SAFE_RELEASE(pModel);
}
#ifdef _DEBUG
void CMapElement_Door::Describe_Entity()
{
}
#endif // _DEBUG
@@ -10,6 +10,7 @@
#include "MapElement_Light.h"
#include "MapElement_Interactable.h"
#include "MapElement_Lake.h"
#include "MapElement_Door.h"
#include "Layer.h"
CMapInfo::CMapInfo()
@@ -573,6 +574,71 @@ HRESULT CMapInfo::Load_WaterElemet(const _char* pFileName)
return S_OK;
}
HRESULT CMapInfo::Load_DoorElemet(const _char* pFileName)
{
tinyxml2::XMLDocument xmlDoc;
string strPath = "../Bin/Resources/Data/Map/Door/" + string(pFileName) + ".xml";
if ((tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(strPath.c_str())))
return E_FAIL;
tinyxml2::XMLElement* root = xmlDoc.FirstChildElement("Doors");
if (nullptr == root)
{
MSG_BOX("Failed to Find root");
return S_OK;
}
for (auto* Object = root->FirstChildElement("Object"); Object; Object = Object->NextSiblingElement("Object"))
{
CMapElement_Door::ELEMENT_DOOR_DESC Desc = {};
/* Model Prototypes */
Object->QueryUnsignedAttribute("Lod_Level", &Desc.iMaxLodLevel);
string strTag = {};
for (auto* PrototypeTag = Object->FirstChildElement("PrototypeTag"); PrototypeTag; PrototypeTag = PrototypeTag->NextSiblingElement("PrototypeTag"))
{
strTag = PrototypeTag->GetText();
Desc.ModelPrototypeTags.push_back(CMyTools::ToWstring(strTag));
}
/* Transform */
auto* Position = Object->FirstChildElement("Position");
Position->QueryFloatAttribute("x", &Desc.vPosition.x);
Position->QueryFloatAttribute("y", &Desc.vPosition.y);
Position->QueryFloatAttribute("z", &Desc.vPosition.z);
auto* Scale = Object->FirstChildElement("Scale");
Scale->QueryFloatAttribute("x", &Desc.vScale.x);
Scale->QueryFloatAttribute("y", &Desc.vScale.y);
Scale->QueryFloatAttribute("z", &Desc.vScale.z);
auto* Rotation = Object->FirstChildElement("Rotation");
Rotation->QueryFloatAttribute("x", &Desc.vRotation.x);
Rotation->QueryFloatAttribute("y", &Desc.vRotation.y);
Rotation->QueryFloatAttribute("z", &Desc.vRotation.z);
//auto* HalfGeometryInfo = Object->FirstChildElement("HalfGeometryInfo");
//HalfGeometryInfo->QueryFloatAttribute("x", &Desc.vBoxSize.x);
//HalfGeometryInfo->QueryFloatAttribute("y", &Desc.vBoxSize.y);
//HalfGeometryInfo->QueryFloatAttribute("z", &Desc.vBoxSize.z);
//auto* LocalTranslation = Object->FirstChildElement("LocalTranslation");
//LocalTranslation->QueryFloatAttribute("x", &Desc.vBoxLocalPosition.x);
//LocalTranslation->QueryFloatAttribute("y", &Desc.vBoxLocalPosition.y);
//LocalTranslation->QueryFloatAttribute("z", &Desc.vBoxLocalPosition.z);
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Door>(g_iStaticLevel, NEXT_LEVEL, LAYER_DOOR, &Desc)))
return E_FAIL;
}
return S_OK;
}
HRESULT CMapInfo::Initialize(ID3D11Device* pDevice, ID3D11DeviceContext* pContex)
{
m_pGameInstance = CGameInstance::GetInstance();
@@ -61,6 +61,7 @@ namespace Client {
#define LAYER_LIGHT TEXT("Layer_Light")
#define LAYER_INTERACTABLE TEXT("Layer_Interactable")
#define LAYER_UNIFIED TEXT("Layer_Unified")
#define LAYER_DOOR TEXT("Layer_Door")
#define LAYER_MAPOBJECTMANAGER TEXT("Layer_MapObjectManager")
@@ -49,6 +49,7 @@ DECLARE_SINGLETON(CInfoInstance)
HRESULT Load_LightElements(const _char* pFilePath);
HRESULT Load_InteractableElements(const _char* pFileName);
HRESULT Load_WaterElemet(const _char* pFileName);
HRESULT Load_DoorElemet(const _char* pFileName);
#pragma endregion
#pragma region Spell_INFO
HRESULT Load_SpellInfo(const _char* pFilePath);
@@ -0,0 +1,59 @@
#pragma once
#include "Client_Define.h"
#include "MapElement.h"
NS_BEGIN(Client)
class CMapElement_Door final : public CMapElement
{
public:
typedef struct tagElement_Interactable_Desc : MAPELEMENT_DESC
{
_uint iSubKind = {};
_float3 vBoxLocalPosition;
_float3 vBoxSize;
}ELEMENT_DOOR_DESC;
private:
CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CMapElement_Door(const CMapElement_Door& rhs);
virtual ~CMapElement_Door() = 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;
private:
CRigidBody* m_pRigidBody = { nullptr };
PSX::PxRigidDynamic* m_pActor = { nullptr };
#ifdef _DEBUG
_bool m_bUseSelectColor = { true };
_float m_fPower = {};
_float m_fMass = {};
_float3 m_vBoxSize = {};
#endif // _DEBUG
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 CMapElement_Door* 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
+1
View File
@@ -25,6 +25,7 @@ class CMapInfo final : public CBase
HRESULT Load_LightElements(const _char* pFileName);
HRESULT Load_InteractableElements(const _char* pFileName);
HRESULT Load_WaterElemet(const _char* pFileName);
HRESULT Load_DoorElemet(const _char* pFileName);
private:
CGameInstance* m_pGameInstance = { nullptr };
@@ -3971,4 +3971,64 @@
<Rotation x="0" y="0" z="0"/>
</PartObject>
</Container>
<Container Name="SideStreet_D">
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
<PartObject Lod_Level="2" Key_Index="0" Render_Type="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D_Lod2</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</PartObject>
<PartObject Lod_Level="2" Key_Index="0" Render_Type="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Streets_SideStreet_D_Wall_Lod2</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</PartObject>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HW_Streets_SideStreet_G_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HW_Streets_SideStreet_G_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HW_Streets_SideStreet_G_Wall_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HW_Streets_SideStreet_G_Wall_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
</Container>
<Container Name="Ollivender_Int_Col">
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="0" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_Floors_COL</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
</Container>
</Land>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Doors>
<Object Lod_Level="2">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_Front_Door</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod1</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod2</PrototypeTag>
<Position x="39.67815" y="3.8" z="71.067245"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="116.99998" z="0"/>
</Object>
</Doors>
@@ -364,6 +364,26 @@
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_APL_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="0" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_Floors_COL</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
<Collision Lod_Level="1" Key_Index="0">
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL</PrototypeTag>
<PrototypeTag>Prototype_GameObject_SM_HM_Ollivanders_INT_PL_COL_Lod1</PrototypeTag>
<Position x="0" y="0" z="0"/>
<Scale x="1" y="1" z="1"/>
<Rotation x="0" y="0" z="0"/>
</Collision>
</Container>
<Container Name="HM_TScrolls_Ext">
<Position x="21.095903" y="0.80000007" z="31.144279"/>
@@ -720,6 +720,52 @@ PS_OUT PS_SPECTOR_WEAPON_MAIN(PS_IN In)
return Out;
}
PS_OUT PS_LEVIOSO(PS_IN In)
{
PS_OUT Out;
float4 vMtrlDiffuse = g_DiffuseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord);
float4 vSurface = g_SurfaceParamsTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord);
float4 vNoise = g_NoiseTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord).r;
if (g_iBinded_Texture[AI_TEXTURE_TYPE_TRANSMISSION] != 0)
{
float4 vTransmission = g_TransmissionTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord);
vMtrlDiffuse *= vTransmission;
}
if (g_iBinded_Texture[AI_TEXTURE_TYPE_EMISSIVE] != 0)
{
float4 vEmissive = g_EmissiveTexture.Sample(AnisoTropy_BLUR_Sampler, In.vTexcoord);
vMtrlDiffuse += vEmissive;
}
if (vMtrlDiffuse.a < 0.2f)
{
discard;
}
float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, AnisoTropy_BLUR_Sampler, In.vTexcoord);
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix));
Out.vAlbedo = vMtrlDiffuse * float4(1.f, 1.f, 0.3f, 1.f) * vNoise;
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
float fSurfaceParam = g_fUsingSurfaceParams;
if (true == AlmostEqual7(g_fUsingSurfaceParams, 0.f))
{
fSurfaceParam = 0;
}
Out.vDepth = float4((In.vProjPos.z / In.vProjPos.w), // NDC 깊이 ( 0~ 1)
(In.vProjPos.w / g_fFar), // 뷰 스페이스 Z
fSurfaceParam, // 서페이스 파라미터
1.f);
Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
Out.vSurface = vSurface;
return Out;
}
technique11 MeshTechnique11
{
@@ -928,4 +974,14 @@ technique11 MeshTechnique11
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_GLASS_CUBE();
}
pass LeviosoPass // 21
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_LEVIOSO();
}
}
@@ -182,6 +182,9 @@ call Update_Shaders.bat
<ClInclude Include="..\Public\Goblin_Dagger.h" />
<ClInclude Include="..\Public\Goblin_Protego.h" />
<ClInclude Include="..\Public\Goblin_Spector.h" />
<ClInclude Include="..\public\MapElement_Chest.h" />
<ClInclude Include="..\public\MapElement_Door.h" />
<ClInclude Include="..\public\MapElement_Chest_Lid.h" />
<ClInclude Include="..\Public\Skill_Data.h" />
<ClInclude Include="..\Public\State_Blink.h" />
<ClInclude Include="..\Public\State_Dead.h" />
@@ -386,6 +389,9 @@ call Update_Shaders.bat
<ClCompile Include="..\Private\Goblin_Dagger.cpp" />
<ClCompile Include="..\Private\Goblin_Protego.cpp" />
<ClCompile Include="..\Private\Goblin_Spector.cpp" />
<ClCompile Include="..\private\MapElement_Chest.cpp" />
<ClCompile Include="..\private\MapElement_Door.cpp" />
<ClCompile Include="..\private\MapElement_Chest_Lid.cpp" />
<ClCompile Include="..\Private\Skill_Data.cpp" />
<ClCompile Include="..\Private\State_Blink.cpp" />
<ClCompile Include="..\Private\State_Dead.cpp" />
@@ -568,6 +568,15 @@
<Filter Include="50.UI\GamePlay_Canvas\Enemy_Panel\Enemy_Detection">
<UniqueIdentifier>{81c6b163-6c8b-47ac-a4b6-e86088ce709f}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Env\03.MapElement\Door">
<UniqueIdentifier>{6cb94611-9a4c-4b22-897c-6a2ff662c59a}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Env\03.MapElement\Chest">
<UniqueIdentifier>{18ff4d8b-a5fd-4c67-a864-5340e31391a2}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Env\03.MapElement\Chest\Lid">
<UniqueIdentifier>{a1e789e1-dce1-4069-8c61-b9f9c89f795d}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Editor.h">
@@ -1134,6 +1143,15 @@
<ClInclude Include="..\public\Enemy_Detection.h">
<Filter>50.UI\GamePlay_Canvas\Enemy_Panel\Enemy_Detection</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Door.h">
<Filter>02.GameObjects\Env\03.MapElement\Door</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Chest.h">
<Filter>02.GameObjects\Env\03.MapElement\Chest</Filter>
</ClInclude>
<ClInclude Include="..\public\MapElement_Chest_Lid.h">
<Filter>02.GameObjects\Env\03.MapElement\Chest\Lid</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="Editor.ico">
@@ -1702,6 +1720,15 @@
<ClCompile Include="..\Private\Enemy_Detection.cpp">
<Filter>50.UI\GamePlay_Canvas\Enemy_Panel\Enemy_Detection</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Door.cpp">
<Filter>02.GameObjects\Env\03.MapElement\Door</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Chest.cpp">
<Filter>02.GameObjects\Env\03.MapElement\Chest</Filter>
</ClCompile>
<ClCompile Include="..\private\MapElement_Chest_Lid.cpp">
<Filter>02.GameObjects\Env\03.MapElement\Chest\Lid</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Editor.rc">
@@ -14,6 +14,8 @@
#include "Player.h"
#include "Unified.h"
#include "MapElement_Lake.h"
#include "MapElement_Door.h"
#include "MapElement_Chest.h"
CLevel_MapViewer::CLevel_MapViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
: CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
@@ -48,6 +50,7 @@ HRESULT CLevel_MapViewer::Initialize()
if (FAILED(Ready_Layer_Terrain(TEXT("Layer_Terrain")))) {
return E_FAIL;
}
if (FAILED(Ready_Layer_Land(TEXT("Layer_Land")))) {
return E_FAIL;
}
@@ -64,6 +67,14 @@ HRESULT CLevel_MapViewer::Initialize()
return E_FAIL;
}
//if (FAILED(Ready_Layer_Door(TEXT("Layer_Door")))) {
// return E_FAIL;
//}
if (FAILED(Ready_Layer_Chest(TEXT("Layer_Chest")))) {
return E_FAIL;
}
if (FAILED(Ready_Layer_MapObjectManager(LAYER_MAPOBJECTMANAGER))) {
return E_FAIL;
}
@@ -416,6 +427,64 @@ HRESULT CLevel_MapViewer::Ready_Layer_Unified(const _wstring& strLayerTag)
return S_OK;
}
HRESULT CLevel_MapViewer::Ready_Layer_Door(const _wstring& strLayerTag)
{
vector<_wstring> ModelPrototypeTags;
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door"));
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod1"));
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_HM_Ollivanders_Front_Door_Lod2"));
CMapElement_Door::ELEMENT_DOOR_DESC Door_Desc = {};
Door_Desc.isEdit = true;
Door_Desc.iSubKind = {};
Door_Desc.vBoxLocalPosition = {};
Door_Desc.vBoxSize = {};
Door_Desc.iMaxLodLevel = 2;
Door_Desc.ModelPrototypeTags = ModelPrototypeTags;
Door_Desc.vPosition = _float3(0.f, 0.f, 0.f);
Door_Desc.vRotation = _float3(0.f, 0.f, 0.f);
Door_Desc.vScale = _float3(1.f, 1.f, 1.f);
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Door>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Door_Desc)))
return E_FAIL;
return S_OK;
}
HRESULT CLevel_MapViewer::Ready_Layer_Chest(const _wstring& strLayerTag)
{
vector<_wstring> ModelPrototypeTags = {};
vector<_wstring> ModelPrototypeTagsLid = {};
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C"));
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod1"));
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod2"));
ModelPrototypeTags.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lod3"));
ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid"));
ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod1"));
ModelPrototypeTagsLid.push_back(TEXT("Prototype_GameObject_SM_Chest_RewardContainer_C_Lid_Lod2"));
CMapElement_Chest::ELEMENT_CHEST_DESC Chest_Desc = {};
Chest_Desc.iMaxLodLevel = 3;
Chest_Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);
Chest_Desc.ModelPrototypeTags = ModelPrototypeTags;
Chest_Desc.vPosition = _float3(0.f, 0.f, 0.f);
Chest_Desc.vRotation = _float3(0.f, 0.f, 0.f);
Chest_Desc.vScale = _float3(1.f, 1.f, 1.f);
Chest_Desc.vBoxSize = _float3(0.3f, 0.25f, 0.27f);
Chest_Desc.vBoxLocalPosition = _float3(-0.01f, 0.3f, -0.25f);
Chest_Desc.iMaxLodLevel_Lid = 2;
Chest_Desc.ModelPrototypeTags_Lid= ModelPrototypeTagsLid;
Chest_Desc.vLid_Offset = _float3(0.f, 0.3f, 0.f);
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapElement_Chest>(g_iStaticLevel, NEXT_LEVEL, strLayerTag, &Chest_Desc)))
return E_FAIL;
return S_OK;
}
HRESULT CLevel_MapViewer::Ready_Layer_MapObjectManager(const _wstring& strLayerTag)
{
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CMapObject_Manager>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
+36 -5
View File
@@ -115,6 +115,7 @@
#include "MapElement_Interactable.h"
#include "MapElement_Static.h"
#include "MapElement_Light.h"
#include "MapElement_Door.h"
#include "Land.h"
#include "Collider.h"
#include "VIBuffer_Model_Instance.h"
@@ -122,6 +123,8 @@
#include "InstancedProp.h"
#include "Unified.h"
#include "MapElement_Lake.h"
#include "MapElement_Chest.h"
#include "MapElement_Chest_Lid.h"
#pragma endregion
@@ -2422,6 +2425,11 @@ HRESULT CLoader::Loading_For_MapViewer()
return E_FAIL;
}
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Levioso_Noise"),
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Effect/Noises/VFX_T_NoiseCaustics02_Color_D.png"), 0)))) {
return E_FAIL;
}
/* For.Prototype_Component_LightPost_Emissive */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("LightPost_Emissive"),
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE,
@@ -2489,7 +2497,7 @@ HRESULT CLoader::Loading_For_MapViewer()
/* For.Prototype_Component_SkyboxModel */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_SkyboxModel"),
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SM_SkyCard.fbx", XMMatrixIdentity()))))
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/SkyBox/SkyBox.bin", XMMatrixIdentity()))))
return E_FAIL;
#pragma region MAP_LANDS
@@ -2552,10 +2560,10 @@ HRESULT CLoader::Loading_For_MapViewer()
///* Terrain*/
//if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain",
// ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
// return E_FAIL;
//if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain",
// ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
// return E_FAIL;
///* TScrolls*/
@@ -2582,7 +2590,7 @@ HRESULT CLoader::Loading_For_MapViewer()
// ".fbx", false, ModelPrototypeTags, ModelPrototypePath)))
// return E_FAIL;
//if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision",
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
// ".fbx", true, ModelPrototypeTags, ModelPrototypePath)))
// return E_FAIL;
///* Gatehouse*/
@@ -2734,6 +2742,11 @@ HRESULT CLoader::Loading_For_MapViewer()
// ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
// return E_FAIL;
/* Fences */
if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\fences",
".fbx", true, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
/* Light */
if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\LightPosts",
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
@@ -2741,7 +2754,7 @@ HRESULT CLoader::Loading_For_MapViewer()
/* Doors */
if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Doors",
".bin", false, ModelPrototypeTags, ModelPrototypePath)))
".bin", true, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
/* Step */
@@ -2777,6 +2790,12 @@ HRESULT CLoader::Loading_For_MapViewer()
".fbx", false, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
/* Object Interactables */
/* Chest */
if (FAILED(MapFolderLoad("C:\\MeshTable\\Game\\Environment\\Objects\\Interactables",
".fbx", false, ModelPrototypeTags, ModelPrototypePath)))
return E_FAIL;
#pragma endregion
#ifdef gimch
@@ -3328,6 +3347,18 @@ if(isLoad_Map)
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Interactable>(g_iStaticLevel, CMapElement_Interactable::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Door */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Door>(g_iStaticLevel, CMapElement_Door::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Chest */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Chest>(g_iStaticLevel, CMapElement_Chest::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Chest_Lid */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Chest_Lid>(g_iStaticLevel, CMapElement_Chest_Lid::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_MapElement_Static */
if (FAILED(m_pGameInstance->Add_Prototype<CMapElement_Static>(g_iStaticLevel, CMapElement_Static::Create(m_pDevice, m_pContext))))
return E_FAIL;
@@ -0,0 +1,468 @@
#include "pch.h"
#include "MapElement_Chest.h"
#include "GameInstance.h"
#include "Terrain.h"
#include "Layer.h"
#include "MapElement_Chest_Lid.h"
CMapElement_Chest::CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CMapElement{ pDevice, pContext }
{
}
CMapElement_Chest::CMapElement_Chest(const CMapElement_Chest& rhs)
: CMapElement(rhs)
{
}
HRESULT CMapElement_Chest::Initialize_Prototype()
{
return S_OK;
}
HRESULT CMapElement_Chest::Initialize(void* pArg)
{
ELEMENT_CHEST_DESC* pDesc = static_cast<ELEMENT_CHEST_DESC*>(pArg);
m_iMaxLodLevel = pDesc->iMaxLodLevel;
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
{
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
//m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]);
}
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
if (FAILED(Ready_Lid(pDesc)))
return E_FAIL;
m_eCurState = m_ePreState = CHEST_STATE::IDLE;
#ifdef _DEBUG
m_bSelected = false;
m_vPosition = pDesc->vPosition;
m_vScale = pDesc->vScale;
m_vRotation = pDesc->vRotation;
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 // _DEBUG
m_vBoxSize = _float3(1.f, 1.f, 1.f);
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize);
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition);
return S_OK;
}
void CMapElement_Chest::Priority_Update(_float fTimeDelta)
{
#ifdef _DEBUG
m_bSelected = false;
#endif
m_pLid->Priority_Update(fTimeDelta);
}
void CMapElement_Chest::Update(_float fTimeDelta)
{
switch (m_eCurState)
{
case Editor::CMapElement_Chest::CHEST_STATE::IDLE:
break;
case Editor::CMapElement_Chest::CHEST_STATE::FOUND:
break;
case Editor::CMapElement_Chest::CHEST_STATE::OPENED:
break;
default:
break;
}
Chage_State();
m_pLid->Update(fTimeDelta);
}
void CMapElement_Chest::Late_Update(_float fTimeDelta)
{
#ifdef _DEBUG
Describe_Entity();
m_pLid->Describe_Entity();
#endif
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
if(CMapElement_Chest::CHEST_STATE::FOUND == m_eCurState)
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
else
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
m_pLid->Late_Update(fTimeDelta);
}
}
HRESULT CMapElement_Chest::Render()
{
if (FAILED(Bind_ShaderResources()))
return E_FAIL;
_uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(m_iShaderPass_Index))) {
return E_FAIL;
}
if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) {
return E_FAIL;
}
}
#ifdef _DEBUG
if (FAILED(m_pRigidBody->Render())) {
return E_FAIL;
}
#endif // _DEBUG
if (FAILED(m_pLid->Render(m_iShaderPass_Index)))
return E_FAIL;
return S_OK;
}
HRESULT CMapElement_Chest::Ready_Components(void* pArg)
{
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
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;
/* Com_Texture */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Levioso_Noise"),
reinterpret_cast<CComponent**>(&m_pNoiseTextureCom))))
return E_FAIL;
ELEMENT_CHEST_DESC* pPhysXDummyDesc = static_cast<ELEMENT_CHEST_DESC*>(pArg);
// RIGID_BODY
CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind;
if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CMapElement_Chest::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
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_SRV("g_NoiseTexture", m_pNoiseTextureCom->Get_SRV(0)))) {
return E_FAIL;
}
return S_OK;
}
HRESULT CMapElement_Chest::Ready_Lid(ELEMENT_CHEST_DESC* pArg)
{
m_pLid = m_pGameInstance->Clone_Prototype<CMapElement_Chest_Lid>(g_iStaticLevel, pArg, this);
if (nullptr == m_pLid)
return E_FAIL;
return S_OK;
}
void CMapElement_Chest::Chage_State()
{
if (m_ePreState != m_eCurState)
{
switch (m_eCurState)
{
case Editor::CMapElement_Chest::CHEST_STATE::IDLE:
m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT);
break;
case Editor::CMapElement_Chest::CHEST_STATE::FOUND:
m_iShaderPass_Index = 21; //ENUM_CLASS(SHADER_PASS_MESH::DEFAULT);
break;
case Editor::CMapElement_Chest::CHEST_STATE::OPENED:
m_iShaderPass_Index = ENUM_CLASS(SHADER_PASS_MESH::DEFAULT);
break;
default:
break;
}
m_ePreState = m_eCurState;
}
}
CMapElement_Chest* CMapElement_Chest::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CMapElement_Chest* pInstance = new CMapElement_Chest(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CMapElement_Chest");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CMapElement_Chest::Clone(void* pArg, CGameObject* pOwner)
{
CMapElement_Chest* pInstance = new CMapElement_Chest(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMapElement_Chest");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CMapElement_Chest::Free()
{
if (nullptr != m_pRigidBody) {
m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor());
}
__super::Free();
if (m_bCloned)
SAFE_RELEASE(m_pLid);
SAFE_RELEASE(m_pRigidBody);
SAFE_RELEASE(m_pNoiseTextureCom);
SAFE_RELEASE(m_pShaderCom);
for (auto& pModel : m_pModelComs)
SAFE_RELEASE(pModel);
}
void CMapElement_Chest::Describe_Entity()
{
if (m_bDead)
return;
if (nullptr == m_pGameInstance)
return;
PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f);
if (GUI::CollapsingHeader("Rigid Body"))
{
GUI::InputFloat("Power", &m_fPower);
if (GUI::Button("Move Test"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
{
m_pActor->wakeUp();
m_pActor->addForce(vDir * m_fPower * 100000.f, PSX::PxForceMode::eFORCE);
}
}
if (GUI::Button("OFF_Kinematic"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false);
}
if (GUI::Button("ON_Kinematic"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true);
}
if (GUI::InputFloat("Mass", &m_fMass))
m_pActor->setMass(m_fMass);
m_pRigidBody->Describe_Entity();
}
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::Checkbox("Select Color ON / OFF", &m_bUseSelectColor);
GUI::Text("----- Transfrom ----");
_float3 vMove = {};
GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f);
GUI::InputFloat("Up", &vMove.y, 0.05f, 0.1f);
GUI::InputFloat("Look", &vMove.z, 0.05f, 0.1f);
m_pTransformCom->Move_Right(vMove.x);
m_pTransformCom->Move_Up(vMove.y);
m_pTransformCom->Move_Look(vMove.z);
XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION));
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
{
_float3 vPosition = {};
if (m_pGameInstance->isPicking(&vPosition))
{
memcpy(&m_vPosition, &vPosition, sizeof(_float3));
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
}
}
GUI::Text("----- Rotation ----");
GUI::InputFloat("X##Rotation", &m_vRotation.x, 1.f, 15.f);
GUI::InputFloat("Y##Rotation", &m_vRotation.y, 1.f, 15.f);
GUI::InputFloat("Z##Rotation", &m_vRotation.z, 1.f, 15.f);
m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z));
GUI::Text("----- Scale ----");
GUI::InputFloat("X##Scale", &m_vScale.x, 0.05f, 0.1f);
GUI::InputFloat("Y##Scale", &m_vScale.y, 0.05f, 0.1f);
GUI::InputFloat("Z##Scale", &m_vScale.z, 0.05f, 0.1f);
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("IDLE"))
{
m_eCurState = CHEST_STATE::IDLE;
}
if (GUI::Button("FOUND"))
{
m_eCurState = CHEST_STATE::FOUND;
}
if (GUI::Button("OPENED"))
{
m_eCurState = CHEST_STATE::OPENED;
}
if (GUI::Button("Delete"))
m_bDead = true;
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));
}
HRESULT CMapElement_Chest::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)
{
tinyxml2::XMLElement* object = doc.NewElement("Object");
object->SetAttribute("Type", ENUM_CLASS(MAPOBJECT_TYPE::ELEMENT_INTERACT));
object->SetAttribute("ID", ENUM_CLASS(m_eInteractableID));
object->SetAttribute("Lod_Level", m_iLodIndex);
root->InsertEndChild(object);
#pragma region PROTOTYPETAG
for (_uint i = 0; i < m_iLodIndex + 1; ++i)
{
tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag");
prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str());
object->InsertEndChild(prototype);
}
#pragma endregion
#pragma region TRANSFORM
_float3 vPosition = {};
XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION));
_float3 vScale = m_pTransformCom->Get_Scale();
_float3 vRotation = {};
XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector());
vRotation.x = XMConvertToDegrees(vRotation.x);
vRotation.y = XMConvertToDegrees(vRotation.y);
vRotation.z = XMConvertToDegrees(vRotation.z);
tinyxml2::XMLElement* Position = doc.NewElement("Position");
Position->SetAttribute("x", vPosition.x);
Position->SetAttribute("y", vPosition.y);
Position->SetAttribute("z", vPosition.z);
object->InsertEndChild(Position);
tinyxml2::XMLElement* Scale = doc.NewElement("Scale");
Scale->SetAttribute("x", vScale.x);
Scale->SetAttribute("y", vScale.y);
Scale->SetAttribute("z", vScale.z);
object->InsertEndChild(Scale);
tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation");
Rotation->SetAttribute("x", vRotation.x);
Rotation->SetAttribute("y", vRotation.y);
Rotation->SetAttribute("z", vRotation.z);
object->InsertEndChild(Rotation);
_float3 vHalfGeometryInfo = static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Get_HalfGeometryInfo();
tinyxml2::XMLElement* HalfGeometryInfo = doc.NewElement("HalfGeometryInfo");
HalfGeometryInfo->SetAttribute("x", vHalfGeometryInfo.x);
HalfGeometryInfo->SetAttribute("y", vHalfGeometryInfo.y);
HalfGeometryInfo->SetAttribute("z", vHalfGeometryInfo.z);
object->InsertEndChild(HalfGeometryInfo);
_float3 vLocalTranslation = static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Get_LocalTranslation();
tinyxml2::XMLElement* LocalTranslation = doc.NewElement("LocalTranslation");
LocalTranslation->SetAttribute("x", vLocalTranslation.x);
LocalTranslation->SetAttribute("y", vLocalTranslation.y);
LocalTranslation->SetAttribute("z", vLocalTranslation.z);
object->InsertEndChild(LocalTranslation);
#pragma endregion
return S_OK;
}
@@ -0,0 +1,314 @@
#include "pch.h"
#include "MapElement_Chest_Lid.h"
#include "MapElement_Chest.h"
#include "GameInstance.h"
CMapElement_Chest_Lid::CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CMapElement{ pDevice, pContext }
{
}
CMapElement_Chest_Lid::CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs)
: CMapElement(rhs)
{
}
HRESULT CMapElement_Chest_Lid::Initialize_Prototype()
{
return S_OK;
}
HRESULT CMapElement_Chest_Lid::Initialize(void* pArg)
{
CMapElement_Chest::ELEMENT_CHEST_DESC* pDesc = static_cast<CMapElement_Chest::ELEMENT_CHEST_DESC*>(pArg);
m_iMaxLodLevel = pDesc->iMaxLodLevel_Lid;
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
{
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags_Lid[i]);
}
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
m_fOpenDuration = 1.f;
m_fRotationAngle = 30.f;
m_vPosition = pDesc->vLid_Offset;
m_vRotation = _float3(0.f, 0.f, 0.f);
m_vScale = _float3(1.f, 1.f, 1.f);
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
m_pParentWorldMatrix = m_pOwner->Get_Component<CTransform>()->Get_WorldMatrixPtr();
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix));
return S_OK;
}
void CMapElement_Chest_Lid::Priority_Update(_float fTimeDelta)
{
}
void CMapElement_Chest_Lid::Update(_float fTimeDelta)
{
switch (m_eState)
{
case Editor::CMapElement_Chest_Lid::LID_STATE::IDLE:
break;
case Editor::CMapElement_Chest_Lid::LID_STATE::OPENING:
if (Opening(fTimeDelta))
m_eState = LID_STATE::OPENED;
break;
case Editor::CMapElement_Chest_Lid::LID_STATE::OPENED:
break;
default:
break;
}
}
void CMapElement_Chest_Lid::Late_Update(_float fTimeDelta)
{
/* 부모에서 Render 호출 */
}
HRESULT CMapElement_Chest_Lid::Render(_uint iShaderPass)
{
if (FAILED(Bind_ShaderResources()))
return E_FAIL;
_uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(iShaderPass))) {
return E_FAIL;
}
if (FAILED(m_pModelComs[m_iLodIndex]->Render(i))) {
return E_FAIL;
}
}
return S_OK;
}
HRESULT CMapElement_Chest_Lid::Ready_Components(void* pArg)
{
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
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 CMapElement_Chest_Lid::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) {
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;
}
_bool CMapElement_Chest_Lid::Opening(_float fTimeDelta)
{
m_fTimeAcc += fTimeDelta;
if (m_fTimeAcc >= m_fOpenDuration)
{
m_fTimeAcc = m_fOpenDuration;
m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle), 0.f, 0.f);
return true;
}
m_pTransformCom->Rotation(XMConvertToRadians(m_fRotationAngle * m_fTimeAcc / m_fOpenDuration), 0.f, 0.f);
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix));
return false;
}
void CMapElement_Chest_Lid::Reset()
{
m_fTimeAcc = 0.f;
m_pTransformCom->Rotation(0.f, 0.f, 0.f);
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix));
}
CMapElement_Chest_Lid* CMapElement_Chest_Lid::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CMapElement_Chest_Lid");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CMapElement_Chest_Lid::Clone(void* pArg, CGameObject* pOwner)
{
CMapElement_Chest_Lid* pInstance = new CMapElement_Chest_Lid(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMapElement_Chest_Lid");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CMapElement_Chest_Lid::Free()
{
__super::Free();
SAFE_RELEASE(m_pShaderCom);
for (auto& pModel : m_pModelComs)
SAFE_RELEASE(pModel);
}
void CMapElement_Chest_Lid::Describe_Entity()
{
if (m_bDead)
return;
if (nullptr == m_pGameInstance)
return;
GUI::Begin("Lid");
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 ----");
_float3 vMove = {};
GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f);
GUI::InputFloat("Up", &vMove.y, 0.05f, 0.1f);
GUI::InputFloat("Look", &vMove.z, 0.05f, 0.1f);
m_pTransformCom->Move_Right(vMove.x);
m_pTransformCom->Move_Up(vMove.y);
m_pTransformCom->Move_Look(vMove.z);
XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION));
GUI::Text("----- Rotation ----");
GUI::InputFloat("X##Rotation", &m_vTargetRotation.x, 1.f, 15.f);
GUI::InputFloat("Y##Rotation", &m_vTargetRotation.y, 1.f, 15.f);
GUI::InputFloat("Z##Rotation", &m_vTargetRotation.z, 1.f, 15.f);
GUI::InputFloat("m_fRotationAngle", &m_fRotationAngle, 1.f, 5.f);
GUI::InputFloat("m_fOpenDuration", &m_fOpenDuration, 0.1f, 1.f);
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * XMLoadFloat4x4(m_pParentWorldMatrix));
if (GUI::Button("Open"))
m_eState = LID_STATE::OPENING;
if (GUI::Button("Reset"))
Reset();
GUI::End();
}
HRESULT CMapElement_Chest_Lid::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)
{
tinyxml2::XMLElement* object = doc.NewElement("Object");
object->SetAttribute("Lod_Level", m_iMaxLodLevel);
root->InsertEndChild(object);
#pragma region PROTOTYPETAG
for (_uint i = 0; i < m_iLodIndex + 1; ++i)
{
tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag");
prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str());
object->InsertEndChild(prototype);
}
#pragma endregion
#pragma region TRANSFORM
_float3 vPosition = {};
XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION));
_float3 vScale = m_pTransformCom->Get_Scale();
_float3 vRotation = {};
XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector());
vRotation.x = XMConvertToDegrees(vRotation.x);
vRotation.y = XMConvertToDegrees(vRotation.y);
vRotation.z = XMConvertToDegrees(vRotation.z);
tinyxml2::XMLElement* Position = doc.NewElement("Position");
Position->SetAttribute("x", vPosition.x);
Position->SetAttribute("y", vPosition.y);
Position->SetAttribute("z", vPosition.z);
object->InsertEndChild(Position);
tinyxml2::XMLElement* Scale = doc.NewElement("Scale");
Scale->SetAttribute("x", vScale.x);
Scale->SetAttribute("y", vScale.y);
Scale->SetAttribute("z", vScale.z);
object->InsertEndChild(Scale);
tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation");
Rotation->SetAttribute("x", vRotation.x);
Rotation->SetAttribute("y", vRotation.y);
Rotation->SetAttribute("z", vRotation.z);
object->InsertEndChild(Rotation);
#pragma endregion
return S_OK;
}
@@ -0,0 +1,416 @@
#include "pch.h"
#include "MapElement_Door.h"
#include "GameInstance.h"
#include "Terrain.h"
#include "Layer.h"
#include "VIBuffer_Terrain.h"
CMapElement_Door::CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CMapElement{ pDevice, pContext }
{
}
CMapElement_Door::CMapElement_Door(const CMapElement_Door& rhs)
: CMapElement(rhs)
{
}
HRESULT CMapElement_Door::Initialize_Prototype()
{
return S_OK;
}
HRESULT CMapElement_Door::Initialize(void* pArg)
{
ELEMENT_DOOR_DESC* pDesc = static_cast<ELEMENT_DOOR_DESC*>(pArg);
m_iMaxLodLevel = pDesc->iMaxLodLevel;
for (_uint i = 0; i < m_iMaxLodLevel + 1; i++)
{
m_ModelPrototypeTags.push_back(pDesc->ModelPrototypeTags[i]);
//m_ModelPathIndices.push_back((*pDesc->pModelPathIndices)[i]);
}
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
#ifdef _DEBUG
m_isEdit = pDesc->isEdit;
m_bSelected = false;
m_vPosition = pDesc->vPosition;
m_vScale = pDesc->vScale;
m_vRotation = pDesc->vRotation;
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 // _DEBUG
m_vBoxSize = _float3(1.f, 1.f, 1.f);/*
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Set_HalfGeometryInfo(pDesc->vBoxSize);
static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Move_LocalPos(_float4(0.f, 0.f, 0.f, 0.f), pDesc->vBoxLocalPosition);*/
return S_OK;
}
void CMapElement_Door::Priority_Update(_float fTimeDelta)
{
#ifdef _DEBUG
m_bSelected = false;
#endif
}
void CMapElement_Door::Update(_float fTimeDelta)
{
if (m_isEdit)
{
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));
}
}
void CMapElement_Door::Late_Update(_float fTimeDelta)
{
#ifdef _DEBUG
if(m_isEdit)
Describe_Entity();
#endif
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
}
HRESULT CMapElement_Door::Render()
{
if (FAILED(Bind_ShaderResources()))
return E_FAIL;
_uint iNumMeshes = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (m_bSelected && m_bUseSelectColor)
{
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) {
return E_FAIL;
}
}
else
{
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;
}
}
#ifdef _DEBUG
//if (FAILED(m_pRigidBody->Render())) {
// return E_FAIL;
//}
#endif // _DEBUG
return S_OK;
}
HRESULT CMapElement_Door::Ready_Components(void* pArg)
{
if (FAILED(__super::Ready_Components(pArg))) {
return E_FAIL;
}
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;
ELEMENT_DOOR_DESC* pPhysXDummyDesc = static_cast<ELEMENT_DOOR_DESC*>(pArg);
//// RIGID_BODY
//CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC Desc{};
//Desc.iSubKind = ENUM_CLASS(PXOBJECT::BOX);//pPhysXDummyDesc->iSubKind;
//if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("PHYSX_DYNAMIC_BOX"), (CComponent**)&m_pRigidBody, &Desc))) {
// return E_FAIL;
//}
return S_OK;
}
HRESULT CMapElement_Door::Bind_ShaderResources()
{
if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", m_pTransformCom->Get_WorldMatrixPtr()))) {
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;
}
CMapElement_Door* CMapElement_Door::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CMapElement_Door* pInstance = new CMapElement_Door(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CMapElement_Door");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CMapElement_Door::Clone(void* pArg, CGameObject* pOwner)
{
CMapElement_Door* pInstance = new CMapElement_Door(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CMapElement_Door");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CMapElement_Door::Free()
{
if (nullptr != m_pRigidBody) {
m_pGameInstance->Release_Actor(*m_pRigidBody->Get_Actor());
}
__super::Free();
//SAFE_RELEASE(m_pRigidBody);
SAFE_RELEASE(m_pShaderCom);
for (auto& pModel : m_pModelComs)
SAFE_RELEASE(pModel);
}
void CMapElement_Door::Describe_Entity()
{
if (m_bDead)
return;
if (nullptr == m_pGameInstance)
return;
GUI::Begin("Door");
PSX::PxVec3 vDir = PSX::PxVec3(0.f, 1.f, 0.f);
/*if (GUI::CollapsingHeader("Rigid Body"))
{
GUI::InputFloat("Power", &m_fPower);
if (GUI::Button("Move Test"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
{
m_pActor->wakeUp();
m_pActor->addForce(vDir * m_fPower * 100000.f, PSX::PxForceMode::eFORCE);
}
}
if (GUI::Button("OFF_Kinematic"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, false);
}
if (GUI::Button("ON_Kinematic"))
{
m_pActor = static_cast<PSX::PxRigidDynamic*>(m_pRigidBody->Get_Actor());
if (nullptr != m_pActor)
m_pActor->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, true);
}
if (GUI::InputFloat("Mass", &m_fMass))
m_pActor->setMass(m_fMass);
m_pRigidBody->Describe_Entity();
}*/
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);
if (GUI::Button("Save_DoorData"))
{
tinyxml2::XMLDocument doc;
string strPath = "../Bin/Resources/Data/Map/Door/Element_Door_Info.xml";
tinyxml2::XMLError loadResult = doc.LoadFile(strPath.c_str());
tinyxml2::XMLElement* root = {};
if (loadResult == tinyxml2::XML_SUCCESS)
{
root = doc.FirstChildElement("Doors");
Save_XML(doc, root);
if (doc.SaveFile(strPath.c_str()) != tinyxml2::XML_SUCCESS) {
MSG_BOX("Failed to Save DoorInfo File");
}
}
else
MSG_BOX("Failed to Save Data");
}
GUI::Checkbox("Select Color ON / OFF", &m_bUseSelectColor);
GUI::Text("----- Transfrom ----");
_float3 vMove = {};
GUI::InputFloat("Right", &vMove.x, 0.05f, 0.1f);
GUI::InputFloat("Up", &vMove.y, 0.05f, 0.1f);
GUI::InputFloat("Look", &vMove.z, 0.05f, 0.1f);
m_pTransformCom->Move_Right(vMove.x);
m_pTransformCom->Move_Up(vMove.y);
m_pTransformCom->Move_Look(vMove.z);
XMStoreFloat3(&m_vPosition, m_pTransformCom->Get_State(STATE::POSITION));
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);
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
{
_float3 vPosition = {};
if (m_pGameInstance->isPicking(&vPosition))
{
memcpy(&m_vPosition, &vPosition, sizeof(_float3));
m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&m_vPosition), 1.f));
}
}
GUI::Text("----- Rotation ----");
GUI::InputFloat("X##Rotation", &m_vRotation.x, 1.f, 15.f);
GUI::InputFloat("Y##Rotation", &m_vRotation.y, 1.f, 15.f);
GUI::InputFloat("Z##Rotation", &m_vRotation.z, 1.f, 15.f);
m_pTransformCom->Rotation(XMConvertToRadians(m_vRotation.x), XMConvertToRadians(m_vRotation.y), XMConvertToRadians(m_vRotation.z));
GUI::Text("----- Scale ----");
GUI::InputFloat("X##Scale", &m_vScale.x, 0.05f, 0.1f);
GUI::InputFloat("Y##Scale", &m_vScale.y, 0.05f, 0.1f);
GUI::InputFloat("Z##Scale", &m_vScale.z, 0.05f, 0.1f);
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;
GUI::End();
//m_bSelected = true;
}
HRESULT CMapElement_Door::Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)
{
tinyxml2::XMLElement* object = doc.NewElement("Object");
object->SetAttribute("Lod_Level", m_iMaxLodLevel);
root->InsertEndChild(object);
#pragma region PROTOTYPETAG
for (_uint i = 0; i < m_iMaxLodLevel + 1; ++i)
{
tinyxml2::XMLElement* prototype = doc.NewElement("PrototypeTag");
prototype->SetText(CMyTools::ToString(m_ModelPrototypeTags[i]).c_str());
object->InsertEndChild(prototype);
}
#pragma endregion
#pragma region TRANSFORM
_float3 vPosition = {};
XMStoreFloat3(&vPosition, m_pTransformCom->Get_State(STATE::POSITION));
_float3 vScale = m_pTransformCom->Get_Scale();
_float3 vRotation = {};
XMStoreFloat3(&vRotation, m_pTransformCom->Get_RollPitchYawVector());
vRotation.x = XMConvertToDegrees(vRotation.x);
vRotation.y = XMConvertToDegrees(vRotation.y);
vRotation.z = XMConvertToDegrees(vRotation.z);
tinyxml2::XMLElement* Position = doc.NewElement("Position");
Position->SetAttribute("x", vPosition.x);
Position->SetAttribute("y", vPosition.y);
Position->SetAttribute("z", vPosition.z);
object->InsertEndChild(Position);
tinyxml2::XMLElement* Scale = doc.NewElement("Scale");
Scale->SetAttribute("x", vScale.x);
Scale->SetAttribute("y", vScale.y);
Scale->SetAttribute("z", vScale.z);
object->InsertEndChild(Scale);
tinyxml2::XMLElement* Rotation = doc.NewElement("Rotation");
Rotation->SetAttribute("x", vRotation.x);
Rotation->SetAttribute("y", vRotation.y);
Rotation->SetAttribute("z", vRotation.z);
object->InsertEndChild(Rotation);
//_float3 vHalfGeometryInfo = static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Get_HalfGeometryInfo();
//tinyxml2::XMLElement* HalfGeometryInfo = doc.NewElement("HalfGeometryInfo");
//HalfGeometryInfo->SetAttribute("x", vHalfGeometryInfo.x);
//HalfGeometryInfo->SetAttribute("y", vHalfGeometryInfo.y);
//HalfGeometryInfo->SetAttribute("z", vHalfGeometryInfo.z);
//object->InsertEndChild(HalfGeometryInfo);
//_float3 vLocalTranslation = static_cast<CRigidBody_Dynamic*>(m_pRigidBody)->Get_LocalTranslation();
//tinyxml2::XMLElement* LocalTranslation = doc.NewElement("LocalTranslation");
//LocalTranslation->SetAttribute("x", vLocalTranslation.x);
//LocalTranslation->SetAttribute("y", vLocalTranslation.y);
//LocalTranslation->SetAttribute("z", vLocalTranslation.z);
//object->InsertEndChild(LocalTranslation);
#pragma endregion
return S_OK;
}
@@ -78,9 +78,6 @@ void CMapElement_Interactable::Update(_float fTimeDelta)
void CMapElement_Interactable::Late_Update(_float fTimeDelta)
{
#ifdef _DEBUG
#endif
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pModelComs[0]->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
@@ -43,9 +43,8 @@ void CMapObject_Collision::Late_Update(_float fTimeDelta)
XMStoreFloat4x4(&m_CombinedWorldMatrix, m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix());
if (m_bVisible){
if (m_pGameInstance->isIn_WorldFrustum(XMLoadFloat4(reinterpret_cast<_float4*>(m_CombinedWorldMatrix.m[3])), m_pTransformCom->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
}
@@ -25,6 +25,8 @@ class CLevel_MapViewer final : public CLevel
HRESULT Ready_Layer_InstanceProp(const _wstring& strLayerTag);
HRESULT Ready_Layer_BuildingContainer(const _wstring& strLayerTag);
HRESULT Ready_Layer_Unified(const _wstring& strLayerTag);
HRESULT Ready_Layer_Door(const _wstring& strLayerTag);
HRESULT Ready_Layer_Chest(const _wstring& strLayerTag);
HRESULT Ready_Layer_MapObjectManager(const _wstring& strLayerTag);
@@ -0,0 +1,76 @@
#pragma once
#include "Editor_Define.h"
#include "MapElement.h"
NS_BEGIN(Editor)
class CMapElement_Chest final : public CMapElement
{
public:
enum class CHEST_STATE { IDLE, FOUND, OPENED, END };
public:
typedef struct tagElement_Chest_Desc : MAPOBJECT_LOD_DESC
{
_uint iInteractableID = {};
_uint iSubKind = {};
_float3 vBoxLocalPosition;
_float3 vBoxSize;
_uint iMaxLodLevel_Lid{};
vector<_wstring> ModelPrototypeTags_Lid;
_float3 vLid_Offset = {};
}ELEMENT_CHEST_DESC;
private:
CMapElement_Chest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CMapElement_Chest(const CMapElement_Chest& rhs);
virtual ~CMapElement_Chest() = 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;
private:
ELEMENT_INTERACTABLE_ID m_eInteractableID = { ELEMENT_INTERACTABLE_ID::END };
CHEST_STATE m_ePreState = {};
CHEST_STATE m_eCurState = {};
_uint m_iShaderPass_Index = {};
class CMapElement_Chest_Lid* m_pLid = { nullptr };
CRigidBody* m_pRigidBody = { nullptr };
PSX::PxRigidDynamic* m_pActor = { nullptr };
CTexture* m_pNoiseTextureCom = { nullptr };
#ifdef _DEBUG
_bool m_bUseSelectColor = { true };
_float m_fPower = {};
_float m_fMass = {};
_float3 m_vBoxSize = {};
#endif // _DEBUG
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
virtual HRESULT Ready_Components(void* pArg) override;
virtual HRESULT Bind_ShaderResources() override;
HRESULT Ready_Lid(ELEMENT_CHEST_DESC* pArg);
void Chage_State();
public:
static CMapElement_Chest* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
void Describe_Entity() override;
virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override;
};
NS_END
@@ -0,0 +1,65 @@
#pragma once
#include "Editor_Define.h"
#include "MapElement.h"
NS_BEGIN(Editor)
class CMapElement_Chest_Lid final : public CMapElement
{
public:
enum class LID_STATE{IDLE, OPENING, OPENED, END};
private:
CMapElement_Chest_Lid(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CMapElement_Chest_Lid(const CMapElement_Chest_Lid& rhs);
virtual ~CMapElement_Chest_Lid() = 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(_uint iShaderPass);
private:
LID_STATE m_eState = { LID_STATE::END };
_bool m_isRotationAnim = {};
_float m_fOpenDuration = {};
_float m_fTimeAcc = {};
_float m_fRotationAngle = {};
_float3 m_vTargetPosition = {};
_float3 m_vTargetRotation = {};
_float4x4 m_CombinedWorldMatrix = {};
#ifdef _DEBUG
_bool m_isOpen = {};
_float3 m_vDefaultPos = {};
const _float4x4* m_pParentWorldMatrix = { nullptr };
#endif // _DEBUG
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
virtual HRESULT Ready_Components(void* pArg) override;
virtual HRESULT Bind_ShaderResources() override;
_bool Opening(_float fTimeDelta);
#ifdef _DEBUG
void Reset();
#endif // _DEBUG
public:
static CMapElement_Chest_Lid* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
void Describe_Entity() override;
virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override;
};
NS_END
@@ -0,0 +1,59 @@
#pragma once
#include "Editor_Define.h"
#include "MapElement.h"
NS_BEGIN(Editor)
class CMapElement_Door final : public CMapElement
{
public:
typedef struct tagElement_Interactable_Desc : MAPOBJECT_LOD_DESC
{
_bool isEdit = {}; // Editor 용
_uint iSubKind = {};
_float3 vBoxLocalPosition;
_float3 vBoxSize;
}ELEMENT_DOOR_DESC;
private:
CMapElement_Door(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CMapElement_Door(const CMapElement_Door& rhs);
virtual ~CMapElement_Door() = 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;
private:
CRigidBody* m_pRigidBody = { nullptr };
PSX::PxRigidDynamic* m_pActor = { nullptr };
#ifdef _DEBUG
_bool m_isEdit = {};
_bool m_bUseSelectColor = { true };
_float m_fPower = {};
_float m_fMass = {};
_float3 m_vBoxSize = {};
#endif // _DEBUG
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 CMapElement_Door* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
virtual void Free() override;
void Describe_Entity() override;
virtual HRESULT Save_XML(tinyxml2::XMLDocument& doc, tinyxml2::XMLElement* root)override;
};
NS_END
@@ -18,6 +18,7 @@ CGameObject::CGameObject(const CGameObject& rhs)
, m_pContext(rhs.m_pContext)
, m_pGameInstance(rhs.m_pGameInstance)
, m_bDead(rhs.m_bDead)
, m_bCloned(true)
{
SAFE_ADDREF(m_pGameInstance);
SAFE_ADDREF(m_pDevice);
@@ -107,6 +107,7 @@ class ENGINE_DLL CGameObject abstract
_float m_fCamDepth = { FLT_MAX };
_bool m_bDead = { false };
_bool m_bVisible = { true };
_bool m_bCloned = { false };
protected:
virtual HRESULT Bind_ShaderResources()PURE;
virtual HRESULT Ready_Components(void* pArg);