-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.txt
More file actions
37 lines (28 loc) · 1.21 KB
/
README.txt
File metadata and controls
37 lines (28 loc) · 1.21 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
Scene tutorial
We want the entire scene to be built and edited from outside
Demo.cpp, so that people dont need to scroll through Vulkan
code to build a game.
Inside Scene.cpp, all Meshes, Textures, and Entities,
can be added, removed, drawn, and updated.
To do this, we need an abstraction layer that lets
Demo handle anything that the Scene can do.
Demo is now a singleton, so it can be accessed
from anywhere. That means we dont need to pass
a pointer of Demo to Scene, Mesh, Entity, or Texture
We initialize Scene in Demo.cpp, after initCmd
starts recording commands, and before it ends.
After Scene is created, the initCmd buffer ends,
executes, and then deletes CPU buffers after they
are copied to GPU (convered in previous tutorial)
While the secondary command buffer is being built,
it calls Scene->Draw to add the Scene's entities to
the command buffer. When Scene->Draw ends, the
secondary command buffer is finalized
Scene::Draw calls new functions in Demo:
4 functions to apply different pipelines
1 function to draw each entity
In Demo::draw, all entities are updated by calling
Scene->Update
When Demo::~Demo is called, at the end of the demo,
Scene::~Scene is called, to destroy all entities, textures,
and meshes