是否可以将立方体环境贴图绕Y轴旋转180度?

时间:2020-10-20 22:08:40

标签: three.js

我想将Y轴上的立方体贴图旋转180度。

scene = new THREE.Scene();

scene.background = new THREE.CubeTextureLoader()
                                      .setPath( '/path/to/my/docs/' )
                                      .load( [ 'posX.jpg', 'negX.jpg', 
                                               'posY.jpg', 'negY.jpg', 
                                               'posZ.jpg', 'negZ.jpg' ] );
// this doesn't work
scene.background.rotation.y = Math.PI;

我该怎么做

1 个答案:

答案 0 :(得分:0)

可惜,但在Three.js中,我无法使用SELECT * FROM forec WHERE stationid = 1 AND time1 >= '2020-10-21 05:00:00'; 参数来旋转立方体贴图:

rotation

解决方案

在我的情况下,最简单的解决方案(我想绕Y轴旋转)是重命名构成立方体贴图侧面的4张图像,以将立方体(天空盒)重新定向180度。

我们必须记住,默认情况下Three.js scene.background.rotation.y = Math.PI; Camera方向

看这些照片。左图描绘了默认的6图像放置以形成立方体贴图。右边的图像代表大约180度的Y轴重新定向的立方体。

enter image description here

重命名过程

因此,对于重新定向,您只需重命名4个源文件。这是一张表格,向您展示如何:

-Z

重命名过程后,将|--------------------|--------------------| | "Default name" | "RENAMED" | |--------------------|--------------------| | posX.jpg | negX.jpg | |--------------------|--------------------| | negX.jpg | posX.jpg | |--------------------|--------------------| | posZ.jpg | negZ.jpg | |--------------------|--------------------| | negZ.jpg | posZ.jpg | |--------------------|--------------------| posY.jpg图像旋转180度