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:
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 developm开发者_Python百科ent 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.
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.
: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.
精彩评论