wasabia / three_dart

three.js rewrite by Dart, Dart 3D library. an easy to use, lightweight, cross-platform, general purpose 3D library.
MIT License
444 stars 77 forks source link

Loading Gltf file doesn't work #134

Open alazarLaz opened 1 year ago

alazarLaz commented 1 year ago

I was trying to load gltf file using three_dart and three_dart_jsm. Using the current packages available from pubdev it displays blank page. Some examples work but the game_fps doesn't work at all. I also tried to add Gltfloader on a new file (not from example). It displays nothing. When I tried the latest version from this repo (add this repo to pubdev file) it installs both packages but basic functions and getters are not defined... I really love the package but loading gltf files is not working for me.

alazarLaz commented 1 year ago

'GLTFMeshStandardSGMaterial' is from 'package:three_dart_jsm/three_dart_jsm/loaders/gltf/index.dart' ('../../../../../../.pub-cache/git/three_dart_jsm-3f65834519e80f693d89627114bcbe11c1ae8381/lib/three_dart_jsm/loaders/gltf/index.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'uniforms'. uniforms["glossinessMap"]["value"] = v; ^^^^^^^^ ../../../../../../.pub-cache/git/three_dart_jsm-3f65834519e80f693d89627114bcbe11c1ae8381/lib/three_dart_jsm/loaders/gltf/GLTFMeshStandardSGMaterial.dart:131:12: Error: The getter 'defines' isn't defined for the class 'GLTFMeshStandardSGMaterial'.

alazarLaz commented 1 year ago

An Observatory debugger and profiler on SM N975F is available at: http://127.0.0.1:33531/P0_hE5iniuw=/ I/Gralloc4(15953): mapper 4.x is not supported W/Gralloc3(15953): mapper 3.x is not supported I/gralloc (15953): Arm Module v1.0 W/Gralloc4(15953): allocator 4.x is not supported W/Gralloc3(15953): allocator 3.x is not supported The Flutter DevTools debugger and profiler on SM N975F is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:33531/P0_hE5iniuw=/ I/SurfaceView@c34b04(15953): uSP: rtp = Rect(0, 0 - 1080, 2094) rtsw = 1080 rtsh = 2094 I/SurfaceView@c34b04(15953): onSSPAndSRT: pl = 0 pt = 0 sx = 1.0 sy = 1.0 I/SurfaceView@c34b04(15953): aOrMT: uB = true t = android.view.SurfaceControl$Transaction@3578700 fN = 1 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionChanged:1728 android.graphics.RenderNode$CompositePositionUpdateListener.positionChanged:319 I/SurfaceView@c34b04(15953): aOrMT: vR.mWNT, vR = ViewRootImpl@892b8a5[MainActivity] I/ViewRootImpl@892b8a5MainActivity: mWNT: t = android.view.SurfaceControl$Transaction@3578700 fN = 1 android.view.SurfaceView.applyOrMergeTransaction:1628 android.view.SurfaceView.access$500:124 android.view.SurfaceView$SurfaceViewPositionUpdateListener.positionChanged:1728 I/ViewRootImpl@892b8a5MainActivity: mWNT: merge t to BBQ I/ViewRootImpl@892b8a5MainActivity: [DP] pdf(0) 1 android.view.ViewRootImpl.lambda$addFrameCompleteCallbackIfNeeded$3$ViewRootImpl:4987 android.view.ViewRootImpl$$ExternalSyntheticLambda16.run:6 android.os.Handler.handleCallback:938 I/ViewRootImpl@892b8a5MainActivity: [DP] rdf() D/ViewRootImpl@892b8a5MainActivity: reportDrawFinished (fn: -1) I/ViewRootImpl@892b8a5MainActivity: MSG_WINDOW_FOCUS_CHANGED 1 1 D/InputMethodManager(15953): startInputInner - Id : 0 I/InputMethodManager(15953): startInputInner - mService.startInputOrWindowGainedFocus D/InputMethodManager(15953): startInputInner - Id : 0 I/flutter (15953): Important warn: make sure set samples before setRenderTarget
I/flutter (15953): render cost: 55 I/flutter (15953): {geometries: 0, textures: 1} I/flutter (15953): {frame: 1.0, calls: 0, triangles: 0, points: 0, lines: 0} I/flutter (15953): render: sourceTexture: 3 D/com.futouapp.flutter_gl.flutter_gl.EglEnv(15953): egl make current I/System.out(15953): Results of compiling source: I/System.out(15953): Results of compiling source: E/flutter (15953): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: Class 'GLTFParser' has no instance getter '_markDefs'. E/flutter (15953): Receiver: Instance of 'GLTFParser' E/flutter (15953): Tried calling: _markDefs E/flutter (15953): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5) E/flutter (15953): #1 GLTFParser.parse. (package:three_dart_jsm/three_dart_jsm/loaders/gltf/gltf_parser.dart:96:18) E/flutter (15953): #2 GLTFParser._invokeAll (package:three_dart_jsm/three_dart_jsm/loaders/gltf/gltf_parser.dart:203:30) E/flutter (15953): #3 GLTFParser.parse (package:three_dart_jsm/three_dart_jsm/loaders/gltf/gltf_parser.dart:95:5) E/flutter (15953): #4 GLTFLoader.parse (package:three_dart_jsm/three_dart_jsm/loaders/gltf/gltf_loader.dart:276:12) E/flutter (15953): #5 GLTFLoader.load. (package:three_dart_jsm/three_dart_jsm/loaders/gltf/gltf_loader.dart:115:13) E/flutter (15953): #6 FileLoader.load (package:three_dart/three3d/loaders/file_loader.dart:199:57) E/flutter (15953):

And this is the error I get when i use the packages available from pubdev

hasnentai commented 1 year ago

Hi @alazarLaz, Did you get this working? I am stuck with the same issue

Knightro63 commented 12 months ago

Hi @alazarLaz,

This is the same issue as https://github.com/wasabia/three_dart/issues/133.

if tl;dr there is 2 options

1) Use the older version of the repo e.g.(three_dart: 0.0.14 and three_dart_jsm:0.0.9)

or

2) Use the forked version of this repo, which is still an older version, but some of the small issues have been fixed while they are working on getting a new version of this repo into pub.dev.

in you pubspec.yaml file add these

  flutter_gl: 0.0.21
  three_dart:
    git:
      url: https://github.com/Knightro63/three_dart.git
  three_dart_jsm:
    git:
      url: https://github.com/Knightro63/three_dart_jsm.git

you need to use the examples from this repo or the examples from the older repo to get this to work since some of the variable names have changed from 0.0.14 to 0.0.16.

If you are using web and notice that your textures only load once please add the line below to you dispose function.

THREE.loading = {};

If you have a issue with flutter_gl kotlin-gradle-plugin:1.3.61 take a look at this issue https://github.com/wasabia/three_dart/issues/135.

Finally this does not work on iOS simulator or Linux.

Hope this helps.

ShakeelKhalid1913 commented 12 months ago

Hi @alazarLaz,

This is the same issue as #133.

if tl;dr there is 2 options

  1. Use the older version of the repo e.g.(three_dart: 0.0.14 and three_dart_jsm:0.0.9)

or

  1. Use the forked version of this repo, which is still an older version, but some of the small issues have been fixed while they are working on getting a new version of this repo into pub.dev.

in you pubspec.yaml file add these

flutter_gl: 0.0.21 three_dart: git: url: https://github.com/Knightro63/three_dart.git three_dart_jsm: git: url: https://github.com/Knightro63/three_dart_jsm.git

you need to use the examples from this repo or the examples from the older repo to get this to work since some of the variable names have changed from 0.0.14 to 0.0.16.

If you are using web and notice that your textures only load once please add the line below to you dispose function.

THREE.loading = {};

If you have a issue with flutter_gl kotlin-gradle-plugin:1.3.61 take a look at this issue #135.

Finally this does not work on iOS simulator or Linux.

Hope this helps.

Resolving dependencies... (1.4s) Because example depends on three_dart_jsm from git which doesn't exist (Could not find git ref 'HEAD' (usage: git rev-list []

... [--] [...] ` limiting output: --max-count= --max-age= --min-age= --sparse --no-merges --min-parents= --no-min-parents --max-parents= --no-max-parents --remove-empty --all --branches --tags --remotes --stdin --exclude-hidden=[receive|uploadpack] --quiet ordering output: --topo-order --date-order --reverse formatting output: --parents --children --objects | --objects-edge --disk-usage[=human] --unpacked --header | --pretty --[no-]object-names --abbrev= | --no-abbrev --abbrev-commit --left-right --count special purpose: --bisect --bisect-vars ` Im getting this issue
Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

It looks like flutter is trying to get three_dart_jsm: git not

three_dart_jsm:
  git:
    url: https://github.com/Knightro63/three_dart_jsm.git

Yaml files require 2 or 4 spaces as indentations to get the correct information below it for that repo.

Hope this solves the issue.

ShakeelKhalid1913 commented 11 months ago

I somehow solved the issue. I used your repo, thanks. May I know why it takes long time to load webgl_animation_frames page.

for tokyo.gltf page render in few time. but it taking time to render other animation gltf files.

image

ShakeelKhalid1913 commented 11 months ago

to load fbx. sometimes it works next time it does not. sambadancing fbx works. and if I try other fbx it does not work for them.

it stuck here image

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

GLTF files have a lot of data in them and parsing them into there respective parts takes time. It could be optimized by not using dart and doing it natively then sending that info to dart, but that would take time to code.

As for the not loading on web more than once issue could you add this to the dispose function.

THREE.loading = {};

Hope this helps.

ShakeelKhalid1913 commented 11 months ago

It could be optimized by not using dart and doing it natively then sending that info to dart

Can webview flutter help in this? if yes. it would be helpful if you provide any tutorial. My project is related to sign animation and I have animations in glb/gltfs. i just want to play them on screen according to the user input.

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

I noticed there is a null value in the loader function. This will keep the function from loading.

Can you change var result = await loader.loadAsync('animate7.gltf',null); to var result = await loader.loadAsync('animate7.gltf');

I did some tests with three_dart vs three.js and the difference for web is 100ms to 2sec. It was worse on safari and edge at about 2 sec difference. Chrome and Firefox was about 100-300ms. This will be different for types of computers. So I don't think webview would help with this.

Not sure how your app is set up but you might try having a home page and start loading them asynchronously in the background and stored globally. Just watch for excess memory usage https://docs.flutter.dev/tools/devtools/memory.

ShakeelKhalid1913 commented 11 months ago

Hi @ShakeelKhalid1913,

I noticed there is a null value in the loader function. This will keep the function from loading.

Can you change

var result = await loader.loadAsync('animate7.gltf',null);

to

var result = await loader.loadAsync('animate7.gltf');

I did some tests with three_dart vs three.js and the difference for web is 100ms to 2sec. It was worse on safari and edge at about 2 sec difference. Chrome and Firefox was about 100-300ms. This will be different for types of computers. So I don't think webview would help with this.

Not sure how your app is set up but you might try having a home page and start loading them asynchronously in the background and stored globally. Just watch for excess memory usage https://docs.flutter.dev/tools/devtools/memory.

Thanks a lot. It really worked. According to my project i want to ask a question. Is it fine to load animations like this? There are almost 2000 words for now. Could all animations store in one glb file? I know that we can have multiple animations in one glb but don't know the limitations. Any idea?

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

For this file type animations are not the problem since they are json based movement information. So, yes having all the animations in one file should be fine. The memory issue would come form the image sizes for the 3d object. Since gltf and glb files have a lot of texture information.

ShakeelKhalid1913 commented 11 months ago

Right. i did not know this. as I never worked with animations before.

have a look at it. i have 2 animations in glb file for now. when I play them. i created a map with <name of animation, animationclip> and get all animations that exist in map from string. its lagging like both animations are playing at same time. i want to add some duration between these two and also I tried THREE.loading = {}; in dispose but its playing animations in repeat image

both animations are playing at same time. image

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

You are on the right track for your animations to play. Looks like you are missing a few things.

From my understanding: 1)Play one animation not on repeat 2)Have a duration between animations 3)Keep the animation in the same spot when done playing

import 'dart:async';

Timer? _timer;
int currentDuaration = 0;
List<int> durations = [1917,2125];
Map<String,dynamic> animations = {};//make this a global variable

Future<void> initPage() async {
  //other code above
  mixer = THREE.AnimationMixer(model);
  for(int i = 0; i < result["animations"].length; i++){
    AnimationClip animationClip = result["animations"][i];
    animations[animationClip.name] = animationClip;
  }
  List<String> animationName = widget.animations.split(" ");
  _timer = pause(); //add _timer?.cancel(); to dispose function
}
//other code below

Create a new void function

late AnimationAction action;

Timer pause(){
    return Timer(Duration(milliseconds: durations[currentDuaration]), () {
       if(currentDuaration < durations.length){
           playAnimation(animationName[currentDuaration]);
           _timer = playDuration();
           currentDuaration++;
      }
      _timer?.cancel();
    });
}

void playAnimation(String animation){
  if(animations.containsKey(animation)){
    action = mixer!.clipAction(animation)!;
    action.repetitions = 1; //keeps the action from repeating
    action.clampWhenFinished = true;//keep same position when done with action
    action.play();//play animation
  }
}

void render() {
   //other code above
    if(!action.isRunning() && currentDuration < durations.length){
        _timer = pause(); 
    }
    //other code below
}

This might need some tweaking since I have not used this code.

Hope this helps.

ShakeelKhalid1913 commented 11 months ago

It looks much sense now for me. but would it be a generic? because durations are stored in array. let's say each animation I want to play after 3 second. because no animation would be that long.

and One more thing there are some issue in Class AnimationMixer this function AnimationAction? clipAction(clip, [optionalRoot, blendMode])

whenever I try to play an animation that I already played on it (animation that stored in mixer) it gives me error of no "actionByRoot" function found and then knownaction //444 line var existingAction = actionsForClip.actionByRoot[rootUuid]; //221 line actionsForClip.knownActions

so I had to comment if condition of existing clip I had to remove else condition on 220 lines too. i think its better you test this by your own. then we can update repo? what do you think.

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

To make it more generic between each animation use a counter for what animations you are on instead of the currentDuration and const Duration(seconds: 3) for the timer.

Thanks for letting me know of the issue. I will take a look to update both repos.

ShakeelKhalid1913 commented 11 months ago

Yes. it works now. i have added counter and duration. Duration will be the current animation duration. everything is almost done. except build for android :( and orbitcontrol is not working. i want to control the camera

what could be the issue? do I have to change gradle version? the issue is in flutter_gl. image

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

Looks like you need to update flutter_gl in path 'C:\Users\shake\AppData\Local\Pub\Cache\hosted\pub.dev\flutter_gl-0.0.21\android\build.gradle'.

Please change the file to this.

group 'com.futouapp.flutter_gl.flutter_gl'
version '1.0-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.7.20'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

rootProject.allprojects {
    repositories {
        google()
        mavenCentral()

        flatDir {
            dirs 'libs/aars'
        }
    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
    compileSdkVersion 33

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }
    defaultConfig {
        minSdkVersion 24
    }
    lintOptions {
        disable 'InvalidPackage'
    }

}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'

    implementation(name:'threeegl', ext:'aar')
}

You will also need to update your 'android/app/build.gradle' change compileSdkVersion to 33 and change targetSdkVersion to 33.

Hope this helps.

ShakeelKhalid1913 commented 11 months ago

i'm getting this issue

FAILURE: Build failed with an exception.

this is what I modified in app/gradle of my project (I updated flutter_gl build file with above code too

android {
   namespace "com.example.flutter_three"
   compileSdkVersion 33
   ndkVersion flutter.ndkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

kotlinOptions {
    jvmTarget = '1.8'
}

sourceSets {
    main.java.srcDirs += 'src/main/kotlin'
}

defaultConfig {
    // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
    applicationId "com.example.flutter_three"
    // You can update the following values to match your application needs.
    // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
    minSdkVersion flutter.minSdkVersion
    targetSdkVersion 33
    versionCode flutterVersionCode.toInteger()
    versionName flutterVersionName
}
Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913 ,

Check to make sure threeegl.aar is in 'E:/Projects/FYP/flutter_three/android/app/libs/aars/threeegl.aar'. If it is not go get from 'three_dart/example/android/app/libs/aars' and place it in 'E:/Projects/FYP/flutter_three/android/app/libs/aars'.

ShakeelKhalid1913 commented 11 months ago

Finally.. it works. Thank you so much for you help and kindness sir. if I have any query I will certainly approach you. I had now completely lost all courage but haha it worked this time.

The character is not showing properly. that is just the last problem (the problem was in web too). any guidance? Character was made in readyplayerme.

image

FYI i had also to add this in manifest -> android tools:replace="android:label"

Knightro63 commented 11 months ago

Finally.. it works. Thank you so much for you help and kindness sir. if I have any query I will certainly approach you. I had now completely lost all courage but haha it worked this time.

The character is not showing properly. that is just the last problem (the problem was in web too). any guidance? Character was made in readyplayerme.

image

FYI i had also to add this in manifest -> android tools:replace="android:label"

Hi @ShakeelKhalid1913,

Thank you for the kind words. Sorry your character is not showing properly. Could you please describe to me why it is not showing properly?

ShakeelKhalid1913 commented 11 months ago

I don't know kaybe the issue is in readyplayerme. I will try to add character from mixamo

ShakeelKhalid1913 commented 11 months ago

Hi.. the issue is resolved. Now i want to add two functionalities.first is I want to control camera (orbit controller). and second one is i want to add image texture as background. i am having issue with both. any idea how can i solve this problem?

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

Please go to here or here for the examples of orbit controls.

As for the background image in your initPage function add this code.

    var textureLoader = THREE.TextureLoader(null);
    textureLoader.flipY = true;
    scene.background = await textureLoader.loadAsync('imageFile');

Hope this helps.

ShakeelKhalid1913 commented 11 months ago

Thank you :)

i am having this issue not related to three dart. any idea how can I solve this? issue

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

While this question is not related to this issue, you have a couple of problems with the code you posted on stack. I am unsure of what you were asking because of the lack of info, but here is a shot in the "dart". Here is an example of a FutureBuilder in dart for this repo as your question seems to stem from a FutureBuilder problem.

  1. Your transcript function is a Future but has no await. Thus, this function returns null or FutureOr to the future in FutureBuilder. Try adding await to the return. return await app_services.transcriptFile(widget.audioRecorder.recordFilePath);
  2. The submit widget is a final and null, and gets called in the build future, but never gets declared.
  3. Your child widget is also null when getting initialized. Try making your else statement return CircularProgressIndicator() to avoid any null return.
  4. Your if statement needs a return value as well for the FutureBuilder.

If you want this class to continue to update the text from a user input or other method you should probably switch from a FutureBuilder to a conditional statement and use setState to update the text.

String? responseText; // make this a global

Future<String> transcript(String method) async {
    debugPrint(method);
    app_services.transcriptFile(widget.audioRecorder.recordFilePath).then((transcript){
      setState((){
          responseText = transcript; 
       });
    });
    // Use the below statement if you wish to keep the FutureBuilder
    // return await app_services.transcriptFile(widget.audioRecorder.recordFilePath);
}

Widget build(BuildContext context) {
    return responseText == null?CircularProgressIndicator():Text(responseText);
}

Hope this helps.

hasnentai commented 11 months ago

Hi, @Knightro63 I have a huge .gltf file and want to cache it in Android and ios. For the web, the cache is happening by default. How can I do it for Android and ios?

Knightro63 commented 11 months ago

Hi @hasnentai,

You will need to enable Cache for this to work. In you main.dart file add Cache.enabled = true;.

If you notice any issues let me know as I have not looked into this much. Also this does not work well on Blob types and you might see your images not updating correctly.

Hope this helps.

ShakeelKhalid1913 commented 11 months ago

you mean THREE.Cache.enabled = true ? will it cache the glb file?

Knightro63 commented 11 months ago

Hi @ShakeelKhalid1913,

You could use either depending on your import.

It does not cache the glb file itself but what is in the file e.g.(textures).

import 'package:flutter/material.dart';
import 'package:three_dart/three_dart.dart';
import 'app/ExampleApp.dart';

void main() {
  Cache.enabled = true;
  runApp( const ExampleApp() );
}
ShakeelKhalid1913 commented 10 months ago

Hello again!

I have question. i want to allow user to change the character. how can I reload character when user select a new character. i recalled initPage with new character name on button pressed. It works but only 1 time. what could be the way to solve this problem?

Knightro63 commented 10 months ago

Hi @ShakeelKhalid1913,

You should only call initPage once. If you call it multiple times you will have problems with the scene being reissued. Have you tried scene.remove(character);? This will remove the character from the scene to allow a new one to be put in. Below is an example of a method that you could try.

import 'package:three_dart/three_dart.dart' as THREE;
import 'package:three_dart_jsm/three_dart_jsm.dart' as THREE_JSM;

  late THREE.Scene scene;

  Future<void> initPage() async {
    scene = THREE.Scene();
    loadCharacter(pathToCharacter);
  }

  Future<void> loadCharacter(String characterUrl) async {
    THREE.Loader loader = THREE_JSM.GLTFLoader();
    var result = await loader.loadAsync(characterUrl);
    THREE.Object3D character = result["scene"];
    scene.add(character);
    setState(() {});
  }
  void removeCharacter(THREE.Object3D character) {
    scene.remove(character);
  }

  Future<void> removeOldAddNew(THREE.Object3D oldCharacter,String newCharacterPath) async{
    removeCharacter(oldCharacter);
    await loadCharacter(newCharacterPath);
  }

Hope this helps.

ShakeelKhalid1913 commented 10 months ago

The issue is same. i have two characters red.glb and blue.glb

APplication starts with red.glb when I pressed button it goes to blue.glb and display it. displaying 2nd character is working. but when I again pressed button to go back to previous character it stuck in loading. when going back to red.glb, it stuck in loadSync. because loadSync completed is not printing

image

ShakeelKhalid1913 commented 10 months ago

i found a way. i load both characters at start of the app. but set visible of 2nd character false. so whenever button presses I do

model1.visible = !model1.visible; model2.visible = !model2.visible; print("${model1.visible} ${model2.visible}"); setState(() {});

what do you think about this?

Knightro63 commented 10 months ago

Hi @ShakeelKhalid1913,

If you only have a couple and it doesn't affect your memory usage, then yes that is a good way to do it. The issue you were having might be related to caching. I will look into it to see if it is a bug. I used it with obj files with no issue but have not had the time to check other types of files.

ShakeelKhalid1913 commented 10 months ago

Yes kindly inform me if you found the solution.

Also after updating flutter Three.cache were causing issue in my project. I removed it

ShakeelKhalid1913 commented 10 months ago

@Knightro63 Did you found what is the problem?

Knightro63 commented 9 months ago

Hi @ShakeelKhalid1913,

I am unsure what the problems are you might be having. I ran all the examples with cache on and off with no issue. If you are using my repo for you project util a new version of this repo becomes available be sure to run flutter pub upgrade to update any changes I have made to your existing project.

I have also tried adding and removing gltf and glb files with the code I placed above with no issues.

lemba3 commented 7 months ago

I somehow solved the issue. I used your repo, thanks.

How did you solve it? Im stuck with the following error (Could not find git ref 'HEAD' (usage: git rev-list [] ... [--] [...] works fine for the three_dart git repo but not the three_dart_jsm git repo

ShakeelKhalid1913 commented 7 months ago

I somehow solved the issue. I used your repo, thanks.

How did you solve it? Im stuck with the following error

(Could not find git ref 'HEAD' (usage: git rev-list

[] ... [--] [...]

works fine for the three_dart git repo but not the three_dart_jsm git repo

I actually changed code in the repo to make it work. Its been 3-4 months. Maybe flutter version creates this issue

zjyhll commented 3 months ago

as you can see,the problem is“[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: Class 'GLTFParser' has no instance getter '_markDefs'.” image image image

Just open these two comments

zjyhll commented 3 months ago

还有一个问题 image

这extension明明是一个Map,为何要用 extension.specularFactor去拿数据而不是 extension['specularFactor']