- Sceneform SDK for Android
was open sourced and archived ( github.com/google-ar/sceneform-android-sdk
) with version 1.16.0.
- This site ( developers.google.com/sceneform
) serves as the documentation archive for the previous version, Sceneform SDK for Android
1.15.0.
- Do not use version 1.17.0 of the Sceneform Maven artifacts
.
- The 1.17.1 Maven artifacts can be used. Other than the version, however, the 1.17.1 artifacts are identical to the 1.15.0 artifacts.
ShapeFactory
Stay organized with collections
Save and categorize content based on your preferences.
Utility class used to dynamically construct ModelRenderable
s for various shapes.
Inherited Methods
From class
java.lang.Object
Public Constructors
public
ShapeFactory
()
Public Methods
Creates a ModelRenderable
in the shape of a cube with the give specifications.
Parameters
Returns
- renderable representing a cube with the given parameters
public
static ModelRenderable
makeCylinder
(float radius, float height, Vector3
center, Material
material)
Creates a ModelRenderable
in the shape of a cylinder with the give specifications.
Parameters
Returns
- renderable representing a cylinder with the given parameters
Creates a ModelRenderable
in the shape of a sphere with the give specifications.
Parameters
Returns
- renderable representing a sphere with the given parameters
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-06-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-06-26 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eShapeFactory\u003c/code\u003e is a utility class for dynamically creating \u003ccode\u003eModelRenderable\u003c/code\u003e objects representing basic shapes.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to create cubes, cylinders, and spheres with specified dimensions, center points, and materials.\u003c/p\u003e\n"],["\u003cp\u003eThese methods (\u003ccode\u003emakeCube\u003c/code\u003e, \u003ccode\u003emakeCylinder\u003c/code\u003e, \u003ccode\u003emakeSphere\u003c/code\u003e) return a \u003ccode\u003eModelRenderable\u003c/code\u003e that can be used to display the shape in an AR scene.\u003c/p\u003e\n"],["\u003cp\u003eEach shape's creation requires specifying size or radius, center position, and the desired material for rendering.\u003c/p\u003e\n"]]],["`ShapeFactory` constructs `ModelRenderable` objects for cubes, cylinders, and spheres. `makeCube` generates a cube, requiring size, center, and material parameters. `makeCylinder` creates a cylinder, using radius, height, center, and material. `makeSphere` builds a sphere, needing radius, center, and material inputs. Each method returns a `ModelRenderable` of the specified shape with its properties. A default constructor for `ShapeFactory` is available.\n"],null,["# ShapeFactory\n\npublic final class **ShapeFactory** \nUtility class used to dynamically construct [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable)s for various shapes. \n\n### Public Constructors\n\n|---|------------------------------------------------------------------------------------------------------|\n| | [ShapeFactory](/sceneform/reference/com/google/ar/sceneform/rendering/ShapeFactory#ShapeFactory())() |\n\n### Public Methods\n\n|--------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) | [makeCube](/sceneform/reference/com/google/ar/sceneform/rendering/ShapeFactory#makeCube(com.google.ar.sceneform.math.Vector3,%20com.google.ar.sceneform.math.Vector3,%20com.google.ar.sceneform.rendering.Material))([Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) size, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material) Creates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a cube with the give specifications. |\n| static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) | [makeCylinder](/sceneform/reference/com/google/ar/sceneform/rendering/ShapeFactory#makeCylinder(float,%20float,%20com.google.ar.sceneform.math.Vector3,%20com.google.ar.sceneform.rendering.Material))(float radius, float height, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material) Creates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a cylinder with the give specifications. |\n| static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) | [makeSphere](/sceneform/reference/com/google/ar/sceneform/rendering/ShapeFactory#makeSphere(float,%20com.google.ar.sceneform.math.Vector3,%20com.google.ar.sceneform.rendering.Material))(float radius, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material) Creates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a sphere with the give specifications. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|-----------------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [Object](https://developer.android.com/reference/java/lang/Object) | clone() |\n| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object) arg0) |\n| void | finalize() |\n| final [Class](https://developer.android.com/reference/java/lang/Class)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](https://developer.android.com/reference/java/lang/String) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public\n**ShapeFactory**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable)\n**makeCube**\n([Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) size, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material)\n\nCreates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a cube with the give specifications. \n\n##### Parameters\n\n| size | the size of the constructed cube |\n| center | the center of the constructed cube |\n| material | the material to use for rendering the cube |\n|----------|--------------------------------------------|\n\n##### Returns\n\n- renderable representing a cube with the given parameters \n\n#### public static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable)\n**makeCylinder**\n(float radius, float height, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material)\n\nCreates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a cylinder with the give specifications. \n\n##### Parameters\n\n| radius | the radius of the constructed cylinder |\n| height | the height of the constructed cylinder |\n| center | the center of the constructed cylinder |\n| material | the material to use for rendering the cylinder |\n|----------|------------------------------------------------|\n\n##### Returns\n\n- renderable representing a cylinder with the given parameters \n\n#### public static [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable)\n**makeSphere**\n(float radius, [Vector3](/sceneform/reference/com/google/ar/sceneform/math/Vector3) center, [Material](/sceneform/reference/com/google/ar/sceneform/rendering/Material) material)\n\nCreates a [ModelRenderable](/sceneform/reference/com/google/ar/sceneform/rendering/ModelRenderable) in the shape of a sphere with the give specifications. \n\n##### Parameters\n\n| radius | the radius of the constructed sphere |\n| center | the center of the constructed sphere |\n| material | the material to use for rendering the sphere |\n|----------|----------------------------------------------|\n\n##### Returns\n\n- renderable representing a sphere with the given parameters"]]