API Docs for:
Show:

LS.RenderInstance Class

RenderInstance contains info of one object to be rendered on the scene. It shouldnt contain ids to resources (strings), instead if must contain the direct reference (to mesh, material)

Constructor

LS.RenderInstance

()

Methods

applyTransform

(
  • matrix
  • normal_matrix
)

applies a transformation to the current matrix

Parameters:

  • matrix Mat4
  • normal_matrix Mat4

    [optional]

computeNormalMatrix

()

Updates the normal matrix using the matrix

enableFlag

(
  • flag
)

Enable flag in the flag bit field

Parameters:

  • flag Number

    id

enableFlag

(
  • flag
)

Disable flag in the flag bit field

Parameters:

  • flag Number

    id

enableFlag

(
  • flag
)
Boolean

Tells if a flag is enabled

Parameters:

  • flag Number

    id

Returns:

Boolean:

flag value

render

(
  • shader
)

Calls render taking into account primitive and range

Parameters:

  • shader Shader

update

()

Used to update the RI info without having to go through the collectData process, it is faster but some changes may take a while

updateAABB

()

Computes the instance bounding box in world space from the one in local space

wasVisibleByCamera

(
  • camera
)
Boolean

Checks if this object was visible by a camera during the last frame

Parameters:

  • camera LS.Camera

    [optional] if a camera is supplied it checks if it was visible by that camera, otherwise tells you if it was visible by any camera

Returns:

Boolean:

true if it was visible by the camera (or any camera if no camera supplied), false otherwise