Class PlaneRenderer


  • public class PlaneRenderer
    extends java.lang.Object
    Control rendering of ARCore planes.

    Used to visualize detected planes and to control whether Renderables cast shadows on them.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  PlaneRenderer.PlaneRendererMode
      Use this enum to configure the Plane Rendering.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String MATERIAL_COLOR
      Float3 material parameter to control the RGB tint of the plane.
      static java.lang.String MATERIAL_SPOTLIGHT_RADIUS
      Float material parameter to control the radius of the spotlight.
      static java.lang.String MATERIAL_TEXTURE
      Material parameter that controls what texture is being used when rendering the planes.
      static java.lang.String MATERIAL_UV_SCALE
      Float2 material parameter to control the X/Y scaling of the texture's UV coordinates.
    • Field Detail

      • MATERIAL_TEXTURE

        public static final java.lang.String MATERIAL_TEXTURE
        Material parameter that controls what texture is being used when rendering the planes.
        See Also:
        Constant Field Values
      • MATERIAL_UV_SCALE

        public static final java.lang.String MATERIAL_UV_SCALE
        Float2 material parameter to control the X/Y scaling of the texture's UV coordinates. Can be used to adjust for the texture's aspect ratio and control the frequency of tiling.
        See Also:
        Constant Field Values
      • MATERIAL_COLOR

        public static final java.lang.String MATERIAL_COLOR
        Float3 material parameter to control the RGB tint of the plane.
        See Also:
        Constant Field Values
      • MATERIAL_SPOTLIGHT_RADIUS

        public static final java.lang.String MATERIAL_SPOTLIGHT_RADIUS
        Float material parameter to control the radius of the spotlight.
        See Also:
        Constant Field Values
    • Constructor Detail

      • PlaneRenderer

        public PlaneRenderer​(Renderer renderer)
    • Method Detail

      • isEnabled

        public boolean isEnabled()
        Check if the plane renderer is enabled.
      • setEnabled

        public void setEnabled​(boolean enabled)
        Enable/disable the plane renderer.
      • isShadowReceiver

        public boolean isShadowReceiver()
        Return true if Renderables in the scene cast shadows onto the planes.
      • setShadowReceiver

        public void setShadowReceiver​(boolean shadowReceiver)
        Control whether Renderables in the scene should cast shadows onto the planes.

        If false - no planes receive shadows, regardless of the per-plane setting.

      • isVisible

        public boolean isVisible()
        Return true if plane visualization is visible.
      • setVisible

        public void setVisible​(boolean visible)
        Control visibility of plane visualization.

        If false - no planes are drawn. Note that shadow visibility is independent of plane visibility.

      • getMaterial

        public java.util.concurrent.CompletableFuture<Material> getMaterial()
        Returns default material instance used to render the planes.
      • setPlaneRendererMode

        public void setPlaneRendererMode​(PlaneRenderer.PlaneRendererMode planeRendererMode)
             Set here how tracked planes should be visualized on the screen. Two options are available,
             RENDER_ALL and RENDER_TOP_MOST.
             To see all tracked planes which are visible to the camera set the PlaneRendererMode to
             RENDER_ALL. This mode eats up quite a few resources and should only be set
             with care. To optimize the rendering set the mode to RENDER_TOP_MOST.
             In that case only the top most plane visible to a camera is rendered on the screen.
             Especially on weaker smartphone models this improves the overall performance.
        
             The default mode is RENDER_TOP_MOST
         
        Parameters:
        planeRendererMode - PlaneRenderer.PlaneRendererMode
      • update

        public void update​(com.google.ar.core.Frame frame,
                           java.util.Collection<com.google.ar.core.Plane> updatedPlanes,
                           int viewWidth,
                           int viewHeight)