gpt4 book ai didi

javascript - requestAnimFrame 未定义

转载 作者:行者123 更新时间:2023-12-01 03:29:38 27 4
gpt4 key购买 nike

我正在使用 javascript 构建自己的自定义引擎(不要问为什么)

我的代码工作正常,直到我添加了用于画线的 bline 算法(比使用递归函数快得多),然后突然这段代码崩溃了,我不完全确定为什么

这是控制台中显示的错误

Uncaught ReferenceError :requestAnimFrame 未定义
在 HTMLDocument.init (main.js?v=0.0.6:40)

这是代码

function init() {
canvas = document.getElementById("frontBuffer");
mera = new GameCore.Camera();
device = new GameCore.Device(canvas);
mesh = new GameCore.Mesh("Cube", 8, 12);
meshes.push(mesh);
mesh.Vertices[0] = new BABYLON.Vector3(-1, 1, 1);
mesh.Vertices[1] = new BABYLON.Vector3(1, 1, 1);
mesh.Vertices[2] = new BABYLON.Vector3(-1, -1, 1);
mesh.Vertices[3] = new BABYLON.Vector3(1, -1, 1);
mesh.Vertices[4] = new BABYLON.Vector3(-1, 1, -1);
mesh.Vertices[5] = new BABYLON.Vector3(1, 1, -1);
mesh.Vertices[6] = new BABYLON.Vector3(1, -1, -1);
mesh.Vertices[7] = new BABYLON.Vector3(-1, -1, -1);
mesh.Faces[0] = { A:0, B:1, C:2 };
mesh.Faces[1] = { A:1, B:2, C:3 };
mesh.Faces[2] = { A:1, B:3, C:6 };
mesh.Faces[3] = { A:1, B:5, C:6 };
mesh.Faces[4] = { A:0, B:1, C:4 };
mesh.Faces[5] = { A:1, B:4, C:5 };

mesh.Faces[6] = { A:2, B:3, C:7 };
mesh.Faces[7] = { A:3, B:6, C:7 };
mesh.Faces[8] = { A:0, B:2, C:7 };
mesh.Faces[9] = { A:0, B:4, C:7 };
mesh.Faces[10] = { A:4, B:5, C:6 };
mesh.Faces[11] = { A:4, B:6, C:7 };

mera.Position = new BABYLON.Vector3(0, 0, 10);
mera.Target = new BABYLON.Vector3(0, 0, 0);

requestAnimFrame(drawingLoop);
}

最佳答案

事实上它是requestAnimationFrame()

关于javascript - requestAnimFrame 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44600917/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com