don't expose FILAMENT_ASSET_ERROR

This commit is contained in:
Nick Fisher
2023-10-11 15:34:19 +08:00
parent 08ba9400d3
commit 1be2367b4f
3 changed files with 13 additions and 5 deletions

View File

@@ -5,7 +5,6 @@ import 'package:polyvox_filament/animations/bone_animation_data.dart';
import 'package:polyvox_filament/animations/morph_animation_data.dart';
typedef FilamentEntity = int;
const FilamentEntity FILAMENT_ASSET_ERROR = 0;
enum ToneMapper { ACES, FILMIC, LINEAR }

View File

@@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:ffi';
import 'dart:io';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/services.dart';
import 'package:ffi/ffi.dart';
@@ -10,6 +9,8 @@ import 'package:polyvox_filament/animations/bone_animation_data.dart';
import 'package:polyvox_filament/animations/morph_animation_data.dart';
import 'package:polyvox_filament/generated_bindings.dart';
const FilamentEntity _FILAMENT_ASSET_ERROR = 0;
class FilamentControllerFFI extends FilamentController {
late MethodChannel _channel = MethodChannel("app.polyvox.filament/event");
@@ -352,7 +353,7 @@ class FilamentControllerFFI extends FilamentController {
}
var asset = _lib.load_glb_ffi(
_assetManager!, path.toNativeUtf8().cast<Char>(), unlit);
if (asset == FILAMENT_ASSET_ERROR) {
if (asset == _FILAMENT_ASSET_ERROR) {
throw Exception("An error occurred loading the asset at $path");
}
return asset;
@@ -372,7 +373,7 @@ class FilamentControllerFFI extends FilamentController {
_assetManager!,
path.toNativeUtf8().cast<Char>(),
relativeResourcePath.toNativeUtf8().cast<Char>());
if (asset == FILAMENT_ASSET_ERROR) {
if (asset == _FILAMENT_ASSET_ERROR) {
throw Exception("An error occurred loading the asset at $path");
}
return asset;

View File

@@ -9,6 +9,8 @@ import 'filament_controller.dart';
typedef AssetManager = int;
const FilamentEntity _FILAMENT_ASSET_ERROR = 0;
///
/// This is a previous iteration of FilamentController that used platform channels for every distinct platform.
/// This is no longer used; currently kept only for reference/posterity.
@@ -245,7 +247,7 @@ class FilamentControllerMethodChannel extends FilamentController {
}
var asset =
await _channel.invokeMethod("loadGlb", [_assetManager, path, unlit]);
if (asset == FILAMENT_ASSET_ERROR) {
if (asset == _FILAMENT_ASSET_ERROR) {
throw Exception("An error occurred loading the asset at $path");
}
return asset;
@@ -659,4 +661,10 @@ class FilamentControllerMethodChannel extends FilamentController {
@override
// TODO: implement pickResult
Stream<FilamentEntity?> get pickResult => throw UnimplementedError();
@override
String? getNameForEntity(FilamentEntity entity) {
// TODO: implement getNameForEntity
throw UnimplementedError();
}
}