我在故障上编写了一个演示场景来测试我在a-frame中输出的gltf模型,但是我在控制台中遇到错误:
我的代码
<!DOCTYPE html>
<html>
<head>
<title>Basic Scene - A-Frame</title>
<meta name="description" content="Basic Scene - A-Frame">
<script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
</head>
<body>
<a-scene>
<a-assets>
<a-asset-item id="gltfDemo" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fexport.gltf?1499844855169"></a-asset-item>
<a-asset-item id="buffer_0.bin" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fbuffer_0.bin?1499844851189"></a-asset-item>
<a-asset-item id="buffer_1.bin" src="https://cdn.glitch.com/a3c2afff-dcc6-4918-bb73-5716b35f39b0%2Fbuffer_1.bin?1499844853034"></a-asset-item>
</a-assets>
<a-entity gltf-model="#gltfDemo"></a-entity>
<a-sky color="#000"></a-sky>
<a-light type="ambient" color="#445451"></a-light>
<a-plane color="#050" rotation="-90 0 0" height="100" width="100"></a-plane>
<a-camera>
<a-cursor color="#FAFAFA"></a-cursor>
</a-camera>
</a-scene>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
错误:
VM1762:1 Uncaught SyntaxError: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at e.parse (GLTFLoader.js:68)
at GLTFLoader.js:32
at three.js:29160
Run Code Online (Sandbox Code Playgroud)
源文件: Glitch Fiddle包含源文件
我有一种感觉,我错误地将gltf导入故障或以错误的方式使用它.有谁能够帮我?
我正在使用 regl 渲染圆圈,并且有三个目标:
更新:演示链接现在反映了有效的、已接受的答案。下面的代码不变。
索引.js
const regl = require('regl');
const glsl = require('glslify');
const vertexShader = glsl.file('../shaders/vertex.glsl');
const fragmentShader = glsl.file('../shaders/fragment.glsl');
// Create webgl context and clear.
const canvasEl = document.querySelector('canvas');
const app = regl({
canvas: canvasEl,
extensions: ['OES_standard_derivatives']
});
app.clear({color: [0, 0, 0, 0], depth: 1});
// Generate random points and colors.
const attributes = {position: [], color: []};
for (let i = 0; i < 100; i++) { …Run Code Online (Sandbox Code Playgroud) 我正在为一个项目设置一个基础数据结构,希望有一个抽象的基础GraphNode对象,许多其他对象将从中继承。每个 GraphNode 子类都具有元数据,其中可能包括文字(字符串、数字等)和对其他 GraphNode 派生类型的引用。
子类示例:
\ninterface IPerson {\n name: string;\n age: number;\n friend: Person;\n pet: Pet;\n}\n\ninterface IPet {\n type: \'dog\' | \'cat\';\n name: string;\n}\n\nclass Person extends GraphNode<IPerson> {}\nclass Pet extends GraphNode<IPet> {}\nRun Code Online (Sandbox Code Playgroud)\n用法示例:
\nconst spot = new Pet()\n .set(\'type\', \'dog\')\n .set(\'name\', \'Spot\');\n\nconst jo = new Person()\n .set(\'name\', \'Jo\')\n .set(\'age\', 41)\n .set(\'pet\', spot) // \xe2\x9a\xa0\xef\xb8\x8f Should not accept GraphNode argument.\n .setRef(\'pet\', spot); // \xe2\x9c\x85 Correct.\n\nconst sam = new Person()\n .set(\'name\', \'Sam\')\n .set(\'age\', 45)\n .set(\'friend\', …Run Code Online (Sandbox Code Playgroud) 如何为WebVR页面提高WASD控件的速度?因为现在它变得非常慢.
<a-entity position="0 1.8 0" camera look-controls wasd-controls>
<a-camera id="camera">
<a-cursor color="#333" maxDistance="30"></a-cursor>
</a-camera>
</a-entity>
Run Code Online (Sandbox Code Playgroud) 我有以下片段:
new Uint16Array( arraybuffer, 0, 18108 );
Run Code Online (Sandbox Code Playgroud)
我知道,arraybuffer是的一个实例ArrayBuffer,那arraybuffer.byteLength是31984.该arraybuffer的内容是一个黑盒子给我。因为缓冲区的byteLength> 18108,所以我希望它能正常工作。相反,我得到以下错误:
铬:
RangeError:无效的类型化数组长度
Firefox:
TypeError:无效的参数
是什么原因导致失败,或者如何检查无法打开的ArrayBuffer?
我正在尝试使用 Deno 递归读取文件Deno.readDir,但他们提供的示例仅执行给定的文件夹:
for await (const entry of Deno.readDir(Deno.cwd())) {
console.log(entry.name);
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能使这个递归?
aframe ×2
archilogic ×1
arraybuffer ×1
blending ×1
deno ×1
file-io ×1
generics ×1
glsl ×1
gltf ×1
javascript ×1
regl ×1
shader ×1
typed-arrays ×1
typescript ×1
webvr ×1