Renderable

  • Renderable is an abstract base class for rendering objects in 3D space within Sceneform by attaching to a Node .

  • It provides functionalities like setting materials, collision shapes, render priority, and shadow behavior.

  • ModelRenderable and ViewRenderable are direct subclasses used for rendering 3D models and 2D Android views, respectively.

  • Renderables can be customized with materials, collision shapes, and rendering order using dedicated methods.

  • This class allows developers to control how objects appear and interact within the AR scene.

public abstract class Renderable
Known Direct Subclasses
ModelRenderable Renders a 3D Model by attaching it to a Node with setRenderable(Renderable)
ViewRenderable Renders a 2D Android view in 3D space by attaching it to a Node with setRenderable(Renderable)

Base class for rendering in 3D space by attaching to a Node with setRenderable(Renderable) .

Constants

int RENDER_PRIORITY_DEFAULT *
int RENDER_PRIORITY_FIRST *
int RENDER_PRIORITY_LAST *

Fields

protected CollisionShape collisionShape

Protected Constructors

Public Methods

CollisionShape
getCollisionShape ()
Get the CollisionShape used for collision detection with this Renderable .
Material
getMaterial (int submeshIndex)
Returns the material bound to the specified submesh.
Material
getMaterial ()
Returns the material bound to the first submesh.
int
getRenderPriority ()
Get the render priority that controls the order of rendering.
int
getSubmeshCount ()
Returns the number of submeshes that this renderable has.
String
getSubmeshName (int submeshIndex)
Returns the name associated with the specified submesh.
boolean
isShadowCaster ()
Returns true if configured to cast shadows on other renderables.
boolean
isShadowReceiver ()
Returns true if configured to receive shadows cast by other renderables.
abstract Renderable
makeCopy ()
Creates a new instance of this Renderable.
void
setCollisionShape ( CollisionShape collisionShape)
Set the CollisionShape used for collision detection with this Renderable .
void
setMaterial ( Material material)
Sets the material bound to the first submesh.
void
setMaterial (int submeshIndex, Material material)
Sets the material bound to the specified submesh.
void
setRenderPriority (int renderPriority)
Set the render priority to control the order of rendering.
void
setShadowCaster (boolean isShadowCaster)
Sets whether the renderable casts shadow on other renderables in the scene.
void
setShadowReceiver (boolean isShadowReceiver)
Sets whether the renderable receives shadows cast by other renderables in the scene.
void

Inherited Methods

Constants

public static final int RENDER_PRIORITY_DEFAULT

Constant Value: 4

public static final int RENDER_PRIORITY_FIRST

Constant Value: 0

public static final int RENDER_PRIORITY_LAST

Constant Value: 7

Fields

protected CollisionShape collisionShape

Protected Constructors

protected Renderable ( Renderable other)

Parameters
other

Public Methods

public CollisionShape getCollisionShape ()

Get the CollisionShape used for collision detection with this Renderable .

public Material getMaterial (int submeshIndex)

Returns the material bound to the specified submesh.

Parameters
submeshIndex

public Material getMaterial ()

Returns the material bound to the first submesh.

public int getRenderPriority ()

Get the render priority that controls the order of rendering. The priority is between a range of 0 (rendered first) and 7 (rendered last). The default value is 4.

public int getSubmeshCount ()

Returns the number of submeshes that this renderable has. All Renderables have at least one.

public String getSubmeshName (int submeshIndex)

Returns the name associated with the specified submesh.

Parameters
submeshIndex
Throws
if the index is out of range

public boolean isShadowCaster ()

Returns true if configured to cast shadows on other renderables.

public boolean isShadowReceiver ()

Returns true if configured to receive shadows cast by other renderables.

public abstract Renderable makeCopy ()

Creates a new instance of this Renderable.

The new renderable will have unique copy of all mutable state. All materials referenced by the Renderable will also be instanced. Immutable data will be shared between the instances.

public void setCollisionShape ( CollisionShape collisionShape)

Set the CollisionShape used for collision detection with this Renderable .

Parameters
collisionShape

public void setMaterial ( Material material)

Sets the material bound to the first submesh.

Parameters
material

public void setMaterial (int submeshIndex, Material material)

Sets the material bound to the specified submesh.

Parameters
submeshIndex
material

public void setRenderPriority (int renderPriority)

Set the render priority to control the order of rendering. The priority is between a range of 0 (rendered first) and 7 (rendered last). The default value is 4.

Parameters
renderPriority

public void setShadowCaster (boolean isShadowCaster)

Sets whether the renderable casts shadow on other renderables in the scene.

Parameters
isShadowCaster

public void setShadowReceiver (boolean isShadowReceiver)

Sets whether the renderable receives shadows cast by other renderables in the scene.

Parameters
isShadowReceiver

public void updateFromDefinition ( RenderableDefinition definition)

Parameters
definition
Design a Mobile Site
View Site in Mobile | Classic
Share by: