add check for broken loadGltf on Windows and add some documentation
This commit is contained in:
@@ -301,7 +301,11 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FilamentEntity> loadGltf(
|
Future<FilamentEntity> loadGltf(
|
||||||
String path, String relativeResourcePath) async {
|
String path, String relativeResourcePath, { bool force=false}) async {
|
||||||
|
|
||||||
|
if(Platform.isWindows && !force) {
|
||||||
|
throw Exception("loadGltf has a race condition on Windows which is likely to crash your program. If you really want to try, pass force=true to loadGltf");
|
||||||
|
}
|
||||||
if (_viewer == null || _resizing) {
|
if (_viewer == null || _resizing) {
|
||||||
throw Exception("No viewer available, ignoring");
|
throw Exception("No viewer available, ignoring");
|
||||||
}
|
}
|
||||||
@@ -465,9 +469,9 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
dataPtr.elementAt(i).value = animation.data[i];
|
dataPtr.elementAt(i).value = animation.data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
var morphIndicesPtr = calloc<Int>(animation.animatedMorphIndices.length);
|
Pointer<Int> idxPtr = calloc<Int>(animation.animatedMorphIndices.length);
|
||||||
for (int i = 0; i < animation.numMorphTargets; i++) {
|
for (int i = 0; i < animation.numMorphTargets; i++) {
|
||||||
morphIndicesPtr.elementAt(i) = animation.animatedMorphIndices[i];
|
idxPtr.elementAt(i).value = animation.animatedMorphIndices[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
_lib.set_morph_animation(
|
_lib.set_morph_animation(
|
||||||
@@ -475,12 +479,12 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
asset,
|
asset,
|
||||||
animation.meshName.toNativeUtf8().cast<Char>(),
|
animation.meshName.toNativeUtf8().cast<Char>(),
|
||||||
dataPtr,
|
dataPtr,
|
||||||
morphIndicesPtr,
|
idxPtr,
|
||||||
animation.numMorphTargets,
|
animation.numMorphTargets,
|
||||||
animation.numFrames,
|
animation.numFrames,
|
||||||
(animation.frameLengthInMs));
|
(animation.frameLengthInMs));
|
||||||
calloc.free(dataPtr);
|
calloc.free(dataPtr);
|
||||||
calloc.free(morphIndicesPtr);
|
calloc.free(idxPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -529,6 +533,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// Removes/destroys the specified entity from the scene.
|
/// Removes/destroys the specified entity from the scene.
|
||||||
|
/// [asset] will no longer be a valid handle after this method is called; ensure you immediately discard all references once this method is complete.
|
||||||
///
|
///
|
||||||
@override
|
@override
|
||||||
Future removeAsset(FilamentEntity asset) async {
|
Future removeAsset(FilamentEntity asset) async {
|
||||||
@@ -540,6 +545,7 @@ class FilamentControllerFFI extends FilamentController {
|
|||||||
|
|
||||||
///
|
///
|
||||||
/// Removes/destroys all renderable entities from the scene (including cameras).
|
/// Removes/destroys all renderable entities from the scene (including cameras).
|
||||||
|
/// All [FilamentEntity] handles will no longer be valid after this method is called; ensure you immediately discard all references to all entities once this method is complete.
|
||||||
///
|
///
|
||||||
@override
|
@override
|
||||||
Future clearAssets() async {
|
Future clearAssets() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user