rename plugin from PolyvoxFilament to FlutterFilament

rename plugin from PolyvoxFilament to FlutterFilament
This commit is contained in:
Nick Fisher
2023-10-26 14:05:03 +11:00
parent b42d31a773
commit 8b9e6a2b3a
125 changed files with 1539 additions and 1460 deletions

View File

@@ -0,0 +1,8 @@
{
"allAbis": [
"arm64-v8a"
],
"validAbis": [
"ARM64_V8A"
]
}

View File

@@ -0,0 +1 @@
[]

View File

@@ -0,0 +1,20 @@
{
"ndkHandlerSupportedAbis": [
"ARMEABI_V7A",
"ARM64_V8A",
"X86",
"X86_64"
],
"ndkHandlerDefaultAbis": [
"ARMEABI_V7A",
"ARM64_V8A",
"X86",
"X86_64"
],
"externalNativeBuildAbiFilters": [],
"ndkConfigAbiFilters": [
"arm64-v8a"
],
"splitsFilterAbis": [],
"ideBuildOnlyTargetAbi": true
}

View File

@@ -0,0 +1,11 @@
{
"ndk": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk\\ndk\\25.2.9519653",
"revision": {
"mMajor": 25,
"mMinor": 2,
"mMicro": 9519653,
"mPreview": 0,
"mPrecision": "MICRO",
"mPreviewSeparator": " "
}
}

View File

@@ -0,0 +1,22 @@
[
{
"level": "INFO",
"message": "android.ndkVersion from module build.gradle is [25.2.9519653]"
},
{
"level": "INFO",
"message": "android.ndkPath from module build.gradle is not set"
},
{
"level": "INFO",
"message": "ndk.dir in local.properties is not set"
},
{
"level": "INFO",
"message": "Not considering ANDROID_NDK_HOME because support was removed after deprecation period."
},
{
"level": "INFO",
"message": "sdkFolder is C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk"
}
]

View File

@@ -0,0 +1,17 @@
{
"ndkVersionFromDsl": "25.2.9519653",
"sdkFolder": "C:\\Users\\Nick\\AppData\\Local\\Android\\Sdk",
"sideBySideNdkFolderNames": [
"19.2.5345600",
"21.1.6352462",
"21.4.7075529",
"22.0.7026061",
"22.1.7171670",
"23.0.7599858",
"23.1.7779620",
"23.2.8568313",
"24.0.8215888",
"25.1.8937393",
"25.2.9519653"
]
}

View File

@@ -7,9 +7,9 @@ include_directories(src/main/cpp)
link_directories(src/main/jniLibs/${ANDROID_ABI})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
add_library(polyvox_filament_android SHARED
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/PolyvoxFilamentApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/PolyvoxFilamentFFIApi.cpp"
add_library(flutter_filament_android SHARED
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FlutterFilamentApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FlutterFilamentFFIApi.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/main/cpp/FilamentAndroid.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/AssetManager.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/../ios/src/FilamentViewer.cpp"
@@ -24,7 +24,7 @@ add_library(FILAMENT_SHADERS SHARED
)
target_link_libraries(
polyvox_filament_android
flutter_filament_android
FILAMENT_SHADERS
-landroid
-llog

View File

@@ -1 +1 @@
rootProject.name = 'polyvox_filament'
rootProject.name = 'flutter_filament'

View File

@@ -3,7 +3,7 @@
extern "C" {
#include "PolyvoxFilamentFFIApi.h"
#include "FlutterFilamentFFIApi.h"
void* get_native_window_from_surface(
jobject surface,

View File

@@ -26,21 +26,21 @@ import io.flutter.view.TextureRegistry.SurfaceTextureEntry
import java.io.File
import java.util.*
class LoadFilamentResourceFromOwnerImpl(plugin:PolyvoxFilamentPlugin) : LoadFilamentResourceFromOwner {
class LoadFilamentResourceFromOwnerImpl(plugin:FlutterFilamentPlugin) : LoadFilamentResourceFromOwner {
var plugin = plugin
override fun loadResourceFromOwner(path: String?, owner: Pointer?): ResourceBuffer {
return plugin.loadResourceFromOwner(path, owner)
}
}
class FreeFilamentResourceFromOwnerImpl(plugin:PolyvoxFilamentPlugin) : FreeFilamentResourceFromOwner {
class FreeFilamentResourceFromOwnerImpl(plugin:FlutterFilamentPlugin) : FreeFilamentResourceFromOwner {
var plugin = plugin
override fun freeResourceFromOwner(rb: ResourceBuffer, owner: Pointer?) {
plugin.freeResourceFromOwner(rb, owner)
}
}
class RenderCallbackImpl(plugin:PolyvoxFilamentPlugin) : RenderCallback {
class RenderCallbackImpl(plugin:FlutterFilamentPlugin) : RenderCallback {
var plugin = plugin
override fun renderCallback(owner:Pointer?) {
plugin.renderCallback();
@@ -51,8 +51,8 @@ class RenderCallbackImpl(plugin:PolyvoxFilamentPlugin) : RenderCallback {
}
}
/** PolyvoxFilamentPlugin */
class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, LoadFilamentResourceFromOwner, FreeFilamentResourceFromOwner {
/** FlutterFilamentPlugin */
class FlutterFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, LoadFilamentResourceFromOwner, FreeFilamentResourceFromOwner {
companion object {
const val CHANNEL_NAME = "app.polyvox.filament/event"
@@ -80,7 +80,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
this.flutterPluginBinding = flutterPluginBinding
channel = MethodChannel(flutterPluginBinding.binaryMessenger, CHANNEL_NAME)
channel.setMethodCallHandler(this)
_lib = Native.loadLibrary("polyvox_filament_android", FilamentInterop::class.java, Collections.singletonMap(Library.OPTION_ALLOW_OBJECTS, true))
_lib = Native.loadLibrary("flutter_filament_android", FilamentInterop::class.java, Collections.singletonMap(Library.OPTION_ALLOW_OBJECTS, true))
}
override fun onAttachedToActivity(binding: ActivityPluginBinding) {
@@ -93,7 +93,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
var _lastId = 1
override fun loadResourceFromOwner(path: String?, owner: Pointer?): ResourceBuffer {
Log.i("polyvox_filament", "Loading resource from path $path")
Log.i("flutter_filament", "Loading resource from path $path")
var data:ByteArray? = null
if(path!!.startsWith("file://")) {
data = File(path!!.substring(6)).readBytes()
@@ -108,14 +108,14 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
if (hotReloadPath != null) {
data = File(hotReloadPath).readBytes()
} else {
Log.i("polyvox_filament", "Loading resource from main asset bundle at ${assetPath}")
Log.i("flutter_filament", "Loading resource from main asset bundle at ${assetPath}")
val assetManager: AssetManager = activity.assets
try {
data = assetManager.open(key).readBytes()
Log.i("polyvox_filament", "Loaded ${data.size} bytes")
Log.i("flutter_filament", "Loaded ${data.size} bytes")
} catch (e:Exception) {
Log.e("polyvox_filament", "Failed to open asset at ${assetPath}", null)
Log.e("flutter_filament", "Failed to open asset at ${assetPath}", null)
}
}
}
@@ -135,7 +135,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
rb.data = Pointer(0)
}
} catch(e:Exception) {
Log.e("polyvox_filament", "Error setting resource buffer : $e", null);
Log.e("flutter_filament", "Error setting resource buffer : $e", null);
}
rb.write();
return rb;
@@ -153,7 +153,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
@RequiresApi(Build.VERSION_CODES.M)
override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
Log.e("polyvox_filament", call.method, null)
Log.e("flutter_filament", call.method, null)
when (call.method) {
"createTexture" -> {
if(_surfaceTextureEntry != null) {
@@ -167,7 +167,7 @@ class PolyvoxFilamentPlugin: FlutterPlugin, MethodCallHandler, ActivityAware, Lo
result.error("DIMENSION_MISMATCH","Both dimensions must be greater than zero (you provided $width x $height)", null);
return;
}
Log.i("polyvox_filament", "Creating Surface Texture of size ${width}x${height}");
Log.i("flutter_filament", "Creating Surface Texture of size ${width}x${height}");
_surfaceTextureEntry = flutterPluginBinding.textureRegistry.createSurfaceTexture()
_surfaceTexture = _surfaceTextureEntry!!.surfaceTexture();

View File

@@ -11,17 +11,17 @@ class HotReloadPathHelper {
companion object {
fun getAssetPath(path: String, packageName: String): String? {
val packagePath = "/data/user/0/${packageName}/code_cache/"
Log.v("polyvox_filament", "Looking for hot reloaded asset ${path} under package path ${packagePath}")
Log.v("flutter_filament", "Looking for hot reloaded asset ${path} under package path ${packagePath}")
val files = File(packagePath).walkBottomUp().filter {
it.path.endsWith(path)
}.sortedBy {
it.lastModified()
}.toList()
if(files.size > 0) {
Log.v("polyvox_filament", "Using hot reloaded asset at ${files.last().path}")
Log.v("flutter_filament", "Using hot reloaded asset at ${files.last().path}")
return files.last().path;
}
Log.v("polyvox_filament", "No hot reloaded asset found.")
Log.v("flutter_filament", "No hot reloaded asset found.")
return null;
}
}