Files
filament/android/samples
Pixelflinger 746e273336 rework how dynamic resolution scaling is specified
- now the DynamicResolutionOptions don't specify the target frame rate,
  they only specify how to scale this given view

- there is a new FrameRateOptions setting on Renderer, which is used
  to specify the desired target frame rate for the whole Renderer

- the frame rate is now specified as a "frame interval" in units of
  the display frame period.

- the display frame period is (indirectly) set via DisplayInfo.

In other words, the use must set (and update) DisplayInfo properly
(the default are reasonable, but assume 60 Hz). They must also set the
desired interval (default is 1, which is probably what you want).
Finally they must enable dynamic scaling per View, the defaults are
also reasonable.

Currently Renderer doesn't attempt (yet) to actually target the
requested frame rate, so it's up to the caller to push frames at the
desired speed. however, dynamic resolution, like before, will attempt
to shrink work to fit the target.
2020-04-06 16:55:24 -07:00
..

Filament sample Android apps

This directory contains several sample Android applications that demonstrate how to use the Filament APIs:

hello-triangle

Demonstrates how to setup a rendering surface for Filament:

Hello Triangle

lit-cube

Demonstrates how to create a light and a mesh with the attributes required for lighting:

Lit Cube

image-based-lighting

Demonstrates how to create image-based lights and load complex meshes:

Image-based Lighting

textured-object

Demonstrates how to load and use textures for complex materials:

Textured Object

transparent-rendering

Demonstrates how to render into a transparent SurfaceView:

Transparent Rendering

texture-view

Demonstrates how to render into a TextureView instead of a SurfaceView:

Texture View

material-builder

Demonstrates how to programatically generate Filament materials, as opposed to compiling them on the host machine:

Material Builder

gltf-viewer

Demonstrates how to load glTF models and use the camera manipulator:

glTF Viewer

hello-camera

Demonstrates how to use Stream with Android's Camera2 API:

Hello Camera

stream-test

Tests the various ways to interact with Stream by drawing into an external texture using Canvas. See the following screenshot; if the two sets of stripes are perfectly aligned, then the Filament frame and the external texture are perfectly synchronized.

Stream Test

Prerequisites

Before you start, make sure to read Filament's README. You need to be able to compile Filament's native library and Filament's AAR for this project. The easiest way to proceed is to install all the required dependencies and to run the following commands at the root of the source tree:

$ ./build.sh -p desktop -i release
$ ./build.sh -p android release

This will build all the native components and the AAR required by this sample application.

If you do not use the build script, you must set the filament_tools_dir property when invoking Gradle, either from the command line or from local.properties. This property must point to the distribution/install directory for desktop (produced by make/ninja install). This directory must contain bin/matc and bin/cmgen.

Example:

$ ./gradlew -Pfilament_tools_dir=../../dist-release assembleDebug

Important: SDK location

Either ensure your ANDROID_HOME environment variable is set or make sure the root project contains a local.properties file with the sdk.dir property pointing to your installation of the Android SDK.

Android Studio

You must use Android Studio 3.6 RC 1 or higher. To open the project, point Studio to the android folder. After opening the project and syncing to gradle, select the sample of your choice using the drop-down widget in the toolbar.

Compiling

To compile and run each sample make sure you have selected the appropriate build variant (arm7, arm8, x86 or x86_64). If you are not sure you can simply select the "universal" variant which includes all the other ones.