自定义3D渲染器在Java中的问题

huangapple 未分类评论45阅读模式
标题翻译

Problems with custom 3d renderer in java

问题

所以我最近开始在Java中制作自己的3D渲染器。我已经制作了一个立方体和一个可以用WASD和鼠标移动的相机。我只有一个问题:

当相机看向其他地方或者立方体的一个点位于显示器的角落时,渲染器会出现问题(它会渲染一个不应该被绘制的多边形)。

经过调试,我发现渲染器想要在x: -142500的位置渲染一个点(远离我的1500x1500窗口)。然后我尝试通过实现屏幕剪裁来修复这个问题(这样142500的x坐标将被移动到屏幕的边缘)。然而,这也没有起作用 自定义3D渲染器在Java中的问题

我会非常感谢任何帮助。
问题(红色部分是边缘,蓝色条纹区域是白色三角形应该渲染的位置)

编辑:Dropbox的JAR文件

英文翻译

So I have recently started on my own 3D renderer in Java. I have made a cube and a camera that can be moved with WASD and mouse. I have just one problem:

When the camera looks away or a point of the cube ends up on the corner of the display the renderer freaks out (it renders a polygon that shouldn't be drawn).

After debugging I saw that the renderer wanted to render a point at x: -142500 (way out of my 1500x1500 window). I then tried to fix this by implementing screen clipping (so that 142500 x coordinate would be moved to the edge of the screen). Well, that didn't work either 自定义3D渲染器在Java中的问题

I would appreciate any help.
The problem (the red is where the edge is and the blue striped area is where the white triangle should have rendered)

Edit: dropbox jar file

huangapple
  • 本文由 发表于 2020年3月16日 21:45:04
  • 转载请务必保留本文链接:https://java.coder-hub.com/60707145.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定