Skip to content

Commit a97c7ea

Browse files
committed
Contemplation of the ORM textures and ORM G-Buffer
1 parent 399522f commit a97c7ea

File tree

7 files changed

+87
-23
lines changed

7 files changed

+87
-23
lines changed

src/Shader/GBufferPass.hlsl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ struct VertexOutput
1515

1616
SamplerState texSampler : register(s0);
1717
Texture2D tex : register(t0);
18+
Texture2D metalRough : register(t1);
1819

1920
VertexOutput VertexMain(float4 position : POSITION, float4 normal : NORMAL, float2 uv : TEXCOORD)
2021
{
@@ -35,14 +36,25 @@ struct PixelOutput
3536
{
3637
float4 albedo : SV_Target0;
3738
float4 normal : SV_Target1;
38-
float4 position : SV_Target2;
39+
float4 orm : SV_Target2;
40+
float4 position : SV_Target3;
3941
};
4042

4143
PixelOutput PixelMain(VertexOutput input)
4244
{
45+
float2 uvFlipped = float2(input.uv.x, 1.0f - input.uv.y);
46+
4347
PixelOutput output;
44-
output.albedo = tex.Sample(texSampler, float2(input.uv.x, 1 - input.uv.y));
48+
output.albedo = tex.Sample(texSampler, uvFlipped);
4549
output.normal = input.normal * 0.5f + 0.5f;
50+
51+
float4 sampledOrm = metalRough.Sample(texSampler, uvFlipped);
52+
53+
float occlusion = sampledOrm.r;
54+
float roughness = sampledOrm.g;
55+
float metallic = sampledOrm.b;
56+
57+
output.orm = float4(0.0f, roughness, metallic, 1.0f);
4658
output.position = input.vertexPos;
4759
return output;
4860
}

src/private/Core/GameObject/Component/Mesh.cpp

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ void Mesh::InitConstantBuffer() {
122122
void Mesh::UpdateConstantBuffer() {
123123
UINT nWVPSize = (sizeof(this->m_wvp) + 255) & ~255;
124124
this->m_wvp.World = XMMatrixTranspose(XMMatrixIdentity());
125-
this->m_wvp.World *= XMMatrixTranspose(XMMatrixScaling(0.1f, 0.1f, 0.1f));
126125
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationX(XMConvertToRadians(this->m_transform.rotation.x)));
127126
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationY(XMConvertToRadians(this->m_transform.rotation.y)));
128127
this->m_wvp.World *= XMMatrixTranspose(XMMatrixRotationZ(XMConvertToRadians(this->m_transform.rotation.z)));
@@ -164,7 +163,7 @@ void Mesh::Render() {
164163
Descriptor wvpDesc = this->m_cbv_srvHeap->GetDescriptor(this->m_nWvpIndex);
165164

166165
this->m_list->SetGraphicsRootDescriptorTable(0, this->m_samplerDescriptor.gpuHandle);
167-
this->m_list->SetGraphicsRootDescriptorTable(2, wvpDesc.gpuHandle);
166+
this->m_list->SetGraphicsRootDescriptorTable(3, wvpDesc.gpuHandle);
168167

169168
int i = 0;
170169
for (D3D12_VERTEX_BUFFER_VIEW vbv : this->m_VBVs) {
@@ -173,8 +172,11 @@ void Mesh::Render() {
173172
this->m_list->IASetIndexBuffer(&ibv);
174173

175174
UINT nTextureIndex = this->m_textureIndices[i];
175+
UINT nMetalIndex = this->m_nORMIndices[i];
176176
Descriptor texDesc = this->m_cbv_srvHeap->GetDescriptor(nTextureIndex);
177+
Descriptor metalDesc = this->m_cbv_srvHeap->GetDescriptor(nMetalIndex);
177178
this->m_list->SetGraphicsRootDescriptorTable(1, texDesc.gpuHandle);
179+
this->m_list->SetGraphicsRootDescriptorTable(2, metalDesc.gpuHandle);
178180

179181
this->m_list->DrawIndexedInstanced(this->m_indices[i].size(), 1, 0, 0, 0);
180182
i++;
@@ -189,22 +191,27 @@ void Mesh::InitPipeline() {
189191
UINT nPixelSize = this->m_shader->GetBuffer(SHADER_BUFFER::PIXEL, lpPixel);
190192

191193
CD3DX12_DESCRIPTOR_RANGE albedoRange;
194+
CD3DX12_DESCRIPTOR_RANGE ORMRange;
192195
CD3DX12_DESCRIPTOR_RANGE samplerRange;
193196
CD3DX12_DESCRIPTOR_RANGE wvpRange;
194197
albedoRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0);
198+
ORMRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1);
195199
samplerRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER, 1, 0);
196200
wvpRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_CBV, 1, 0);
197201

198202
CD3DX12_ROOT_PARAMETER albedoParam;
203+
CD3DX12_ROOT_PARAMETER ORMParam;
199204
CD3DX12_ROOT_PARAMETER samplerParam;
200205
CD3DX12_ROOT_PARAMETER wvpParam;
201206
albedoParam.InitAsDescriptorTable(1, &albedoRange, D3D12_SHADER_VISIBILITY_PIXEL);
207+
ORMParam.InitAsDescriptorTable(1, &ORMRange, D3D12_SHADER_VISIBILITY_PIXEL);
202208
samplerParam.InitAsDescriptorTable(1, &samplerRange, D3D12_SHADER_VISIBILITY_PIXEL);
203209
wvpParam.InitAsDescriptorTable(1, &wvpRange, D3D12_SHADER_VISIBILITY_VERTEX);
204210

205211
D3D12_ROOT_PARAMETER rootParams[] = {
206212
samplerParam,
207213
albedoParam,
214+
ORMParam,
208215
wvpParam
209216
};
210217

@@ -254,7 +261,8 @@ void Mesh::InitPipeline() {
254261
plDesc.RTVFormats[0] = DXGI_FORMAT_B8G8R8A8_UNORM;
255262
plDesc.RTVFormats[1] = DXGI_FORMAT_B8G8R8A8_UNORM;
256263
plDesc.RTVFormats[2] = DXGI_FORMAT_B8G8R8A8_UNORM;
257-
plDesc.NumRenderTargets = 3;
264+
plDesc.RTVFormats[3] = DXGI_FORMAT_B8G8R8A8_UNORM;
265+
plDesc.NumRenderTargets = 4;
258266
plDesc.PrimitiveTopologyType = D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
259267
plDesc.SampleDesc.Count = 8;
260268
plDesc.SampleMask = UINT32_MAX;
@@ -281,9 +289,10 @@ void Mesh::D3D12Init(D3D12* renderer) {
281289
void Mesh::InitSampler(D3D12* renderer) {
282290
this->m_cbv_srvHeap = renderer->m_cbvSrvHeap;
283291
UINT nNumTextures = this->m_textures.size();
284-
this->m_cbv_srvHeap->Allocate(this->m_textures.size());
292+
UINT nNumORMTextures = this->m_ORMTextures.size();
293+
this->m_cbv_srvHeap->Allocate(nNumTextures + nNumORMTextures);
285294
UINT nLastIndex = m_cbv_srvHeap->GetLastDescriptorIndex();
286-
UINT nFirstIndex = nLastIndex - nNumTextures + 1;
295+
UINT nFirstIndex = nLastIndex - nNumTextures;
287296

288297
UINT nActualIndex = nFirstIndex;
289298
for (std::pair<UINT, ComPtr<ID3D12Resource>> resource : this->m_textures) {
@@ -295,9 +304,23 @@ void Mesh::InitSampler(D3D12* renderer) {
295304

296305
Descriptor resDesc = m_cbv_srvHeap->GetDescriptor(nActualIndex);
297306
this->m_textureIndices[resource.first] = nActualIndex;
307+
308+
this->m_dev->CreateShaderResourceView(resource.second.Get(), &srvDesc, resDesc.cpuHandle);
298309
nActualIndex++;
310+
}
311+
312+
for (std::pair<UINT, ComPtr<ID3D12Resource>> resource : this->m_ORMTextures) {
313+
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = { };
314+
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
315+
srvDesc.Texture2D.MipLevels = 1;
316+
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
317+
srvDesc.Format = resource.second->GetDesc().Format;
318+
319+
Descriptor resDesc = m_cbv_srvHeap->GetDescriptor(nActualIndex);
320+
this->m_nORMIndices[resource.first] = nActualIndex;
299321

300322
this->m_dev->CreateShaderResourceView(resource.second.Get(), &srvDesc, resDesc.cpuHandle);
323+
nActualIndex++;
301324
}
302325

303326
renderer->m_samplerHeap->Allocate(1);
@@ -374,14 +397,28 @@ void Mesh::LoadModel(std::string filename) {
374397
this->m_vertices[i] = vertices;
375398

376399
aiString texPath;
377-
if (material->GetTextureCount(aiTextureType_DIFFUSE) > 0 && material->GetTexture(aiTextureType_DIFFUSE, 0, &texPath) == AI_SUCCESS) {
400+
aiString metalPath;
401+
if (material->GetTextureCount(aiTextureType_BASE_COLOR) > 0 && material->GetTexture(aiTextureType_DIFFUSE, 0, &texPath) == AI_SUCCESS) {
378402
const aiTexture* texture = scene->GetEmbeddedTexture(texPath.C_Str());
379403
if (texture != nullptr) {
380404
ResourceManager* resMgr = ResourceManager::GetInstance();
381405
ComPtr<ID3D12Resource> resource;
382406
resMgr->LoadTexture((BYTE*)texture->pcData, texture->mWidth, texture->mFilename.C_Str(), resource);
407+
resource->SetName(L"Mesh Base color");
383408
this->m_textures[i] = resource;
384409
}
385410
}
411+
412+
if (material->GetTextureCount(aiTextureType_METALNESS) > 0 && material->GetTexture(aiTextureType_METALNESS, 0, &metalPath) == AI_SUCCESS) {
413+
const aiTexture* texture = scene->GetEmbeddedTexture(metalPath.C_Str());
414+
415+
if (texture != nullptr) {
416+
ResourceManager* resMgr = ResourceManager::GetInstance();
417+
ComPtr<ID3D12Resource> resource;
418+
resMgr->LoadTexture((BYTE*)texture->pcData, texture->mWidth, texture->mFilename.C_Str(), resource);
419+
resource->SetName(L"Mesh Metallic Roughness");
420+
this->m_ORMTextures[i] = resource;
421+
}
422+
}
386423
}
387424
}

src/private/Core/Renderer/D3D12.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ void D3D12::Init(HWND hwnd) {
9797
this->CreateTexture(this->m_nWidth, this->m_nHeight, 8, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this->m_albedoBuff);
9898
this->CreateTexture(this->m_nWidth, this->m_nHeight, 8, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this->m_uvBuff);
9999
this->CreateTexture(this->m_nWidth, this->m_nHeight, 8, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this->m_positionBuff);
100-
this->CreateTexture(this->m_nWidth, this->m_nHeight, 8, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this->m_materialBuff);
100+
this->CreateTexture(this->m_nWidth, this->m_nHeight, 8, D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET, this->m_ORMBuff);
101101

102102
this->m_albedoBuff->SetName(L"Albedo");
103103
this->m_uvBuff->SetName(L"Normal");
104104
this->m_positionBuff->SetName(L"Position");
105-
this->m_materialBuff->SetName(L"Material Properties");
105+
this->m_ORMBuff->SetName(L"ORM G-Buffer");
106106

107107
this->m_nAlbedoIndex = this->m_rtvHeap->GetDescriptorCount();
108108
this->m_nUVIndex = this->m_nAlbedoIndex + 1;
109109
this->m_nPositionIndex = this->m_nUVIndex + 1;
110-
this->m_nMaterialBuffIndex = this->m_nPositionIndex + 1;
110+
this->m_nORMIndex = this->m_nPositionIndex + 1;
111111

112112
D3D12_RENDER_TARGET_VIEW_DESC GBufferDesc = { };
113113
GBufferDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
@@ -120,22 +120,23 @@ void D3D12::Init(HWND hwnd) {
120120
Descriptor albedoDesc = this->m_rtvHeap->GetDescriptor(this->m_nAlbedoIndex);
121121
Descriptor UVDesc = this->m_rtvHeap->GetDescriptor(this->m_nUVIndex);
122122
Descriptor positionDesc = this->m_rtvHeap->GetDescriptor(this->m_nPositionIndex);
123-
Descriptor materialDesc = this->m_rtvHeap->GetDescriptor(this->m_nMaterialBuffIndex);
123+
Descriptor ORMDesc = this->m_rtvHeap->GetDescriptor(this->m_nORMIndex);
124124

125125
this->m_dev->CreateRenderTargetView(this->m_albedoBuff.Get(), &GBufferDesc, albedoDesc.cpuHandle);
126126
this->m_dev->CreateRenderTargetView(this->m_uvBuff.Get(), &GBufferDesc, UVDesc.cpuHandle);
127127
this->m_dev->CreateRenderTargetView(this->m_positionBuff.Get(), &GBufferDesc, positionDesc.cpuHandle);
128-
this->m_dev->CreateRenderTargetView(this->m_materialBuff.Get(), &GBufferDesc, materialDesc.cpuHandle);
128+
this->m_dev->CreateRenderTargetView(this->m_ORMBuff.Get(), &GBufferDesc, ORMDesc.cpuHandle);
129129

130130
this->ResourceBarrier(this->m_albedoBuff.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET);
131131
this->ResourceBarrier(this->m_uvBuff.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET);
132132
this->ResourceBarrier(this->m_positionBuff.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET);
133-
this->ResourceBarrier(this->m_materialBuff.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET);
133+
this->ResourceBarrier(this->m_ORMBuff.Get(), D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET);
134134

135135
/* Track states */
136136
m_resourceStates[this->m_albedoBuff.Get()] = D3D12_RESOURCE_STATE_RENDER_TARGET;
137137
m_resourceStates[this->m_uvBuff.Get()] = D3D12_RESOURCE_STATE_RENDER_TARGET;
138138
m_resourceStates[this->m_positionBuff.Get()] = D3D12_RESOURCE_STATE_RENDER_TARGET;
139+
m_resourceStates[this->m_ORMBuff.Get()] = D3D12_RESOURCE_STATE_RENDER_TARGET;
139140

140141
// We'll allocate the initial value for our ScreenQuad.
141142
this->m_cbvSrvHeap = new DescriptorHeap(4, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, true);
@@ -230,16 +231,22 @@ void D3D12::Update() {
230231
ComPtr<ID3D12Resource> actualBuffer = this->m_backBuffers[this->m_nActualBackBuffer];
231232
this->ResourceBarrier(actualBuffer, D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
232233

233-
if (this->m_resourceStates[this->m_albedoBuff.Get()] != D3D12_RESOURCE_STATE_RENDER_TARGET)
234+
if (this->m_resourceStates[this->m_albedoBuff.Get()] != D3D12_RESOURCE_STATE_RENDER_TARGET) {
234235
this->ResourceBarrier(this->m_albedoBuff, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
236+
this->ResourceBarrier(this->m_uvBuff, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
237+
this->ResourceBarrier(this->m_positionBuff, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
238+
this->ResourceBarrier(this->m_ORMBuff, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, D3D12_RESOURCE_STATE_RENDER_TARGET);
239+
}
235240

236241

237242
Descriptor albedoDesc = this->m_rtvHeap->GetDescriptor(this->m_nAlbedoIndex);
238243
Descriptor UVDesc = this->m_rtvHeap->GetDescriptor(this->m_nUVIndex);
244+
Descriptor ORMDesc = this->m_rtvHeap->GetDescriptor(this->m_nORMIndex);
239245
Descriptor positionDesc = this->m_rtvHeap->GetDescriptor(this->m_nPositionIndex);
240246
Descriptor dsvDesc = this->m_dsvHeap->GetDescriptor(0);
241247
this->m_list->ClearRenderTargetView(albedoDesc.cpuHandle, RGBA{ 0.f, 0.f, 0.f, 1.f }, 0, nullptr);
242248
this->m_list->ClearRenderTargetView(UVDesc.cpuHandle, RGBA{ 0.f, 0.f, 0.f, 1.f }, 0, nullptr);
249+
this->m_list->ClearRenderTargetView(ORMDesc.cpuHandle, RGBA{ 0.f, 0.f, 0.f, 1.f }, 0, nullptr);
243250
this->m_list->ClearRenderTargetView(positionDesc.cpuHandle, RGBA{ 0.f, 0.f, 0.f, 1.f }, 0, nullptr);
244251
this->m_list->ClearDepthStencilView(dsvDesc.cpuHandle, D3D12_CLEAR_FLAG_DEPTH, 1.f, 0.f, 0, nullptr);
245252

@@ -249,6 +256,7 @@ void D3D12::Update() {
249256
D3D12_CPU_DESCRIPTOR_HANDLE gbuffers[] = {
250257
albedoDesc.cpuHandle,
251258
UVDesc.cpuHandle,
259+
ORMDesc.cpuHandle,
252260
positionDesc.cpuHandle
253261
};
254262
this->m_list->OMSetRenderTargets(_countof(gbuffers), gbuffers, FALSE, &dsvDesc.cpuHandle);
@@ -262,6 +270,9 @@ void D3D12::Update() {
262270
this->sceneMgr->Render();
263271

264272
this->ResourceBarrier(this->m_albedoBuff, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
273+
this->ResourceBarrier(this->m_uvBuff, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
274+
this->ResourceBarrier(this->m_positionBuff, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
275+
this->ResourceBarrier(this->m_ORMBuff, D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
265276

266277
Descriptor rtv = this->m_rtvHeap->GetDescriptor(this->m_nActualBackBuffer);
267278
this->m_list->OMSetRenderTargets(1, &rtv.cpuHandle, FALSE, nullptr);

src/private/Core/Renderer/ScreenQuad.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ void ScreenQuad::D3D12Init(D3D12* renderer) {
6666
Descriptor albedoDesc = renderer->m_cbvSrvHeap->GetDescriptor(0);
6767
Descriptor normalDesc = renderer->m_cbvSrvHeap->GetDescriptor(1);
6868
Descriptor positionDesc = renderer->m_cbvSrvHeap->GetDescriptor(2);
69+
Descriptor ORMDesc = renderer->m_cbvSrvHeap->GetDescriptor(3);
6970

7071
D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = { };
7172
srvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
@@ -76,31 +77,32 @@ void ScreenQuad::D3D12Init(D3D12* renderer) {
7677
this->m_dev->CreateShaderResourceView(renderer->m_albedoBuff.Get(), &srvDesc, albedoDesc.cpuHandle);
7778
this->m_dev->CreateShaderResourceView(renderer->m_uvBuff.Get(), &srvDesc, normalDesc.cpuHandle);
7879
this->m_dev->CreateShaderResourceView(renderer->m_positionBuff.Get(), &srvDesc, positionDesc.cpuHandle);
80+
this->m_dev->CreateShaderResourceView(renderer->m_ORMBuff.Get(), &srvDesc, ORMDesc.cpuHandle);
7981

8082
CD3DX12_DESCRIPTOR_RANGE albedoRange;
8183
CD3DX12_DESCRIPTOR_RANGE normalRange;
8284
CD3DX12_DESCRIPTOR_RANGE positionRange;
83-
CD3DX12_DESCRIPTOR_RANGE materialRange;
85+
CD3DX12_DESCRIPTOR_RANGE ORMRange;
8486

8587
albedoRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 0);
8688
normalRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 1);
8789
positionRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 2);
88-
materialRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 3);
90+
ORMRange.Init(D3D12_DESCRIPTOR_RANGE_TYPE_SRV, 1, 3);
8991

9092
CD3DX12_ROOT_PARAMETER albedoParam;
9193
CD3DX12_ROOT_PARAMETER normalParam;
9294
CD3DX12_ROOT_PARAMETER positionParam;
93-
CD3DX12_ROOT_PARAMETER materialParam;
95+
CD3DX12_ROOT_PARAMETER ORMParam;
9496
albedoParam.InitAsDescriptorTable(1, &albedoRange, D3D12_SHADER_VISIBILITY_PIXEL);
9597
normalParam.InitAsDescriptorTable(1, &normalRange, D3D12_SHADER_VISIBILITY_PIXEL);
9698
positionParam.InitAsDescriptorTable(1, &positionRange, D3D12_SHADER_VISIBILITY_PIXEL);
97-
materialParam.InitAsDescriptorTable(1, &materialRange, D3D12_SHADER_VISIBILITY_PIXEL);
99+
ORMParam.InitAsDescriptorTable(1, &ORMRange, D3D12_SHADER_VISIBILITY_PIXEL);
98100

99101
D3D12_ROOT_PARAMETER rootParams[] = {
100102
albedoParam,
101103
normalParam,
102104
positionParam,
103-
materialParam
105+
ORMParam
104106
};
105107

106108
D3D12_ROOT_SIGNATURE_DESC rootDesc = { };

src/private/Core/Scene/Scene.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Scene::Scene(std::string name) {
88
void Scene::Init() {
99
Mesh* m_mesh = new Mesh("StaticMeshComponent", m_go->transform);
1010
m_go->m_components.push_back(m_mesh);
11-
m_mesh->LoadModel("Ch44.fbx");
11+
m_mesh->LoadModel("barrel.glb");
1212
this->AddGameObject(m_go);
1313

1414
this->m_editorCamera = new EditorCamera("EditorCamera");

src/public/Core/GameObject/Component/Mesh.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ class Mesh : public Component {
4343
std::map<UINT, std::vector<Vertex>> m_vertices;
4444
std::map<UINT, std::vector<UINT>> m_indices;
4545
std::map <UINT, ComPtr<ID3D12Resource>> m_textures;
46+
std::map <UINT, ComPtr<ID3D12Resource>> m_ORMTextures;
4647
std::map<UINT, UINT> m_textureIndices;
48+
std::map<UINT, UINT> m_nORMIndices;
4749

4850
std::vector<D3D12_VERTEX_BUFFER_VIEW> m_VBVs;
4951
std::vector<D3D12_INDEX_BUFFER_VIEW> m_IBVs;

src/public/Core/Renderer/D3D12.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ class D3D12 : public Renderer {
6565
ComPtr<ID3D12Resource> m_albedoBuff;
6666
ComPtr<ID3D12Resource> m_uvBuff;
6767
ComPtr<ID3D12Resource> m_positionBuff;
68-
ComPtr<ID3D12Resource> m_materialBuff;
68+
ComPtr<ID3D12Resource> m_ORMBuff;
6969

7070
UINT m_nAlbedoIndex;
7171
UINT m_nUVIndex;
7272
UINT m_nPositionIndex;
73-
UINT m_nMaterialBuffIndex;
73+
UINT m_nORMIndex;
7474

7575
UINT m_nBackBuffers;
7676

0 commit comments

Comments
 (0)