blob: 7d41659ff4c4437dda1e0bc31572a940e021c25d (
plain) (
blame)
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
|
/*
* Copyright (c) 2008-2018, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#include "SceneRenderer.h"
#include "Scene.h"
#include "Camera.h"
bool SceneRenderer::InitializeWithScene(ID3D11Device* device, Scene& scene)
{
mMeshRenderer.Initialize(device);
for (auto& sceneNode : scene.GetNodes())
{
if (sceneNode.layer < kLayersCount)
{
mMeshes[sceneNode.layer].emplace_back();
D3D11Mesh& mesh = mMeshes[sceneNode.layer].back();
mesh.InitializeFromMesh(device, *sceneNode.mesh);
mesh.mMatWorld = sceneNode.matWorld;
}
}
return true;
}
void SceneRenderer::RenderLayer(ID3D11DeviceContext* deviceContext, uint32_t layer, const Camera& camera)
{
mMeshRenderer.RenderMeshes(deviceContext, mMeshes[layer], camera);
}
|