diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 44 |
1 files changed, 26 insertions, 18 deletions
@@ -20,32 +20,35 @@ educational purposes. | |||
20 | ### Gfx | 20 | ### Gfx |
21 | 21 | ||
22 | The `Gfx` object represents the graphics subsystem and is at the center of the | 22 | The `Gfx` object represents the graphics subsystem and is at the center of the |
23 | library's high-level API. The `Gfx` object exposes a `Render` backend and a | 23 | library's high-level API. The `Gfx` object exposes a render backend (`GfxCore`) |
24 | `Renderer` and allows the caller to create `Scene`s. | 24 | and a `Renderer`, and allows the caller to create `Scene`s. |
25 | 25 | ||
26 | ### Render Backend | 26 | ### Render Backend |
27 | 27 | ||
28 | The `Render` backend is a thin abstraction layer over low-level graphics APIs | 28 | The render backend (`GfxCore`) is a thin abstraction layer over low-level |
29 | like OpenGL or Vulkan. It holds GPU resources such as geometry, textures, | 29 | graphics APIs like OpenGL or Vulkan. It holds GPU resources such as geometry, |
30 | shaders, etc, and exposes functions to manipulate them. | 30 | textures, shaders, etc, and exposes functions to manipulate them. |
31 | 31 | ||
32 | Currently there is only one implementation of the `Render` backend based on | 32 | Currently, there is only one implementation of the render backend based on |
33 | OpenGL. | 33 | OpenGL. |
34 | 34 | ||
35 | #### Ownership | 35 | #### Ownership |
36 | 36 | ||
37 | The `Render` backend owns all rendering resources: buffers, geometries, | 37 | The render backend owns all rendering resources: buffers, geometries, textures, |
38 | textures, shaders, etc. Even resources that point to other resources do not own | 38 | shaders, etc. Even resources that point to other resources do not own those |
39 | those other resources (geometries pointing to buffers). | 39 | other resources (geometries pointing to buffers). |
40 | 40 | ||
41 | There is no ownership tracking in the render backend. It is up to the client to | 41 | There is no lifetime tracking in the render backend. It is up to the client to |
42 | manage resource lifetime. | 42 | manage resource lifetime. |
43 | 43 | ||
44 | ### Low-level Renderer | ||
45 | |||
46 | `ImmRenderer` is a low-level, immediate mode renderer. | ||
47 | |||
44 | ### Scene | 48 | ### Scene |
45 | 49 | ||
46 | A `Scene` encapsulates a scene graph. A scene graph contains the elements that | 50 | A `Scene` graph contains the elements that make up a scene. The current scene |
47 | make up a scene: nodes, cameras, lights, objects, etc. The current scene graph | 51 | graph implementation includes: |
48 | implementation includes: | ||
49 | 52 | ||
50 | - Camera | 53 | - Camera |
51 | - Light | 54 | - Light |
@@ -64,7 +67,8 @@ functions to set the parent node of an object/camera/light. If we exposed the | |||
64 | former, the API could create the illusion that the hierarchy can be a DAG. | 67 | former, the API could create the illusion that the hierarchy can be a DAG. |
65 | 68 | ||
66 | The strict tree hierarchy should not be that restrictive in practice. Even the | 69 | The strict tree hierarchy should not be that restrictive in practice. Even the |
67 | glTF 2.0 spec [enforces this](https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#nodes-and-hierarchy): | 70 | glTF 2.0 |
71 | spec [enforces this](https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#nodes-and-hierarchy): | ||
68 | 72 | ||
69 | > *For Version 2.0 conformance, the glTF node hierarchy is not a directed | 73 | > *For Version 2.0 conformance, the glTF node hierarchy is not a directed |
70 | > acyclic graph (DAG) or scene graph, but a disjoint union of strict trees. That | 74 | > acyclic graph (DAG) or scene graph, but a disjoint union of strict trees. That |
@@ -76,9 +80,9 @@ glTF 2.0 spec [enforces this](https://github.com/KhronosGroup/glTF/blob/master/s | |||
76 | Two use cases for instancing seem to be: | 80 | Two use cases for instancing seem to be: |
77 | 81 | ||
78 | 1. Creating N identical clones, but each with a unique transform. (Ex: N | 82 | 1. Creating N identical clones, but each with a unique transform. (Ex: N |
79 | animated characters animated in unison but located in different locations.) | 83 | animated characters animated in unison but located in different locations.) |
80 | 2. Creating N copies of a sub-tree, each now being their own unique tree. (Ex: | 84 | 2. Creating N copies of a sub-tree, each now being their own unique tree. (Ex: |
81 | The same N animated characters, but each of them now being animated separately.) | 85 | The same N animated characters, but each of them now being animated separately.) |
82 | 86 | ||
83 | Some scene graphs | 87 | Some scene graphs |
84 | ([Panda3D](https://docs.panda3d.org/1.10/python/programming/scene-graph/instancing)) | 88 | ([Panda3D](https://docs.panda3d.org/1.10/python/programming/scene-graph/instancing)) |
@@ -87,10 +91,10 @@ to have multiple parents. This turns the scene graph into a DAG and adds a | |||
87 | number of complications for us: | 91 | number of complications for us: |
88 | 92 | ||
89 | 1. Shared ownership of children. We would now need some sort of ref counting or | 93 | 1. Shared ownership of children. We would now need some sort of ref counting or |
90 | deferred GC to delete nodes and their subtrees. | 94 | deferred GC to delete nodes and their subtrees. |
91 | 2. Nodes no longer have a unique parent. | 95 | 2. Nodes no longer have a unique parent. |
92 | 3. Given a node, we can no longer determine its location (which parent link do | 96 | 3. Given a node, we can no longer determine its location (which parent link do |
93 | you follow?), or any attribute that is derived from its parent(s). | 97 | you follow?), or any attribute that is derived from its parent(s). |
94 | 98 | ||
95 | In our case, we stick to strict tree hierarchies. | 99 | In our case, we stick to strict tree hierarchies. |
96 | 100 | ||
@@ -131,6 +135,10 @@ Code under `util/` provides functionality that need not be in the core part | |||
131 | of the library (Gfx, render backend, scene or renderer). This includes functions | 135 | of the library (Gfx, render backend, scene or renderer). This includes functions |
132 | to compute irradiance maps, create procedural geometry, etc. | 136 | to compute irradiance maps, create procedural geometry, etc. |
133 | 137 | ||
138 | ### Memory management | ||
139 | |||
140 | TODO | ||
141 | |||
134 | ## Ideas for Future Work | 142 | ## Ideas for Future Work |
135 | 143 | ||
136 | - Render graphs to allow for custom multi-pass rendering algorithms. | 144 | - Render graphs to allow for custom multi-pass rendering algorithms. |