### Model Instance Definition Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelInstanceDef.html Methods for creating and starting model instance definitions using FlatBufferBuilder. ```APIDOC ## createModelInstanceDef ### Description Creates a model instance definition with various data offsets and properties. ### Method static int createModelInstanceDef ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **builder** (FlatBufferBuilder) - Required - The FlatBufferBuilder to use. * **vertex_dataOffset** (int) - Required - Offset for vertex data. * **indices16Offset** (int) - Required - Offset for 16-bit indices. * **indices32Offset** (int) - Required - Offset for 32-bit indices. * **rangesOffset** (int) - Required - Offset for ranges. * **materialsOffset** (int) - Required - Offset for materials. * **vertex_attributesOffset** (int) - Required - Offset for vertex attributes. * **num_vertices** (long) - Required - The number of vertices. * **interleaved** (boolean) - Required - Whether vertex data is interleaved. * **shader_to_mesh_bonesOffset** (int) - Required - Offset for shader-to-mesh bones. * **blend_shapesOffset** (int) - Required - Offset for blend shapes. * **blend_attributesOffset** (int) - Required - Offset for blend attributes. * **aabbsOffset** (int) - Required - Offset for Axis-Aligned Bounding Boxes. ### Request Example ```json { "builder": "", "vertex_dataOffset": 0, "indices16Offset": 0, "indices32Offset": 0, "rangesOffset": 0, "materialsOffset": 0, "vertex_attributesOffset": 0, "num_vertices": 100, "interleaved": true, "shader_to_mesh_bonesOffset": 0, "blend_shapesOffset": 0, "blend_attributesOffset": 0, "aabbsOffset": 0 } ``` ### Response #### Success Response (200) * **modelInstanceDefOffset** (int) - The offset of the created model instance definition. #### Response Example ```json { "modelInstanceDefOffset": 10 } ``` ## startModelInstanceDef ### Description Starts a model instance definition builder. ### Method static void startModelInstanceDef ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **builder** (FlatBufferBuilder) - Required - The FlatBufferBuilder to use. ### Request Example ```json { "builder": "" } ``` ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Java: Start ModelPipelineMaterialDef Creation Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelPipelineMaterialDef.html Initiates the process of starting a ModelPipelineMaterialDef definition within a FlatBufferBuilder. This method is part of the FlatBuffers schema generation for incremental building. ```java static void startModelPipelineMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder) ``` -------------------------------- ### Basic AR Model Viewer Setup in Android Source: https://context7.com/sceneview/sceneform-android/llms.txt Sets up a basic AR application in Android to display 3D models on detected planes using Sceneform and ARCore. This involves configuring the Activity, layout XML, AndroidManifest, and build.gradle dependencies. ```kotlin class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) // Get ArFragment from layout val arFragment = supportFragmentManager.findFragmentById(R.id.arFragment) as ArFragment // Load and place model from assets on plane tap arFragment.setOnTapPlaneGlbModel("model.glb") } } ``` ```xml ``` ```xml ``` ```gradle // app/build.gradle dependencies { implementation "com.gorisse.thomas.sceneform:sceneform:1.23.0" } ``` -------------------------------- ### FrameTime Start Time (Seconds) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-7.html Gets the time in seconds when this frame started. ```APIDOC ## GET /sceneview/sceneform-android/FrameTime ### Description Gets the time in seconds when this frame started. ### Method GET ### Endpoint /sceneview/sceneform-android/FrameTime#getStartSeconds() ### Parameters None ### Request Example None ### Response #### Success Response (200) - **startSeconds** (Double) - The start time of the frame in seconds. #### Response Example ```json { "startSeconds": 1678886400.123 } ``` ``` -------------------------------- ### FrameTime Start Time (TimeUnit) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-7.html Gets the time when this frame started, in the specified TimeUnit. ```APIDOC ## GET /sceneview/sceneform-android/FrameTime ### Description Gets the time when this frame started, in the specified TimeUnit. ### Method GET ### Endpoint /sceneview/sceneform-android/FrameTime#getStartTime(TimeUnit) ### Parameters #### Path Parameters None #### Query Parameters - **unit** (TimeUnit) - The time unit to return the time in. ### Request Example None ### Response #### Success Response (200) - **startTime** (Long) - The start time of the frame in the specified unit. #### Response Example ```json { "startTime": 1678886400123456789 } ``` ``` -------------------------------- ### Example: Creating a Vector of Strings (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/FlatBufferBuilder.html Demonstrates the usage of `startVector`, `addOffset`, and `endVector` to create a vector of strings. It highlights the process of creating individual string offsets and then assembling them into a vector, noting the reverse order of addition due to buffer filling. ```Java FlatBufferBuilder builder = new FlatBufferBuilder(existingBuffer); int[] offsets = new int[10]; for (int i = 0; i < 10; i++) { offsets[i] = fbb.createString(" " + i); } builder.startVector(4, offsets.length, 4); for (int i = offsets.length - 1; i >= 0; i--) { builder.addOffset(offsets[i]); } int offsetOfTheVector = fbb.endVector(); ``` -------------------------------- ### Get Arc Start Angle Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ArcDef.html Retrieves the start angle of the arc. The angle is measured in radians, with 0 radians corresponding to the vertical position. This value defines the starting orientation of the arc. ```java public float startAngle() ``` -------------------------------- ### com.google.flatbuffers Package Overview Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/package-summary.html This section provides an overview of the classes available within the com.google.flatbuffers package. ```APIDOC ## Package: com.google.flatbuffers ### Description This package provides classes for building and accessing data in the FlatBuffers format. ### Classes * **Constants** - Class that holds shared constants. * **FlatBufferBuilder** - Class that helps you build a FlatBuffer. * **FlatBufferBuilder.ByteBufferFactory** - An interface that provides a user of the FlatBufferBuilder class the ability to specify the method in which the internal buffer gets allocated. * **FlatBufferBuilder.HeapByteBufferFactory** - An implementation of the ByteBufferFactory interface that is used when one is not provided by the user. * **Struct** - All structs in the generated code derive from this class, and add their own accessors. * **Table** - All tables in the generated code derive from this class, and add their own accessors. * **Utf8** - Utility class for UTF-8 operations. * **Utf8Safe** - A set of low-level, high-performance static utility methods related to the UTF-8 character encoding. ``` -------------------------------- ### Get Frame Start Time in Seconds - Java Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/FrameTime.html Retrieves the time in seconds when the current frame began its processing. This can be used to measure the total elapsed time since the frame processing started. ```java public float getStartSeconds() { // Implementation details to calculate and return start time in seconds } ``` -------------------------------- ### Build Light with Builder - Java Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/rendering/Light.Builder.html Demonstrates how to create a Light object using the Light.Builder. This involves instantiating the builder, setting various light properties, and finally calling the build() method to create the Light instance. Dependencies include the Light and Color classes from com.google.ar.sceneform.rendering. ```java Light.Builder builder = new Light.Builder(); builder.setColor(new Color(android.graphics.Color.RED)); // Example color builder.setIntensity(1000f); // Example intensity // ... set other properties as needed Light light = builder.build(); ``` -------------------------------- ### Vertex API Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-7.html Methods related to Vertex objects, though specific examples are not provided in the input. -------------------------------- ### Get Frame Start Time in Specific Units - Java Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/FrameTime.html Retrieves the time when the current frame started, allowing the caller to specify the desired TimeUnit. This is useful for aligning frame times with other time-based events in the application. ```java public long getStartTime(java.util.concurrent.TimeUnit unit) { // Implementation details to calculate and return start time in the specified unit } ``` -------------------------------- ### Renderer Configuration Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-18.html Methods for configuring the renderer, including camera and clear color. ```APIDOC ## setCameraProvider ### Description Sets the camera provider for the renderer. ### Method void ### Endpoint N/A (Method within Renderer class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java renderer.setCameraProvider(cameraProvider); ``` ### Response #### Success Response (void) N/A #### Response Example N/A ``` ```APIDOC ## setClearColor ### Description Sets the clear color for the renderer. ### Method void ### Endpoint N/A (Method within Renderer class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java renderer.setClearColor(new Color(1.0f, 0.0f, 0.0f)); // Red ``` ### Response #### Success Response (void) N/A #### Response Example N/A ``` -------------------------------- ### Get Ray Origin (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/collision/Ray.html Returns the origin point of the Ray. This method is essential for determining the starting position of the ray in 3D space. ```java public @NonNull Vector3 getOrigin() { // Get the origin of the ray. return null; } ``` -------------------------------- ### EngineInstance Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-9.html Methods for managing the Sceneform rendering engine instance. ```APIDOC ## isHeadlessMode() ### Description Checks if the engine is running in headless mode. ### Method Static method ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (boolean) - **true**: The engine is in headless mode. - **false**: The engine is not in headless mode. #### Response Example ```json false ``` ``` -------------------------------- ### Get Data Buffer (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/FlatBufferBuilder.html Retrieves the `ByteBuffer` containing the serialized FlatBuffer data. This method should only be called after `finish()` has been invoked. The actual data starts at the buffer's current position. ```Java public java.nio.ByteBuffer dataBuffer() ``` -------------------------------- ### Build Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-2.html Methods for building various Sceneform components such as Lights, Materials, RenderableDefinitions, and Textures. ```APIDOC ## build() - Light.Builder ### Description Creates a new [`Light`](../com/google/ar/sceneform/rendering/Light.html "class in com.google.ar.sceneform.rendering") based on the parameters set previously. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - Material.Builder ### Description Creates a new [`Material`](../com/google/ar/sceneform/rendering/Material.html "class in com.google.ar.sceneform.rendering") based on the parameters set previously. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - RenderableDefinition.Builder ### Description N/A ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - RenderableDefinition.Submesh.Builder ### Description N/A ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - Texture.Builder ### Description Creates a new [`Texture`](../com/google/ar/sceneform/rendering/Texture.html "class in com.google.ar.sceneform.rendering") based on the parameters set previously. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - Texture.Sampler.Builder ### Description Construct a Sampler from the properties of the Builder. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` ```APIDOC ## build() - Vertex.Builder ### Description N/A ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get Identity Quaternion (identity) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/math/Quaternion.html Retrieves a static Quaternion object that represents no rotation (the identity rotation). This is often used as a starting point for rotations or for resetting orientation. ```java public static Quaternion identity() ``` -------------------------------- ### AndroidPreconditions Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-9.html Methods for checking Android system preconditions. ```APIDOC ## isMinAndroidApiLevel() ### Description Returns true if the Android API level is above the minimum required or if not on an Android device. ### Method Static method ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (boolean) - **true**: The Android API level meets the minimum requirement or the device is not Android. - **false**: The Android API level is below the minimum requirement. #### Response Example ```json true ``` ``` -------------------------------- ### Get Arc Angle Size Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ArcDef.html Retrieves the angular size of the arc. The size is measured in radians and defines the extent of the arc from its start angle. This determines how much of a circle the arc covers. ```java public float angleSize() ``` -------------------------------- ### Get Full Sized Byte Array from Buffer (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/FlatBufferBuilder.html Copies the entire content of the internal `ByteBuffer` into a `byte[]`. This provides a complete copy of the serialized FlatBuffer data, starting from the buffer's current position to its end. ```Java public byte[] sizedByteArray() ``` -------------------------------- ### GLHelper Constructor Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/rendering/GLHelper.html Initializes a new instance of the GLHelper class. ```APIDOC ## GLHelper() ### Description Initializes a new instance of the GLHelper class. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) N/A #### Response Example ```json {} ``` ``` -------------------------------- ### Configure Automatic Depth Mode with Occlusion (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/depth.md Configures the AR session to use automatic depth mode and enables depth occlusion for virtual objects. This requires the ARCore session and Sceneform view setup. ```java @Override public void onSessionConfiguration(Session session, Config config) { if (session.isDepthModeSupported(Config.DepthMode.AUTOMATIC)) { config.setDepthMode(Config.DepthMode.AUTOMATIC); } config.setUpdateMode(Config.UpdateMode.LATEST_CAMERA_IMAGE); } @Override public void onViewCreated(ArFragment arFragment, ArSceneView arSceneView) { // By default he occlusion is disabled even if the DepthMode is set to AUTOMATIC or RAW_DEPTH_ONLY // Not every Depth use case requires the occlusion feature! arSceneView.getCameraStream() .setDepthOcclusionMode(CameraStream.DepthOcclusionMode .DEPTH_OCCLUSION_ENABLED); } ``` -------------------------------- ### RenderableDefinition.Submesh.Builder Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-17.html Factory class for creating instances of RenderableDefinition.Submesh. ```APIDOC ## RenderableDefinition.Submesh.Builder ### Description Factory class for [`RenderableDefinition.Submesh`](../com/google/ar/sceneform/rendering/RenderableDefinition.Submesh.html "class in com.google.ar.sceneform.rendering"). ### Class com.google.ar.sceneform.rendering.RenderableDefinition.Submesh.Builder ### Package com.google.ar.sceneform.rendering ``` -------------------------------- ### Get Arc Properties (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ArcDef.html Retrieves the properties of an arc, including its start angle, size, inner radius, outer radius, and the number of samples used for drawing. These methods are part of the Sceneform Android library for defining 3D arc geometries. ```java public float angleSize() public float innerRadius() public float outerRadius() public int numSamples() ``` -------------------------------- ### FlatBufferBuilder Initialization Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-9.html Initializes the FlatBufferBuilder with a ByteBuffer and a factory. ```APIDOC ## POST /flatbuffers/FlatBufferBuilder#init ### Description Initializes the FlatBufferBuilder with a provided ByteBuffer and a ByteBufferFactory. ### Method POST ### Endpoint /flatbuffers/FlatBufferBuilder#init(ByteBuffer, FlatBufferBuilder.ByteBufferFactory) ### Parameters #### Request Body - **byteBuffer** (ByteBuffer) - Required - The ByteBuffer to use for building. - **byteBufferFactory** (FlatBufferBuilder.ByteBufferFactory) - Required - The factory for creating ByteBuffers. ### Request Example ```json { "byteBuffer": "...", "byteBufferFactory": { "class": "com.google.flatbuffers.FlatBufferBuilder$ByteBufferFactory" } } ``` ### Response #### Success Response (200) - **void** - Initialization successful. #### Response Example None ``` -------------------------------- ### FlatBufferBuilder Constructors Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/FlatBufferBuilder.html This section details the various constructors available for the FlatBufferBuilder class, allowing for different initialization strategies. ```APIDOC ## FlatBufferBuilder Constructors ### Description Provides multiple constructors to initialize the FlatBufferBuilder with varying initial buffer sizes and optional `ByteBufferFactory` implementations. ### Method `FlatBufferBuilder()` ### Description Starts with a buffer of 1KiB and grows as required. --- ### Method `FlatBufferBuilder(int initial_size)` ### Description Starts with a buffer of size `initial_size` and grows as required. --- ### Method `FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory)` ### Description Starts with a buffer of size `initial_size` and grows as required, using the provided `ByteBufferFactory`. --- ### Method `FlatBufferBuilder(int initial_size, FlatBufferBuilder.ByteBufferFactory bb_factory, java.nio.ByteBuffer existing_bb, Utf8 utf8)` ### Description Starts with a buffer of size `initial_size` and grows as required, using the provided `ByteBufferFactory`, an existing `ByteBuffer`, and a `Utf8` object. --- ### Method `FlatBufferBuilder(java.nio.ByteBuffer existing_bb)` ### Description Alternative constructor allowing reuse of `ByteBuffer`s. --- ### Method `FlatBufferBuilder(java.nio.ByteBuffer existing_bb, FlatBufferBuilder.ByteBufferFactory bb_factory)` ### Description Alternative constructor allowing reuse of `ByteBuffer`s, with a specified `ByteBufferFactory`. ``` -------------------------------- ### Control Animation by Frame, Fraction, or Time Source: https://github.com/sceneview/sceneform-android/blob/master/README.md These Java code examples utilize `ModelAnimator` to control animations on a `RenderableInstance`. They show how to start an animation by specifying an animation name along with a target frame, a fractional value (0.0 to 1.0), or a specific time in seconds. The animation will transition from its current state to the specified value. ```java ModelAnimator.ofAnimationFrame(model, "AnimationName", 100).start(); ``` ```java ModelAnimator.ofAnimationFraction(model, "AnimationName", 0.2f, 0.8f, 1f).start(); ``` ```java ModelAnimator.ofAnimationTime(model, "AnimationName", 10.0f)}.start(); ``` -------------------------------- ### Initialize RenderableDefinition.Submesh.Builder Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/rendering/RenderableDefinition.Submesh.Builder.html Constructs a new Builder instance. This is the entry point for creating a Submesh. ```java public Builder() ``` -------------------------------- ### QuaternionEvaluator.evaluate Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/math/QuaternionEvaluator.html This function returns the result of linearly interpolating the start and end values, with `fraction` representing the proportion between the start and end values. ```APIDOC ## evaluate(float fraction, Quaternion startValue, Quaternion endValue) ### Description This function returns the result of linearly interpolating the start and end values, with `fraction` representing the proportion between the start and end values. The calculation is a simple parametric calculation: `result = x0 + t * (x1 - x0)`, where `x0` is `startValue`, `x1` is `endValue`, and `t` is `fraction`. Specified by: `evaluate` in interface `android.animation.TypeEvaluator` ### Method POST ### Endpoint N/A ### Parameters #### Query Parameters - **fraction** (float) - Required - The fraction from the starting to the ending values - **startValue** (Quaternion) - Required - The start value. - **endValue** (Quaternion) - Required - The end value. ### Request Example ```json { "fraction": 0.5, "startValue": { "x": 0.0, "y": 0.0, "z": 0.0, "w": 1.0 }, "endValue": { "x": 0.0, "y": 1.0, "z": 0.0, "w": 0.0 } } ``` ### Response #### Success Response (200) - **Quaternion** (Quaternion) - A linear interpolation between the start and end values, given the `fraction` parameter. #### Response Example ```json { "x": 0.0, "y": 0.5, "z": 0.0, "w": 0.5 } ``` ``` -------------------------------- ### Light Configuration Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-18.html Methods for configuring light properties such as color and color temperature. ```APIDOC ## setColor (Light.Builder) ### Description Sets the "RGB" color of the light. ### Method void ### Endpoint N/A (Method within Light.Builder class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java Light.Builder.create().setColor(new Color(0.0f, 1.0f, 0.0f)).build(); // Green ``` ### Response #### Success Response (void) N/A #### Response Example N/A ``` ```APIDOC ## setColor (Light) ### Description Sets the "RGB" color of the light. ### Method void ### Endpoint N/A (Method within Light class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java light.setColor(new Color(0.0f, 0.0f, 1.0f)); // Blue ``` ### Response #### Success Response (void) N/A #### Response Example N/A ``` ```APIDOC ## setColorTemperature ### Description Sets the color temperature of the light. ### Method void ### Endpoint N/A (Method within Light.Builder class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java Light.Builder.create().setColorTemperature(6500.0f).build(); // Daylight ``` ### Response #### Success Response (void) N/A #### Response Example N/A ``` -------------------------------- ### Create and Start Materials Vector with FlatBufferBuilder Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelPipelineRenderableDef.html Helper methods for creating and starting a vector of materials within a FlatBufferBuilder. These are used when serializing multiple material definitions. ```java public static int createMaterialsVector(com.google.flatbuffers.FlatBufferBuilder builder, int[] data) public static void startMaterialsVector(com.google.flatbuffers.FlatBufferBuilder builder, int numElems) ``` -------------------------------- ### Initialize and Start FlatBuffer Structures (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/MaterialTextureDef.html Static utility methods for initializing and starting the creation of FlatBuffer structures, specifically for MaterialTextureDef and its associated UsagePerChannelVector. ```java public static void startMaterialTextureDef(FlatBufferBuilder builder) { builder.startObject(2); } ``` ```java public static void startUsagePerChannelVector(FlatBufferBuilder builder, int numElems) { builder.startVector(4, numElems, 4); } ``` -------------------------------- ### Rendering Utilities Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/allclasses.html Contains utilities for rendering, including plane rendering, resource management, and renderer callbacks. ```APIDOC ## Rendering Utilities ### Description Utility classes and interfaces related to the rendering process in Sceneform, including plane rendering, resource management, and renderer callbacks. ### Endpoints #### `com.google.ar.sceneform.rendering.PlaneFactory` - **Description**: Factory class for creating `Plane` objects. #### `com.google.ar.sceneform.rendering.PlaneRenderer` - **Description**: Renders detected planes in the AR scene. #### `com.google.ar.sceneform.rendering.PlaneRenderer.PlaneRendererMode` - **Description**: Enum defining the rendering modes for `PlaneRenderer`. #### `com.google.ar.sceneform.rendering.Renderer` - **Description**: Core rendering engine for Sceneform. #### `com.google.ar.sceneform.rendering.Renderer.PreRenderCallback` - **Description**: Interface for callbacks executed before rendering each frame. #### `com.google.ar.sceneform.resources.ResourceHolder` - **Description**: Interface for objects that hold and manage resources. #### `com.google.ar.sceneform.rendering.ResourceManager` - **Description**: Manages the lifecycle and loading of resources used in rendering. ``` -------------------------------- ### KeyVariantPairDef: Start Building (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/KeyVariantPairDef.html Initiates the process of starting to build a KeyVariantPairDef object using a FlatBufferBuilder. This method is called before adding fields. ```java public static void startKeyVariantPairDef(com.google.flatbuffers.FlatBufferBuilder builder) ``` -------------------------------- ### AR SceneView Session Management Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-18.html Methods for setting up and configuring the AR Session for the ArSceneView. ```APIDOC ## AR SceneView Session Management ### Description Manages the AR Session and its configuration for the ArSceneView. ### Method `setSession(Session)` `setSessionConfig(Config config, boolean updateImmediately)` ### Endpoint N/A (Methods within a class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```java ArSceneView arSceneView = new ArSceneView(this); Session session = createArSession(); // Assume this method creates a valid Session arSceneView.setSession(session); Config config = new Config(session); // Configure the config object as needed arSceneView.setSessionConfig(config, true); ``` ### Response #### Success Response (200) N/A (Methods modify object state) #### Response Example N/A ``` -------------------------------- ### Access Start and End Indices (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelIndexRange.html Retrieves the start and end indices of the ModelIndexRange. These methods are used to read the range values after the object has been initialized or assigned from a FlatBuffer. ```java public long start() public long end() ``` -------------------------------- ### Engine Instance API Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-5.html API for managing the rendering engine instance, including headless mode. ```APIDOC ## Engine Instance API ### Description Manages the rendering engine instance, including enabling headless mode. ### enableHeadlessEngine() #### Method `static` `void` #### Endpoint N/A (Static method) #### Parameters None ### Request Example ```json { "description": "Enables the headless rendering engine." } ``` ### Response #### Success Response (200) This method does not return a value; it configures the engine instance. ``` -------------------------------- ### Get UTF-8 Encoded Length of Sequence (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/flatbuffers/Utf8Safe.html Returns the number of bytes in the UTF-8-encoded form of a sequence. This method is more efficient than converting to bytes and getting the length for strings. ```java public int encodedLength(java.lang.CharSequence sequence) ``` -------------------------------- ### LoadHelper Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-9.html Utilities for loading assets, including checking data URI formats. ```APIDOC ## isGltfDataUri(Uri) ### Description Checks if the provided Uri is a GLTF data URI. ### Method Static method ### Endpoint N/A ### Parameters #### Path Parameters - **uri** (Uri) - Required - The Uri to check. ### Request Example None ### Response #### Success Response (boolean) - **true**: The Uri is a GLTF data URI. - **false**: The Uri is not a GLTF data URI. #### Response Example ```json true ``` ``` -------------------------------- ### Get Android View from ViewRenderable (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/rendering/ViewRenderable.html Retrieves the 2D Android View associated with this ViewRenderable instance. This view is what gets rendered within the Sceneform scene. ```java public android.view.View getView() { // Implementation returns the associated Android View } ``` -------------------------------- ### Material and Texture Builder Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-18.html Methods for setting registry IDs and samplers for Material and Texture builders. ```APIDOC ## Material and Texture Builder Methods ### Description Methods to allow Material or Texture to be reused by setting a registry ID, and to control rendering parameters with a sampler. ### Method - setRegistryId - setSampler ### Endpoint N/A (Class methods) ### Parameters - **setRegistryId**: (Object) - Sets a registry ID to allow the Material or Texture to be reused. - **setSampler**: (Texture.Sampler) - Sets the Texture.Sampler to control rendering parameters. ### Request Example N/A ### Response N/A ``` -------------------------------- ### Start Vertex Attributes Vector with FlatBufferBuilder in Java Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelInstanceDef.html Starts the process of creating a vector for vertex attributes in a FlatBufferBuilder, indicating the number of elements. Essential for defining mesh structure. ```java public static void startVertexAttributesVector(FlatBufferBuilder builder, int numElems) ``` -------------------------------- ### Texture Sampler Builder Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/rendering/Texture.Sampler.html Provides a static method to obtain a builder for creating or configuring Texture.Sampler instances. ```APIDOC ## POST /sceneview/sceneform-android/Texture/Sampler/builder ### Description Returns a builder object that can be used to construct or modify Texture.Sampler instances. ### Method POST ### Endpoint /sceneview/sceneform-android/Texture/Sampler/builder ### Parameters None ### Request Example None ### Response #### Success Response (200) - **builder** (Texture.Sampler.Builder) - An instance of the Texture.Sampler.Builder class. #### Response Example { "builder": "Texture.Sampler.Builder" } ``` -------------------------------- ### SceneView Display and Appearance Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/SceneView.html Methods for setting the background, transparency, and mirroring the SceneView content. ```APIDOC ## SceneView Display and Appearance ### Description Methods for configuring the visual appearance of the SceneView, including setting backgrounds, transparency, and mirroring its content to a Surface. ### Methods - **`setBackground(android.graphics.drawable.Drawable background)`** - **Description**: Sets the background of the SceneView to a given Drawable, or removes the background if null is provided. - **Method**: void - **Parameters**: - **background** (android.graphics.drawable.Drawable) - The Drawable to set as the background. - **Endpoint**: N/A (Instance Method) - **`setTransparent(boolean transparent)`** - **Description**: Sets the background of the SceneView to be transparent or opaque. - **Method**: void - **Parameters**: - **transparent** (boolean) - True to make the background transparent, false for opaque. - **Endpoint**: N/A (Instance Method) - **`startMirroringToSurface(android.view.Surface surface, int left, int bottom, int width, int height)`** - **Description**: Designates a Surface onto which the contents of this SceneView should be mirrored. Useful for capturing the view's content. - **Method**: void - **Parameters**: - **surface** (android.view.Surface) - The Surface to mirror to. - **left** (int) - The left coordinate for mirroring. - **bottom** (int) - The bottom coordinate for mirroring. - **width** (int) - The width of the mirrored content. - **height** (int) - The height of the mirrored content. - **Endpoint**: N/A (Instance Method) - **`stopMirroringToSurface(android.view.Surface surface)`** - **Description**: Stops mirroring the SceneView's content to the specified Surface. Call this when capturing is complete. - **Method**: void - **Parameters**: - **surface** (android.view.Surface) - The Surface to stop mirroring to. - **Endpoint**: N/A (Instance Method) ``` -------------------------------- ### Start and Add Data to ModelPipelineRenderableDef with FlatBufferBuilder Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelPipelineRenderableDef.html Static methods for initializing and adding data to a ModelPipelineRenderableDef using FlatBufferBuilder. This includes starting the definition and adding source, materials, and attributes offsets. ```java public static void startModelPipelineRenderableDef(com.google.flatbuffers.FlatBufferBuilder builder) public static void addSource(com.google.flatbuffers.FlatBufferBuilder builder, int sourceOffset) public static void addMaterials(com.google.flatbuffers.FlatBufferBuilder builder, int materialsOffset) public static void addAttributes(com.google.flatbuffers.FlatBufferBuilder builder, int attributesOffset) ``` -------------------------------- ### Scene Class Overview Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/Scene.html Provides an overview of the Scene class, its inheritance, and its role in managing the scene graph and hit testing. ```APIDOC ## Scene Class ### Description The Sceneform Scene maintains the scene graph, a hierarchical organization of a scene's content. A scene can have zero or more child nodes and each node can have zero or more child nodes. The Scene also provides hit testing, a way to detect which node is touched by a MotionEvent or Ray. * Inherits from: `NodeParent` ### Nested Classes * `static interface Scene.OnPeekTouchListener`: Interface for a callback invoked before `Scene.OnTouchListener`. * `static interface Scene.OnTouchListener`: Interface for a callback invoked when a touch event is dispatched to a scene. * `static interface Scene.OnUpdateListener`: Interface for a callback invoked once per frame before the scene is updated. ### Constructor * `Scene(SceneView view)`: Creates a scene with the given context. ``` -------------------------------- ### Load and Place Animated 3D Models in AR Source: https://context7.com/sceneview/sceneform-android/llms.txt Demonstrates how to load GLB models from various sources (assets, URL, raw resources) and place them in an AR scene using Sceneform. It includes functionality to animate the loaded models upon placement and handle user taps on AR planes. ```kotlin class MainFragment : Fragment(R.layout.fragment_main) { private lateinit var arFragment: ArFragment private var model: Renderable? = null override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) arFragment = childFragmentManager.findFragmentById(R.id.arFragment) as ArFragment arFragment.setOnTapArPlaneListener(::onTapPlane) lifecycleScope.launchWhenCreated { loadModel() } } private suspend fun loadModel() { // Load from assets folder model = ModelRenderable.builder() .setSource(context, Uri.parse("models/character.glb")) .setIsFilamentGltf(true) .await() // Alternative: Load from URL // model = ModelRenderable.builder() // .setSource(context, Uri.parse("https://example.com/model.glb")) // .setIsFilamentGltf(true) // .await() // Alternative: Load from raw resources // model = ModelRenderable.builder() // .setSource(context, R.raw.my_model) // .setIsFilamentGltf(true) // .await() } private fun onTapPlane(hitResult: HitResult, plane: Plane, motionEvent: MotionEvent) { if (model == null) { Toast.makeText(context, "Loading...", Toast.LENGTH_SHORT).show() return } // Create anchor at tap location val anchor = hitResult.createAnchor() val anchorNode = AnchorNode(anchor) arFragment.arSceneView.scene.addChild(anchorNode) // Create transformable node (can be moved, scaled, rotated) val transformableNode = TransformableNode(arFragment.transformationSystem) transformableNode.renderable = model transformableNode.renderableInstance.animate(true).start() anchorNode.addChild(transformableNode) } } ``` -------------------------------- ### Get ChangeId in ChangeId Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-7.html Retrieves the current value of a ChangeId. This utility class is likely used for tracking changes or versions of objects. The get() method returns the internal value of the ChangeId. ```java public final long get() ``` -------------------------------- ### Get Current Animation Frame Position Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/animation/ModelAnimation.html Gets the current frame number within the animation. The value ranges from 0 to the total frame count obtained by `getFrameCount()`. ```java public int getFramePosition() Get the current frame number at the current animation position. Returns: Frame number on the timeline. Between 0 and [`getFrameCount()`](#getFrameCount()) See Also: [`getTimePosition()`](#getTimePosition()), [`getFrameCount()`](#getFrameCount()) ``` -------------------------------- ### BufferHelper Constructor Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/utilities/BufferHelper.html Initializes a new instance of the BufferHelper class. ```APIDOC ## BufferHelper Constructor ### Description Initializes a new instance of the BufferHelper class. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters None ### Request Example ```json {} ``` ### Response #### Success Response (200) This is a constructor, no specific response body. #### Response Example ```json {} ``` ``` -------------------------------- ### MaterialDef Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/MaterialDef.html Detailed documentation for the methods available in the MaterialDef class, including initialization, assignment, and creation helper methods. ```APIDOC ## MaterialDef Methods ### Method Summary * `[__assign(int _i, java.nio.ByteBuffer _bb)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Assigns buffer data to this table. * `void [__init(int _i, java.nio.ByteBuffer _bb)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Initializes the table with the given buffer and offset. * `static void [addName(com.google.flatbuffers.FlatBufferBuilder builder, int nameOffset)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Adds a name to the FlatBufferBuilder. * `static void [addProperties(com.google.flatbuffers.FlatBufferBuilder builder, int propertiesOffset)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Adds properties to the FlatBufferBuilder. * `static void [addTextures(com.google.flatbuffers.FlatBufferBuilder builder, int texturesOffset)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Adds textures to the FlatBufferBuilder. * `static int [createMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder, int nameOffset, int propertiesOffset, int texturesOffset)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Creates a MaterialDef object in the FlatBufferBuilder. * `static int [createTexturesVector(com.google.flatbuffers.FlatBufferBuilder builder, int[] data)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Creates a textures vector in the FlatBufferBuilder. * `static int [endMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder)](MaterialDef.html "class in com.google.ar.sceneform.lullmodel")` Finishes the creation of a MaterialDef object in the FlatBufferBuilder. ### Method Details * `[__assign(int _i, java.nio.ByteBuffer _bb)]()` * `void [__init(int _i, java.nio.ByteBuffer _bb)]()` * `static void [addName(com.google.flatbuffers.FlatBufferBuilder builder, int nameOffset)]()` * `static void [addProperties(com.google.flatbuffers.FlatBufferBuilder builder, int propertiesOffset)]()` * `static void [addTextures(com.google.flatbuffers.FlatBufferBuilder builder, int texturesOffset)]()` * `static int [createMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder, int nameOffset, int propertiesOffset, int texturesOffset)]()` * `static int [createTexturesVector(com.google.flatbuffers.FlatBufferBuilder builder, int[] data)]()` * `static int [endMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder)]()` ``` -------------------------------- ### Get Root ModelPipelineDef from ByteBuffer - Java Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelPipelineDef.html Parses a ByteBuffer to get the root ModelPipelineDef object. This is the primary entry point for accessing the pipeline definition from serialized data. ```java public static ModelPipelineDef getRootAsModelPipelineDef(java.nio.ByteBuffer _bb) ``` -------------------------------- ### FilamentEngineWrapper and IEngine Methods Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-3.html Methods related to view creation in the Filament rendering engine. ```APIDOC ## createView ### Description This method is used to create a view within the rendering engine. It is available in both `FilamentEngineWrapper` (as a method) and `IEngine` (as an interface method). ### Method `public` ### Endpoint N/A (Class/Interface Method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json {} ``` ### Response #### Success Response (200) N/A (Returns a View object or equivalent) #### Response Example ```json { "view": "" } ``` ``` -------------------------------- ### Get Current Animation Time Position (Seconds) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/animation/ModelAnimation.html Gets the current elapsed time in seconds within the animation. The value ranges from 0 to the total duration obtained by `getDuration()`. ```java public float getTimePosition() Get the current time position in seconds at the current animation position. Returns: timePosition Elapsed time of interest in seconds. Between 0 and [`getDuration()`](#getDuration()) See Also: [`getDuration()`](#getDuration()) ``` -------------------------------- ### Node and Renderable Configuration Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-18.html Methods for setting properties of nodes and renderable submeshes, including names and tap listeners. ```APIDOC ## Node and Renderable Configuration ### Description Methods for configuring nodes and their associated renderable components, such as setting names and touch event listeners. ### Methods - `Node.setName(String name)` - `RenderableDefinition.Submesh.Builder.setName(String name)` - `RenderableDefinition.Submesh.setName(String name)` - `Node.setOnTapListener(Node.OnTapListener listener)` - `Node.setOnTouchListener(Node.OnTouchListener listener)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Get all Augmented Images from a Collection Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/Trackables.html Extracts all Augmented Images from a given collection of AR trackables. This is a convenient way to get a list of all detected images without additional filtering. ```java static java.util.Collection getAugmentedImages(java.util.Collection trackables) ``` -------------------------------- ### LightInstance API Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/index-files/index-1.html Details the `LightInstance` class and its method for attaching to a renderer. ```APIDOC ## POST /sceneform/rendering/lightinstance ### Description This endpoint represents the `LightInstance` class and its method for associating with a renderer. ### Method `attachToRenderer(Renderer)` ### Endpoint `/sceneform/rendering/lightinstance` ### Description Attaches the `LightInstance` to a specific `Renderer`. ### Parameters #### Request Body - **renderer** (Renderer) - Required - The `Renderer` to attach the light instance to. ``` -------------------------------- ### Start Indices32 Vector FlatBuffer Sceneform Android Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/ModelInstanceDef.html Starts the definition of a FlatBuffer vector for 32-bit indices. This static method assists in the efficient serialization of mesh indices using FlatBufferBuilder in Sceneform Android. ```java static void [startIndices32Vector](#startIndices32Vector(com.google.flatbuffers.FlatBufferBuilder,int))​(com.google.flatbuffers.FlatBufferBuilder builder, int numElems) ``` -------------------------------- ### Start Material Definition Creation (Java) Source: https://github.com/sceneview/sceneform-android/blob/master/docs/javadoc/com/google/ar/sceneform/lullmodel/MaterialDef.html Static utility methods used with FlatBufferBuilder to start the definition of a MaterialDef or its associated vectors, such as the textures vector. These are part of the FlatBuffers serialization process. ```java static void startMaterialDef(com.google.flatbuffers.FlatBufferBuilder builder) static void startTexturesVector(com.google.flatbuffers.FlatBufferBuilder builder, int numElems) ```