草庐IT

newRotationMatrix

全部标签

javascript - 在 WebGL 中制作球体旋转

不确定我在这里遗漏了什么。试图通过让用户单击“旋转”按钮来使行星(即球体)旋转,但似乎无法弄清楚。我确实有以下部分通过用户与鼠标的交互来旋转球体:document.onmousemove=function(){if(!mouseDown){return;}varnewX=event.clientX;varnewY=event.clientY;vardeltaX=newX-lastMouseXvarnewRotationMatrix=mat4.create();mat4.identity(newRotationMatrix);mat4.rotate(newRotationMatrix,d