我正在尝试使用 Three.js 创建一个简单的 Skybox,但遇到了我应用于立方体的纹理的问题,该纹理只能在外部工作,而不是在立方体内部显示。
这是我的天空盒代码:
var path = assetPath + skyboxPrefix;
var urls = [ path + 'alpine_front.jpg',
path + 'alpine_back.jpg',
path + 'alpine_left.jpg',
path + 'alpine_right.jpg',
path + 'alpine_top.jpg' ];
var cubeTexture = THREE.ImageUtils.loadTextureCube( urls );
var shader = THREE.ShaderUtils.lib["cube"];
shader.uniforms["tCube"].texture = cubeTexture;
var skyboxMaterial = new THREE.ShaderMaterial( {
uniforms : shader.uniforms,
fragmentShader : shader.fragmentShader,
vertexShader : shader.vertexShader,
depthWrite : false
} );
var skyboxGeom = new THREE.CubeGeometry( 10000, 10000, 10000 );
skybox = new THREE.Mesh( skyboxGeom, skyboxMaterial );
skybox.flipSided = true;
scene.add(skybox);