简体   繁体   English

Java相当于WPF的3D功能

[英]Java equivalent to WPF's 3D functionalities

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: 我最近从事WPF的研究(说实话,我之所以加入WPF是因为它内置了3D对象,相机和渲染功能),这使我能够做到这一点:

替代文字

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. 使用方向键([↑] [↓] [→] [←])走路和转弯,[Q]或[A],以及[W]或[S](“上帝模式”)进行更广泛的查看上面的迷宫。

Note: I have no intention on harming anyone's PC. 注意:我无意损害任何人的PC。 Please, would the first one to run it comment here stating that it's safe ? 拜托,第一个运行它的人会在这里发表评论,指出它很安全吗? Or just run it on a VM. 或者只是在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. 我知道的并不是那么令人印象深刻(假设有十分之一的时间可以使用一些工具来开发更流畅,更详细的小游戏),但这是为学习和开发自己的游戏而设计的3D开发和空间概念中的概念。

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 ? 正如我最近在学习Java一样,我想知道:是否有像WPF中提供的工具一样容易使用3D的工具?

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. 对于那些不知道的人:WPF提供了创建3d对象,相机,光线,面部并渲染它们(通过相机的视图)的可能性,而这个小型测试游戏是用固定的立方体和通过用户交互移动的相机制作的。

Note: Not a dupe, it's not about Java equivalent for WPF, i'm asking specifically about the WPF's 3D functionalities. 注意:不是骗子,不是关于WPF的Java等效项,我是在专门询问WPF的3D功能。

The java equilant is Java 3D Java Equilant是Java 3D

If you are writing a game then a simpler set of bindings like LWGL might be a more suitable choice. 如果您正在编写游戏, 则更简单的绑定集(例如LWGL)可能是更合适的选择。

:DI did maze game using Swing in Java. :DI在Java中使用Swing做迷宫游戏。 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. Java3D,但这与WPF不同,并且不易使用IMO。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM