Expose setCulling to public RenderableManager API (#2331)

This commit is contained in:
Ben Doherty
2020-04-02 17:07:19 -07:00
committed by GitHub
parent 2dbe0b64be
commit df2caf4f62
4 changed files with 28 additions and 0 deletions
@@ -268,6 +268,13 @@ Java_com_google_android_filament_RenderableManager_nSetPriority(JNIEnv*, jclass,
rm->setPriority((RenderableManager::Instance) i, (uint8_t) priority);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetCulling(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jboolean enabled) {
RenderableManager *rm = (RenderableManager *) nativeRenderableManager;
rm->setCulling((RenderableManager::Instance) i, enabled);
}
extern "C" JNIEXPORT void JNICALL
Java_com_google_android_filament_RenderableManager_nSetCastShadows(JNIEnv*, jclass,
jlong nativeRenderableManager, jint i, jboolean enabled) {
@@ -453,6 +453,15 @@ public class RenderableManager {
nSetPriority(mNativeObject, i, priority);
}
/**
* Changes whether or not frustum culling is on.
*
* @see Builder#culling
*/
public void setCulling(@EntityInstance int i, boolean enabled) {
nSetCulling(mNativeObject, i, enabled);
}
/**
* Changes whether or not the renderable casts shadows.
*
@@ -646,6 +655,7 @@ public class RenderableManager {
private static native void nSetAxisAlignedBoundingBox(long nativeRenderableManager, int i, float cx, float cy, float cz, float ex, float ey, float ez);
private static native void nSetLayerMask(long nativeRenderableManager, int i, int select, int value);
private static native void nSetPriority(long nativeRenderableManager, int i, int priority);
private static native void nSetCulling(long nativeRenderableManager, int i, boolean enabled);
private static native void nSetCastShadows(long nativeRenderableManager, int i, boolean enabled);
private static native void nSetReceiveShadows(long nativeRenderableManager, int i, boolean enabled);
private static native void nSetScreenSpaceContactShadows(long nativeRenderableManager, int i, boolean enabled);
@@ -337,6 +337,13 @@ public:
*/
void setPriority(Instance instance, uint8_t priority) noexcept;
/**
* Changes whether or not frustum culling is on.
*
* \see Builder::culling()
*/
void setCulling(Instance instance, bool enable) noexcept;
/**
* Changes whether or not the renderable casts shadows.
*
@@ -571,6 +571,10 @@ void RenderableManager::setPriority(Instance instance, uint8_t priority) noexcep
upcast(this)->setPriority(instance, priority);
}
void RenderableManager::setCulling(Instance instance, bool enable) noexcept {
upcast(this)->setCulling(instance, enable);
}
void RenderableManager::setCastShadows(Instance instance, bool enable) noexcept {
upcast(this)->setCastShadows(instance, enable);
}