This shard takes the sequence of render pass objects specified in the Steps parameter, processes it sequentially, and renders the final scene based on the view object specified in the View parameter.
@template(spin-transform [t location] {
t | Math.Multiply(0.2) | Math.AxisAngleX | Math.Rotation >= rotX
t | Math.Multiply(0.7) | Math.AxisAngleY | Math.Rotation >= rotY
t | Math.Multiply(0.9) | Math.AxisAngleZ | Math.Rotation >= rotZ
location | Math.Translation | Math.MatMul(rotX) | Math.MatMul(rotY) | Math.MatMul(rotZ)
})
GFX.MainWindow(Contents: {
// Load the built-in cube mesh
GFX.BuiltinMesh(Type: BuiltinMeshType::Cube) >= mesh
// Declare transform variable
@f3(0 0 0) | Math.Translation >= transform
// The queue that will contain the draw commands (just the cube)
// By default this queue it automatically cleared after it has been processed
GFX.DrawQueue >= queue
// Define a pass that renders the cube, with the built-in color and camera transform behavior
GFX.BuiltinFeature(BuiltinFeatureId::Transform) >> features
GFX.BuiltinFeature(BuiltinFeatureId::BaseColor) >> features
GFX.DrawablePass(Features: features Queue: queue) >> render-steps
// Setup the camera
{Position: @f3(0 0 8) Target: @f3(0 0 0)} | Math.LookAt >= view-transform
GFX.View(View: view-transform) >= view
// Rotate the cubes transform
Animation.Timer = time
@spin-transform(time @f3(0.0 0 0))
// Update and retrieve the drawable
// Note that the transform is the input
GFX.Drawable(Mesh: mesh Params: {baseColor: @f4(0 1 0 1)}) >= drawable
// Add drawable to the queue
drawable | GFX.Draw(queue)
// Render everything
GFX.Render(View: view Steps: render-steps)
})
[warning] Context has 2 buffers at release (2 released, 2 kept)
[warning] Context has 4 textures at release (1 released, 4 kept)