Class Renderable
- java.lang.Object
-
- com.google.ar.sceneform.rendering.Renderable
-
- Direct Known Subclasses:
ModelRenderable
,ViewRenderable
public abstract class Renderable extends java.lang.Object
Base class for rendering in 3D space by attaching to aNode
withNode.setRenderable(Renderable)
.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_ANIMATION_FRAME_RATE
static int
RENDER_PRIORITY_DEFAULT
static int
RENDER_PRIORITY_FIRST
static int
RENDER_PRIORITY_LAST
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description RenderableInstance
createInstance(TransformProvider transformProvider)
int
getAnimationFrameRate()
Gets the number of frames per seconds defined in the asset animation.CollisionShape
getCollisionShape()
Get theCollisionShape
used for collision detection with thisRenderable
.Matrix
getFinalModelMatrix(Matrix originalMatrix)
Gets the final model matrix to use for rendering thisRenderable
based on the matrix passed in.ChangeId
getId()
Material
getMaterial()
Returns the material bound to the first submesh.Material
getMaterial(int submeshIndex)
Returns the material bound to the specified submesh.int
getRenderPriority()
Get the render priority that controls the order of rendering.int
getSubmeshCount()
Returns the number of submeshes that this renderable has.java.lang.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 theCollisionShape
used for collision detection with thisRenderable
.void
setMaterial(int submeshIndex, Material material)
Sets the material bound to the specified submesh.void
setMaterial(Material material)
Sets the material bound to the first 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
updateFromDefinition(RenderableDefinition definition)
-
-
-
Field Detail
-
RENDER_PRIORITY_DEFAULT
public static final int RENDER_PRIORITY_DEFAULT
- See Also:
- Constant Field Values
-
RENDER_PRIORITY_FIRST
public static final int RENDER_PRIORITY_FIRST
- See Also:
- Constant Field Values
-
RENDER_PRIORITY_LAST
public static final int RENDER_PRIORITY_LAST
- See Also:
- Constant Field Values
-
DEFAULT_ANIMATION_FRAME_RATE
public static final int DEFAULT_ANIMATION_FRAME_RATE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getCollisionShape
@Nullable public CollisionShape getCollisionShape()
Get theCollisionShape
used for collision detection with thisRenderable
.
-
setCollisionShape
public void setCollisionShape(@Nullable CollisionShape collisionShape)
Set theCollisionShape
used for collision detection with thisRenderable
.
-
getMaterial
public Material getMaterial()
Returns the material bound to the first submesh.
-
getMaterial
public Material getMaterial(int submeshIndex)
Returns the material bound to the specified submesh.
-
setMaterial
public void setMaterial(Material material)
Sets the material bound to the first submesh.
-
setMaterial
public void setMaterial(int submeshIndex, Material material)
Sets the material bound to the specified submesh.
-
getSubmeshName
public java.lang.String getSubmeshName(int submeshIndex)
Returns the name associated with the specified submesh.- Throws:
java.lang.IllegalArgumentException
- if the index is out of range
-
getRenderPriority
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.
-
setRenderPriority
public void setRenderPriority(@IntRange(from=0L,to=7L) 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.
-
isShadowCaster
public boolean isShadowCaster()
Returns true if configured to cast shadows on other renderables.
-
setShadowCaster
public void setShadowCaster(boolean isShadowCaster)
Sets whether the renderable casts shadow on other renderables in the scene.
-
isShadowReceiver
public boolean isShadowReceiver()
Returns true if configured to receive shadows cast by other renderables.
-
setShadowReceiver
public void setShadowReceiver(boolean isShadowReceiver)
Sets whether the renderable receives shadows cast by other renderables in the scene.
-
getAnimationFrameRate
public int getAnimationFrameRate()
Gets the number of frames per seconds defined in the asset animation.
-
getSubmeshCount
public int getSubmeshCount()
Returns the number of submeshes that this renderable has. All Renderables have at least one.
-
getId
public ChangeId getId()
-
createInstance
public RenderableInstance createInstance(TransformProvider transformProvider)
-
updateFromDefinition
public void updateFromDefinition(RenderableDefinition definition)
-
makeCopy
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.
-
getFinalModelMatrix
public Matrix getFinalModelMatrix(Matrix originalMatrix)
Gets the final model matrix to use for rendering thisRenderable
based on the matrix passed in. Default implementation simply passes through the original matrix. WARNING: Do not modify the originalMatrix! If the final matrix isn't the same as the original matrix, then a new instance must be returned.
-
-