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

WebGLState: Added clearColor()

上级 5c28d5af
......@@ -234,7 +234,7 @@ THREE.WebGLRenderer = function ( parameters ) {
}
_gl.clearColor( r, g, b, a );
state.clearColor( r, g, b, a );
}
......
......@@ -6,6 +6,8 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
var _this = this;
var color = new THREE.Vector4();
var newAttributes = new Uint8Array( 16 );
var enabledAttributes = new Uint8Array( 16 );
var attributeDivisors = new Uint8Array( 16 );
......@@ -49,12 +51,13 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
var currentTextureSlot = undefined;
var currentBoundTextures = {};
var currentClearColor = new THREE.Vector4();
var currentScissor = new THREE.Vector4();
var currentViewport = new THREE.Vector4();
this.init = function () {
gl.clearColor( 0, 0, 0, 1 );
this.clearColor( 0, 0, 0, 1 );
gl.clearDepth( 1 );
gl.clearStencil( 0 );
......@@ -523,7 +526,7 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
}
}
};
this.bindTexture = function ( webglType, webglTexture ) {
......@@ -583,6 +586,19 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {
//
this.clearColor = function ( r, g, b, a ) {
color.set( r, g, b, a );
if ( currentClearColor.equals( color ) === false ) {
gl.clearColor( r, g, b, a );
currentClearColor.copy( color );
}
};
this.scissor = function ( scissor ) {
if ( currentScissor.equals( scissor ) === false ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册