javascript 我如何包含 gl-matrix?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15931119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I include gl-matrix?
提问by Dmitry
What I did:
我做了什么:
Downloaded master branch from here: https://github.com/toji/gl-matrixPut src folder into my project's folder. Included gl-matrix-manifest.js from there. Tried this:
从这里下载主分支:https: //github.com/toji/gl-matrix将 src 文件夹放入我的项目文件夹中。从那里包括 gl-matrix-manifest.js。试过这个:
var mvMatrix = mat4.create();
Result:
结果:
var mvMatrix = mat4.create();
ReferenceError: mat4 is not defined
Okay, let's indlude mat4 directly. Included. Result:
好的,让我们直接引入 mat4。包括。结果:
var out = new GLMAT_ARRAY_TYPE(16);
ReferenceError: GLMAT_ARRAY_TYPE is not defined
Okay, maybe it needs common.js:
好吧,也许它需要 common.js:
var x = axis[0], y = axis[1], z = axis[2],
TypeError: axis is undefined
WTF, included all other files from src folder (common, vectors,matrices,quat):
WTF,包括 src 文件夹中的所有其他文件(common、vectors、matrices、quat):
var x = axis[0], y = axis[1], z = axis[2],
TypeError: axis is undefined
(same)
(相同的)
How do I include propertly? In particular I need mat4 and vec4.
我如何正确地包含?我特别需要 mat4 和 vec4。
采纳答案by lukyer
Just include /dist/gl-matrix-min.js or /dist/gl-matrix.js :)
只需包含 /dist/gl-matrix-min.js 或 /dist/gl-matrix.js :)
回答by Alon Granot
Once the source is specified correctly, I still couldn't directly call mat4.
一旦正确指定了源,我仍然无法直接调用 mat4。
I had to type "glMatrix.mat4" instead.
我不得不输入“glMatrix.mat4”。