如何在Java 3D API中将不同的图像设置为3D立方体的面/边? [英] How to set different images as faces/sides of a 3D cube in Java 3D API?

查看:136
本文介绍了如何在Java 3D API中将不同的图像设置为3D立方体的面/边?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一小段代码,在我的SWT应用程序中绘制一个3D立方体,允许旋转它。



现在,我想更改立方体的每个面/侧并在其上绘制不同的图像,但我找不到如何去做(或至少,如果这是可能的话)。



我可以将多维数据集的完整纹理更改为图像,但它会更改所有的面并且我想要为每张脸设定不同的图像。这可能吗?任何代码示例?



谢谢

解决方案

使用TextureCubeMap类纹理的一个子类。纹理贴图可用于将图像应用到立方体的面。



您可以通过使用xyz坐标指定立方体的面积作为正面和负面来执行此操作。

请参阅下面的链接以获取完整文档。


I've created a small piece of code which draws a 3D cube in my SWT application allowing to rotate it.

Now, I want to change each face/side of the cube and draw a different image on it, but I can't find how to do it (or at least, in an easy way, if that's possible).

I was able to change the complete texture of the cube to an image, but it change all the faces and I want to set a different image to each face. Is this possible? Any code example?

Thanks

解决方案

Use TextureCubeMap class which is a sub class of Texture. The texture mapping can be used to apply images to faces of the cube.

You can do it by specifying the cube faces using xyz coordinates as positive and negative.

Refer the below link for its complete documentation.

这篇关于如何在Java 3D API中将不同的图像设置为3D立方体的面/边?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆