setMaterial method
Implementation
void setMaterial(Material material, bool frontFaceCW) {
material.side == DoubleSide ? disable(WebGL.CULL_FACE) : enable(WebGL.CULL_FACE);
bool flipSided = (material.side == BackSide);
if (frontFaceCW) flipSided = !flipSided;
setFlipSided(flipSided);
(material.blending == NormalBlending && material.transparent == false)
? setBlending(NoBlending, null, null, null, null, null, null, false)
: setBlending(material.blending, material.blendEquation, material.blendSrc, material.blendDst,
material.blendEquationAlpha, material.blendSrcAlpha, material.blendDstAlpha, material.premultipliedAlpha);
depthBuffer.setFunc(material.depthFunc);
depthBuffer.setTest(material.depthTest);
depthBuffer.setMask(material.depthWrite);
colorBuffer.setMask(material.colorWrite);
final stencilWrite = material.stencilWrite;
stencilBuffer.setTest(stencilWrite);
if (stencilWrite) {
stencilBuffer.setMask(material.stencilWriteMask);
stencilBuffer.setFunc(material.stencilFunc, material.stencilRef, material.stencilFuncMask);
stencilBuffer.setOp(material.stencilFail, material.stencilZFail, material.stencilZPass);
}
setPolygonOffset(material.polygonOffset, material.polygonOffsetFactor, material.polygonOffsetUnits);
material.alphaToCoverage? enable(WebGL.SAMPLE_ALPHA_TO_COVERAGE) : disable(WebGL.SAMPLE_ALPHA_TO_COVERAGE);
}