Table of Contents

NervLand: Drawing our first cube

OKay, so in this session, I want to turn my previous simple triangle display into a 3D cube. To achieve that I would like to start using an index buffer, and also introduce the minimal support required to handle an ortho projection, so that I could play a simple cube animation and see it rotating. This all sounds pretty easy said like this, but I'm sure I will find some trouble on my path, as usual 😆. So let's get started.

Preparing the cube mesh data

For the X/Y axis I'm currently following the same conventions as in vulkan: X from left to right of the screen and Y from top to bottom of the screen

Reconsidering the CmdBufProvider structure

Updating the RenderGraph

Improving on framebuffer management

Improving on commandbuffers management

Fixing nervluna bindings for full nvk namespace

Building rendergraph in lua

Adding support for global functions in LLS library writer

Preparing matrix class support

NervLuna: support to bind simple template classes

On the question: “Why do we use the @nv::MyStruct suffix here ?”: this is simply because the template parameter names can be the same for may template classes, and since in our type system we register the types by names we need to separate those “virtual types” into different versions depending on which template class they are coming from.

NervLand: Adding support for unit tests

Building new push constant updater

One thing to keep in mind with the code just above, is that when using a perspective projection, we really cannot use a near plane distance of 0.0 as this would mess the projection matrix completely ;-)

Yet, one thing I eventually realized with this experiment is that in GLSL we should pass our matrices in column-major order if we want to continue post-multiplying by vectors (whereas on the C++ side I'm using row-major matrix representation): So this will require some fixing.

Conclusion