常规实现中如何改变轨迹球的中心?
我使用以下两个教程成功地在java中实现了轨迹球:
- http://nehe.gamedev.net /tutorial/arcball_rotation/19003
- http://www.java -tips.org/other-api-tips/jogl/arcball-rotation-nehe-tutorial-jogl-port.html
该轨迹球位于屏幕中心。现在,我希望将其置于屏幕上的任意点的中心。如何将中心逻辑合并到现有代码中?由于中心的引入,鼠标坐标的归一化如何变化?
I have successfully implemented a trackball in java using the below two tutorials:
- http://nehe.gamedev.net/tutorial/arcball_rotation/19003
- http://www.java-tips.org/other-api-tips/jogl/arcball-rotation-nehe-tutorial-jogl-port.html
This trackball is centered at the screen center. Now, I wish to center it at any point on the screen. How can I incorporate the center logic in the existing code? How the normalization of mouse coordinates change due to introduction of center?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可以通过转换鼠标坐标轻松实现。当您像第一个教程开始时那样转换鼠标坐标时,不要只是将它们转换为指定的范围 -1..1,而是首先减去要创建轨迹球的屏幕中心的偏移量中心。因此,要使轨迹球中心向右 50 像素、中心上方 20 像素,请使用
This can be easily achieved by transforming the mouse coordinates. When you transform the mouse coordinates as you do at the start of the first tutorial, instead of just transforming them as specified to the range -1..1, first subtract the offset from the centre of the screen where you want to make your trackball centre. So to make the trackball centre 50 pixels to the right and 20 pixels above the centre, use