Package 

Class RenderableManager


  • 
    public class RenderableManager
    
                        

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

    Renderables are bundles of primitives, each of which has its own geometry and material. All primitives in a particular renderable share a set of rendering attributes, such as whether they cast shadows or use vertex skinning. Kotlin usage example:

    val entity = EntityManager.get().create()
    
    RenderableManager.Builder(1)
            .boundingBox(Box(0.0f, 0.0f, 0.0f, 9000.0f, 9000.0f, 9000.0f))
            .geometry(0, RenderableManager.PrimitiveType.TRIANGLES, vb, ib)
            .material(0, material)
            .build(engine, entity)
    
    scene.addEntity(renderable)
    

    To modify the state of an existing renderable, clients should first use RenderableManager to get a temporary handle called an instance. The instance can then be used to get or set the renderable's state. Please note that instances are ephemeral; clients should store entities, not instances.

    • Method Detail

      • hasComponent

         boolean hasComponent(int entity)

        Checks if the given entity already has a renderable component.

      • getInstance

         int getInstance(int entity)

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

      • destroy

         void destroy(int entity)

        Destroys the renderable component in the given entity.

      • setBonesAsMatrices

         void setBonesAsMatrices(int i, @NonNull() Buffer matrices, @IntRange(from = 0, to = 255) int boneCount, @IntRange(from = 0) int offset)

        Sets the transforms associated with each bone of a Renderable.

        Parameters:
        i - Instance of the Renderable
        matrices - A FloatBuffer containing boneCount 4x4 packed matrices (i.e.
        boneCount - Number of bones to set
        offset - Index of the first bone to set
      • setBonesAsQuaternions

         void setBonesAsQuaternions(int i, @NonNull() Buffer quaternions, @IntRange(from = 0, to = 255) int boneCount, @IntRange(from = 0) int offset)

        Sets the transforms associated with each bone of a Renderable.

        Parameters:
        i - Instance of the Renderable
        quaternions - A FloatBuffer containing boneCount transforms.
        boneCount - Number of bones to set
        offset - Index of the first bone to set
      • setMorphWeights

         void setMorphWeights(int i, @NonNull() Array<float> weights, @IntRange(from = 0) int offset)

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

        The renderable must be built with morphing enabled. In legacy morphing mode, only thefirst 4 weights are considered.

      • setLayerMask

         void setLayerMask(int i, @IntRange(from = 0, to = 255) int select, @IntRange(from = 0, to = 255) int value)

        Changes the visibility bits.

      • setPriority

         void setPriority(int i, @IntRange(from = 0, to = 7) int priority)

        Changes the coarse-level draw ordering.

      • setChannel

         void setChannel(int i, @IntRange(from = 0, to = 3) int channel)

        Changes the channel of a renderable

      • setCulling

         void setCulling(int i, boolean enabled)

        Changes whether or not frustum culling is on.

      • setLightChannel

         void setLightChannel(int i, @IntRange(from = 0, to = 7) int channel, boolean enable)

        Enables or disables a light channel.Light channel 0 is enabled by default.

        Parameters:
        i - Instance of the component obtained from getInstance().
        channel - Light channel to set
        enable - true to enable, false to disable
      • getLightChannel

         boolean getLightChannel(int i, @IntRange(from = 0, to = 7) int channel)

        Returns whether a light channel is enabled on a specified renderable.

        Parameters:
        i - Instance of the component obtained from getInstance().
        channel - Light channel to query
      • setCastShadows

         void setCastShadows(int i, boolean enabled)

        Changes whether or not the renderable casts shadows.

      • setReceiveShadows

         void setReceiveShadows(int i, boolean enabled)

        Changes whether or not the renderable can receive shadows.

      • setScreenSpaceContactShadows

         void setScreenSpaceContactShadows(int i, boolean enabled)

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

      • isShadowCaster

         boolean isShadowCaster(int i)

        Checks if the renderable can cast shadows.

      • isShadowReceiver

         boolean isShadowReceiver(int i)

        Checks if the renderable can receive shadows.

      • getPrimitiveCount

        @IntRange(from = 0) int getPrimitiveCount(int i)

        Gets the immutable number of primitives in the given renderable.

      • setBlendOrderAt

         void setBlendOrderAt(int instance, @IntRange(from = 0) int primitiveIndex, @IntRange(from = 0, to = 65535) int blendOrder)

        Changes the drawing order for blended primitives. The drawing order is either global orlocal (default) to this Renderable. In either case, the Renderable priority takes precedence.

        Parameters:
        instance - the renderable of interest
        primitiveIndex - the primitive of interest
        blendOrder - draw order number (0 by default).
      • setGlobalBlendOrderEnabledAt

         void setGlobalBlendOrderEnabledAt(int instance, @IntRange(from = 0) int primitiveIndex, boolean enabled)

        Changes whether the blend order is global or local to this Renderable (by default).

        Parameters:
        instance - the renderable of interest
        primitiveIndex - the primitive of interest
        enabled - true for global, false for local blend ordering.