鼹鼠山着色器
我正在尝试理解摩尔山并希望将一个顶点乘以两个矩阵,说:
output = theVertex * scaleMatrix * rotationMatrix
我猜我的顶点着色器看起来像这样:
"m44 vt0, va0, vc0\n" +
"mul op, vt0, vc1\n";
我会设置矩阵
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, scaleMatrix);
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, rotationMatrix);
但它不起作用。我做错了什么?
我知道我可以在放置着色器之前对矩阵进行倍增,但我正在尝试理解 AGAL。
干杯
I'm trying to understand molehill and would like to multiple a vertex by two matrices, say:
output = theVertex * scaleMatrix * rotationMatrix
Im guessing my vertex shader would look something like:
"m44 vt0, va0, vc0\n" +
"mul op, vt0, vc1\n";
And i would set the matrices with
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 0, scaleMatrix);
context3d.setProgramConstantsFromMatrix(Context3DProgramType.VERTEX, 1, rotationMatrix);
But its not working. What am i doing wrong?
Im aware that i could multiple the matrix before putting on the shader, but i am trying to understand AGAL.
Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
m44
矩阵是 4x4 浮点数,它需要 4 个寄存器,因为每个寄存器是 128 位(4 个浮点数),因此您必须将旋转矩阵加载到 vc4 寄存器中:A
m44
matrix is 4x4 floats, it takes 4 registers as each register is 128bits (4 floats) so you have to load your rotation matrix into vc4 register: