Java 相当于 WPF 的 3D 功能

发布于 2024-09-28 22:43:24 字数 717 浏览 3 评论 0原文

我最近正在研究 WPF(说实话,我只是因为内置的 3D 对象、相机和渲染功能而进入它),这使我能够做到这一点:

alt text

下载: 迷宫大师

使用方向键([↑][↓][→][←])行走和转弯,[Q]或[A],[W]或[S ](“上帝模式”)从上方更广阔地观察迷宫。

注意:我无意伤害任何人的电脑。请问,第一个运行它的人会在这里评论说它是安全的吗?或者只是在虚拟机上运行它。

我知道这并不是那么令人印象深刻(考虑到有一些工具可以用来开发更流畅、更详细的小游戏,就像这个在十分之一的时间内),但它是为了学习和开发我的3D 开发和空间概念中的概念。

由于我最近正在学习 Java,我想知道:是否有可以像 WPF 中提供的工具一样轻松地处理 3D 的工具?

对于那些不知道的人:WPF 提供了创建 3D 对象、相机、灯光、面孔并渲染它们(通过相机视图)的可能性,这个小测试游戏是使用固定立方体和使用用户交互移动的相机制作的。

注意:不是骗人的,这不是 WPF 的 Java 等价物,我是专门询问 WPF 的 3D 功能。

I've recently engaged on studying WPF (to be honest, I've gotten into it just because there was built-in 3D object, camera and rendering capabilities), which has allowed me to do this:

alt text

Download: Master Maze

Use directional keys ([ ↑ ] [ ↓ ] [→] [←]) to walk and turn, [Q] or [A], and [W] or [S] ("god mode") to have a broader look on the maze from above.

Note: I have no intention on harming anyone's PC. Please, would the first one to run it comment here stating that it's safe ? Or just run it on a VM.

Which I'm aware is not quite that impressive (given that there are tools that can be used to develop way smoother and more detailed little games like this one in a tenth of the time), but it was made for learning, and developing my notions in 3D development and spacial concepts.

As I'm learning Java recently, and I'm wondering: are there tools to work with 3D just as easily as in what is provided in WPF ?

For those who don't know: WPF provides the possiblity to create 3d objects, cameras, light, faces and render them (through the camera's view), and this little test game was made with fixed cubes and a camera that moves using user interaction.

Note: Not a dupe, it's not about Java equivalent for WPF, i'm asking specifically about the WPF's 3D functionalities.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

暮凉 2024-10-05 22:43:24

java 等效项是 Java 3D

如果您正在编写游戏,那么一组更简单的绑定,例如 LWGL 可能是更合适的选择。

The java equilant is Java 3D

If you are writing a game then a simpler set of bindings like LWGL might be a more suitable choice.

缺⑴份安定 2024-10-05 22:43:24

:DI 使用 Java 中的 Swing 做了迷宫游戏。我的渲染很简单,因为

public void paintComponent(Graphics g)
{
    super.paintComponent(g);
    buffor = (Graphics2D)g;
    double ca,sa,alfa,r,x=0,y=0,size;
    buffor.setColor(Color.BLUE);
    buffor.fillRect(0,0,639,240);
    buffor.setColor(Color.GREEN);              
    buffor.fillRect(0,241,639,479);
    alfa=ga-0.52359; ///the result how we see things
    buffor.setColor(Color.WHITE); 
    int i;
    for (i=0;i<640;i++)
    {       
        if((map[(int)(y/64.0)][(int)(x/64.0)]=='e'))
        {
            buffor.setColor(Color.BLACK); 
            buffor.drawString("EXIT",330,330);
            buffor.setColor(Color.WHITE); 
        }
        ca=Math.cos(alfa); sa=Math.sin(alfa); r=0.0; x=gx; y=gy;
        while((map[(int)(y/64.0)][(int)(x/64.0)]!='x') && (map[(int)(y/64.0)][(int)(x/64.0)]!='e'))
               {
                    x=gx+r*sa;
                    y=gy+r*ca;
                    r=r+0.01;
               }
        r *= Math.cos(ga - alfa);
        size=12000/r;
        buffor.drawLine(i,240-(int)size,i,240+(int)size);
        alfa=alfa+0.00163625;
    }
    buffor.drawImage(cross,289,209,null);
    buffor.drawImage(logo,0,0,null);
    System.out.println(""+ (int)(gy/64.0) + " " + (int)(gx/64.0) + " " + ga);
}

Java3D 但这与 WPF 不同,而且在我看来并不容易使用。

:D I did maze game using Swing in Java. My rendering was simply as it

public void paintComponent(Graphics g)
{
    super.paintComponent(g);
    buffor = (Graphics2D)g;
    double ca,sa,alfa,r,x=0,y=0,size;
    buffor.setColor(Color.BLUE);
    buffor.fillRect(0,0,639,240);
    buffor.setColor(Color.GREEN);              
    buffor.fillRect(0,241,639,479);
    alfa=ga-0.52359; ///the result how we see things
    buffor.setColor(Color.WHITE); 
    int i;
    for (i=0;i<640;i++)
    {       
        if((map[(int)(y/64.0)][(int)(x/64.0)]=='e'))
        {
            buffor.setColor(Color.BLACK); 
            buffor.drawString("EXIT",330,330);
            buffor.setColor(Color.WHITE); 
        }
        ca=Math.cos(alfa); sa=Math.sin(alfa); r=0.0; x=gx; y=gy;
        while((map[(int)(y/64.0)][(int)(x/64.0)]!='x') && (map[(int)(y/64.0)][(int)(x/64.0)]!='e'))
               {
                    x=gx+r*sa;
                    y=gy+r*ca;
                    r=r+0.01;
               }
        r *= Math.cos(ga - alfa);
        size=12000/r;
        buffor.drawLine(i,240-(int)size,i,240+(int)size);
        alfa=alfa+0.00163625;
    }
    buffor.drawImage(cross,289,209,null);
    buffor.drawImage(logo,0,0,null);
    System.out.println(""+ (int)(gy/64.0) + " " + (int)(gx/64.0) + " " + ga);
}

There is Java3D but this is diffrent than WPF and not that easy to use IMO.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文