{"action":"created","comment":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/comments/63603598","id":63603598,"diff_hunk":"@@ -337,168 +328,87 @@ THREE.WebGLState = function ( gl, extensions, paramThreeToGL ) {\n \n \t};\n \n-\tthis.setDepthFunc = function ( depthFunc ) {\n-\n-\t\tif ( currentDepthFunc !== depthFunc ) {\n-\n-\t\t\tif ( depthFunc ) {\n-\n-\t\t\t\tswitch ( depthFunc ) {\n-\n-\t\t\t\t\tcase THREE.NeverDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.NEVER );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.AlwaysDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.ALWAYS );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.LessDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.LESS );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.LessEqualDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.EqualDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.EQUAL );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.GreaterEqualDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.GEQUAL );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.GreaterDepth:\n-\n-\t\t\t\t\t\tgl.depthFunc( gl.GREATER );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tcase THREE.NotEqualDepth:\n+\tthis.enableDepthBuffer = function () {\n \n-\t\t\t\t\t\tgl.depthFunc( gl.NOTEQUAL );\n-\t\t\t\t\t\tbreak;\n-\n-\t\t\t\t\tdefault:\n+\t\tthis.depthBuffer.enabled = true;\n \n-\t\t\t\t\t\tgl.depthFunc( gl.LEQUAL );\n-\n-\t\t\t\t}\n+\t};\n \n-\t\t\t} else {\n+\tthis.disableDepthBuffer = function () {\n \n-\t\t\t\tgl.depthFunc( gl.LEQUAL );\n+\t\tthis.depthBuffer.enabled = false;\n \n-\t\t\t}\n+\t};\n \n-\t\t\tcurrentDepthFunc = depthFunc;\n+\tthis.setDepthFunc = function ( depthFunc ) {\n \n-\t\t}\n+\t\tthis.depthBuffer.func( depthFunc );\n \n \t};\n \n \tthis.setDepthTest = function ( depthTest ) {\n \n-\t\tif ( depthTest ) {\n-\n-\t\t\tthis.enable( gl.DEPTH_TEST );\n-\n-\t\t} else {\n-\n-\t\t\tthis.disable( gl.DEPTH_TEST );\n-\n-\t\t}\n+\t\tthis.depthBuffer.test( depthTest );\n \n \t};\n \n \tthis.setDepthWrite = function ( depthWrite ) {\n \n-\t\t// TODO: Rename to setDepthMask\n+\t\tthis.depthBuffer.mask( depthWrite );\n \n-\t\tif ( currentDepthWrite !== depthWrite ) {\n+\t};\n \n-\t\t\tgl.depthMask( depthWrite );\n-\t\t\tcurrentDepthWrite = depthWrite;\n+\tthis.enableColorBuffer = function () {\n \n-\t\t}\n+\t\tthis.colorBuffer.enabled = true;\n \n \t};\n \n-\tthis.setColorWrite = function ( colorWrite ) {\n+\tthis.disableColorBuffer = function () {\n \n-\t\t// TODO: Rename to setColorMask\n+\t\tthis.colorBuffer.enabled = false;\n \n-\t\tif ( currentColorWrite !== colorWrite ) {\n+\t};\n \n-\t\t\tgl.colorMask( colorWrite, colorWrite, colorWrite, colorWrite );\n-\t\t\tcurrentColorWrite = colorWrite;\n+\tthis.setColorWrite = function ( colorWrite ) {\n \n-\t\t}\n+\t\tthis.colorBuffer.mask( colorWrite );\n \n \t};\n \n \tthis.setStencilFunc = function ( stencilFunc, stencilRef, stencilMask ) {\n \n-\t\tif ( currentStencilFunc !== stencilFunc ||\n-\t\t\t\t currentStencilRef \t!== stencilRef \t||\n-\t\t\t\t currentStencilMask !== stencilMask ) {\n-\n-\t\t\tgl.stencilFunc( stencilFunc,  stencilRef, stencilMask );\n-\n-\t\t\tcurrentStencilFunc = stencilFunc;\n-\t\t\tcurrentStencilRef  = stencilRef;\n-\t\t\tcurrentStencilMask = stencilMask;\n-\n-\t\t}\n+\t\tthis.stencilBuffer.func( stencilFunc, stencilRef, stencilMask );\n \n \t};\n \n \tthis.setStencilOp = function ( stencilFail, stencilZFail, stencilZPass ) {\n \n-\t\tif ( currentStencilFail\t !== stencilFail \t||\n-\t\t\t\t currentStencilZFail !== stencilZFail ||\n-\t\t\t\t currentStencilZPass !== stencilZPass ) {\n-\n-\t\t\tgl.stencilOp( stencilFail,  stencilZFail, stencilZPass );\n-\n-\t\t\tcurrentStencilFail  = stencilFail;\n-\t\t\tcurrentStencilZFail = stencilZFail;\n-\t\t\tcurrentStencilZPass = stencilZPass;\n-\n-\t\t}\n+\t\tthis.stencilBuffer.op( stencilFail, stencilZFail, stencilZPass );\n \n \t};\n \n \tthis.setStencilTest = function ( stencilTest ) {\n \n-\t\tif ( stencilTest ) {\n+\t\tthis.stencilBuffer.test( stencilTest );\n \n-\t\t\tthis.enable( gl.STENCIL_TEST );\n-\n-\t\t} else {\n+\t};\n \n-\t\t\tthis.disable( gl.STENCIL_TEST );\n+\tthis.setStencilWrite = function ( stencilWrite ) {","path":"src/renderers/webgl/WebGLState.js","position":204,"original_position":204,"commit_id":"0faa9d4d60df5ea57708268b29dfeb4b38e49d66","original_commit_id":"0faa9d4d60df5ea57708268b29dfeb4b38e49d66","user":{"login":"WestLangley","id":1000017,"avatar_url":"https://avatars.githubusercontent.com/u/1000017?v=3","gravatar_id":"","url":"https://api.github.com/users/WestLangley","html_url":"https://github.com/WestLangley","followers_url":"https://api.github.com/users/WestLangley/followers","following_url":"https://api.github.com/users/WestLangley/following{/other_user}","gists_url":"https://api.github.com/users/WestLangley/gists{/gist_id}","starred_url":"https://api.github.com/users/WestLangley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WestLangley/subscriptions","organizations_url":"https://api.github.com/users/WestLangley/orgs","repos_url":"https://api.github.com/users/WestLangley/repos","events_url":"https://api.github.com/users/WestLangley/events{/privacy}","received_events_url":"https://api.github.com/users/WestLangley/received_events","type":"User","site_admin":false},"body":"`stencilWrite` is a mask, not a boolean. Should it be called `stencilMask`? Should the method be `setStencilMask`? I am concernced that we still do not have this right...","created_at":"2016-05-17T21:03:20Z","updated_at":"2016-05-17T21:03:20Z","html_url":"https://github.com/mrdoob/three.js/pull/8852#discussion_r63603598","pull_request_url":"https://api.github.com/repos/mrdoob/three.js/pulls/8852","_links":{"self":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/comments/63603598"},"html":{"href":"https://github.com/mrdoob/three.js/pull/8852#discussion_r63603598"},"pull_request":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/8852"}}},"pull_request":{"url":"https://api.github.com/repos/mrdoob/three.js/pulls/8852","id":69526243,"html_url":"https://github.com/mrdoob/three.js/pull/8852","diff_url":"https://github.com/mrdoob/three.js/pull/8852.diff","patch_url":"https://github.com/mrdoob/three.js/pull/8852.patch","issue_url":"https://api.github.com/repos/mrdoob/three.js/issues/8852","number":8852,"state":"open","locked":false,"title":"WebGLState: Enhance API for Masking","user":{"login":"Mugen87","id":12612165,"avatar_url":"https://avatars.githubusercontent.com/u/12612165?v=3","gravatar_id":"","url":"https://api.github.com/users/Mugen87","html_url":"https://github.com/Mugen87","followers_url":"https://api.github.com/users/Mugen87/followers","following_url":"https://api.github.com/users/Mugen87/following{/other_user}","gists_url":"https://api.github.com/users/Mugen87/gists{/gist_id}","starred_url":"https://api.github.com/users/Mugen87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mugen87/subscriptions","organizations_url":"https://api.github.com/users/Mugen87/orgs","repos_url":"https://api.github.com/users/Mugen87/repos","events_url":"https://api.github.com/users/Mugen87/events{/privacy}","received_events_url":"https://api.github.com/users/Mugen87/received_events","type":"User","site_admin":false},"body":"This PR ensures that masking is correctly managed via `WebGLState`.\r\n\r\nIt also should address @WestLangley `s feedback in #8843. The mentioned [fiddle](http://jsfiddle.net/q73ok880/) should work after this PR is merged. ","created_at":"2016-05-10T15:26:18Z","updated_at":"2016-05-17T21:03:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"50159a6f72117e260a7c4fba28d9fdf4ece14bd9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mrdoob/three.js/pulls/8852/commits","review_comments_url":"https://api.github.com/repos/mrdoob/three.js/pulls/8852/comments","review_comment_url":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mrdoob/three.js/issues/8852/comments","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/0faa9d4d60df5ea57708268b29dfeb4b38e49d66","head":{"label":"Mugen87:dev","ref":"dev","sha":"0faa9d4d60df5ea57708268b29dfeb4b38e49d66","user":{"login":"Mugen87","id":12612165,"avatar_url":"https://avatars.githubusercontent.com/u/12612165?v=3","gravatar_id":"","url":"https://api.github.com/users/Mugen87","html_url":"https://github.com/Mugen87","followers_url":"https://api.github.com/users/Mugen87/followers","following_url":"https://api.github.com/users/Mugen87/following{/other_user}","gists_url":"https://api.github.com/users/Mugen87/gists{/gist_id}","starred_url":"https://api.github.com/users/Mugen87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mugen87/subscriptions","organizations_url":"https://api.github.com/users/Mugen87/orgs","repos_url":"https://api.github.com/users/Mugen87/repos","events_url":"https://api.github.com/users/Mugen87/events{/privacy}","received_events_url":"https://api.github.com/users/Mugen87/received_events","type":"User","site_admin":false},"repo":{"id":44012154,"name":"three.js","full_name":"Mugen87/three.js","owner":{"login":"Mugen87","id":12612165,"avatar_url":"https://avatars.githubusercontent.com/u/12612165?v=3","gravatar_id":"","url":"https://api.github.com/users/Mugen87","html_url":"https://github.com/Mugen87","followers_url":"https://api.github.com/users/Mugen87/followers","following_url":"https://api.github.com/users/Mugen87/following{/other_user}","gists_url":"https://api.github.com/users/Mugen87/gists{/gist_id}","starred_url":"https://api.github.com/users/Mugen87/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mugen87/subscriptions","organizations_url":"https://api.github.com/users/Mugen87/orgs","repos_url":"https://api.github.com/users/Mugen87/repos","events_url":"https://api.github.com/users/Mugen87/events{/privacy}","received_events_url":"https://api.github.com/users/Mugen87/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mugen87/three.js","description":"JavaScript 3D library.","fork":true,"url":"https://api.github.com/repos/Mugen87/three.js","forks_url":"https://api.github.com/repos/Mugen87/three.js/forks","keys_url":"https://api.github.com/repos/Mugen87/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mugen87/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mugen87/three.js/teams","hooks_url":"https://api.github.com/repos/Mugen87/three.js/hooks","issue_events_url":"https://api.github.com/repos/Mugen87/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/Mugen87/three.js/events","assignees_url":"https://api.github.com/repos/Mugen87/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/Mugen87/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/Mugen87/three.js/tags","blobs_url":"https://api.github.com/repos/Mugen87/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mugen87/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mugen87/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mugen87/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mugen87/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/Mugen87/three.js/languages","stargazers_url":"https://api.github.com/repos/Mugen87/three.js/stargazers","contributors_url":"https://api.github.com/repos/Mugen87/three.js/contributors","subscribers_url":"https://api.github.com/repos/Mugen87/three.js/subscribers","subscription_url":"https://api.github.com/repos/Mugen87/three.js/subscription","commits_url":"https://api.github.com/repos/Mugen87/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mugen87/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mugen87/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mugen87/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mugen87/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/Mugen87/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mugen87/three.js/merges","archive_url":"https://api.github.com/repos/Mugen87/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mugen87/three.js/downloads","issues_url":"https://api.github.com/repos/Mugen87/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/Mugen87/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/Mugen87/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/Mugen87/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mugen87/three.js/labels{/name}","releases_url":"https://api.github.com/repos/Mugen87/three.js/releases{/id}","deployments_url":"https://api.github.com/repos/Mugen87/three.js/deployments","created_at":"2015-10-10T13:41:49Z","updated_at":"2016-02-10T19:36:47Z","pushed_at":"2016-05-17T16:17:41Z","git_url":"git://github.com/Mugen87/three.js.git","ssh_url":"git@github.com:Mugen87/three.js.git","clone_url":"https://github.com/Mugen87/three.js.git","svn_url":"https://github.com/Mugen87/three.js","homepage":"http://threejs.org/","size":374924,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":false,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mrdoob:dev","ref":"dev","sha":"90fceec5f7b31f52583bb3dd5d20a0d829362e41","user":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"repo":{"id":576201,"name":"three.js","full_name":"mrdoob/three.js","owner":{"login":"mrdoob","id":97088,"avatar_url":"https://avatars.githubusercontent.com/u/97088?v=3","gravatar_id":"","url":"https://api.github.com/users/mrdoob","html_url":"https://github.com/mrdoob","followers_url":"https://api.github.com/users/mrdoob/followers","following_url":"https://api.github.com/users/mrdoob/following{/other_user}","gists_url":"https://api.github.com/users/mrdoob/gists{/gist_id}","starred_url":"https://api.github.com/users/mrdoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrdoob/subscriptions","organizations_url":"https://api.github.com/users/mrdoob/orgs","repos_url":"https://api.github.com/users/mrdoob/repos","events_url":"https://api.github.com/users/mrdoob/events{/privacy}","received_events_url":"https://api.github.com/users/mrdoob/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mrdoob/three.js","description":"JavaScript 3D library.","fork":false,"url":"https://api.github.com/repos/mrdoob/three.js","forks_url":"https://api.github.com/repos/mrdoob/three.js/forks","keys_url":"https://api.github.com/repos/mrdoob/three.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mrdoob/three.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mrdoob/three.js/teams","hooks_url":"https://api.github.com/repos/mrdoob/three.js/hooks","issue_events_url":"https://api.github.com/repos/mrdoob/three.js/issues/events{/number}","events_url":"https://api.github.com/repos/mrdoob/three.js/events","assignees_url":"https://api.github.com/repos/mrdoob/three.js/assignees{/user}","branches_url":"https://api.github.com/repos/mrdoob/three.js/branches{/branch}","tags_url":"https://api.github.com/repos/mrdoob/three.js/tags","blobs_url":"https://api.github.com/repos/mrdoob/three.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mrdoob/three.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mrdoob/three.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/mrdoob/three.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mrdoob/three.js/statuses/{sha}","languages_url":"https://api.github.com/repos/mrdoob/three.js/languages","stargazers_url":"https://api.github.com/repos/mrdoob/three.js/stargazers","contributors_url":"https://api.github.com/repos/mrdoob/three.js/contributors","subscribers_url":"https://api.github.com/repos/mrdoob/three.js/subscribers","subscription_url":"https://api.github.com/repos/mrdoob/three.js/subscription","commits_url":"https://api.github.com/repos/mrdoob/three.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/mrdoob/three.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/mrdoob/three.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/mrdoob/three.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/mrdoob/three.js/contents/{+path}","compare_url":"https://api.github.com/repos/mrdoob/three.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mrdoob/three.js/merges","archive_url":"https://api.github.com/repos/mrdoob/three.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mrdoob/three.js/downloads","issues_url":"https://api.github.com/repos/mrdoob/three.js/issues{/number}","pulls_url":"https://api.github.com/repos/mrdoob/three.js/pulls{/number}","milestones_url":"https://api.github.com/repos/mrdoob/three.js/milestones{/number}","notifications_url":"https://api.github.com/repos/mrdoob/three.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mrdoob/three.js/labels{/name}","releases_url":"https://api.github.com/repos/mrdoob/three.js/releases{/id}","deployments_url":"https://api.github.com/repos/mrdoob/three.js/deployments","created_at":"2010-03-23T18:58:01Z","updated_at":"2016-05-17T17:27:10Z","pushed_at":"2016-05-17T20:26:29Z","git_url":"git://github.com/mrdoob/three.js.git","ssh_url":"git@github.com:mrdoob/three.js.git","clone_url":"https://github.com/mrdoob/three.js.git","svn_url":"https://github.com/mrdoob/three.js","homepage":"http://threejs.org/","size":582764,"stargazers_count":25073,"watchers_count":25073,"language":"JavaScript","has_issues":true,"has_downloads":false,"has_wiki":true,"has_pages":true,"forks_count":8330,"mirror_url":null,"open_issues_count":654,"forks":8330,"open_issues":654,"watchers":25073,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/8852"},"html":{"href":"https://github.com/mrdoob/three.js/pull/8852"},"issue":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/8852"},"comments":{"href":"https://api.github.com/repos/mrdoob/three.js/issues/8852/comments"},"review_comments":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/8852/comments"},"review_comment":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mrdoob/three.js/pulls/8852/commits"},"statuses":{"href":"https://api.github.com/repos/mrdoob/three.js/statuses/0faa9d4d60df5ea57708268b29dfeb4b38e49d66"}}}}