Class Scene

Base class of scenes.

It contains methods for recursively drawing and updating nodes. You need to inherit from the Scene class to create your own scene object.

Functions

scene:init () The public constructor.
scene:render_nodes (node, environment[, renderstates[, filter]]) Node render function.
scene:update_nodes (node, environment) Node update function.


Functions

scene:init ()
The public constructor.
scene:render_nodes (node, environment[, renderstates[, filter]])
Node render function. Recursively renders all nodes in the hierarchy with proper sorting and filtering.

Parameters:

  • node menori.Node Node to start rendering from
  • environment menori.Environment Rendering environment containing camera and other settings
  • renderstates table Table containing render states and canvas configuration (optional)
  • filter function Callback function for custom node filtering during render (optional)

Returns:

    number Number of rendered drawable nodes

Usage:

    -- Basic usage with default parameters
    local count = scene:render_nodes(root_node, environment)
    
    -- With custom render states
    local renderstates = {
        canvas1, canvas2,      -- canvases to render to
        clear = true,          -- clear before rendering
        colors = {color, ...}, -- clear color
        node_sort_comp = custom_sort_function
    }
    scene:render_nodes(root_node, environment, renderstates)
    
    -- With custom filter function
    local function custom_filter(node, scene, environment)
        if node.visible then
            node:render(scene, environment)
        end
    end
    scene:render_nodes(root_node, environment, nil, custom_filter)
scene:update_nodes (node, environment)
Node update function.

Parameters:

generated by LDoc 1.5.0 Last updated 2025-08-18 00:01:40