Class ViewRenderable
- java.lang.Object
-
- com.google.ar.sceneform.rendering.Renderable
-
- com.google.ar.sceneform.rendering.ViewRenderable
-
@RequiresApi(api=24) public class ViewRenderable extends Renderable
Renders a 2D Android view in 3D space by attaching it to aNodewithNode.setRenderable(Renderable). By default, the size of the view is 1 meter in theSceneper 250dp in the layout. Use aViewSizerto control how the size of the view in theSceneis calculated.future = ViewRenderable.builder().setView(context, R.layout.view).build(); viewRenderable = future.thenAccept(...);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classViewRenderable.BuilderFactory class forViewRenderablestatic classViewRenderable.HorizontalAlignmentControls the horizontal alignment of theViewRenderablerelative to theNodeit is attached to.static classViewRenderable.VerticalAlignmentControls the vertical alignment of theViewRenderablerelative to theNodeit is attached to.
-
Field Summary
-
Fields inherited from class com.google.ar.sceneform.rendering.Renderable
DEFAULT_ANIMATION_FRAME_RATE, RENDER_PRIORITY_DEFAULT, RENDER_PRIORITY_FIRST, RENDER_PRIORITY_LAST
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ViewRenderable.Builderbuilder()Constructs aViewRenderableMatrixgetFinalModelMatrix(Matrix originalMatrix)Takes the model matrix from theTransformProviderfor rendering thisNodeand scales it to size it appropriately based on the meters to pixel ratio for the view.ViewRenderable.HorizontalAlignmentgetHorizontalAlignment()Gets theViewRenderable.HorizontalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the x-axis.ViewSizergetSizer()ViewRenderable.VerticalAlignmentgetVerticalAlignment()Gets theViewRenderable.VerticalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the y-axis.android.view.ViewgetView()The 2D AndroidViewthat is rendered by thisViewRenderable.ViewRenderablemakeCopy()Creates a new instance of this ViewRenderable.voidsetHorizontalAlignment(ViewRenderable.HorizontalAlignment horizontalAlignment)Sets theViewRenderable.HorizontalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the x-axis.voidsetSizer(ViewSizer viewSizer)voidsetVerticalAlignment(ViewRenderable.VerticalAlignment verticalAlignment)Sets theViewRenderable.VerticalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the y-axis.-
Methods inherited from class com.google.ar.sceneform.rendering.Renderable
createInstance, getAnimationFrameRate, getCollisionShape, getId, getMaterial, getMaterial, getRenderPriority, getSubmeshCount, getSubmeshName, isShadowCaster, isShadowReceiver, setCollisionShape, setMaterial, setMaterial, setRenderPriority, setShadowCaster, setShadowReceiver, updateFromDefinition
-
-
-
-
Method Detail
-
getView
public android.view.View getView()
The 2D AndroidViewthat is rendered by thisViewRenderable.
-
makeCopy
public ViewRenderable makeCopy()
Creates a new instance of this ViewRenderable.The new renderable will have unique copy of all mutable state. All materials referenced by the ViewRenderable will also be instanced. Immutable data will be shared between the instances. The new ViewRenderable will reference the same getFilamentEngine View as the original ViewRenderable.
- Specified by:
makeCopyin classRenderable
-
getSizer
public ViewSizer getSizer()
-
setSizer
public void setSizer(ViewSizer viewSizer)
-
getHorizontalAlignment
public ViewRenderable.HorizontalAlignment getHorizontalAlignment()
Gets theViewRenderable.HorizontalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the x-axis. The default isViewRenderable.HorizontalAlignment.CENTER.
-
setHorizontalAlignment
public void setHorizontalAlignment(ViewRenderable.HorizontalAlignment horizontalAlignment)
Sets theViewRenderable.HorizontalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the x-axis. The default isViewRenderable.HorizontalAlignment.CENTER.
-
getVerticalAlignment
public ViewRenderable.VerticalAlignment getVerticalAlignment()
Gets theViewRenderable.VerticalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the y-axis. The default isViewRenderable.VerticalAlignment.BOTTOM.
-
setVerticalAlignment
public void setVerticalAlignment(ViewRenderable.VerticalAlignment verticalAlignment)
Sets theViewRenderable.VerticalAlignmentthat controls where theViewRenderableis positioned relative to theNodeit is attached to along the y-axis. The default isViewRenderable.VerticalAlignment.BOTTOM.
-
getFinalModelMatrix
public Matrix getFinalModelMatrix(Matrix originalMatrix)
Takes the model matrix from theTransformProviderfor rendering thisNodeand scales it to size it appropriately based on the meters to pixel ratio for the view.- Overrides:
getFinalModelMatrixin classRenderable- Parameters:
originalMatrix-
-
builder
public static ViewRenderable.Builder builder()
Constructs aViewRenderable
-
-