static jlong create(JNIEnv* env, jclass clazz, jlong rootNodePtr, jlong surfacePtr) { RenderNode* rootNode = reinterpret_cast<RenderNode*>(rootNodePtr); sp<Surface> surface(reinterpret_cast<Surface*>(surfacePtr)); ContextFactory factory; RenderProxy* proxy = new RenderProxy(false, rootNode, &factory); proxy->loadSystemProperties(); proxy->setSwapBehavior(kSwap_discardBuffer); proxy->initialize(surface); // Shadows can't be used via this interface, so just set the light source // to all 0s. (and width & height are unused, TODO remove them) proxy->setup(0, 0, 0, 0, 0); proxy->setLightCenter((Vector3){0, 0, 0}); return (jlong) proxy; }
static void android_view_ThreadedRenderer_setLightCenter(JNIEnv* env, jobject clazz, jlong proxyPtr, jfloat lightX, jfloat lightY, jfloat lightZ) { RenderProxy* proxy = reinterpret_cast<RenderProxy*>(proxyPtr); proxy->setLightCenter((Vector3){lightX, lightY, lightZ}); }