1. 首页
  2. three.js

three.jsSafari中的首次加载不显示.glb

大家好,n我是新来的three.js我被一个奇怪的“虫子”缠住了。在所有浏览器中,我的测试都工作得很好。但是当我在Safari上加载带有空缓存的页面时,什么也没有出现。我需要重新加载页面,以便文件按预期方式显示。当然,我不能期望任何用户理解需要重新加载页面,这是我的代码:nlet container;let camera;let controls;let renderer;let scene;function => {update();render();onWindowResize();} = new THREE.PerspectiveCamera( 35, container.clientWidth / container.clientHeight, 1, 100 );camera.position.set( 0, 0, 10 );}function = = = new THREE.PointLight( 0xffffff, 10 );camera.add( mainLight );scene.add( camera );}function loadModels() = true;container.appendChild( renderer.domElement );}// perform any updates to the scene, called once per frame// avoid heavy computation herefunction update() {controls.update();}// render, or \”draw a still image\”, of the scenefunction render() {if ( gltf.scene ) gltf.scene.rotation.y += 0.01;renderer.render( scene, camera );}function onWindowResize()>nIn the Inspector tool I get the following Error Messages:nSyntaxError: JSON Parse error: Unexpected EOFnTypeError: undefined is not an object (evaluating \”c.length\”)nTypeError: undefined is not an object (evaluating \”d.length\”)nThe testpage I am working on can be found here:ntestpage 1nI am greatful for any tip! Solved by Mugen87 in post #2 That\”s indeed strange. For some reasons, the initial request to your glTF asset returns null. The runtime error is the result of passingnull to GLTFLoader.parse(). When importing the 3D model into the three.js editor, it works even on first try though. Can you please try it with a different glTF…nThat\”s indeed strange. For some reasons, the initial request to your glTF asset returns null。运行时错误是在将三维模型导入数据库时将null传递给GLTFLoader.parse().n的结果three.js编辑器5,它甚至可以在第一次尝试时使用。n您可以使用存储库中的其他glTF资产进行尝试吗?比如这个4号?是否发生了相同的错误?n顺便说一句:对于这样的型号,19MB相当大。考虑通过glTF-pipeline压缩您的模型。这样做会将大小减少到大约3.3 MB。我已附上转换后的文件以供测试之用。ntestDraco.glb(3.3MB)。n谢谢@Mugen87。n是的,看来3D模型本身有问题。n无论如何,谢谢你的快速回复,我会调查一下DRACO压缩机n First load in Safari doesn’t display the .glbn

three.jsSafari中的首次加载不显示.glb 为WP2原创文章,链接:https://www.wp2.cn/three-js/three-jssafari%e4%b8%ad%e7%9a%84%e9%a6%96%e6%ac%a1%e5%8a%a0%e8%bd%bd%e4%b8%8d%e6%98%be%e7%a4%ba-glb/