1 |
- define(["exports","./WebGLConstants-71f10989","./BoundingRectangle-418864a2","./Color-45274500","./when-92c6cf3c","./Check-52a7d806","./WindingOrder-1b9c8a87"],(function(e,t,n,i,a,r,o){"use strict";var s={_maximumCombinedTextureImageUnits:0,_maximumCubeMapSize:0,_maximumFragmentUniformVectors:0,_maximumTextureImageUnits:0,_maximumRenderbufferSize:0,_maximumTextureSize:0,_maximumVaryingVectors:0,_maximumVertexAttributes:0,_maximumVertexTextureImageUnits:0,_maximumVertexUniformVectors:0,_minimumAliasedLineWidth:0,_maximumAliasedLineWidth:0,_minimumAliasedPointSize:0,_maximumAliasedPointSize:0,_maximumViewportWidth:0,_maximumViewportHeight:0,_maximumTextureFilterAnisotropy:0,_maximumDrawBuffers:0,_maximumColorAttachments:0,_highpFloatSupported:!1,_highpIntSupported:!1,_uniformBufferOffsetAlignment:256,_maxUniformBufferBinding:36,_maxArrayTextureLayers:256};Object.defineProperties(s,{maximumCombinedTextureImageUnits:{get:function(){return s._maximumCombinedTextureImageUnits}},maximumCubeMapSize:{get:function(){return s._maximumCubeMapSize}},maximumFragmentUniformVectors:{get:function(){return s._maximumFragmentUniformVectors}},maximumTextureImageUnits:{get:function(){return s._maximumTextureImageUnits}},maximumRenderbufferSize:{get:function(){return s._maximumRenderbufferSize}},maximumTextureSize:{get:function(){return s._maximumTextureSize}},maximumVaryingVectors:{get:function(){return s._maximumVaryingVectors}},maximumVertexAttributes:{get:function(){return s._maximumVertexAttributes}},maximumVertexTextureImageUnits:{get:function(){return s._maximumVertexTextureImageUnits}},maximumVertexUniformVectors:{get:function(){return s._maximumVertexUniformVectors}},minimumAliasedLineWidth:{get:function(){return s._minimumAliasedLineWidth}},maximumAliasedLineWidth:{get:function(){return s._maximumAliasedLineWidth}},minimumAliasedPointSize:{get:function(){return s._minimumAliasedPointSize}},maximumAliasedPointSize:{get:function(){return s._maximumAliasedPointSize}},maximumViewportWidth:{get:function(){return s._maximumViewportWidth}},maximumViewportHeight:{get:function(){return s._maximumViewportHeight}},maximumTextureFilterAnisotropy:{get:function(){return s._maximumTextureFilterAnisotropy}},maximumDrawBuffers:{get:function(){return s._maximumDrawBuffers}},maximumColorAttachments:{get:function(){return s._maximumColorAttachments}},highpFloatSupported:{get:function(){return s._highpFloatSupported}},highpIntSupported:{get:function(){return s._highpIntSupported}},uniformBufferOffsetAlignment:{get:function(){return s._uniformBufferOffsetAlignment}},maxUniformBufferBinding:{get:function(){return s._maxUniformBufferBinding}},maxArrayTextureLayers:{get:function(){return s._maxArrayTextureLayers}}});var u={ADD:t.B.FUNC_ADD,SUBTRACT:t.B.FUNC_SUBTRACT,REVERSE_SUBTRACT:t.B.FUNC_REVERSE_SUBTRACT,MIN:t.B.MIN,MAX:t.B.MAX},l=Object.freeze(u),c={ZERO:t.B.ZERO,ONE:t.B.ONE,SOURCE_COLOR:t.B.SRC_COLOR,ONE_MINUS_SOURCE_COLOR:t.B.ONE_MINUS_SRC_COLOR,DESTINATION_COLOR:t.B.DST_COLOR,ONE_MINUS_DESTINATION_COLOR:t.B.ONE_MINUS_DST_COLOR,SOURCE_ALPHA:t.B.SRC_ALPHA,ONE_MINUS_SOURCE_ALPHA:t.B.ONE_MINUS_SRC_ALPHA,DESTINATION_ALPHA:t.B.DST_ALPHA,ONE_MINUS_DESTINATION_ALPHA:t.B.ONE_MINUS_DST_ALPHA,CONSTANT_COLOR:t.B.CONSTANT_COLOR,ONE_MINUS_CONSTANT_COLOR:t.B.ONE_MINUS_CONSTANT_COLOR,CONSTANT_ALPHA:t.B.CONSTANT_ALPHA,ONE_MINUS_CONSTANT_ALPHA:t.B.ONE_MINUS_CONSTANT_ALPHA,SOURCE_ALPHA_SATURATE:t.B.SRC_ALPHA_SATURATE},f=Object.freeze(c),d={DISABLED:Object.freeze({enabled:!1}),ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:l.ADD,equationAlpha:l.ADD,functionSourceRgb:f.SOURCE_ALPHA,functionSourceAlpha:f.ONE,functionDestinationRgb:f.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:f.ONE_MINUS_SOURCE_ALPHA}),PRE_MULTIPLIED_ALPHA_BLEND:Object.freeze({enabled:!0,equationRgb:l.ADD,equationAlpha:l.ADD,functionSourceRgb:f.ONE,functionSourceAlpha:f.ONE,functionDestinationRgb:f.ONE_MINUS_SOURCE_ALPHA,functionDestinationAlpha:f.ONE_MINUS_SOURCE_ALPHA}),ADDITIVE_BLEND:Object.freeze({enabled:!0,equationRgb:l.ADD,equationAlpha:l.ADD,functionSourceRgb:f.SOURCE_ALPHA,functionSourceAlpha:f.ONE,functionDestinationRgb:f.ONE,functionDestinationAlpha:f.ONE})},h=Object.freeze(d);function m(e){if("object"!=typeof e||null===e)return e;for(var t,n=Object.keys(e),i=0;i<n.length;i++)t=n[i],e.hasOwnProperty(t)&&"_applyFunctions"!==t&&(e[t]=m(e[t]));return Object.freeze(e)}function p(e){return e===t.B.FUNC_ADD||e===t.B.FUNC_SUBTRACT||e===t.B.FUNC_REVERSE_SUBTRACT||e===t.B.MIN||e===t.B.MAX}function g(e){return e===t.B.ZERO||e===t.B.ONE||e===t.B.SRC_COLOR||e===t.B.ONE_MINUS_SRC_COLOR||e===t.B.DST_COLOR||e===t.B.ONE_MINUS_DST_COLOR||e===t.B.SRC_ALPHA||e===t.B.ONE_MINUS_SRC_ALPHA||e===t.B.DST_ALPHA||e===t.B.ONE_MINUS_DST_ALPHA||e===t.B.CONSTANT_COLOR||e===t.B.ONE_MINUS_CONSTANT_COLOR||e===t.B.CONSTANT_ALPHA||e===t.B.ONE_MINUS_CONSTANT_ALPHA||e===t.B.SRC_ALPHA_SATURATE}function b(e){return e===t.B.NEVER||e===t.B.LESS||e===t.B.EQUAL||e===t.B.LEQUAL||e===t.B.GREATER||e===t.B.NOTEQUAL||e===t.B.GEQUAL||e===t.B.ALWAYS}function A(e){return e===t.B.ZERO||e===t.B.KEEP||e===t.B.REPLACE||e===t.B.INCR||e===t.B.DECR||e===t.B.INVERT||e===t.B.INCR_WRAP||e===t.B.DECR_WRAP}function O(e){var u=a.u(e,{}),l=a.u(u.cull,{}),c=a.u(u.polygonOffset,{}),f=a.u(u.scissorTest,{}),d=a.u(f.rectangle,{}),h=a.u(u.depthRange,{}),m=a.u(u.depthTest,{}),O=a.u(u.colorMask,{}),S=a.u(u.blending,{}),T=a.u(S.color,{}),_=a.u(u.stencilTest,{}),R=a.u(_.frontOperation,{}),E=a.u(_.backOperation,{}),C=a.u(u.sampleCoverage,{}),N=u.viewport;if(this.frontFace=a.u(u.frontFace,o.W.COUNTER_CLOCKWISE),this.cull={enabled:a.u(l.enabled,!1),face:a.u(l.face,t.B.BACK)},this.lineWidth=a.u(u.lineWidth,1),this.polygonOffset={enabled:a.u(c.enabled,!1),factor:a.u(c.factor,0),units:a.u(c.units,0)},this.scissorTest={enabled:a.u(f.enabled,!1),rectangle:n.f.clone(d)},this.depthRange={near:a.u(h.near,0),far:a.u(h.far,1)},this.depthTest={enabled:a.u(m.enabled,!1),func:a.u(m.func,t.B.LESS)},this.colorMask={red:a.u(O.red,!0),green:a.u(O.green,!0),blue:a.u(O.blue,!0),alpha:a.u(O.alpha,!0)},this.depthMask=a.u(u.depthMask,!0),this.stencilMask=a.u(u.stencilMask,-1),this.blending={enabled:a.u(S.enabled,!1),color:new i.e(a.u(T.red,0),a.u(T.green,0),a.u(T.blue,0),a.u(T.alpha,0)),equationRgb:a.u(S.equationRgb,t.B.FUNC_ADD),equationAlpha:a.u(S.equationAlpha,t.B.FUNC_ADD),functionSourceRgb:a.u(S.functionSourceRgb,t.B.ONE),functionSourceAlpha:a.u(S.functionSourceAlpha,t.B.ONE),functionDestinationRgb:a.u(S.functionDestinationRgb,t.B.ZERO),functionDestinationAlpha:a.u(S.functionDestinationAlpha,t.B.ZERO)},this.stencilTest={enabled:a.u(_.enabled,!1),frontFunction:a.u(_.frontFunction,t.B.ALWAYS),backFunction:a.u(_.backFunction,t.B.ALWAYS),reference:a.u(_.reference,0),mask:a.u(_.mask,-1),frontOperation:{fail:a.u(R.fail,t.B.KEEP),zFail:a.u(R.zFail,t.B.KEEP),zPass:a.u(R.zPass,t.B.KEEP)},backOperation:{fail:a.u(E.fail,t.B.KEEP),zFail:a.u(E.zFail,t.B.KEEP),zPass:a.u(E.zPass,t.B.KEEP)}},this.sampleCoverage={enabled:a.u(C.enabled,!1),value:a.u(C.value,1),invert:a.u(C.invert,!1)},this.viewport=a.e(N)?new n.f(N.x,N.y,N.width,N.height):void 0,this.lineWidth<s.minimumAliasedLineWidth||this.lineWidth>s.maximumAliasedLineWidth)throw new r.t("renderState.lineWidth is out of range. Check minimumAliasedLineWidth and maximumAliasedLineWidth.");if(!o.W.validate(this.frontFace))throw new r.t("Invalid renderState.frontFace.");if(!function(e){return e===t.B.FRONT||e===t.B.BACK||e===t.B.FRONT_AND_BACK}(this.cull.face))throw new r.t("Invalid renderState.cull.face.");if(this.scissorTest.rectangle.width<0||this.scissorTest.rectangle.height<0)throw new r.t("renderState.scissorTest.rectangle.width and renderState.scissorTest.rectangle.height must be greater than or equal to zero.");if(this.depthRange.near>this.depthRange.far)throw new r.t("renderState.depthRange.near can not be greater than renderState.depthRange.far.");if(this.depthRange.near<0)throw new r.t("renderState.depthRange.near must be greater than or equal to zero.");if(this.depthRange.far>1)throw new r.t("renderState.depthRange.far must be less than or equal to one.");if(!function(e){return e===t.B.NEVER||e===t.B.LESS||e===t.B.EQUAL||e===t.B.LEQUAL||e===t.B.GREATER||e===t.B.NOTEQUAL||e===t.B.GEQUAL||e===t.B.ALWAYS}(this.depthTest.func))throw new r.t("Invalid renderState.depthTest.func.");if(this.blending.color.red<0||this.blending.color.red>1||this.blending.color.green<0||this.blending.color.green>1||this.blending.color.blue<0||this.blending.color.blue>1||this.blending.color.alpha<0||this.blending.color.alpha>1)throw new r.t("renderState.blending.color components must be greater than or equal to zero and less than or equal to one.");if(!p(this.blending.equationRgb))throw new r.t("Invalid renderState.blending.equationRgb.");if(!p(this.blending.equationAlpha))throw new r.t("Invalid renderState.blending.equationAlpha.");if(!g(this.blending.functionSourceRgb))throw new r.t("Invalid renderState.blending.functionSourceRgb.");if(!g(this.blending.functionSourceAlpha))throw new r.t("Invalid renderState.blending.functionSourceAlpha.");if(!g(this.blending.functionDestinationRgb))throw new r.t("Invalid renderState.blending.functionDestinationRgb.");if(!g(this.blending.functionDestinationAlpha))throw new r.t("Invalid renderState.blending.functionDestinationAlpha.");if(!b(this.stencilTest.frontFunction))throw new r.t("Invalid renderState.stencilTest.frontFunction.");if(!b(this.stencilTest.backFunction))throw new r.t("Invalid renderState.stencilTest.backFunction.");if(!A(this.stencilTest.frontOperation.fail))throw new r.t("Invalid renderState.stencilTest.frontOperation.fail.");if(!A(this.stencilTest.frontOperation.zFail))throw new r.t("Invalid renderState.stencilTest.frontOperation.zFail.");if(!A(this.stencilTest.frontOperation.zPass))throw new r.t("Invalid renderState.stencilTest.frontOperation.zPass.");if(!A(this.stencilTest.backOperation.fail))throw new r.t("Invalid renderState.stencilTest.backOperation.fail.");if(!A(this.stencilTest.backOperation.zFail))throw new r.t("Invalid renderState.stencilTest.backOperation.zFail.");if(!A(this.stencilTest.backOperation.zPass))throw new r.t("Invalid renderState.stencilTest.backOperation.zPass.");if(a.e(this.viewport)){if(this.viewport.width<0)throw new r.t("renderState.viewport.width must be greater than or equal to zero.");if(this.viewport.height<0)throw new r.t("renderState.viewport.height must be greater than or equal to zero.");if(this.viewport.width>s.maximumViewportWidth)throw new r.t("renderState.viewport.width must be less than or equal to the maximum viewport width ("+s.maximumViewportWidth.toString()+"). Check maximumViewportWidth.");if(this.viewport.height>s.maximumViewportHeight)throw new r.t("renderState.viewport.height must be less than or equal to the maximum viewport height ("+s.maximumViewportHeight.toString()+"). Check maximumViewportHeight.")}this.id=0,this._applyFunctions=[]}var S=0,T={};function _(e,t,n){n?e.enable(t):e.disable(t)}function R(e,t){e.frontFace(t.frontFace)}function E(e,t){var n=t.cull,i=n.enabled;_(e,e.CULL_FACE,i),i&&e.cullFace(n.face)}function C(e,t){e.lineWidth(t.lineWidth)}function N(e,t){var n=t.polygonOffset,i=n.enabled;_(e,e.POLYGON_OFFSET_FILL,i),i&&e.polygonOffset(n.factor,n.units)}function B(e,t,n){var i=t.scissorTest,r=a.e(n.scissorTest)?n.scissorTest.enabled:i.enabled;if(_(e,e.SCISSOR_TEST,r),r){var o=a.e(n.scissorTest)?n.scissorTest.rectangle:i.rectangle;e.scissor(o.x,o.y,o.width,o.height)}}function w(e,t){var n=t.depthRange;e.depthRange(n.near,n.far)}function x(e,t){var n=t.depthTest,i=n.enabled;_(e,e.DEPTH_TEST,i),i&&e.depthFunc(n.func)}function v(e,t){var n=t.colorMask;e.colorMask(n.red,n.green,n.blue,n.alpha)}function L(e,t){e.depthMask(t.depthMask)}function F(e,t){e.stencilMask(t.stencilMask)}function U(e,t,n){var i=t.blending,r=a.e(n.blendingEnabled)?n.blendingEnabled:i.enabled;_(e,e.BLEND,r),r&&(function(e,t){e.blendColor(t.red,t.green,t.blue,t.alpha)}(e,i.color),e.blendEquationSeparate(i.equationRgb,i.equationAlpha),e.blendFuncSeparate(i.functionSourceRgb,i.functionDestinationRgb,i.functionSourceAlpha,i.functionDestinationAlpha))}function I(e,t){var n=t.stencilTest,i=n.enabled;if(_(e,e.STENCIL_TEST,i),i){var a=n.frontFunction,r=n.backFunction,o=n.reference,s=n.mask;e.stencilFunc(a,o,s),e.stencilFuncSeparate(e.BACK,r,o,s),e.stencilFuncSeparate(e.FRONT,a,o,s);var u=n.frontOperation,l=u.fail,c=u.zFail,f=u.zPass;e.stencilOpSeparate(e.FRONT,l,c,f);var d=n.backOperation,h=d.fail,m=d.zFail,p=d.zPass;e.stencilOpSeparate(e.BACK,h,m,p)}}function k(e,t){var n=t.sampleCoverage,i=n.enabled;_(e,e.SAMPLE_COVERAGE,i),i&&e.sampleCoverage(n.value,n.invert)}O.fromCache=function(e){var t=JSON.stringify(e),n=T[t];if(a.e(n))return++n.referenceCount,n.state;var i=new O(e),r=JSON.stringify(i);return n=T[r],a.e(n)||(i.id=S++,n={referenceCount:0,state:i=m(i)},T[r]=n),++n.referenceCount,T[t]={referenceCount:1,state:n.state},n.state},O.removeFromCache=function(e){var t=new O(e),n=JSON.stringify(t),i=T[n],r=JSON.stringify(e),o=T[r];a.e(o)&&(--o.referenceCount,0===o.referenceCount&&(delete T[r],a.e(i)&&--i.referenceCount)),a.e(i)&&0===i.referenceCount&&delete T[n]},O.getCache=function(){return T},O.clearCache=function(){T={}};var D=new n.f;function P(e,t,n){var i=a.u(t.viewport,n.viewport);a.e(i)||((i=D).width=n.context.drawingBufferWidth,i.height=n.context.drawingBufferHeight),n.context.uniformState.viewport=i,e.viewport(i.x,i.y,i.width,i.height)}O.apply=function(e,t,n){R(e,t),E(e,t),C(e,t),N(e,t),w(e,t),x(e,t),v(e,t),L(e,t),F(e,t),I(e,t),k(e,t),B(e,t,n),U(e,t,n),P(e,t,n)},O.partialApply=function(e,t,n,i,r,o,s,u){if(t!==n){var l=n._applyFunctions[t.id];a.e(l)||(l=function(e,t){var n=[];return e.frontFace!==t.frontFace&&n.push(R),(e.cull.enabled!==t.cull.enabled||e.cull.face!==t.cull.face)&&n.push(E),e.lineWidth!==t.lineWidth&&n.push(C),(e.polygonOffset.enabled!==t.polygonOffset.enabled||e.polygonOffset.factor!==t.polygonOffset.factor||e.polygonOffset.units!==t.polygonOffset.units)&&n.push(N),(e.depthRange.near!==t.depthRange.near||e.depthRange.far!==t.depthRange.far)&&n.push(w),(e.depthTest.enabled!==t.depthTest.enabled||e.depthTest.func!==t.depthTest.func)&&n.push(x),(e.colorMask.red!==t.colorMask.red||e.colorMask.green!==t.colorMask.green||e.colorMask.blue!==t.colorMask.blue||e.colorMask.alpha!==t.colorMask.alpha)&&n.push(v),e.depthMask!==t.depthMask&&n.push(L),e.stencilMask!==t.stencilMask&&n.push(F),(e.stencilTest.enabled!==t.stencilTest.enabled||e.stencilTest.frontFunction!==t.stencilTest.frontFunction||e.stencilTest.backFunction!==t.stencilTest.backFunction||e.stencilTest.reference!==t.stencilTest.reference||e.stencilTest.mask!==t.stencilTest.mask||e.stencilTest.frontOperation.fail!==t.stencilTest.frontOperation.fail||e.stencilTest.frontOperation.zFail!==t.stencilTest.frontOperation.zFail||e.stencilTest.backOperation.fail!==t.stencilTest.backOperation.fail||e.stencilTest.backOperation.zFail!==t.stencilTest.backOperation.zFail||e.stencilTest.backOperation.zPass!==t.stencilTest.backOperation.zPass)&&n.push(I),(e.sampleCoverage.enabled!==t.sampleCoverage.enabled||e.sampleCoverage.value!==t.sampleCoverage.value||e.sampleCoverage.invert!==t.sampleCoverage.invert)&&n.push(k),n}(t,n),n._applyFunctions[t.id]=l);for(var c=l.length,f=0;f<c;++f)l[f](e,n)}((a.e(i.scissorTest)?i.scissorTest:t.scissorTest)!==(a.e(r.scissorTest)?r.scissorTest:n.scissorTest)||u)&&B(e,n,r);var d=a.e(i.blendingEnabled)?i.blendingEnabled:t.blending.enabled,h=a.e(r.blendingEnabled)?r.blendingEnabled:n.blending.enabled;(d!==h||h&&t.blending!==n.blending)&&U(e,n,r),(t!==n||i!==r||i.context!==r.context||o!==s)&&P(e,n,r)},O.getState=function(e){if(!a.e(e))throw new r.t("renderState is required.");return{frontFace:e.frontFace,cull:{enabled:e.cull.enabled,face:e.cull.face},lineWidth:e.lineWidth,polygonOffset:{enabled:e.polygonOffset.enabled,factor:e.polygonOffset.factor,units:e.polygonOffset.units},scissorTest:{enabled:e.scissorTest.enabled,rectangle:n.f.clone(e.scissorTest.rectangle)},depthRange:{near:e.depthRange.near,far:e.depthRange.far},depthTest:{enabled:e.depthTest.enabled,func:e.depthTest.func},colorMask:{red:e.colorMask.red,green:e.colorMask.green,blue:e.colorMask.blue,alpha:e.colorMask.alpha},depthMask:e.depthMask,stencilMask:e.stencilMask,blending:{enabled:e.blending.enabled,color:i.e.clone(e.blending.color),equationRgb:e.blending.equationRgb,equationAlpha:e.blending.equationAlpha,functionSourceRgb:e.blending.functionSourceRgb,functionSourceAlpha:e.blending.functionSourceAlpha,functionDestinationRgb:e.blending.functionDestinationRgb,functionDestinationAlpha:e.blending.functionDestinationAlpha},stencilTest:{enabled:e.stencilTest.enabled,frontFunction:e.stencilTest.frontFunction,backFunction:e.stencilTest.backFunction,reference:e.stencilTest.reference,mask:e.stencilTest.mask,frontOperation:{fail:e.stencilTest.frontOperation.fail,zFail:e.stencilTest.frontOperation.zFail,zPass:e.stencilTest.frontOperation.zPass},backOperation:{fail:e.stencilTest.backOperation.fail,zFail:e.stencilTest.backOperation.zFail,zPass:e.stencilTest.backOperation.zPass}},sampleCoverage:{enabled:e.sampleCoverage.enabled,value:e.sampleCoverage.value,invert:e.sampleCoverage.invert},viewport:a.e(e.viewport)?n.f.clone(e.viewport):void 0}},e._0x438131=h,e.e=s,e.u=O}));
|