未捕获的异常:在帧中使用 Draco 解码器加载 glTF 模型时的对象
Uncaught exception: Object when loading a glTF model using Draco Decoder in a-frame
我正在尝试使用 draco decoder in glitch.com following the a-frame documentation. You can take a look to the full project and code here 加载 glTF 模型。当我 运行 代码在本地时,一切都按预期工作,但是当我 运行 glitch.com 应用程序时,我得到一个 未捕获的异常:对象 3 浏览器控制台错误。这是我正在使用的 HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chaitén VR 3</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="scripts/camera-listener.js"></script>
</head>
<body>
<a-scene
stats
renderer="antialias: true; colorManagement: true; sortObjects: true; physicallyCorrectLights: true; maxCanvasWidth: 1920; maxCanvasHeight: 1920;"
gltf-model="dracoDecoderPath: scripts/draco_decoder">
<a-assets timeout="69000">
<a-asset-item
id="cave"
src="https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcueva_6_dcompress_1.gltf">
</a-asset-item>
</a-assets>
<a-sky
color="#000">
</a-sky>
<a-gltf-model
src="#cave"
scale="1 1 1"
position="0 0 -10"
rotation="-90 90 0"
shadow="cast: true"
sound="src: https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcave_1.mp3; autoplay: true; loop: true; volume: 2">
</a-gltf-model>
<a-entity
id="camera"
camera
look-controls
wasd-controls="acceleration:150"
position="-4.5 1.6 -1">
</a-entity>
<a-entity
id="light"
light="type: point; intensity: 15; distance: 10; decay: 1; shadowCameraVisible: false;"
position="-4.5 1.6 0.35">
</a-entity>
<a-entity camera-listener></a-entity>
</a-scene>
</body>
我在 Blender 2.82 中创建了原始的 glTF,并使用 glTF Pipeline 将模型转换为 Draco glTF。
我检查了这个文件:time_draco_decode.html 发现:
// It is recommended to always pull your Draco JavaScript and WASM decoders
// from this URL. Users will benefit from having the Draco decoder in cache
// as more sites start using the static URL.
let decoderPath = 'https://www.gstatic.com/draco/v1/decoders/';
我使用了那个路径,现在应用程序运行正常。
我正在尝试使用 draco decoder in glitch.com following the a-frame documentation. You can take a look to the full project and code here 加载 glTF 模型。当我 运行 代码在本地时,一切都按预期工作,但是当我 运行 glitch.com 应用程序时,我得到一个 未捕获的异常:对象 3 浏览器控制台错误。这是我正在使用的 HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chaitén VR 3</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="scripts/camera-listener.js"></script>
</head>
<body>
<a-scene
stats
renderer="antialias: true; colorManagement: true; sortObjects: true; physicallyCorrectLights: true; maxCanvasWidth: 1920; maxCanvasHeight: 1920;"
gltf-model="dracoDecoderPath: scripts/draco_decoder">
<a-assets timeout="69000">
<a-asset-item
id="cave"
src="https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcueva_6_dcompress_1.gltf">
</a-asset-item>
</a-assets>
<a-sky
color="#000">
</a-sky>
<a-gltf-model
src="#cave"
scale="1 1 1"
position="0 0 -10"
rotation="-90 90 0"
shadow="cast: true"
sound="src: https://cdn.glitch.com/b8b66d5a-73ec-4bfe-8bfc-6ac0f5e30e89%2Fcave_1.mp3; autoplay: true; loop: true; volume: 2">
</a-gltf-model>
<a-entity
id="camera"
camera
look-controls
wasd-controls="acceleration:150"
position="-4.5 1.6 -1">
</a-entity>
<a-entity
id="light"
light="type: point; intensity: 15; distance: 10; decay: 1; shadowCameraVisible: false;"
position="-4.5 1.6 0.35">
</a-entity>
<a-entity camera-listener></a-entity>
</a-scene>
</body>
我在 Blender 2.82 中创建了原始的 glTF,并使用 glTF Pipeline 将模型转换为 Draco glTF。
我检查了这个文件:time_draco_decode.html 发现:
// It is recommended to always pull your Draco JavaScript and WASM decoders
// from this URL. Users will benefit from having the Draco decoder in cache
// as more sites start using the static URL.
let decoderPath = 'https://www.gstatic.com/draco/v1/decoders/';
我使用了那个路径,现在应用程序运行正常。