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
()
Item Index
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
Tells if a flag is enabled
Parameters:
-
flag
Numberid
Returns:
flag value
enableFlag
-
flag
Disable flag in the flag bit field
Parameters:
-
flag
Numberid
enableFlag
-
flag
Enable flag in the flag bit field
Parameters:
-
flag
Numberid
render
-
shader
Calls render taking into account primitive and range
Parameters:
-
shader
Shader
setBoundinbBox
-
bbox
Sets the object oriented bounding box using the BBox format (usually is the mesh bounding but in some cases could be different like with skinning or submeshes)
Parameters:
-
bbox
BBoxbounding in bbox format
setRange
-
start
-
length
specifies the rendering range for the mesh (from where and how many primitives), if -1 then ignored
Parameters:
-
start
Number -
length
Number
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
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:
true if it was visible by the camera (or any camera if no camera supplied), false otherwise