-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRenderComponent.cpp
36 lines (32 loc) · 917 Bytes
/
RenderComponent.cpp
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
#include "D3D12FrameWork/RenderComponent.h"
#include "D3D12FrameWork/GraphicPipelineStateObject.h"
#include "D3D12FrameWork/MaterialFactory.h"
#include "D3D12FrameWork/MeshFactory.h"
namespace D3D12FrameWork{
RenderComponent::RenderComponent(IPipelineStateObject& _pso)
:m_pso(_pso){
_pso.AddRenderComponent(*this);
}
RenderComponent::~RenderComponent() {
m_pso.get().RemoveRenderComponent(this);
}
bool
RenderComponent::CreateMaterialSet(
std::span<MaterialSetDescriptor> const& _msDesc
) {
m_pMaterialSets.resize(_msDesc.size());
for (auto i = 0u; i < _msDesc.size();i++) {
m_pMaterialSets[i] = MaterialFactory::Instance()->CreateMaterialSet(
_msDesc[i], &(m_pso.get()));
}
return true;
}
bool
RenderComponent::CreateMeshSet(
std::string_view const _meshName
) {
m_pMeshSet = MeshFactory::Instance()->CreateMeshSet(
_meshName, &(m_pso.get()));
return true;
}
}