Closed sebastian-meyer closed 1 year ago
There is no problem to do this this way, probably I just missed this library when changing paths
import { GUI } from './node_modules/lil-gui/dist/lil-gui.esm.min.js';
The problem with three.js newest version is they started using importmap which is not supported by Drupal we are using. I stared implementation with default paths but it's not possible inside Drupal yet.
So maybe the best option for us would be to use the original release of three.js in the DFG-Viewer and combine that with your main.js
file? If I put all the original files in the correct locations given in the "include"s in main.js
that should work, right?
I just saw that three.js includes an lil-gui
library. So maybe we could make things even easier and use
include { GUI } from './js/jsm/libs/lil-gui.module.min.js';
instead of the import from node_modules
directory?
Perfect, it works with three.js version of lil-gui. I didn't notice it before. Thanks.
Now I got a bit further:
lil-gui.module.min.js
in main.js
relative (as mentioned above)main.js
and spinner/*
from your repository to the DFG-Viewerbuild/*
and examples/jsm
(as js/jsm
) from the official r145 release of three.js to the DFG-Viewerimportmap
statement as requirement by three.js to the DFG-ViewerSo far this seems to work. But there are still paths in your main.js
that are only valid in the Drupal context and don't work in the DFG-Viewer. Currently you are passing paths like module/dfg_3dviewer/main/*
to some of the three.js modules, which don't exist in the DFG-Viewer. Instead, there the paths should be like typo3conf/ext/dlf/Resources/Public/Javascript/3DViewer/*
. Can we find a way of making at least the prefix configurable? If you like, I can provide a pull request.
Great to hear it. Could you please check the newest code then? I just added some more things and made code cleanup.
Your latest code is now deployed here (without any changes): https://3dtest.dfg-viewer.de/viewer?tx_dlf[id]=https://4dcity.org/modelupload/70ef075a31ef44ac97bc1459baee7a18/70ef075a31ef44ac97bc1459baee7a18metsmods.xml&no_cache=1
Now I deployed my code with the changes from #27 and configured CONFIG.basePath
according to my environment. Good news is: the viewer gets to the point where it tries to load the gltf file, now. Bad news: this fails, but I don't know why (the errors point to three.module.js
and GLTFLoader.js
). Could you please take it from here?
(I get the same errors when using your latest code and just search/replace the Drupal paths, so it probably isn't caused by my changes in #27.)
@thedworak Have you made any progress in solving the problem?
No, but I also didn't investigate this any further. I debugged the code as far as integration with the DFG-Viewer is concerned. Now it seems to be issues with the viewer itself, so you are the expert for that. ;o)
Discussion on jour fixe: @thedworak will solve this in coming weeks
@sebastian-meyer Daniel solved the problem. Could you please check it?
Unfortunately it's still not working.
The viewer still tries to load something from the Mainz repository even when loading a model from Jena. According to the JS console it tries to access https://3d-repository.hs-mainz.de/export_xml_single/?page=0&_format=xml (which results in a 500 error) and then calls for https://4dcity.org/modelupload/600db4895c834276a4f667609fec89a4/metadata/600db4895c834276a4f667609fec89a4.gltf_viewer (which doesn't exist either). Subsequentely loading fails completely and nothing is shown.
I tested with this example. The model itself seems fine, because it works with model-viewer (apart from missing support for glossy materials).
Again: I think we still need to get rid of all the code inside the viewer which is specific for the Mainz repository. This should be placed into a separate module which then can be used in WissKI, but omitted in the DFG-Viewer.
Did you try to use lightweight version of the viewer?
I am using this one: https://github.com/thedworak/dfg_3dviewer/blob/main/viewer/main.js
Where do I find the lightweight version?
Please change the ligthweight to true inside CONFIG variable const CONFIG = { ... "lightweight": true };
Looks good! With lightweight: true
it's working!
There is still an error, because fetchSettings
in main.js tries to load https://3dtest.dfg-viewer.de/null
, but this seems to not prevent display of model. Maybe save the settings in a cookie or disable settings in lightweight mode?
@thedworak Will do this until next week
I think it should be resolved
@sebastian-meyer Could you please check it?
Unfortunately the latest changes seem to be a step backwards, because now nothing is shown at all. There are no errors in the console, but also no model shown. The loading indicator stays at 0%.
Examples:
@thedworak Could you please have a look again?
The main.js I use can be found here: https://3dtest.dfg-viewer.de/typo3conf/ext/dlf/Resources/Public/Javascript/3DViewer/main.js
Could you please @sebastian-meyer take a look right now?
@thedworak Now the viewer displays the base reference system, but no model. There is an error in the console, which may be related?
It's really hard to debug what is wrong when there is no output in the console. Maybe you could try this time, I just pushed some changes
Ignore my last (deleted) comment! I forgot to purge the cache...
Now it's working! Thank you very much! I'll close this issue.
That's great!
In
main/main.js
all but one includes are handled as relative paths and work fine when integrating with the DFG-Viewer. But this include uses an absolute path which is only valid in Drupal/WissKI and therefore breaks integration: https://github.com/thedworak/dfg_3dviewer/blob/72368981a5b6ca4f10e54db1d5678acb82aa141a/main/main.js#L27 Is there a reason for this being an absolute path or could it be a relative path as well?I suggest changing it like:
import { GUI } from './node_modules/lil-gui/dist/lil-gui.esm.min.js';
Furthermore, when I change this locally, there are multiple additional absolute include paths in the library files (e. g.
three.module.js
andGLTFLoader.js
) which also break integration.