- Began new overarching window interface - Began outlining renderer interfaces - Began a binary tree implementation in bintree.h, this will act as a generalized binary tree, then red-black tree will be implemented on top of it for sequences (ordered sets)
2.4 KiB
2D Graphics (gfx2d)
Table of Contents
Introduction
This system handles the rendering of 2D meshes and textures.
Links:
- https://en.wikipedia.org/wiki/Quadtree
- https://developer.nvidia.com/gpugems/gpugems3/part-iv-image-effects/chapter-25-rendering-vector-art-gpu
Structures (gfx2d)
For the 2d rendering framework, Materials need to be rendered independently because we have no size constraints for images. This disallows us from using a meta-shader like in the 3d rendering framework.
I may have come up with a solution for the above problem. We can define software subsections for images that are of differing size, then fit them to the optimal texture array size. The textures will be centered in the storage, then have padding that fits one of the wrapping models supported by samplers
struct Object
{
vec2 location, scale; // A matrix would be 36 bytes, this is instead 20 bytes
float rotation;
}
-
BVH
- Quadtree
- Leaf Size and Tree Depth should be calculated by the scene, constraints are as follows:
- Min Object Size
- Max Object Size
- Scene Center
- Scene Edge
- Insertions and Updates are done on the CPU
- Nodes
- Start Index 32-bits
- Object Count 32-bits
- Objects
- Buffer of Object IDs grouped by Octree Node
- Leaf Size and Tree Depth should be calculated by the scene, constraints are as follows:
- Culling
- Starting at each Octree Leaf, traverse upwards.
- Insert Visible Leaf IDs
- Track using atomic buffer
- Generate the Command Buffer for Culled Meshes from the Visible Leaf Buffer
- Count Materials
- Count Meshes per Material
- Generate the Culled Object Buffer by copying objects from the Object Buffer
- Adjust Buffer Size using the counts
- Insert using another atomic buffer
- Quadtree
-
Translucent objects will be sorted. We can cheat by using a z-index instead of a z-coordinate. This will allow us to sort objects as they are created. We can still bulk render each z-index, with meshes and objects being grouped by material.