Add basic support for instanced renderables

We can now specify an "instance count" per renderable during creation. 
This instance count applies to all render primitives in the 
Renderable.

This will simply draw the renderable "instance count" times. A new
method available to vertex shaders, getInstanceIndex(), allows the
material to discriminate the instances and adjust the position/transform
accordingly.

Typically this is used for particle systems.
This commit is contained in:
Mathias Agopian
2022-02-14 13:55:59 -08:00
committed by Mathias Agopian
parent d13ccd1c26
commit 1d6aeb5de1
10 changed files with 76 additions and 9 deletions

View File

@@ -221,6 +221,13 @@ Java_com_google_android_filament_RenderableManager_nBuilderLightChannel(JNIEnv*,
builder->lightChannel(channel, (bool)enable);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nBuilderInstances(JNIEnv*, jclass,
jlong nativeBuilder, jint instanceCount) {
RenderableManager::Builder *builder = (RenderableManager::Builder *) nativeBuilder;
builder->instances(instanceCount);
}
// ------------------------------------------------------------------------------------------------
extern "C" JNIEXPORT void JNICALL