Scene module

Outlines a script draws into the world the camera is looking at, over the level geometry rather than over the interface.

The calls are available from trx.scene.on_paint and nowhere else, and raise anywhere else. Nothing is remembered between frames: a shape that is to stay on screen is drawn again every time it happens.

A shape is placed the way an item position and a zone are, so it needs no room and belongs to none. The outlines are drawn as wireframe, and one reaching further from its middle than a level is wide draws at that limit instead.

Functions

  • trx.scene.on_paint(callback)
    Happens on every drawn frame, after the rooms and everything standing in them, and before the interface. The drawing calls here work during it and raise anywhere else. It follows the frame rate, not the game clock.

    Parameters:

    • callback (function). What to run when it happens.

    Returns: trx.events.Listener. The attached handler.

    Example:

    trx.scene.on_paint(function()
      trx.scene.sphere(trx.lara.item.pos, 512, "00ff00")
    end)
    
  • trx.scene.box(min, max, color, [alpha])
    Draws the outline of a world-space box. The corners may come in any order.

    Parameters:

    • min (trx.math.Vec3). One corner of the box.
    • max (trx.math.Vec3). The opposite corner of the box.
    • color (trx.math.Color or string). The color of the outline, or the hex text one is written as.
    • alpha (integer, optional, default 255). How solid the outline is, counted 0 to 255.

    Example:

    trx.scene.on_paint(function()
      trx.scene.box(
        { x = 51200, y = -2048, z = 30720 },
        { x = 53248, y = 0, z = 32768 },
        "00ff00")
    end)
    
  • trx.scene.sphere(centre, radius, color, [alpha])
    Draws the outline of a sphere.

    Parameters:

    • centre (trx.math.Vec3). Middle of the sphere.
    • radius (trx.math.Distance). How far out it reaches.
    • color (trx.math.Color or string). The color of the outline, or the hex text one is written as.
    • alpha (integer, optional, default 255). How solid the outline is, counted 0 to 255.

    Example:

    trx.scene.on_paint(function()
      trx.scene.sphere(trx.lara.item.pos, 2048, "00ff00", 128)
    end)