RenderableManager

class RenderableManager(nativeHandle: NativePointer)

Factory and manager for Renderables, which are entities that can be drawn.

Renderables are bundles of primitives, each with its own geometry and material. All primitives in a renderable share rendering attributes such as shadow casting, skinning, morphing, layer masks, and priority.

Creating renderables:

val entity = entityManager.create()
RenderableManager.Builder(1) // 1 primitive
.boundingBox(Box(floatArrayOf(0f, 0f, 0f), floatArrayOf(1f, 1f, 1f)))
.material(0, materialInstance)
.geometry(0, PrimitiveType.TRIANGLES, vertexBuffer, indexBuffer, 0, 6)
.receiveShadows(true)
.castShadows(true)
.build(engine, entity)

scene.addEntity(entity)

Modifying renderables: To modify an existing renderable, use RenderableManager to get a temporary handle called an Instance. The instance is used to get/set rendering state. Instances are ephemeral; store Entity IDs, not instances.

Related components:

  • Use TransformManager to associate a 4x4 transform with an entity

  • Use LightManager to add lights

  • Use RenderableManager to add geometry and materials

See also

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard
class Bone

A bone transform as a unit quaternion and a translation, the compact alternative to a 4x4 matrix.

Link copied to clipboard
class Builder(count: Int)

Adds renderable components to entities using a builder pattern.

Link copied to clipboard
object Companion
Link copied to clipboard

Primitive topology types.

Properties

Link copied to clipboard

The number of renderable components.

Link copied to clipboard

All entities with a renderable component, in no particular order.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Functions

Link copied to clipboard
fun clearMaterialInstanceAt(instance: EntityInstance, primitiveIndex: Int)

Clears the material instance for a primitive (revert to default).

Link copied to clipboard
fun destroy(e: Entity)

Destroys the renderable component in the given entity.

Link copied to clipboard
fun empty(): Boolean

Returns true if there are no renderable components.

Link copied to clipboard

Gets the bounding box used for frustum culling.

Link copied to clipboard
fun getBlendOrderAt(instance: EntityInstance, primitiveIndex: Int): Int

Gets the drawing order for blended primitives.

Link copied to clipboard
fun getChannel(instance: EntityInstance): Int

Get the channel a renderable is associated to.

Link copied to clipboard

Retrieves the set of enabled attribute slots in the given primitive's VertexBuffer.

Link copied to clipboard

Returns the Entity of the component from its Instance.

Link copied to clipboard

Returns whether large-scale fog is enabled for this renderable.

Link copied to clipboard

Gets a temporary handle that can be used to access the renderable state.

Link copied to clipboard

Get the number of instances in the given entity.

Link copied to clipboard

Get the visibility bits.

Link copied to clipboard
fun getLightChannel(instance: EntityInstance, channel: Int): Boolean

Returns whether a light channel is enabled on this renderable.

Link copied to clipboard
fun getMaterialInstanceAt(instance: EntityInstance, primitiveIndex: Int): MaterialInstance?

Gets a material instance on a primitive.

Link copied to clipboard

Get the MorphTargetBuffer of the given renderable, or null if it has none.

Link copied to clipboard

Get the number of morph targets in the given entity.

Link copied to clipboard

Get the number of primitives in the given entity.

Link copied to clipboard

Get the coarse-level draw ordering.

Link copied to clipboard

Checks if the given entity already has a renderable component.

Link copied to clipboard

Get whether or not frustum culling is on.

Link copied to clipboard
fun isGlobalBlendOrderEnabledAt(instance: EntityInstance, primitiveIndex: Int): Boolean

Gets whether the blend order is global or local to this Renderable.

Link copied to clipboard

Checks if the renderable can use screen-space contact shadows.

Link copied to clipboard

Checks if the renderable can cast shadows.

Link copied to clipboard

Checks if the renderable can receive shadows.

Link copied to clipboard

Changes the bounding box used for frustum culling. The renderable must not have staticGeometry enabled.

Link copied to clipboard
fun setBlendOrderAt(instance: EntityInstance, primitiveIndex: Int, order: Int)

Sets the drawing order for blended primitives.

Link copied to clipboard
fun setBones(instance: EntityInstance, transforms: Array<RenderableManager.Bone>, boneCount: Int = transforms.size, offset: Int = 0)
fun setBones(instance: EntityInstance, transforms: FloatArray, boneCount: Int = transforms.size / 16, offset: Int = 0)

Updates the bone transforms in the range [offset, offset + boneCount). The bones must be pre-allocated using Builder.skinning().

Link copied to clipboard
fun setCastShadows(instance: EntityInstance, enable: Boolean)

Changes whether or not the renderable casts shadows.

Link copied to clipboard
fun setChannel(instance: EntityInstance, channel: Int)

Changes the channel a renderable is associated to.

Link copied to clipboard
fun setCulling(instance: EntityInstance, enable: Boolean)

Changes whether or not frustum culling is on.

Link copied to clipboard
fun setFogEnabled(instance: EntityInstance, enable: Boolean)

Changes whether or not the large-scale fog is applied to this renderable.

Link copied to clipboard
fun setGeometryAt(instance: EntityInstance, primitiveIndex: Int, type: RenderableManager.PrimitiveType, vertices: VertexBuffer, offset: Int, count: Int)

Changes the geometry for a non-indexed primitive.

fun setGeometryAt(instance: EntityInstance, primitiveIndex: Int, type: RenderableManager.PrimitiveType, vertices: VertexBuffer, indices: IndexBuffer, offset: Int, count: Int)

Changes the geometry for a primitive.

Link copied to clipboard
fun setGlobalBlendOrderEnabledAt(instance: EntityInstance, primitiveIndex: Int, enabled: Boolean)

Sets whether the blend order is global or local to this Renderable.

Link copied to clipboard
fun setLayerMask(instance: EntityInstance, select: Int, values: Int)

Changes the visibility bits.

Link copied to clipboard
fun setLightChannel(instance: EntityInstance, channel: Int, enable: Boolean)

Enables or disables a light channel for this renderable.

Link copied to clipboard
fun setMaterialInstanceAt(instance: EntityInstance, primitiveIndex: Int, materialInstance: MaterialInstance)

Changes a material instance on a primitive.

Link copied to clipboard
fun setMorphTargetBufferOffsetAt(instance: EntityInstance, level: Int, primitiveIndex: Int, offset: Int)

Associates a MorphTargetBuffer offset to the given primitive.

Link copied to clipboard
fun setMorphWeights(instance: EntityInstance, weights: FloatArray, offset: Int = 0)

Updates the vertex morphing weights on a renderable, all zeroes by default.

Link copied to clipboard
fun setPriority(instance: EntityInstance, priority: Int)

Changes the coarse-level draw ordering.

Link copied to clipboard
fun setReceiveShadows(instance: EntityInstance, enable: Boolean)

Changes whether or not the renderable can receive shadows.

Link copied to clipboard

Changes whether or not the renderable can use screen-space contact shadows.

Link copied to clipboard
fun setSkinningBuffer(instance: EntityInstance, skinningBuffer: SkinningBuffer, count: Int, offset: Int)

Associates a region of a SkinningBuffer to a renderable instance.