/* * Copyright (C) 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include #include using namespace filament; extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nCreateSampler(JNIEnv *env, jclass type, jint min, jint max, jint s, jint t, jint r) { return TextureSampler(static_cast(min), static_cast(max), static_cast(s), static_cast(t), static_cast(r)).getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nCreateCompareSampler(JNIEnv *env, jclass type, jint mode, jint function) { return TextureSampler(static_cast(mode), static_cast(function)).getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetMinFilter(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getMinFilter()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetMinFilter(JNIEnv *env, jclass type, jint sampler_, jint filter) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setMinFilter(static_cast(filter)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetMagFilter(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getMagFilter()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetMagFilter(JNIEnv *env, jclass type, jint sampler_, jint filter) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setMagFilter(static_cast(filter)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetWrapModeS(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getWrapModeS()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetWrapModeS(JNIEnv *env, jclass type, jint sampler_, jint mode) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setWrapModeS(static_cast(mode)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetWrapModeT(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getWrapModeT()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetWrapModeT(JNIEnv *env, jclass type, jint sampler_, jint mode) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setWrapModeT(static_cast(mode)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetWrapModeR(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getWrapModeR()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetWrapModeR(JNIEnv *env, jclass type, jint sampler_, jint mode) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setWrapModeR(static_cast(mode)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetCompareMode(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getCompareMode()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetCompareMode(JNIEnv *env, jclass type, jint sampler_, jint mode) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setCompareMode(static_cast(mode), sampler.getCompareFunc()); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nGetCompareFunction(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return static_cast(sampler.getCompareFunc()); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetCompareFunction(JNIEnv *env, jclass type, jint sampler_, jint function) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setCompareMode(sampler.getCompareMode(), static_cast(function)); return sampler.getSamplerParams().u; } extern "C" JNIEXPORT jfloat JNICALL Java_com_google_android_filament_TextureSampler_nGetAnisotropy(JNIEnv *env, jclass type, jint sampler_) { TextureSampler &sampler = reinterpret_cast(sampler_); return sampler.getAnisotropy(); } extern "C" JNIEXPORT jint JNICALL Java_com_google_android_filament_TextureSampler_nSetAnisotropy(JNIEnv *env, jclass type, jint sampler_, jfloat anisotropy) { TextureSampler &sampler = reinterpret_cast(sampler_); sampler.setAnisotropy(anisotropy); return sampler.getSamplerParams().u; }