[Add] 헤어 마스크 선택 + 색깔변경 추가
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
@@ -11,10 +11,12 @@ float g_LifeRatio;
|
||||
float g_fRimStrength;
|
||||
float g_fRimPower;
|
||||
float3 g_vRimColor;
|
||||
float4 g_TestColor;
|
||||
vector g_vCamPosition;
|
||||
|
||||
Texture2D g_DiffuseTexture;
|
||||
Texture2D g_NormalTexture;
|
||||
Texture2D g_MaskingTexture;
|
||||
|
||||
matrix g_BoneMatrices[512];
|
||||
|
||||
@@ -272,6 +274,38 @@ PS_OUT_BLUR PS_MAIN_BLUR(PS_IN_BLUR In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT PS_MAIN_TEST(PS_IN In)
|
||||
{
|
||||
PS_OUT Out;
|
||||
|
||||
float4 vMtrlDiffuse = g_TestColor;
|
||||
|
||||
float4 vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
|
||||
float fAlpha = vMtrlMask.r;
|
||||
|
||||
if (fAlpha < 0.1f)
|
||||
discard;
|
||||
|
||||
float4 vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord);
|
||||
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
|
||||
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
|
||||
|
||||
if (g_bRimLight)
|
||||
{
|
||||
float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength);
|
||||
vMtrlDiffuse.rgb = lerp(vMtrlDiffuse.rgb, g_vRimColor.rgb, fRimLight);
|
||||
}
|
||||
|
||||
Out.vDiffuse = float4(vMtrlDiffuse.rgb * vMtrlMask.r, g_TestColor.a);
|
||||
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
|
||||
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
technique11 DefaultTechnique
|
||||
{
|
||||
@@ -313,4 +347,14 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_BLUR();
|
||||
}
|
||||
|
||||
pass TestPass
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default, 0);
|
||||
SetBlendState(BS_AlphaBlend, 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_MAIN_TEST();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ HRESULT CBody::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CBody::Ready_Components()
|
||||
{
|
||||
if (m_strModelPrototypeTag != L"")
|
||||
|
||||
@@ -49,7 +49,36 @@ void CHair::Late_Update(_float fTimeDelta)
|
||||
|
||||
HRESULT CHair::Render()
|
||||
{
|
||||
__super::Render();
|
||||
if (!m_pModelCom ||!m_pTextureCom)
|
||||
return S_OK;
|
||||
|
||||
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_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*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(4))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pModelCom->Render(i))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -65,9 +94,40 @@ HRESULT CHair::Ready_Components()
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("MaskTexture1"),
|
||||
reinterpret_cast<CComponent**>(&m_pTextureCom))))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHair::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;
|
||||
}
|
||||
|
||||
if (FAILED(m_pTextureCom->Bind_ShaderResource(m_pShaderCom, "g_MaskingTexture", iTextureIndex))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(m_pShaderCom->Bind_RawValue("g_TestColor",&m_vColor,sizeof(_float4)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
CHair* CHair::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CHair* pInstance = new CHair(pDevice, pContext);
|
||||
@@ -98,8 +158,28 @@ void CHair::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pTextureCom);
|
||||
}
|
||||
|
||||
void CHair::Describe_Entity()
|
||||
{
|
||||
if (!m_pModelCom )
|
||||
return;
|
||||
|
||||
for (_uint i = 0; i < dynamic_cast<CTexture*>(m_pTextureCom)->Get_Size(); i++)
|
||||
{
|
||||
_char label[128];
|
||||
|
||||
sprintf_s(label, "%s%d","Mask",i);
|
||||
|
||||
if (GUI::ImageButton(label, dynamic_cast<CTexture*>(m_pTextureCom)->Get_SRV(i), ImVec2(48, 48)))
|
||||
{
|
||||
iTextureIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
m_vColor = _float4(1.f, 0.f, 0.f, 1.f);
|
||||
|
||||
GUI::DragFloat4("COLOR", (_float*)&m_vColor, 0.1f);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,34 +72,30 @@ void CLevel_ObjectViewer::Add_Object()
|
||||
|
||||
void CLevel_ObjectViewer::Add_Human()
|
||||
{
|
||||
if (GUI::BeginTabItem("Body"))
|
||||
if (GUI::BeginTabItem("Head"))
|
||||
{
|
||||
Category_PartsModelList("Human/Body","Body");
|
||||
Category_PartsModelList("Human/Head", "Head");
|
||||
|
||||
GUI::EndTabItem();
|
||||
}
|
||||
|
||||
if (GUI::BeginTabItem("Head"))
|
||||
_bool bDisabled = {};
|
||||
if (m_HumanRoot)
|
||||
bDisabled = (m_HumanRoot->Get_MainModel());
|
||||
if (!bDisabled) GUI::BeginDisabled();
|
||||
if (GUI::BeginTabItem("Body"))
|
||||
{
|
||||
_bool bDisabled = (m_HumanRoot == nullptr);
|
||||
if (bDisabled) GUI::BeginDisabled();
|
||||
Category_PartsModelList("Human/Body", "Body");
|
||||
|
||||
Category_PartsModelList("Human/Head", "Head");
|
||||
|
||||
if (bDisabled) GUI::EndDisabled();
|
||||
GUI::EndTabItem();
|
||||
}
|
||||
|
||||
if (GUI::BeginTabItem("Hair"))
|
||||
{
|
||||
_bool bDisabled = (m_HumanRoot == nullptr);
|
||||
if (bDisabled) GUI::BeginDisabled();
|
||||
|
||||
Category_PartsModelList("Human/Hair", "Hair");
|
||||
|
||||
if (bDisabled) GUI::EndDisabled();
|
||||
GUI::EndTabItem();
|
||||
}
|
||||
if (!bDisabled) GUI::EndDisabled();
|
||||
}
|
||||
|
||||
void CLevel_ObjectViewer::Show_ModelFilePath()
|
||||
@@ -163,7 +159,8 @@ void CLevel_ObjectViewer::Category_PartsModelList(const _char* Category, const _
|
||||
{
|
||||
if (!m_HumanRoot)
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRootModelPart>(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, TEXT("Layer_Root"), nullptr, nullptr, reinterpret_cast<CRootModelPart**>(&m_HumanRoot))))
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CRootModelPart>(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, TEXT("Layer_Root"),
|
||||
nullptr, nullptr, reinterpret_cast<CRootModelPart**>(&m_HumanRoot))))
|
||||
return;
|
||||
}
|
||||
for (_uint i = 0; i < m_pGameInstance->BinaryModelFilePathCount(); i++)
|
||||
@@ -180,10 +177,19 @@ void CLevel_ObjectViewer::Category_PartsModelList(const _char* Category, const _
|
||||
|
||||
CDummyObject::PARTS_OBJECT_DESC Desc = {};
|
||||
|
||||
Desc.pModelPrototypeTag = Save_ModelName(szCategory);
|
||||
m_HumanRoot->Set_PrototypeModelName(Save_ModelName(szCategory));
|
||||
|
||||
dynamic_cast<CRootModelPart*>(m_HumanRoot)->Set_PrototypeModelName(Desc.pModelPrototypeTag);
|
||||
dynamic_cast<CRootModelPart*>(m_HumanRoot)->Set_ModelName(szCategory);
|
||||
m_HumanRoot->Set_ModelName(szCategory);
|
||||
|
||||
_uint iIndex = 0;
|
||||
if (strstr(szCategory,"Head"))
|
||||
iIndex = 0;
|
||||
else if (strstr(szCategory,"Body"))
|
||||
iIndex = 1;
|
||||
else if (strstr(szCategory,"Hair"))
|
||||
iIndex = 2;
|
||||
|
||||
m_HumanRoot->Change_Model(iIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,14 +212,14 @@ void CLevel_ObjectViewer::Show_AnimList()
|
||||
}
|
||||
if (m_HumanRoot)
|
||||
{
|
||||
CModel* pModel = dynamic_cast<CRootModelPart*>(m_HumanRoot)->Get_ModelParts(0)->Get_Component<CModel>();
|
||||
CModel* pModel = m_HumanRoot->Get_MainModel();
|
||||
if (pModel)
|
||||
{
|
||||
for (_uint i = 0; i < pModel->Get_AnimSize(); i++)
|
||||
{
|
||||
if (GUI::Button(pModel->Get_AnimList(i)))
|
||||
{
|
||||
pModel->Set_AnimationIndex(i);
|
||||
m_HumanRoot->Set_Animation(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -263,7 +269,7 @@ void CLevel_ObjectViewer::Object_Setting()
|
||||
GUI::Begin("PartsObject_Info");
|
||||
if (m_HumanRoot)
|
||||
{
|
||||
CModel* pModel = dynamic_cast<CRootModelPart*>(m_HumanRoot)->Get_ModelParts(0)->Get_Component<CModel>();
|
||||
CModel* pModel = m_HumanRoot->Get_MainModel();
|
||||
if (pModel)
|
||||
{
|
||||
_float AnimTrack = pModel->Get_CurrentTrackPosition();
|
||||
@@ -278,28 +284,39 @@ void CLevel_ObjectViewer::Object_Setting()
|
||||
{
|
||||
pModel->Set_PlayAnim(bPlayAnim);
|
||||
}
|
||||
|
||||
if (GUI::Button("Add Event"))
|
||||
{
|
||||
ImDrawList* draw = ImGui::GetForegroundDrawList();
|
||||
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
|
||||
float scale = 50.f;
|
||||
|
||||
draw->AddLine(center, ImVec2(center.x + scale, center.y), IM_COL32(255, 0, 0, 255), 2.0f);
|
||||
draw->AddLine(center, ImVec2(center.x, center.y - scale), IM_COL32(0, 255, 0, 255), 2.0f);
|
||||
draw->AddLine(center, ImVec2(center.x + scale * 0.5f, center.y + scale * 0.5f), IM_COL32(0, 0, 255, 255), 2.0f);
|
||||
}
|
||||
|
||||
if (GUI::Button("Delete"))
|
||||
{
|
||||
m_pGameInstance->Get_Layer(NEXT_LEVEL, TEXT("Layer_Root"))->Clear_Layer();
|
||||
m_HumanRoot = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_HumanRoot)
|
||||
m_HumanRoot->Get_ModelParts(2)->Describe_Entity();
|
||||
}
|
||||
|
||||
GUI::End();
|
||||
}
|
||||
|
||||
void CLevel_ObjectViewer::Save_LayerName(const _char* Category)
|
||||
void CLevel_ObjectViewer::Save_LayerName(const _char* Layer)
|
||||
{
|
||||
_wstring szLayer = TEXT("Layer_");
|
||||
|
||||
_wchar szCategory[MAX_PATH];
|
||||
_wstring wstrPath = szLayer + CMyTools::ToWstring(Layer);
|
||||
|
||||
wcscpy_s(m_wszLayer, szLayer.c_str());
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, Category, -1, szCategory, MAX_PATH);
|
||||
|
||||
wcscat_s(m_wszLayer, szCategory);
|
||||
wcscpy_s(m_wszLayer, wstrPath.c_str());
|
||||
}
|
||||
|
||||
_wchar* CLevel_ObjectViewer::Save_ModelName(const _char* Category)
|
||||
@@ -309,12 +326,8 @@ _wchar* CLevel_ObjectViewer::Save_ModelName(const _char* Category)
|
||||
_wstring szDir = TEXT("Prototype_Component_");
|
||||
_wstring szDir2 = TEXT("_Model");
|
||||
|
||||
_wchar wszName[MAX_PATH] = { 0 };
|
||||
|
||||
MultiByteToWideChar(CP_ACP, 0, m_szName, -1, wszName, MAX_PATH);
|
||||
|
||||
wcscpy_s(m_wszName, szDir.c_str());
|
||||
wcscat_s(m_wszName, wszName);
|
||||
wcscat_s(m_wszName, CMyTools::ToWstring(m_szName).c_str());
|
||||
wcscat_s(m_wszName, szDir2.c_str());
|
||||
|
||||
return m_wszName;
|
||||
@@ -326,7 +339,7 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
|
||||
CameraDesc.fFovy = XMConvertToRadians(60.0f);
|
||||
CameraDesc.fNear = 0.1f;
|
||||
CameraDesc.fFar = 500.f;
|
||||
CameraDesc.vEye = _float3(0.f, 50.f, -10.f);
|
||||
CameraDesc.vEye = _float3(0.f, 30.f, -10.f);
|
||||
CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
|
||||
CameraDesc.fSpeedPerSec = 5.f;
|
||||
CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f);
|
||||
@@ -362,8 +375,8 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_UI(const _wstring& strLayerTag)
|
||||
|
||||
HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
|
||||
{
|
||||
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CDummy_Cube>(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE)))
|
||||
return E_FAIL;*/
|
||||
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CDummy_Cube>(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -664,7 +664,11 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Young_M_Head_Ivory_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/Young_M_Head_Ivory.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/Male/Young_M_Head_Ivory.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_T_NPC_F_Head_Eye_Honey_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Head/FeMale/T_NPC_F_Head_Eye_Honey.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Hair1_Model"),
|
||||
@@ -675,6 +679,10 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Hair/Hair2/Hair2.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Hair3_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Hair/Hair3/Hair3.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_GoblinHead_Model"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Goblin/GoblinHead.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
@@ -691,6 +699,22 @@ HRESULT CLoader::Loading_For_ObjectViewer()
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Monster/Troll/Troll.bin", XMMatrixScaling(0.001f, 0.001f, 0.001f) * XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Desc_Box"),
|
||||
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity()))))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("MaskTexture1"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Models/Human/Hair/Mask%d.png"), 2)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/*if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("MaskTexture2"),
|
||||
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Models/Human/Hair/T_GHO_M_Hair_GHOHair01_WigTall_THV_MSK.png"), 0)))) {
|
||||
return E_FAIL;
|
||||
}*/
|
||||
|
||||
|
||||
m_strMessage = TEXT("Shader Loading..");
|
||||
|
||||
m_strMessage = TEXT("Prototype Loading..");
|
||||
|
||||
@@ -47,9 +47,6 @@ void CModelParts::Update(_float fTimeDelta)
|
||||
{
|
||||
XMStoreFloat4x4(&m_CombinedWorldMatrix,
|
||||
XMLoadFloat4x4(m_pTransformCom->Get_WorldMatrixPtr()) * XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr()));
|
||||
|
||||
Change_Model();
|
||||
|
||||
}
|
||||
|
||||
void CModelParts::Late_Update(_float fTimeDelta)
|
||||
@@ -92,53 +89,17 @@ HRESULT CModelParts::Render()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CModelParts::Change_Model()
|
||||
void CModelParts::Change_Model(const _wchar* Prototype)
|
||||
{
|
||||
if (dynamic_cast<CRootModelPart*>(m_pOwner)->Get_PrototypeModelName())
|
||||
if (m_pModelCom)
|
||||
{
|
||||
if (m_strPreModelPrototypeTag != dynamic_cast<CRootModelPart*>(m_pOwner)->Get_PrototypeModelName())
|
||||
{
|
||||
Set_Model("Body");
|
||||
Set_Model("Hair");
|
||||
Set_Model("Head");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CModelParts::Set_Model(const _char* PartType)
|
||||
{
|
||||
const _char* ObjectType = typeid(*this).name();
|
||||
const _char* ModelName = dynamic_cast<CRootModelPart*>(m_pOwner)->Get_ModelName();
|
||||
if (strstr(ObjectType, PartType))
|
||||
{
|
||||
if (strstr(ModelName, PartType))
|
||||
{
|
||||
if (m_pModelCom)
|
||||
{
|
||||
m_iAnimIndex = m_pModelCom->Get_AnimIndex();
|
||||
m_fTrackPosition = m_pModelCom->Get_CurrentTrackPosition();
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
Remove_Component<CModel>();
|
||||
}
|
||||
|
||||
m_strModelPrototypeTag = dynamic_cast<CRootModelPart*>(m_pOwner)->Get_PrototypeModelName();
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag,
|
||||
reinterpret_cast<CComponent**>(&m_pModelCom))))
|
||||
return;
|
||||
|
||||
if (strstr(PartType,"Body"))
|
||||
{
|
||||
dynamic_cast<CRootModelPart*>(m_pOwner)->Set_MainModel(m_pModelCom);
|
||||
}
|
||||
|
||||
m_pModelCom->Set_AnimationIndex(m_iAnimIndex);
|
||||
m_pModelCom->Set_CurrentTrackPosition(m_fTrackPosition);
|
||||
|
||||
m_strPreModelPrototypeTag = m_strModelPrototypeTag;
|
||||
}
|
||||
Remove_Component<CModel>();
|
||||
SAFE_RELEASE(m_pModelCom);
|
||||
}
|
||||
|
||||
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, Prototype,
|
||||
reinterpret_cast<CComponent**>(&m_pModelCom))))
|
||||
return;
|
||||
}
|
||||
|
||||
HRESULT CModelParts::Ready_Components()
|
||||
|
||||
@@ -28,6 +28,9 @@ HRESULT CRootModelPart::Initialize(void* pArg)
|
||||
if (FAILED(__super::Initialize(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Ready_Components(pArg)))
|
||||
return E_FAIL;
|
||||
|
||||
if (FAILED(Ready_PartObjects()))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -58,22 +61,71 @@ HRESULT CRootModelPart::Render()
|
||||
|
||||
void CRootModelPart::Update_Anim(_float fTimeDelta)
|
||||
{
|
||||
if (!m_pMainModel)
|
||||
return;
|
||||
|
||||
for (auto& ModelParts : m_ModelParts)
|
||||
{
|
||||
CModel* pModel = ModelParts->Get_Component<CModel>();
|
||||
if (pModel)
|
||||
{
|
||||
pModel->Set_PlayAnim(m_pMainModel->Get_PlayAnim());
|
||||
pModel->Set_AnimationIndex(m_pMainModel->Get_AnimIndex());
|
||||
pModel->Set_CurrentTrackPosition(m_pMainModel->Get_CurrentTrackPosition());
|
||||
pModel->Set_AnimSpeed(m_pMainModel->Get_AnimSpeed());
|
||||
pModel->Play_Animation(fTimeDelta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CRootModelPart::Ready_Components()
|
||||
void CRootModelPart::Set_MainModel(CModel* Model)
|
||||
{
|
||||
if (m_pMainModel)
|
||||
{
|
||||
SAFE_RELEASE(m_pMainModel);
|
||||
}
|
||||
m_pMainModel = Model;
|
||||
}
|
||||
|
||||
void CRootModelPart::Change_Model(_uint iIndex)
|
||||
{
|
||||
if (m_pMainModel)
|
||||
{
|
||||
m_iAnimIndex = m_pMainModel->Get_AnimIndex();
|
||||
m_fTrackPosition = m_pMainModel->Get_CurrentTrackPosition();
|
||||
}
|
||||
|
||||
m_ModelParts[iIndex]->Change_Model(m_PrototypeModelName);
|
||||
|
||||
CModel* pModel = m_ModelParts[iIndex]->Get_Component<CModel>();
|
||||
|
||||
pModel->Set_AnimationIndex(m_iAnimIndex);
|
||||
pModel->Set_CurrentTrackPosition(m_fTrackPosition);
|
||||
pModel->Play_Animation(0.f);
|
||||
|
||||
if (iIndex == 0)
|
||||
{
|
||||
Set_MainModel(m_ModelParts[iIndex]->Get_Component<CModel>());
|
||||
}
|
||||
}
|
||||
|
||||
void CRootModelPart::Set_Animation(_uint iAnimIndex)
|
||||
{
|
||||
m_pMainModel->Set_AnimationIndex(iAnimIndex);
|
||||
|
||||
for (auto& PartObject : m_ModelParts)
|
||||
{
|
||||
CModel* pModel = PartObject->Get_Component<CModel>();
|
||||
if (pModel)
|
||||
{
|
||||
pModel->Set_AnimationIndex(m_pMainModel->Get_AnimIndex());
|
||||
pModel->Set_CurrentTrackPosition(m_pMainModel->Get_CurrentTrackPosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRootModelPart::Ready_Components(void* pArg)
|
||||
{
|
||||
__super::Ready_Components(pArg);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -86,12 +138,12 @@ HRESULT CRootModelPart::Ready_PartObjects()
|
||||
|
||||
CModelParts* pModelPartsObject = { nullptr };
|
||||
|
||||
if (FAILED(Add_PartObject<CBody>("Human_Body", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast<CBody**>(&pModelPartsObject), &PartsDesc)))
|
||||
if (FAILED(Add_PartObject<CHead>("Human_Head", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast<CHead**>(&pModelPartsObject), &PartsDesc)))
|
||||
return E_FAIL;
|
||||
|
||||
m_ModelParts.push_back(pModelPartsObject);
|
||||
|
||||
if (FAILED(Add_PartObject<CHead>("Human_Head", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast<CHead**>(&pModelPartsObject), &PartsDesc)))
|
||||
if (FAILED(Add_PartObject<CBody>("Human_Body", ENUM_CLASS(LEVEL::STATIC), reinterpret_cast<CBody**>(&pModelPartsObject), &PartsDesc)))
|
||||
return E_FAIL;
|
||||
|
||||
m_ModelParts.push_back(pModelPartsObject);
|
||||
|
||||
@@ -22,13 +22,13 @@ class CHair final : public CModelParts
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
|
||||
HRESULT Bind_ShaderResources();
|
||||
private:
|
||||
CTexture* m_pTextureCom = { nullptr };
|
||||
|
||||
_uint iTextureIndex = { 0 };
|
||||
_float4 m_vColor = {};
|
||||
public:
|
||||
static CHair* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
|
||||
|
||||
@@ -19,7 +19,6 @@ class CHead final : public CModelParts
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
|
||||
|
||||
@@ -34,20 +34,19 @@ class CLevel_ObjectViewer final : public CLevel
|
||||
void Show_AnimList();
|
||||
void Show_ObjectList();
|
||||
void Object_Setting();
|
||||
void Save_LayerName(const _char* Category);
|
||||
void Save_LayerName(const _char* Layer);
|
||||
_wchar* Save_ModelName(const _char* Category);
|
||||
|
||||
private:
|
||||
vector<CGameObject*> m_Objects;
|
||||
vector<CGameObject*> m_PartsObjects;
|
||||
CGameObject* m_HumanRoot = { nullptr };
|
||||
_int m_iObjectIndex = { 0 };
|
||||
_int m_iPartsObjectIndex = { 0 };
|
||||
_char m_szName[MAX_PATH];
|
||||
_wchar m_wszName[MAX_PATH];
|
||||
_wchar m_wszLayer[MAX_PATH];
|
||||
_wchar m_wszPreLayer[MAX_PATH];
|
||||
|
||||
vector<CGameObject*> m_Objects;
|
||||
vector<CGameObject*> m_PartsObjects;
|
||||
class CRootModelPart* m_HumanRoot = { nullptr };
|
||||
_int m_iObjectIndex = { 0 };
|
||||
_int m_iPartsObjectIndex = { 0 };
|
||||
_char m_szName[MAX_PATH];
|
||||
_wchar m_wszName[MAX_PATH];
|
||||
_wchar m_wszLayer[MAX_PATH];
|
||||
_wchar m_wszPreLayer[MAX_PATH];
|
||||
|
||||
public:
|
||||
static CLevel_ObjectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID);
|
||||
|
||||
@@ -30,8 +30,7 @@ class CModelParts abstract : public CPartObject
|
||||
virtual void Update(_float fTimeDelta) override;
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
void Change_Model();
|
||||
void Set_Model(const _char*PartType);
|
||||
virtual void Change_Model(const _wchar* Prototype);
|
||||
_wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; }
|
||||
|
||||
protected:
|
||||
@@ -41,11 +40,8 @@ class CModelParts abstract : public CPartObject
|
||||
_float m_fRimLightPower = { 3.2f };
|
||||
_float m_fRimLightStrength = { 3.04f };
|
||||
_float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f };
|
||||
_float m_fTrackPosition = {};
|
||||
_uint m_iAnimIndex = {};
|
||||
|
||||
_wstring m_strModelPrototypeTag;
|
||||
_wstring m_strPreModelPrototypeTag;
|
||||
protected:
|
||||
HRESULT Ready_Components();
|
||||
HRESULT Bind_ShaderResources();
|
||||
|
||||
@@ -10,6 +10,16 @@ NS_BEGIN(Editor)
|
||||
|
||||
class CRootModelPart final : public CContainerObject
|
||||
{
|
||||
|
||||
public:
|
||||
void Set_PrototypeModelName(const _wchar* PrototypeModelName) { m_PrototypeModelName = PrototypeModelName; }
|
||||
void Set_ModelName(const _char* Name) { m_ModelName = Name; }
|
||||
const _wchar* Get_PrototypeModelName() { return m_PrototypeModelName; }
|
||||
const _char* Get_ModelName() { return m_ModelName; }
|
||||
class CModelParts* Get_ModelParts(_uint iIndex) { return m_ModelParts[iIndex]; }
|
||||
class CModel* Get_MainModel() { return m_pMainModel; }
|
||||
_uint Get_Index() { return m_iAnimIndex; }
|
||||
|
||||
private:
|
||||
CRootModelPart(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CRootModelPart(const CRootModelPart& Prototype);
|
||||
@@ -23,21 +33,20 @@ class CRootModelPart final : public CContainerObject
|
||||
virtual void Late_Update(_float fTimeDelta) override;
|
||||
virtual HRESULT Render() override;
|
||||
void Update_Anim(_float fTimeDelta);
|
||||
void Set_AnimIndex(_uint iIndex) { m_iAnimIndex = iIndex; }
|
||||
void Set_PrototypeModelName(const _wchar* PrototypeModelName) { m_PrototypeModelName = PrototypeModelName; }
|
||||
void Set_ModelName(const _char* Name) { m_ModelName = Name; }
|
||||
const _wchar* Get_PrototypeModelName() { return m_PrototypeModelName; }
|
||||
const _char* Get_ModelName() { return m_ModelName; }
|
||||
class CModelParts* Get_ModelParts(_uint iIndex) { return m_ModelParts[iIndex]; }
|
||||
void Set_MainModel(class CModel* Model) { m_pMainModel = Model; }
|
||||
void Set_MainModel(class CModel* Model);
|
||||
void Change_Model(_uint iIndex);
|
||||
void Set_Animation(_uint iAnimIndex);
|
||||
|
||||
private:
|
||||
class CModel* m_pMainModel = { nullptr };
|
||||
vector<class CModelParts*> m_ModelParts = {};
|
||||
_uint m_iAnimIndex = { 0 };
|
||||
const _wchar* m_PrototypeModelName = { 0 };
|
||||
const _char* m_ModelName = { 0 };
|
||||
class CModel* m_pMainModel = { nullptr };
|
||||
vector<class CModelParts*> m_ModelParts = {};
|
||||
const _wchar* m_PrototypeModelName = { 0 };
|
||||
const _char* m_ModelName = { 0 };
|
||||
_uint m_iAnimIndex = { 0 };
|
||||
_float m_fTrackPosition = {};
|
||||
|
||||
private:
|
||||
HRESULT Ready_Components();
|
||||
virtual HRESULT Ready_Components(void*pArg);
|
||||
HRESULT Ready_PartObjects();
|
||||
HRESULT Bind_ShaderResources();
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; }
|
||||
_float Get_AnimSpeed() { return m_fAnimSpeed; }
|
||||
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
private:
|
||||
HRESULT Initialize(const vector<class CBone*>& Bones, const aiAnimation* pAIAnimation);
|
||||
|
||||
Reference in New Issue
Block a user