Browse Source

WebGLBackground: Simpler skybox code. Thanks @WestLangley!

Mr.doob 8 years ago
parent
commit
e1861b903a

+ 3 - 1
src/renderers/shaders/ShaderLib/cube_vert.glsl

@@ -5,6 +5,8 @@ varying vec3 vWorldPosition;
 void main() {
 
 	vWorldPosition = transformDirection( position, modelMatrix );
-	gl_Position = projectionMatrix * vec4( normalMatrix * position, 1.0 );
+
+	#include <begin_vertex>
+	#include <project_vertex>
 
 }

+ 1 - 0
src/renderers/webgl/WebGLBackground.js

@@ -64,6 +64,7 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
 			}
 
 			boxMesh.material.uniforms.tCube.value = background;
+			boxMesh.matrixWorld.copyPosition( camera.matrixWorld );
 
 			renderList.push( boxMesh, boxMesh.geometry, boxMesh.material, 0, null );