aboutsummaryrefslogtreecommitdiff
path: root/samples/dual_layer/D3D11/src/Scene.cpp
blob: 4a5b9a96943b60200f2d179ae954fa209746dce6 (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
38
39
40
41
42
43
/*
* 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 "Scene.h"


bool Scene::InitializeDefault()
{
    std::shared_ptr<Mesh> actorMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\shaderBall.obj");
    std::shared_ptr<Mesh> cubeMesh = Mesh::LoadFromFile("..\\Media\\Meshes\\cube.obj");

    //
    // Layer 1 = Foreground meshes
    //
    Node node;
    node.mesh = actorMesh;
    node.layer = 1;

    for (uint32_t i = 0; i < 4; ++i)
    {
        node.matWorld = XMMatrixTranslation((i % 2) * 16.0f - 8.0f, (i / 2) * 16.0f - 8.0f, 0.0f);
        mNodes.push_back(node);
    }

    //
    // Layer 0 = Background meshes
    //
    node.mesh = cubeMesh;
    node.matWorld = XMMatrixIdentity();
    node.layer = 0;

    mNodes.push_back(node);


    return true;
}