Skip to content

Commit

Permalink
feat: add material.frontFace
Browse files Browse the repository at this point in the history
  • Loading branch information
06wj committed Oct 9, 2020
1 parent ad80bbf commit ef85b56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/material/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ const {
FUNC_ADD,
ONE,
SRC_ALPHA,
ONE_MINUS_SRC_ALPHA
ONE_MINUS_SRC_ALPHA,
CCW,
} = constants;

const blankInfo = {
Expand Down Expand Up @@ -63,6 +64,13 @@ const Material = Class.create(/** @lends Material.prototype */ {
*/
wireframe: false,

/**
* front face winding orientation
* @default CCW
* @type {GLenum}
*/
frontFace: CCW,

/**
* 是否开启深度测试
* @default true
Expand Down
1 change: 1 addition & 0 deletions src/renderer/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ const WebGLRenderer = Class.create(/** @lends WebGLRenderer.prototype */ {
if (material.cullFace && material.cullFaceType !== FRONT_AND_BACK) {
state.enable(CULL_FACE);
state.cullFace(material.cullFaceType);
state.frontFace(material.frontFace);
} else {
state.disable(CULL_FACE);
}
Expand Down

0 comments on commit ef85b56

Please sign in to comment.