Class ModelNode

Class for drawing Mesh objects.

(Inherited from menori.Node class) ModelNode is a specialized node that renders 3D mesh geometry with materials. It handles transformation matrices, skeletal animation joints, and material properties.

See also:

Fields

modelnode.material Own copy of the Material that is bound to the model.
modelnode.mesh The menori.Mesh object that is bound to the model.

Methods

modelnode:init (mesh[, material=Material.default]) The public constructor.
modelnode:clone () Clone the ModelNode object.
modelnode:calculate_aabb () Calculate axis-aligned bounding box (AABB) with current transformations applied.
modelnode:render (scene, environment) Draw a ModelNode object.


Fields

modelnode.material
Own copy of the Material that is bound to the model. This is a cloned copy of the material passed to the constructor, allowing independent modification without affecting the original material.
  • material menori.Material
modelnode.mesh
The menori.Mesh object that is bound to the model.
  • mesh menori.Mesh

Methods

modelnode:init (mesh[, material=Material.default])
The public constructor.

Parameters:

  • mesh menori.Mesh The mesh object to render
  • material menori.Material The material object (a new copy will be created) (default Material.default)

Usage:

    -- Create a ModelNode with a mesh and default material
    local model = ModelNode(mesh)
    
    -- Create a ModelNode with a custom material
    local material = menori.Material()
    local model = ModelNode(mesh, material)
modelnode:clone ()
Clone the ModelNode object. Creates a copy of the ModelNode with the same mesh and a cloned material.

Returns:

    menori.ModelNode A new cloned ModelNode object
modelnode:calculate_aabb ()
Calculate axis-aligned bounding box (AABB) with current transformations applied. Computes the world-space bounding box by transforming the mesh's local bounds using the current world transformation matrix.

Returns:

    bound3 The transformed bounding box in world coordinates
modelnode:render (scene, environment)
Draw a ModelNode object. This function renders the model using the current material and handles skeletal animation if joints are present. It's called implicitly in the hierarchy when a node is drawn with scene:render_nodes()

Parameters:

  • scene menori.Scene The scene object used for rendering context
  • environment menori.Environment The environment object providing lighting and other rendering parameters

Usage:

    -- This is typically called automatically by the scene
    scene:render_nodes()
    
    -- Or manually for custom rendering
    model_node:render(scene, environment)
generated by LDoc 1.5.0 Last updated 2025-08-18 00:01:40