提交 f1ae2648 编写于 作者: M Mr.doob

WebGLBackground: Use polygonOffset to push background away.

上级 5a570f4b
......@@ -1142,6 +1142,8 @@ function WebGLRenderer( parameters ) {
state.buffers.depth.setMask( true );
state.buffers.color.setMask( true );
state.setPolygonOffset( false );
if ( vr.enabled ) {
vr.submitFrame();
......
......@@ -46,11 +46,8 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
if ( boxMesh === undefined ) {
// Normalized box
// 1.1547 = (1,1,1).normalize() * 2.0
boxMesh = new Mesh(
new BoxBufferGeometry( 1.1547, 1.1547, 1.1547 ),
new BoxBufferGeometry( 1, 1, 1 ),
new ShaderMaterial( {
uniforms: ShaderLib.cube.uniforms,
vertexShader: ShaderLib.cube.vertexShader,
......@@ -58,6 +55,7 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
side: BackSide,
depthTest: true,
depthWrite: false,
polygonOffset: true,
fog: false
} )
);
......@@ -72,6 +70,8 @@ function WebGLBackground( renderer, state, geometries, premultipliedAlpha ) {
this.matrixWorld.makeScale( scale, scale, scale );
this.matrixWorld.copyPosition( camera.matrixWorld );
this.material.polygonOffsetUnits = scale * 10;
};
geometries.update( boxMesh.geometry );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册