我正在使用javascript构建我自己的自定义引擎(不要问为什么)
我的代码一直工作得很好,直到我添加了用于绘制线条的bline算法(比使用递归函数快得多),然后突然这段代码崩溃了,我不完全确定原因。
这是控制台中显示的错误
Uncaught ReferenceError: requestAnimFrame is not defined at 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);
}
发布于 2017-06-17 12:56:56
事实上,它是requestAnimationFrame()
https://stackoverflow.com/questions/44600917
复制相似问题