-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDecalComponent.cpp
More file actions
89 lines (78 loc) · 2.74 KB
/
Copy pathDecalComponent.cpp
File metadata and controls
89 lines (78 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "DecalComponent.h"
#include "DecalSystem.h"
#include "Texture.h"
#include "SceneManager.h"
#include "RenderScene.h"
#include "Scene.h"
void DecalComponent::OnInitialized()
{
auto scene = GetOwner()->m_ownerScene;
auto renderScene = SceneManagers->GetRenderScene();
if (scene)
{
scene->CollectDecalComponent(this);
if (renderScene)
renderScene->RegisterCommand(this);
}
SetDecalTexture(m_diffusefileName.c_str());
SetNormalTexture(m_normalFileName.c_str());
SetORMTexture(m_ormFileName.c_str());
}
// 트랙 C3 — DecalSystem 등록/해지. Awake/OnDestroy(컴포넌트당 1회 게이트)가
// 아니라 씬 편입/이탈 훅을 쓰는 이유는 AnimatorSystem.h 상단 주석 참고 — DDOL
// 오브젝트가 씬을 건널 때도 매번 다시 불려야 하기 때문이다. 실제 파괴 경로
// (Scene::FlushPendingDestroy·PrefabUtility::ApplyComponentDiff)도
// OnUninitializing(위 OnDestroy 브리지) 직전에 OnRemovingFromScene을 먼저
// 부르므로, 이 시스템에서 빠지는 시점이 항상 실 파괴보다 먼저다.
void DecalComponent::OnAddedToScene()
{
DecalSystems->Register(this);
}
void DecalComponent::OnRemovingFromScene()
{
DecalSystems->Unregister(this);
}
void DecalComponent::OnUninitializing()
{
auto scene = GetOwner()->m_ownerScene;
auto renderScene = SceneManagers->GetRenderScene();
if (scene)
{
scene->UnCollectDecalComponent(this);
if(renderScene)
renderScene->UnregisterCommand(this);
}
}
void DecalComponent::SetDecalTexture(const std::string_view& fileName)
{
file::path filename = fileName;
file::path filepath = PathFinder::Relative("Textures\\") / filename.filename();
m_decalTextureOwner = Texture::LoadSharedFromPath(filepath.string());
m_decalTexture = m_decalTextureOwner.get();
m_diffusefileName = fileName;
}
void DecalComponent::SetDecalTexture(const FileGuid& fileGuid)
{
}
void DecalComponent::SetNormalTexture(const std::string_view& fileName)
{
file::path filename = fileName;
file::path filepath = PathFinder::Relative("Textures\\") / filename.filename();
m_normalTextureOwner = Texture::LoadSharedFromPath(filepath.string());
m_normalTexture = m_normalTextureOwner.get();
m_normalFileName = fileName;
}
void DecalComponent::SetNormalTexture(const FileGuid& fileGuid)
{
}
void DecalComponent::SetORMTexture(const std::string_view& fileName)
{
file::path filename = fileName;
file::path filepath = PathFinder::Relative("Textures\\") / filename.filename();
m_ormTextureOwner = Texture::LoadSharedFromPath(filepath.string());
m_occluroughmetalTexture = m_ormTextureOwner.get();
m_ormFileName = fileName;
}
void DecalComponent::SetORMTexture(const FileGuid& fileGuid)
{
}