This commit is contained in:
Nick Fisher
2023-10-03 17:22:48 +11:00
4 changed files with 34 additions and 31 deletions

1
.gitattributes vendored
View File

@@ -544,3 +544,4 @@ assets/materials.uberz filter=lfs diff=lfs merge=lfs -text
assets/materials_ios_arm64.uberz filter=lfs diff=lfs merge=lfs -text assets/materials_ios_arm64.uberz filter=lfs diff=lfs merge=lfs -text
example/assets/shapes/ filter=lfs diff=lfs merge=lfs -text example/assets/shapes/ filter=lfs diff=lfs merge=lfs -text
example/assets/shapes/*.* filter=lfs diff=lfs merge=lfs -text example/assets/shapes/*.* filter=lfs diff=lfs merge=lfs -text
ios/lib/libmikktspace.a filter=lfs diff=lfs merge=lfs -text

View File

@@ -2,7 +2,7 @@ group 'app.polyvox.filament'
version '1.0-SNAPSHOT' version '1.0-SNAPSHOT'
buildscript { buildscript {
ext.kotlin_version = '1.6.0' ext.kotlin_version = '1.6.20'
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
@@ -59,7 +59,7 @@ android {
dependencies { dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
compile 'net.java.dev.jna:jna:5.10.0@aar' implementation 'net.java.dev.jna:jna:5.10.0@aar'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
} }

View File

@@ -13,6 +13,9 @@ const FilamentEntity FILAMENT_ASSET_ERROR = 0;
enum ToneMapper { ACES, FILMIC, LINEAR } enum ToneMapper { ACES, FILMIC, LINEAR }
abstract class FilamentController { abstract class FilamentController {
// the current target size of the viewport, in logical pixels
ui.Size size = ui.Size.zero;
Stream<int?> get textureId; Stream<int?> get textureId;
Future get isReadyForScene; Future get isReadyForScene;
Future setRendering(bool render); Future setRendering(bool render);
@@ -101,7 +104,7 @@ abstract class FilamentController {
/// [morphWeights] is a list of doubles in frame-major format. /// [morphWeights] is a list of doubles in frame-major format.
/// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame. /// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame.
/// ///
void setMorphAnimationData( Future setMorphAnimationData(
FilamentEntity asset, MorphAnimationData animation); FilamentEntity asset, MorphAnimationData animation);
/// ///
@@ -110,39 +113,39 @@ abstract class FilamentController {
/// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame. /// Each frame is [numWeights] in length, and each entry is the weight to be applied to the morph target located at that index in the mesh primitive at that frame.
/// for now we only allow animating a single bone (though multiple skinned targets are supported) /// for now we only allow animating a single bone (though multiple skinned targets are supported)
/// ///
void setBoneAnimation(FilamentEntity asset, BoneAnimationData animation); Future setBoneAnimation(FilamentEntity asset, BoneAnimationData animation);
void removeAsset(FilamentEntity asset); Future removeAsset(FilamentEntity asset);
void clearAssets(); Future clearAssets();
void zoomBegin(); Future zoomBegin();
void zoomUpdate(double z); Future zoomUpdate(double z);
void zoomEnd(); Future zoomEnd();
void playAnimation(FilamentEntity asset, int index, Future playAnimation(FilamentEntity asset, int index,
{bool loop = false, {bool loop = false,
bool reverse = false, bool reverse = false,
bool replaceActive = true, bool replaceActive = true,
double crossfade = 0.0}); double crossfade = 0.0});
void setAnimationFrame(FilamentEntity asset, int index, int animationFrame); Future setAnimationFrame(FilamentEntity asset, int index, int animationFrame);
void stopAnimation(FilamentEntity asset, int animationIndex); Future stopAnimation(FilamentEntity asset, int animationIndex);
void setCamera(FilamentEntity asset, String? name); Future setCamera(FilamentEntity asset, String? name);
void setToneMapping(ToneMapper mapper); Future setToneMapping(ToneMapper mapper);
void setBloom(double bloom); Future setBloom(double bloom);
void setCameraFocalLength(double focalLength); Future setCameraFocalLength(double focalLength);
void setCameraFocusDistance(double focusDistance); Future setCameraFocusDistance(double focusDistance);
void setCameraPosition(double x, double y, double z); Future setCameraPosition(double x, double y, double z);
void moveCameraToAsset(FilamentEntity asset); Future moveCameraToAsset(FilamentEntity asset);
void setViewFrustumCulling(bool enabled); Future setViewFrustumCulling(bool enabled);
void setCameraExposure( Future setCameraExposure(
double aperture, double shutterSpeed, double sensitivity); double aperture, double shutterSpeed, double sensitivity);
void setCameraRotation(double rads, double x, double y, double z); Future setCameraRotation(double rads, double x, double y, double z);
void setCameraModelMatrix(List<double> matrix); Future setCameraModelMatrix(List<double> matrix);
void setMaterialColor( Future setMaterialColor(
FilamentEntity asset, String meshName, int materialIndex, Color color); FilamentEntity asset, String meshName, int materialIndex, Color color);
void transformToUnitCube(FilamentEntity asset); Future transformToUnitCube(FilamentEntity asset);
void setPosition(FilamentEntity asset, double x, double y, double z); Future setPosition(FilamentEntity asset, double x, double y, double z);
void setScale(FilamentEntity asset, double scale); Future setScale(FilamentEntity asset, double scale);
void setRotation( Future setRotation(
FilamentEntity asset, double rads, double x, double y, double z); FilamentEntity asset, double rads, double x, double y, double z);
void hide(FilamentEntity asset, String meshName); Future hide(FilamentEntity asset, String meshName);
void reveal(FilamentEntity asset, String meshName); Future reveal(FilamentEntity asset, String meshName);
} }

View File

@@ -14,7 +14,6 @@ class FilamentControllerFFI extends FilamentController {
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event"); late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
double _pixelRatio = 1.0; double _pixelRatio = 1.0;
ui.Size size = ui.Size.zero;
int? _textureId; int? _textureId;
final _textureIdController = StreamController<int?>.broadcast(); final _textureIdController = StreamController<int?>.broadcast();