Class RenderableInstance
- java.lang.Object
 - 
- com.google.ar.sceneform.rendering.RenderableInstance
 
 
- 
- All Implemented Interfaces:
 AnimatableModel
public class RenderableInstance extends java.lang.Object implements AnimatableModel
Controls how aRenderableis displayed. There can be multiple RenderableInstances displaying a single Renderable. 
- 
- 
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRenderableInstance.SkinningModifierInterface for modifying the bone transforms for this specific RenderableInstance. 
- 
Constructor Summary
Constructors Constructor Description RenderableInstance(TransformProvider transformProvider, Renderable renderable) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanapplyAnimationChange(ModelAnimation animation)Occurs when aModelAnimationhas received any property changed.voidattachToRenderer(Renderer renderer)voiddestroy()Detach and destroy the instancevoiddetachFromRenderer()ModelAnimationgetAnimation(int animationIndex)Get the associatedModelAnimationat the given index or throw anIndexOutOfBoundsException.intgetAnimationCount()Returns the number ofModelAnimationdefinitions in the model.intgetEntity()com.google.android.filament.gltfio.FilamentAssetgetFilamentAsset()MaterialgetMaterial()Returns the material bound to the first submesh.MaterialgetMaterial(int index)Returns the material bound to the specified index.MaterialgetMaterial(java.lang.String name)Returns the material bound to the specified name.java.lang.StringgetMaterialName(int index)Returns the name associated with the specified index.intgetMaterialsCount()Returns the number of materials.MatrixgetRelativeTransform()Returns the transform of this renderable relative to it's node.MatrixgetRelativeTransformInverse()Returns the inverse transform of this renderable relative to it's node.RenderablegetRenderable()Get theRenderableto display for thisRenderableInstance.intgetRenderedEntity()intgetRenderPriority()Get the render priority that controls the order of rendering.MatrixgetWorldModelMatrix()booleanisShadowCaster()Returns true if configured to cast shadows on other renderables.booleanisShadowReceiver()Returns true if configured to receive shadows cast by other renderables.voidprepareForDraw()voidsetMaterial(int entityIndex, int primitiveIndex, Material material)Sets the material bound to the specified index and entityIndexvoidsetMaterial(int primitiveIndex, Material material)Sets the material bound to the specified index.voidsetMaterial(Material material)Sets the material bound to the first index.voidsetRenderPriority(int renderPriority)Set the render priority to control the order of rendering.voidsetShadowCaster(boolean isShadowCaster)Sets whether the renderable casts shadow on other renderables in the scene.voidsetShadowReceiver(boolean isShadowReceiver)Sets whether the renderable receives shadows cast by other renderables in the scene.voidsetSkinningModifier(RenderableInstance.SkinningModifier skinningModifier)booleanupdateAnimations(boolean force)Apply animations changesif fore==trueor the animation has dirty values.- 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
- 
Methods inherited from interface com.google.ar.sceneform.animation.AnimatableModel
animate, animate, animate, animate, getAnimation, getAnimationIndex, getAnimationName, getAnimationNames, getAnimationOrThrow, hasAnimations, onModelAnimationChanged, setAnimationsFramePosition, setAnimationsTimePosition 
 - 
 
 - 
 
- 
- 
Constructor Detail
- 
RenderableInstance
public RenderableInstance(TransformProvider transformProvider, Renderable renderable)
 
 - 
 
- 
Method Detail
- 
getFilamentAsset
@Nullable public com.google.android.filament.gltfio.FilamentAsset getFilamentAsset()
 
- 
getRenderable
public Renderable getRenderable()
Get theRenderableto display for thisRenderableInstance.- Returns:
 Renderableasset, usually a 3D model.
 
- 
getEntity
public int getEntity()
 
- 
getRenderedEntity
public int getRenderedEntity()
 
- 
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. 
- 
getMaterial
public Material getMaterial()
Returns the material bound to the first submesh. 
- 
getMaterialsCount
public int getMaterialsCount()
Returns the number of materials. 
- 
getMaterial
public Material getMaterial(int index)
Returns the material bound to the specified index. 
- 
getMaterial
public Material getMaterial(java.lang.String name)
Returns the material bound to the specified name. 
- 
setMaterial
public void setMaterial(Material material)
Sets the material bound to the first index. 
- 
setMaterial
public void setMaterial(@IntRange(from=0L) int primitiveIndex, Material material)Sets the material bound to the specified index. 
- 
setMaterial
public void setMaterial(int entityIndex, @IntRange(from=0L) int primitiveIndex, Material material)Sets the material bound to the specified index and entityIndex 
- 
getMaterialName
public java.lang.String getMaterialName(int index)
Returns the name associated with the specified index. 
- 
getWorldModelMatrix
public Matrix getWorldModelMatrix()
 
- 
setSkinningModifier
public void setSkinningModifier(@Nullable RenderableInstance.SkinningModifier skinningModifier) 
- 
getAnimation
public ModelAnimation getAnimation(int animationIndex)
Get the associatedModelAnimationat the given index or throw anIndexOutOfBoundsException.- Specified by:
 getAnimationin interfaceAnimatableModel- Parameters:
 animationIndex- Zero-based index for the animation of interest.
 
- 
getAnimationCount
public int getAnimationCount()
Returns the number ofModelAnimationdefinitions in the model.- Specified by:
 getAnimationCountin interfaceAnimatableModel
 
- 
applyAnimationChange
public boolean applyAnimationChange(ModelAnimation animation)
Description copied from interface:AnimatableModelOccurs when aModelAnimationhas received any property changed.
Depending on the returned value, theModelAnimationwill set his isDirty to false or not.
You can choose between applying changes on theObjectAnimatorChoreographer.FrameCallbackor use your ownChoreographerto handle an update/render update hierarchy.
Time position should be applied inside a globalChoreographerframe callback to ensure that the transformations are applied in a hierarchical order.- Specified by:
 applyAnimationChangein interfaceAnimatableModel- Returns:
 - true is the changes have been applied/handled
 
 
- 
prepareForDraw
public void prepareForDraw()
 
- 
attachToRenderer
public void attachToRenderer(Renderer renderer)
 
- 
detachFromRenderer
public void detachFromRenderer()
 
- 
destroy
public void destroy()
Detach and destroy the instance 
- 
getRelativeTransform
@Nullable public Matrix getRelativeTransform()
Returns the transform of this renderable relative to it's node. This will be non-null if the .sfa file includes a scale other than 1 or has recentering turned on. 
- 
getRelativeTransformInverse
@Nullable public Matrix getRelativeTransformInverse()
Returns the inverse transform of this renderable relative to it's node. This will be non-null if the .sfa file includes a scale other than 1 or has recentering turned on. 
- 
updateAnimations
public boolean updateAnimations(boolean force)
Apply animations changesif fore==trueor the animation has dirty values.- Parameters:
 force- Update even if the animation time position didn't changed.- Returns:
 - true if any animation update has been made.
 
 
 - 
 
 -