Socket
Socket
Sign inDemoInstall

@antv/g-plugin-3d

Package Overview
Dependencies
Maintainers
58
Versions
243
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-3d - npm Package Compare versions

Comparing version 1.1.3 to 1.1.4

2

dist/index.umd.min.js

@@ -1,1 +0,1 @@

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mana-syringe"),require("@antv/g-plugin-device-renderer"),require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","mana-syringe","@antv/g-plugin-device-renderer","@antv/g"],e):e(((n="undefined"!=typeof globalThis?globalThis:n||self).G=n.G||{},n.G["3D"]={}),n.window.G.ManaSyringe,n.window.G.DeviceRenderer,n.window.G)}(this,(function(n,e,t,i){"use strict";function o(n,e){for(var t=0;e.length>t;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function r(n,e,t){return e&&o(n.prototype,e),t&&o(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function a(){return a=Object.assign||function(n){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},a.apply(this,arguments)}function c(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,l(n,e)}function l(n,e){return l=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},l(n,e)}function u(n,e){if(null==n)return{};var t,i,o={},r=Object.keys(n);for(i=0;r.length>i;i++)0>e.indexOf(t=r[i])&&(o[t]=n[t]);return o}var f="undefined"!=typeof Float32Array?Float32Array:Array;function s(){var n=new f(16);return f!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n}function d(n,e){return n[0]=e[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function _(){var n=new f(3);return f!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function v(n,e,t){var i=new f(3);return i[0]=n,i[1]=e,i[2]=t,i}function p(n,e,t,i){var o=e[0],r=e[1],a=e[2];return n[0]=o+i*(t[0]-o),n[1]=r+i*(t[1]-r),n[2]=a+i*(t[2]-a),n}Math.hypot||(Math.hypot=function(){for(var n=0,e=arguments.length;e--;)n+=arguments[e]*arguments[e];return Math.sqrt(n)});var g,h=function(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};g=_();function m(){var n=new f(4);return f!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function M(n,e,t){var i=e[0],o=e[1],r=e[2],a=e[3];return n[0]=t[0]*i+t[4]*o+t[8]*r+t[12]*a,n[1]=t[1]*i+t[5]*o+t[9]*r+t[13]*a,n[2]=t[2]*i+t[6]*o+t[10]*r+t[14]*a,n[3]=t[3]*i+t[7]*o+t[11]*r+t[15]*a,n}!function(){var n=m()}();var S,y=function(n){function e(){for(var e,t=arguments.length,i=Array(t),o=0;t>o;o++)i[o]=arguments[o];return(e=n.call.apply(n,[this].concat(i))||this).flipYMatrix=d(s(),v(1,-1,1)),e}c(e,n);var o=e.prototype;return o.applyMa4Position=function(n,e){for(var i=m(),o=0;e.byteLength/4>o;o+=3)i[0]=e[o],i[1]=e[o+1],i[2]=e[o+2],i[3]=1,M(i,i,n),e[o]=i[0],e[o+1]=i[1],e[o+2]=i[2];this.updateVertexBuffer(t.VertexAttributeBufferIndex.POSITION,t.VertexAttributeLocation.POSITION,0,new Uint8Array(e.buffer))},o.applyMa4Normal=function(n,e){var i,o,r=m(),a=((i=s())[0]=(o=n)[0],i[1]=o[1],i[2]=o[2],i[3]=o[3],i[4]=o[4],i[5]=o[5],i[6]=o[6],i[7]=o[7],i[8]=o[8],i[9]=o[9],i[10]=o[10],i[11]=o[11],i[12]=o[12],i[13]=o[13],i[14]=o[14],i[15]=o[15],i);!function(n,e){var t=e[0],i=e[1],o=e[2],r=e[3],a=e[4],c=e[5],l=e[6],u=e[7],f=e[8],s=e[9],d=e[10],_=e[11],v=e[12],p=e[13],g=e[14],h=e[15],m=t*c-i*a,M=t*l-o*a,S=t*u-r*a,y=i*l-o*c,P=i*u-r*c,x=o*u-r*l,E=f*p-s*v,b=f*g-d*v,C=f*h-_*v,L=s*g-d*p,I=s*h-_*p,O=d*h-_*g,R=m*O-M*I+S*L+y*C-P*b+x*E;R&&(n[0]=(c*O-l*I+u*L)*(R=1/R),n[1]=(o*I-i*O-r*L)*R,n[2]=(p*x-g*P+h*y)*R,n[3]=(d*P-s*x-_*y)*R,n[4]=(l*C-a*O-u*b)*R,n[5]=(t*O-o*C+r*b)*R,n[6]=(g*S-v*x-h*M)*R,n[7]=(f*x-d*S+_*M)*R,n[8]=(a*I-c*C+u*E)*R,n[9]=(i*C-t*I-r*E)*R,n[10]=(v*P-p*S+h*m)*R,n[11]=(s*S-f*P-_*m)*R,n[12]=(c*b-a*L-l*E)*R,n[13]=(t*L-i*b+o*E)*R,n[14]=(p*M-v*y-g*m)*R,n[15]=(f*y-s*M+d*m)*R)}(a,a),function(n,e){if(n===e){var t=e[1],i=e[2],o=e[3],r=e[6],a=e[7],c=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=i,n[9]=r,n[11]=e[14],n[12]=o,n[13]=a,n[14]=c}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15]}(a,a);for(var c=0;e.byteLength/4>c;c+=3)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],r[3]=1,M(r,r,a),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2];this.updateVertexBuffer(t.VertexAttributeBufferIndex.NORMAL,t.VertexAttributeLocation.NORMAL,0,new Uint8Array(e.buffer))},o.rebuildPosition=function(){var n=this.createTopology(),e=Float32Array.from(n.positions);this.applyMa4Position(this.flipYMatrix,e),this.dirty=!0},o.applyMat4=function(n){this.applyMa4Position(n,this.vertices[t.VertexAttributeBufferIndex.POSITION]),this.applyMa4Normal(n,this.vertices[t.VertexAttributeBufferIndex.NORMAL])},o.computeBoundingBox=function(){return new i.AABB},o.build=function(){var n=this.createTopology(),e=n.indices,i=n.positions,o=n.normals,r=n.uvs;this.setIndexBuffer(new Uint32Array(e)),this.vertexCount=e.length,this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.POSITION,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.POSITION}],data:Float32Array.from(i)}),this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.NORMAL,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.NORMAL}],data:Float32Array.from(o)}),this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.UV,byteStride:8,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RG,bufferByteOffset:0,location:t.VertexAttributeLocation.UV}],data:Float32Array.from(r)}),this.applyMat4(this.flipYMatrix),this.dirty=!0},e}(t.BufferGeometry),P=4/64,x=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},t))||this}return c(e,n),e.prototype.createTopology=function(){var n=this.props,e=n.widthSegments,t=n.heightSegments,i=n.depthSegments,o=n.height,r=n.width,a=n.depth,c=void 0===e?1:e,l=void 0===t?1:t,u=void 0===i?1:i,f=(void 0===r?1:r)/2,s=(void 0===o?1:o)/2,d=(void 0===a?1:a)/2,g=[v(-f,-s,d),v(f,-s,d),v(f,s,d),v(-f,s,d),v(f,-s,-d),v(-f,-s,-d),v(-f,s,-d),v(f,s,-d)],m=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],M=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],S=1,y=2,x=3,E=4,b=5,C=[],L=[],I=[],O=[],R=[],F=0,k=function(n,e,t){var i,o,r,a,c,l,u;for(r=0;e>=r;r++)for(a=0;t>=a;a++){var f=_(),s=_(),d=_(),v=_();p(f,g[m[n][0]],g[m[n][1]],r/e),p(s,g[m[n][0]],g[m[n][2]],a/t),h(d,s,g[m[n][0]]),(c=v)[0]=(l=f)[0]+(u=d)[0],c[1]=l[1]+u[1],c[2]=l[2]+u[2],i=r/e,o=a/t,C.push(v[0],v[1],v[2]),L.push(M[n][0],M[n][1],M[n][2]),I.push(i,1-o),i=.875*(i/=3)+P,o=.875*(o/=3)+P,O.push(i+=n%3/3,1-(o+=Math.floor(n/3)/3)),e>r&&t>a&&(R.push(F+t+1,F+1,F),R.push(F+t+1,F+t+2,F+1)),F++}};return k(0,c,l),k(S,c,l),k(y,c,u),k(x,c,u),k(E,u,l),k(b,u,l),{indices:R,positions:C,normals:L,uvs:I,uv1s:O}},r(e,[{key:"width",get:function(){return this.props.width},set:function(n){this.props.width!==n&&(this.props.width=n,this.rebuildPosition())}},{key:"height",get:function(){return this.props.height},set:function(n){this.props.height!==n&&(this.props.height=n,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(n){this.props.depth!==n&&(this.props.depth=n,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(n){this.props.widthSegments!==n&&(this.props.widthSegments=n,this.build())}},{key:"heightSegments",get:function(){return this.props.heightSegments},set:function(n){this.props.heightSegments!==n&&(this.props.heightSegments=n,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(n){this.props.depthSegments!==n&&(this.props.depthSegments=n,this.build())}}]),e}(y),E=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({radius:.5,latitudeBands:16,longitudeBands:16},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o,r,a,c,l,u,f,s,d,_,v=this.props,p=v.radius,g=void 0===p?.5:p,h=v.latitudeBands,m=void 0===h?16:h,M=v.longitudeBands,S=void 0===M?16:M,y=[],P=[],x=[],E=[];for(e=0;m>=e;e++)for(i=Math.sin(t=e*Math.PI/m),o=Math.cos(t),n=0;S>=n;n++)a=Math.sin(r=2*n*Math.PI/S-Math.PI/2),d=1-n/S,_=1-e/m,y.push((u=Math.cos(r)*i)*g,(f=o)*g,(s=a*i)*g),P.push(u,f,s),x.push(d,1-_);for(e=0;m>e;++e)for(n=0;S>n;++n)E.push((c=e*(S+1)+n)+1,l=c+S+1,c),E.push(c+1,l+1,l);return{indices:E,positions:y,normals:P,uvs:x,uv1s:x}},r(e,[{key:"radius",get:function(){return this.props.radius},set:function(n){this.props.radius!==n&&(this.props.radius=n,this.build())}},{key:"latitudeBands",get:function(){return this.props.latitudeBands},set:function(n){this.props.latitudeBands!==n&&(this.props.latitudeBands=n,this.build())}},{key:"longitudeBands",get:function(){return this.props.longitudeBands},set:function(n){this.props.longitudeBands!==n&&(this.props.longitudeBands=n,this.build())}}]),e}(y),b=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({tubeRadius:.2,ringRadius:.3,segments:30,sides:20},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o,r,a,c,l,u,f=this.props,s=f.tubeRadius,d=f.ringRadius,_=f.segments,v=void 0===_?30:_,p=f.sides,g=void 0===p?20:p,h=void 0===s?.2:s,m=void 0===d?.3:d,M=[],S=[],y=[],P=[];for(l=0;g>=l;l++)for(u=0;v>=u;u++)if(n=Math.cos(2*Math.PI*u/v)*(m+h*Math.cos(2*Math.PI*l/g)),e=Math.sin(2*Math.PI*l/g)*h,t=Math.sin(2*Math.PI*u/v)*(m+h*Math.cos(2*Math.PI*l/g)),i=Math.cos(2*Math.PI*u/v)*Math.cos(2*Math.PI*l/g),o=Math.sin(2*Math.PI*l/g),r=Math.sin(2*Math.PI*u/v)*Math.cos(2*Math.PI*l/g),a=l/g,c=1-u/v,M.push(n,e,t),S.push(i,o,r),y.push(a,1-c),g>l&&v>u){var x=(l+1)*(v+1)+u,E=l*(v+1)+(u+1),b=(l+1)*(v+1)+(u+1);P.push(l*(v+1)+u,x,E),P.push(x,b,E)}return{indices:P,positions:M,normals:S,uvs:y,uv1s:y}},r(e,[{key:"tubeRadius",get:function(){return this.props.tubeRadius},set:function(n){this.props.tubeRadius!==n&&(this.props.tubeRadius=n,this.build())}},{key:"ringRadius",get:function(){return this.props.ringRadius},set:function(n){this.props.ringRadius!==n&&(this.props.ringRadius=n,this.build())}},{key:"segments",get:function(){return this.props.segments},set:function(n){this.props.segments!==n&&(this.props.segments=n,this.build())}},{key:"sides",get:function(){return this.props.sides},set:function(n){this.props.sides!==n&&(this.props.sides=n,this.build())}}]),e}(y),C=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({width:1,depth:1,widthSegments:5,depthSegments:5},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o=[],r=[],a=[],c=[],l=this.props,u=l.widthSegments,f=l.depthSegments,s=l.width,d=l.depth,_=(void 0===s?1:s)/2,v=(void 0===d?1:d)/2,p=void 0===u?5:u,g=void 0===f?5:f,h=0;for(n=0;p>=n;n++)for(e=0;g>=e;e++)0,t=n/p,i=e/g,o.push(2*_*n/p-_,0,-(2*v*e/g-v)),r.push(0,1,0),a.push(t,1-i),p>n&&g>e&&(c.push(h+g+1,h+1,h),c.push(h+g+1,h+g+2,h+1)),h++;return{indices:c,positions:o,normals:r,uvs:a,uv1s:a}},r(e,[{key:"width",get:function(){return this.props.width},set:function(n){this.props.width!==n&&(this.props.width=n,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(n){this.props.depth!==n&&(this.props.depth=n,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(n){this.props.widthSegments!==n&&(this.props.widthSegments=n,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(n){this.props.depthSegments!==n&&(this.props.depthSegments=n,this.build())}}]),e}(y);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder"}(S||(S={}));var L,I=function(n){function e(e,i){var o,r;(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n reflectedLight.indirectDiffuse *= outputColor.rgb;\n\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:t.CullMode.Back},i))||this).defines=a({},r.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var c=i||{},l=c.map,u=c.wireframe;return l&&(r.map=l),r.wireframe=u,r.setUniforms(((o={})[S.PLACE_HOLDER]=[0,0,0,0],o)),r}return c(e,n),r(e,[{key:"map",get:function(){return this.props.map},set:function(n){var e;this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.setUniforms(((e={})[S.MAP]=n,e))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(n){this.props.aoMap=n}}]),e}(t.Material);!function(n){n.EMISSIVE="u_Emissive",n.SHININESS="u_Shininess",n.SPECULAR="u_Specular",n.BUMP_SCALE="u_BumpScale",n.SPECULAR_MAP="u_SpecularMap",n.BUMP_MAP="u_BumpMap"}(L||(L={}));var O,R=function(n){function e(e,t){var o,r,c=function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = NORMAL) in vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nout vec3 v_ViewPosition;\nout vec3 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec4 position = vec4(a_Position, 1.0);\n\n gl_Position = project(position, u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * position;\n v_ViewPosition = - mvPosition.xyz;\n\n // v_ViewPosition = vec3(mvPosition) / mvPosition.w;\n\n mat3 normalWorld = mat3(transposeMat3(inverseMat3(mat3(u_ViewMatrix * u_ModelMatrix))));\n v_Normal = normalize(normalWorld * a_Normal);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#if defined(USE_BUMPMAP) && defined(USE_LIGHT)\n uniform sampler2D u_BumpMap;\n\n // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n // http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( v_Uv );\n vec2 dSTdy = dFdy( v_Uv );\n\n float Hll = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv ).x;\n float dBx = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdx ).x - Hll;\n float dBy = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\t\t// normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n#ifdef USE_SPECULARMAP\n uniform sampler2D u_SpecularMap;\n#endif\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(\n const in vec3 f0,\n const in float f90,\n const in float dotVH\n) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n return 0.25;\n}\n\nfloat D_BlinnPhong(\n const in float shininess,\n const in float dotNH\n) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\n\nvec3 BRDF_BlinnPhong(\n const in vec3 lightDir,\n const in vec3 viewDir,\n const in vec3 normal,\n const in vec3 specularColor,\n const in float shininess\n) {\n vec3 halfDir = normalize( lightDir + viewDir );\n\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * ( G * D );\n}\n\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\n\nvoid RE_Direct_BlinnPhong(\n const in IncidentLight directLight,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong(\n const in vec3 irradiance,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\n\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n\nin vec3 v_ViewPosition;\nin vec3 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n // diffusemap\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n // specularmap\n float specularStrength = 1.0;\n\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture(SAMPLER_2D(u_SpecularMap), v_Uv);\n specularStrength = texelSpecular.r;\n#endif\n // bumpmap & normalmap\n float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\nvec3 normal = normalize(v_Normal);\n#ifdef USE_DOUBLESIDE\n normal = normal * faceDirection;\n#endif\n\n// #ifdef USE_TANGENT\n// vec3 tangent = normalize( vTangent );\n// vec3 bitangent = normalize( vBitangent );\n\n// #ifdef DOUBLE_SIDED\n// tangent = tangent * faceDirection;\n// bitangent = bitangent * faceDirection;\n// #endif\n\n// #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n// mat3 vTBN = mat3( tangent, bitangent, normal );\n\n// #endif\n// #endif\n #ifdef OBJECTSPACE_NORMALMAP\n // normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n // #ifdef FLIP_SIDED\n // normal = - normal;\n // #endif\n\n // #ifdef DOUBLE_SIDED\n // normal = normal * faceDirection;\n // #endif\n\n // normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n // vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n // mapN.xy *= normalScale;\n\n // #ifdef USE_TANGENT\n // normal = normalize( vTBN * mapN );\n // #else\n // normal = perturbNormal2Arb( - v_ViewPosition, normal, mapN, faceDirection );\n // #endif\n\n#elif defined(USE_BUMPMAP) && defined(USE_LIGHT)\n normal = perturbNormalArb( - v_ViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n\n vec4 diffuseColor = outputColor;\n ReflectedLight reflectedLight = ReflectedLight(vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\n vec3 totalEmissiveRadiance = u_Emissive;\n\n // calculate lighting accumulation\n BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = u_Specular;\nmaterial.specularShininess = u_Shininess;\nmaterial.specularStrength = specularStrength;\n GeometricContext geometry;\ngeometry.position = - v_ViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = u_IsOrtho == 1.0 ? vec3(0, 0, 1) : normalize(v_ViewPosition);\n\nIncidentLight directLight;\n#if defined( NUM_DIR_LIGHTS ) && ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n directionalLight = directionalLights[ i ];\n\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3(0.0);\n vec3 ambient = vec3(0.0);\n #ifdef NUM_AMBIENT_LIGHTS\n ambient = u_AmbientLightColor;\n #endif\n vec3 irradiance = getAmbientLightIrradiance(ambient);\n\n // irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n // #if ( NUM_HEMI_LIGHTS > 0 )\n // #pragma unroll_loop_start\n // for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n // irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n // }\n // #pragma unroll_loop_end\n // #endif\n#endif\n\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n\n #if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif\n\n vec3 outgoingLight = reflectedLight.directDiffuse +\n reflectedLight.indirectDiffuse + \n reflectedLight.directSpecular + \n reflectedLight.indirectSpecular + \n totalEmissiveRadiance;\n\n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",emissive:"black",shininess:30,specular:"#111111",bumpScale:1,doubleSide:!1},t))||this),l=c.specularMap,u=c.bumpMap,f=c.doubleSide,s=c.shininess,d=c.specular,_=i.parseColor(c.emissive),v=i.parseColor(d);return r.setUniforms(((o={u_Placeholder:null})[L.EMISSIVE]=[Number(_.r)/255,Number(_.g)/255,Number(_.b)/255],o[L.SHININESS]=s,o[L.SPECULAR]=[Number(v.r)/255,Number(v.g)/255,Number(v.b)/255],o)),l&&(r.specularMap=l),u&&(r.bumpMap=u),r.doubleSide=f,r.defines=a({},r.defines),r}return c(e,n),r(e,[{key:"emissive",get:function(){return this.props.emissive},set:function(n){var e;this.props.emissive=n;var t=i.parseColor(n);this.setUniforms(((e={})[L.EMISSIVE]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"shininess",get:function(){return this.props.shininess},set:function(n){var e;this.props.shininess=n,this.setUniforms(((e={})[L.SHININESS]=n,e))}},{key:"specular",get:function(){return this.props.specular},set:function(n){var e;this.props.specular=n;var t=i.parseColor(n);this.setUniforms(((e={})[L.SPECULAR]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(n){var e;this.props.map!==n&&(this.props.specularMap=n,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!n,this.setUniforms(((e={})[L.SPECULAR_MAP]=n,e))}},{key:"bumpMap",get:function(){return this.props.bumpMap},set:function(n){var e;this.props.map!==n&&(this.props.bumpMap=n,this.programDirty=!0),this.defines.USE_BUMPMAP=!!n,this.setUniforms(((e={})[L.BUMP_MAP]=n,e[L.BUMP_SCALE]=this.bumpScale,e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(n){var e;this.props.bumpScale=n,this.setUniforms(((e={})[L.BUMP_SCALE]=n,e))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(n){this.props.doubleSide=n,this.defines.USE_DOUBLESIDE=n}}]),e}(I);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder",n.SIZE="u_Size"}(O||(O={}));var F=function(n){function e(e,i){var o,r;(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n float u_Size;\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_PointSize = u_Size;\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n float u_Size;\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n vec2 uv = vec2(gl_PointCoord.x, 1.0 - gl_PointCoord.y);\n\tvec4 mapTexel = texture(SAMPLER_2D(u_Map), uv);\n u_Color *= mapTexel;\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n vec3 outgoingLight = diffuseColor.rgb;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:t.CullMode.Back},i))||this).defines=a({},r.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var c=i||{},l=c.map,u=c.size;return l&&(r.map=l),r.setUniforms(((o={})[O.PLACE_HOLDER]=[0,0,0,0],o[O.SIZE]=u||1,o)),r}return c(e,n),r(e,[{key:"map",get:function(){return this.props.map},set:function(n){var e;this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.setUniforms(((e={})[O.MAP]=n,e))}},{key:"size",get:function(){return this.props.size},set:function(n){var e;this.props.size=n,this.setUniforms(((e={})[O.SIZE]=n,e))}}]),e}(t.Material),k=["style"],A=function(n){function e(e){var t,i=void 0===e?{}:e,o=i.style,r=u(i,k);return(t=n.call(this,a({style:a({fill:"black"},o)},r))||this).define="NUM_AMBIENT_LIGHTS",t.order=-1,t}return c(e,n),e.prototype.uploadUBO=function(n,e){var t=this.parsedStyle.fill;t instanceof i.CSSRGB&&n.push({name:"u_AmbientLightColor",value:[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255]})},e}(t.Light),D=["style"],U=function(n){function e(e){var t,i=void 0===e?{}:e,o=i.style,r=u(i,D);return(t=n.call(this,a({style:a({direction:v(0,-1,0)},o)},r))||this).define="NUM_DIR_LIGHTS",t.order=10,t}c(e,n);var t=e.prototype;return t.getUniformWordCount=function(){return 8},t.uploadUBO=function(n,e){var t=this.parsedStyle,o=t.fill,r=t.direction,a=t.intensity;if(o instanceof i.CSSRGB){var c=[Number(o.r)/255,Number(o.g)/255,Number(o.b)/255];n.push({name:"directionalLights["+e+"].direction",value:r}),n.push({name:"directionalLights["+e+"].intensity",value:a}),n.push({name:"directionalLights["+e+"].color",value:c})}},e}(t.Light),B=e.Module((function(n){})),N=function(){function n(){this.name="3d"}var e=n.prototype;return e.init=function(n){n.load(B,!0)},e.destroy=function(n){n.unload(B)},n}();Object.defineProperty(n,"BlendFactor",{enumerable:!0,get:function(){return t.BlendFactor}}),Object.defineProperty(n,"BlendMode",{enumerable:!0,get:function(){return t.BlendMode}}),Object.defineProperty(n,"BufferFrequencyHint",{enumerable:!0,get:function(){return t.BufferFrequencyHint}}),Object.defineProperty(n,"BufferGeometry",{enumerable:!0,get:function(){return t.BufferGeometry}}),Object.defineProperty(n,"ChannelWriteMask",{enumerable:!0,get:function(){return t.ChannelWriteMask}}),Object.defineProperty(n,"CompareMode",{enumerable:!0,get:function(){return t.CompareMode}}),Object.defineProperty(n,"CullMode",{enumerable:!0,get:function(){return t.CullMode}}),Object.defineProperty(n,"Fog",{enumerable:!0,get:function(){return t.Fog}}),Object.defineProperty(n,"FogType",{enumerable:!0,get:function(){return t.FogType}}),Object.defineProperty(n,"Format",{enumerable:!0,get:function(){return t.Format}}),Object.defineProperty(n,"FrontFaceMode",{enumerable:!0,get:function(){return t.FrontFaceMode}}),Object.defineProperty(n,"GL",{enumerable:!0,get:function(){return t.GL}}),Object.defineProperty(n,"Light",{enumerable:!0,get:function(){return t.Light}}),Object.defineProperty(n,"Material",{enumerable:!0,get:function(){return t.Material}}),Object.defineProperty(n,"Mesh",{enumerable:!0,get:function(){return t.Mesh}}),Object.defineProperty(n,"MipFilterMode",{enumerable:!0,get:function(){return t.MipFilterMode}}),Object.defineProperty(n,"PrimitiveTopology",{enumerable:!0,get:function(){return t.PrimitiveTopology}}),Object.defineProperty(n,"SamplerFormatKind",{enumerable:!0,get:function(){return t.SamplerFormatKind}}),Object.defineProperty(n,"ShaderMaterial",{enumerable:!0,get:function(){return t.ShaderMaterial}}),Object.defineProperty(n,"StencilOp",{enumerable:!0,get:function(){return t.StencilOp}}),Object.defineProperty(n,"TextureDimension",{enumerable:!0,get:function(){return t.TextureDimension}}),Object.defineProperty(n,"TextureUsage",{enumerable:!0,get:function(){return t.TextureUsage}}),Object.defineProperty(n,"VertexAttributeBufferIndex",{enumerable:!0,get:function(){return t.VertexAttributeBufferIndex}}),Object.defineProperty(n,"VertexAttributeLocation",{enumerable:!0,get:function(){return t.VertexAttributeLocation}}),Object.defineProperty(n,"VertexBufferFrequency",{enumerable:!0,get:function(){return t.VertexBufferFrequency}}),Object.defineProperty(n,"WrapMode",{enumerable:!0,get:function(){return t.WrapMode}}),n.AmbientLight=A,n.CubeGeometry=x,n.DirectionalLight=U,n.MeshBasicMaterial=I,n.MeshPhongMaterial=R,n.PlaneGeometry=C,n.Plugin=N,n.PointMaterial=F,n.ProceduralGeometry=y,n.SphereGeometry=E,n.TorusGeometry=b,n.containerModule=B,Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mana-syringe"),require("@antv/g-plugin-device-renderer"),require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","mana-syringe","@antv/g-plugin-device-renderer","@antv/g"],e):e(((n="undefined"!=typeof globalThis?globalThis:n||self).G=n.G||{},n.G["3D"]={}),n.window.G.ManaSyringe,n.window.G.DeviceRenderer,n.window.G)}(this,(function(n,e,t,i){"use strict";function o(n,e){for(var t=0;e.length>t;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}}function r(n,e,t){return e&&o(n.prototype,e),t&&o(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function a(){return a=Object.assign||function(n){for(var e=1;arguments.length>e;e++){var t=arguments[e];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},a.apply(this,arguments)}function c(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,l(n,e)}function l(n,e){return l=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},l(n,e)}function u(n,e){if(null==n)return{};var t,i,o={},r=Object.keys(n);for(i=0;r.length>i;i++)0>e.indexOf(t=r[i])&&(o[t]=n[t]);return o}var f="undefined"!=typeof Float32Array?Float32Array:Array;function s(){var n=new f(16);return f!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n}function d(n,e){return n[0]=e[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=e[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function _(){var n=new f(3);return f!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function v(n,e,t){var i=new f(3);return i[0]=n,i[1]=e,i[2]=t,i}function p(n,e,t,i){var o=e[0],r=e[1],a=e[2];return n[0]=o+i*(t[0]-o),n[1]=r+i*(t[1]-r),n[2]=a+i*(t[2]-a),n}Math.hypot||(Math.hypot=function(){for(var n=0,e=arguments.length;e--;)n+=arguments[e]*arguments[e];return Math.sqrt(n)});var g,h=function(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};g=_();function m(){var n=new f(4);return f!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function M(n,e,t){var i=e[0],o=e[1],r=e[2],a=e[3];return n[0]=t[0]*i+t[4]*o+t[8]*r+t[12]*a,n[1]=t[1]*i+t[5]*o+t[9]*r+t[13]*a,n[2]=t[2]*i+t[6]*o+t[10]*r+t[14]*a,n[3]=t[3]*i+t[7]*o+t[11]*r+t[15]*a,n}!function(){var n=m()}();var S,y=function(n){function e(){for(var e,t=arguments.length,i=new Array(t),o=0;t>o;o++)i[o]=arguments[o];return(e=n.call.apply(n,[this].concat(i))||this).flipYMatrix=d(s(),v(1,-1,1)),e}c(e,n);var o=e.prototype;return o.applyMa4Position=function(n,e){for(var i=m(),o=0;e.byteLength/4>o;o+=3)i[0]=e[o],i[1]=e[o+1],i[2]=e[o+2],i[3]=1,M(i,i,n),e[o]=i[0],e[o+1]=i[1],e[o+2]=i[2];this.updateVertexBuffer(t.VertexAttributeBufferIndex.POSITION,t.VertexAttributeLocation.POSITION,0,new Uint8Array(e.buffer))},o.applyMa4Normal=function(n,e){var i,o,r=m(),a=((i=s())[0]=(o=n)[0],i[1]=o[1],i[2]=o[2],i[3]=o[3],i[4]=o[4],i[5]=o[5],i[6]=o[6],i[7]=o[7],i[8]=o[8],i[9]=o[9],i[10]=o[10],i[11]=o[11],i[12]=o[12],i[13]=o[13],i[14]=o[14],i[15]=o[15],i);!function(n,e){var t=e[0],i=e[1],o=e[2],r=e[3],a=e[4],c=e[5],l=e[6],u=e[7],f=e[8],s=e[9],d=e[10],_=e[11],v=e[12],p=e[13],g=e[14],h=e[15],m=t*c-i*a,M=t*l-o*a,S=t*u-r*a,y=i*l-o*c,P=i*u-r*c,x=o*u-r*l,E=f*p-s*v,b=f*g-d*v,C=f*h-_*v,L=s*g-d*p,I=s*h-_*p,O=d*h-_*g,R=m*O-M*I+S*L+y*C-P*b+x*E;R&&(n[0]=(c*O-l*I+u*L)*(R=1/R),n[1]=(o*I-i*O-r*L)*R,n[2]=(p*x-g*P+h*y)*R,n[3]=(d*P-s*x-_*y)*R,n[4]=(l*C-a*O-u*b)*R,n[5]=(t*O-o*C+r*b)*R,n[6]=(g*S-v*x-h*M)*R,n[7]=(f*x-d*S+_*M)*R,n[8]=(a*I-c*C+u*E)*R,n[9]=(i*C-t*I-r*E)*R,n[10]=(v*P-p*S+h*m)*R,n[11]=(s*S-f*P-_*m)*R,n[12]=(c*b-a*L-l*E)*R,n[13]=(t*L-i*b+o*E)*R,n[14]=(p*M-v*y-g*m)*R,n[15]=(f*y-s*M+d*m)*R)}(a,a),function(n,e){if(n===e){var t=e[1],i=e[2],o=e[3],r=e[6],a=e[7],c=e[11];n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=t,n[6]=e[9],n[7]=e[13],n[8]=i,n[9]=r,n[11]=e[14],n[12]=o,n[13]=a,n[14]=c}else n[0]=e[0],n[1]=e[4],n[2]=e[8],n[3]=e[12],n[4]=e[1],n[5]=e[5],n[6]=e[9],n[7]=e[13],n[8]=e[2],n[9]=e[6],n[10]=e[10],n[11]=e[14],n[12]=e[3],n[13]=e[7],n[14]=e[11],n[15]=e[15]}(a,a);for(var c=0;e.byteLength/4>c;c+=3)r[0]=e[c],r[1]=e[c+1],r[2]=e[c+2],r[3]=1,M(r,r,a),e[c]=r[0],e[c+1]=r[1],e[c+2]=r[2];this.updateVertexBuffer(t.VertexAttributeBufferIndex.NORMAL,t.VertexAttributeLocation.NORMAL,0,new Uint8Array(e.buffer))},o.rebuildPosition=function(){var n=this.createTopology(),e=Float32Array.from(n.positions);this.applyMa4Position(this.flipYMatrix,e),this.dirty=!0},o.applyMat4=function(n){this.applyMa4Position(n,this.vertices[t.VertexAttributeBufferIndex.POSITION]),this.applyMa4Normal(n,this.vertices[t.VertexAttributeBufferIndex.NORMAL])},o.computeBoundingBox=function(){return new i.AABB},o.build=function(){var n=this.createTopology(),e=n.indices,i=n.positions,o=n.normals,r=n.uvs;this.setIndexBuffer(new Uint32Array(e)),this.vertexCount=e.length,this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.POSITION,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.POSITION}],data:Float32Array.from(i)}),this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.NORMAL,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.NORMAL}],data:Float32Array.from(o)}),this.setVertexBuffer({bufferIndex:t.VertexAttributeBufferIndex.UV,byteStride:8,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RG,bufferByteOffset:0,location:t.VertexAttributeLocation.UV}],data:Float32Array.from(r)}),this.applyMat4(this.flipYMatrix),this.dirty=!0},e}(t.BufferGeometry),P=4/64,x=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},t))||this}return c(e,n),e.prototype.createTopology=function(){var n=this.props,e=n.widthSegments,t=n.heightSegments,i=n.depthSegments,o=n.height,r=n.width,a=n.depth,c=void 0===e?1:e,l=void 0===t?1:t,u=void 0===i?1:i,f=(void 0===r?1:r)/2,s=(void 0===o?1:o)/2,d=(void 0===a?1:a)/2,g=[v(-f,-s,d),v(f,-s,d),v(f,s,d),v(-f,s,d),v(f,-s,-d),v(-f,-s,-d),v(-f,s,-d),v(f,s,-d)],m=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],M=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],S=1,y=2,x=3,E=4,b=5,C=[],L=[],I=[],O=[],R=[],F=0,k=function(n,e,t){var i,o,r,a,c,l,u;for(r=0;e>=r;r++)for(a=0;t>=a;a++){var f=_(),s=_(),d=_(),v=_();p(f,g[m[n][0]],g[m[n][1]],r/e),p(s,g[m[n][0]],g[m[n][2]],a/t),h(d,s,g[m[n][0]]),(c=v)[0]=(l=f)[0]+(u=d)[0],c[1]=l[1]+u[1],c[2]=l[2]+u[2],i=r/e,o=a/t,C.push(v[0],v[1],v[2]),L.push(M[n][0],M[n][1],M[n][2]),I.push(i,1-o),i=.875*(i/=3)+P,o=.875*(o/=3)+P,i+=n%3/3,o+=Math.floor(n/3)/3,O.push(i,1-o),e>r&&t>a&&(R.push(F+t+1,F+1,F),R.push(F+t+1,F+t+2,F+1)),F++}};return k(0,c,l),k(S,c,l),k(y,c,u),k(x,c,u),k(E,u,l),k(b,u,l),{indices:R,positions:C,normals:L,uvs:I,uv1s:O}},r(e,[{key:"width",get:function(){return this.props.width},set:function(n){this.props.width!==n&&(this.props.width=n,this.rebuildPosition())}},{key:"height",get:function(){return this.props.height},set:function(n){this.props.height!==n&&(this.props.height=n,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(n){this.props.depth!==n&&(this.props.depth=n,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(n){this.props.widthSegments!==n&&(this.props.widthSegments=n,this.build())}},{key:"heightSegments",get:function(){return this.props.heightSegments},set:function(n){this.props.heightSegments!==n&&(this.props.heightSegments=n,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(n){this.props.depthSegments!==n&&(this.props.depthSegments=n,this.build())}}]),e}(y),E=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({radius:.5,latitudeBands:16,longitudeBands:16},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o,r,a,c,l,u,f,s,d,_,v,p=this.props,g=p.radius,h=void 0===g?.5:g,m=p.latitudeBands,M=void 0===m?16:m,S=p.longitudeBands,y=void 0===S?16:S,P=[],x=[],E=[],b=[];for(e=0;M>=e;e++)for(t=e*Math.PI/M,i=Math.sin(t),o=Math.cos(t),n=0;y>=n;n++)r=2*n*Math.PI/y-Math.PI/2,a=Math.sin(r),c=Math.cos(r),_=1-n/y,v=1-e/M,P.push((f=c*i)*h,(s=o)*h,(d=a*i)*h),x.push(f,s,d),E.push(_,1-v);for(e=0;M>e;++e)for(n=0;y>n;++n)b.push((l=e*(y+1)+n)+1,u=l+y+1,l),b.push(l+1,u+1,u);return{indices:b,positions:P,normals:x,uvs:E,uv1s:E}},r(e,[{key:"radius",get:function(){return this.props.radius},set:function(n){this.props.radius!==n&&(this.props.radius=n,this.build())}},{key:"latitudeBands",get:function(){return this.props.latitudeBands},set:function(n){this.props.latitudeBands!==n&&(this.props.latitudeBands=n,this.build())}},{key:"longitudeBands",get:function(){return this.props.longitudeBands},set:function(n){this.props.longitudeBands!==n&&(this.props.longitudeBands=n,this.build())}}]),e}(y),b=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({tubeRadius:.2,ringRadius:.3,segments:30,sides:20},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o,r,a,c,l,u,f=this.props,s=f.tubeRadius,d=f.ringRadius,_=f.segments,v=void 0===_?30:_,p=f.sides,g=void 0===p?20:p,h=void 0===s?.2:s,m=void 0===d?.3:d,M=[],S=[],y=[],P=[];for(l=0;g>=l;l++)for(u=0;v>=u;u++)if(n=Math.cos(2*Math.PI*u/v)*(m+h*Math.cos(2*Math.PI*l/g)),e=Math.sin(2*Math.PI*l/g)*h,t=Math.sin(2*Math.PI*u/v)*(m+h*Math.cos(2*Math.PI*l/g)),i=Math.cos(2*Math.PI*u/v)*Math.cos(2*Math.PI*l/g),o=Math.sin(2*Math.PI*l/g),r=Math.sin(2*Math.PI*u/v)*Math.cos(2*Math.PI*l/g),a=l/g,c=1-u/v,M.push(n,e,t),S.push(i,o,r),y.push(a,1-c),g>l&&v>u){var x=(l+1)*(v+1)+u,E=l*(v+1)+(u+1),b=(l+1)*(v+1)+(u+1);P.push(l*(v+1)+u,x,E),P.push(x,b,E)}return{indices:P,positions:M,normals:S,uvs:y,uv1s:y}},r(e,[{key:"tubeRadius",get:function(){return this.props.tubeRadius},set:function(n){this.props.tubeRadius!==n&&(this.props.tubeRadius=n,this.build())}},{key:"ringRadius",get:function(){return this.props.ringRadius},set:function(n){this.props.ringRadius!==n&&(this.props.ringRadius=n,this.build())}},{key:"segments",get:function(){return this.props.segments},set:function(n){this.props.segments!==n&&(this.props.segments=n,this.build())}},{key:"sides",get:function(){return this.props.sides},set:function(n){this.props.sides!==n&&(this.props.sides=n,this.build())}}]),e}(y),C=function(n){function e(e,t){return void 0===t&&(t={}),n.call(this,e,a({width:1,depth:1,widthSegments:5,depthSegments:5},t))||this}return c(e,n),e.prototype.createTopology=function(){var n,e,t,i,o=[],r=[],a=[],c=[],l=this.props,u=l.widthSegments,f=l.depthSegments,s=l.width,d=l.depth,_=(void 0===s?1:s)/2,v=(void 0===d?1:d)/2,p=void 0===u?5:u,g=void 0===f?5:f,h=0;for(n=0;p>=n;n++)for(e=0;g>=e;e++)0,t=n/p,i=e/g,o.push(2*_*n/p-_,0,-(2*v*e/g-v)),r.push(0,1,0),a.push(t,1-i),p>n&&g>e&&(c.push(h+g+1,h+1,h),c.push(h+g+1,h+g+2,h+1)),h++;return{indices:c,positions:o,normals:r,uvs:a,uv1s:a}},r(e,[{key:"width",get:function(){return this.props.width},set:function(n){this.props.width!==n&&(this.props.width=n,this.rebuildPosition())}},{key:"depth",get:function(){return this.props.depth},set:function(n){this.props.depth!==n&&(this.props.depth=n,this.rebuildPosition())}},{key:"widthSegments",get:function(){return this.props.widthSegments},set:function(n){this.props.widthSegments!==n&&(this.props.widthSegments=n,this.build())}},{key:"depthSegments",get:function(){return this.props.depthSegments},set:function(n){this.props.depthSegments!==n&&(this.props.depthSegments=n,this.build())}}]),e}(y);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder"}(S||(S={}));var L,I=function(n){function e(e,i){var o,r;(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n reflectedLight.indirectDiffuse += vec3( 1.0 );\n reflectedLight.indirectDiffuse *= outputColor.rgb;\n\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:t.CullMode.Back},i))||this).defines=a({},r.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var c=i||{},l=c.map,u=c.wireframe;return l&&(r.map=l),r.wireframe=u,r.setUniforms(((o={})[S.PLACE_HOLDER]=[0,0,0,0],o)),r}return c(e,n),r(e,[{key:"map",get:function(){return this.props.map},set:function(n){var e;this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.setUniforms(((e={})[S.MAP]=n,e))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(n){this.props.aoMap=n}}]),e}(t.Material);!function(n){n.EMISSIVE="u_Emissive",n.SHININESS="u_Shininess",n.SPECULAR="u_Specular",n.BUMP_SCALE="u_BumpScale",n.SPECULAR_MAP="u_SpecularMap",n.BUMP_MAP="u_BumpMap"}(L||(L={}));var O,R=function(n){function e(e,t){var o,r,c=function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\nlayout(location = NORMAL) in vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nout vec3 v_ViewPosition;\nout vec3 v_Normal;\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n vec4 position = vec4(a_Position, 1.0);\n\n gl_Position = project(position, u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n vec4 mvPosition = u_ViewMatrix * u_ModelMatrix * position;\n v_ViewPosition = - mvPosition.xyz;\n\n // v_ViewPosition = vec3(mvPosition) / mvPosition.w;\n\n mat3 normalWorld = mat3(transposeMat3(inverseMat3(mat3(u_ViewMatrix * u_ModelMatrix))));\n v_Normal = normalize(normalWorld * a_Normal);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n\n #ifdef USE_LIGHT\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n\n #ifdef NUM_AMBIENT_LIGHTS\n vec3 u_AmbientLightColor;\n #endif\n\n #ifdef NUM_DIR_LIGHTS\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n};\n#ifdef USE_LIGHT\n void getDirectionalLightInfo(\n const in DirectionalLight directionalLight, \n const in GeometricContext geometry,\n out IncidentLight light\n ) {\n light.color = directionalLight.color * directionalLight.intensity;\n light.direction = normalize(directionalLight.direction);\n light.visible = true;\n }\n#endif\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_UV\n in vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#if defined(USE_BUMPMAP) && defined(USE_LIGHT)\n uniform sampler2D u_BumpMap;\n\n // Bump Mapping Unparametrized Surfaces on the GPU by Morten S. Mikkelsen\n // http://api.unrealengine.com/attachments/Engine/Rendering/LightingAndShadows/BumpMappingWithoutTangentSpace/mm_sfgrad_bump.pdf\n\n // Evaluate the derivative of the height w.r.t. screen-space using forward differencing (listing 2)\n\n vec2 dHdxy_fwd() {\n vec2 dSTdx = dFdx( v_Uv );\n vec2 dSTdy = dFdy( v_Uv );\n\n float Hll = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv ).x;\n float dBx = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdx ).x - Hll;\n float dBy = u_BumpScale * texture(SAMPLER_2D(u_BumpMap), v_Uv + dSTdy ).x - Hll;\n\n return vec2( dBx, dBy );\n }\n\n vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\n // Workaround for Adreno 3XX dFd*( vec3 ) bug. See #9988\n\n vec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n vec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n vec3 vN = surf_norm;\t\t// normalized\n\n vec3 R1 = cross( vSigmaY, vN );\n vec3 R2 = cross( vN, vSigmaX );\n\n float fDet = dot( vSigmaX, R1 ) * faceDirection;\n\n vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n return normalize( abs( fDet ) * surf_norm - vGrad );\n }\n#endif\n#ifdef USE_SPECULARMAP\n uniform sampler2D u_SpecularMap;\n#endif\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(\n const in vec3 f0,\n const in float f90,\n const in float dotVH\n) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\n\nfloat G_BlinnPhong_Implicit( /* const in float dotNL, const in float dotNV */ ) {\n // geometry term is (n dot l)(n dot v) / 4(n dot l)(n dot v)\n return 0.25;\n}\n\nfloat D_BlinnPhong(\n const in float shininess,\n const in float dotNH\n) {\n return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\n\nvec3 BRDF_BlinnPhong(\n const in vec3 lightDir,\n const in vec3 viewDir,\n const in vec3 normal,\n const in vec3 specularColor,\n const in float shininess\n) {\n vec3 halfDir = normalize( lightDir + viewDir );\n\n float dotNH = saturate( dot( normal, halfDir ) );\n float dotVH = saturate( dot( viewDir, halfDir ) );\n\n vec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\n float G = G_BlinnPhong_Implicit( /* dotNL, dotNV */ );\n\n float D = D_BlinnPhong( shininess, dotNH );\n\n return F * ( G * D );\n}\n\n#ifdef USE_WIREFRAME\n in vec3 v_Barycentric;\n\n float edgeFactor() {\n vec3 d = fwidth(v_Barycentric);\n vec3 a3 = smoothstep(vec3(0.0), d * u_WireframeLineWidth, v_Barycentric);\n return min(min(a3.x, a3.y), a3.z);\n }\n#endif\n\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nstruct BlinnPhongMaterial {\n vec3 diffuseColor;\n vec3 specularColor;\n float specularShininess;\n float specularStrength;\n};\n\nvoid RE_Direct_BlinnPhong(\n const in IncidentLight directLight,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\n reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\n\nvoid RE_IndirectDiffuse_BlinnPhong(\n const in vec3 irradiance,\n const in GeometricContext geometry,\n const in BlinnPhongMaterial material,\n inout ReflectedLight reflectedLight\n) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\n\n#define RE_Direct RE_Direct_BlinnPhong\n#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong\n\nin vec3 v_ViewPosition;\nin vec3 v_Normal;\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n\n // diffusemap\n #ifdef USE_MAP\n #ifdef USE_PATTERN\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #else\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n #endif\n#endif\n // specularmap\n float specularStrength = 1.0;\n\n#ifdef USE_SPECULARMAP\n vec4 texelSpecular = texture(SAMPLER_2D(u_SpecularMap), v_Uv);\n specularStrength = texelSpecular.r;\n#endif\n // bumpmap & normalmap\n float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\nvec3 normal = normalize(v_Normal);\n#ifdef USE_DOUBLESIDE\n normal = normal * faceDirection;\n#endif\n\n// #ifdef USE_TANGENT\n// vec3 tangent = normalize( vTangent );\n// vec3 bitangent = normalize( vBitangent );\n\n// #ifdef DOUBLE_SIDED\n// tangent = tangent * faceDirection;\n// bitangent = bitangent * faceDirection;\n// #endif\n\n// #if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\n// mat3 vTBN = mat3( tangent, bitangent, normal );\n\n// #endif\n// #endif\n #ifdef OBJECTSPACE_NORMALMAP\n // normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; // overrides both flatShading and attribute normals\n\n // #ifdef FLIP_SIDED\n // normal = - normal;\n // #endif\n\n // #ifdef DOUBLE_SIDED\n // normal = normal * faceDirection;\n // #endif\n\n // normal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n // vec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n // mapN.xy *= normalScale;\n\n // #ifdef USE_TANGENT\n // normal = normalize( vTBN * mapN );\n // #else\n // normal = perturbNormal2Arb( - v_ViewPosition, normal, mapN, faceDirection );\n // #endif\n\n#elif defined(USE_BUMPMAP) && defined(USE_LIGHT)\n normal = perturbNormalArb( - v_ViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n\n vec4 diffuseColor = outputColor;\n ReflectedLight reflectedLight = ReflectedLight(vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\n vec3 totalEmissiveRadiance = u_Emissive;\n\n // calculate lighting accumulation\n BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = u_Specular;\nmaterial.specularShininess = u_Shininess;\nmaterial.specularStrength = specularStrength;\n GeometricContext geometry;\ngeometry.position = - v_ViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = u_IsOrtho == 1.0 ? vec3(0, 0, 1) : normalize(v_ViewPosition);\n\nIncidentLight directLight;\n#if defined( NUM_DIR_LIGHTS ) && ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n DirectionalLight directionalLight;\n #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n DirectionalLightShadow directionalLightShadow;\n #endif\n\n #pragma unroll_loop_start\n for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\n directionalLight = directionalLights[ i ];\n\n getDirectionalLightInfo( directionalLight, geometry, directLight );\n\n #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n directionalLightShadow = directionalLightShadows[ i ];\n directLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n #endif\n\n RE_Direct( directLight, geometry, material, reflectedLight );\n }\n #pragma unroll_loop_end\n\n#endif\n\n#if defined( RE_IndirectDiffuse )\n vec3 iblIrradiance = vec3(0.0);\n vec3 ambient = vec3(0.0);\n #ifdef NUM_AMBIENT_LIGHTS\n ambient = u_AmbientLightColor;\n #endif\n vec3 irradiance = getAmbientLightIrradiance(ambient);\n\n // irradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n // #if ( NUM_HEMI_LIGHTS > 0 )\n // #pragma unroll_loop_start\n // for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n // irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n // }\n // #pragma unroll_loop_end\n // #endif\n#endif\n\n#if defined( RE_IndirectSpecular )\n vec3 radiance = vec3( 0.0 );\n vec3 clearcoatRadiance = vec3( 0.0 );\n#endif\n\n #if defined( RE_IndirectDiffuse )\n RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n\n#if defined( RE_IndirectSpecular )\n RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif\n\n vec3 outgoingLight = reflectedLight.directDiffuse +\n reflectedLight.indirectDiffuse + \n reflectedLight.directSpecular + \n reflectedLight.indirectSpecular + \n totalEmissiveRadiance;\n\n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(outputColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n outputColor.xyz = color;\n#endif\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",emissive:"black",shininess:30,specular:"#111111",bumpScale:1,doubleSide:!1},t))||this),l=c.specularMap,u=c.bumpMap,f=c.doubleSide,s=c.shininess,d=c.specular,_=i.parseColor(c.emissive),v=i.parseColor(d);return r.setUniforms(((o={u_Placeholder:null})[L.EMISSIVE]=[Number(_.r)/255,Number(_.g)/255,Number(_.b)/255],o[L.SHININESS]=s,o[L.SPECULAR]=[Number(v.r)/255,Number(v.g)/255,Number(v.b)/255],o)),l&&(r.specularMap=l),u&&(r.bumpMap=u),r.doubleSide=f,r.defines=a({},r.defines),r}return c(e,n),r(e,[{key:"emissive",get:function(){return this.props.emissive},set:function(n){var e;this.props.emissive=n;var t=i.parseColor(n);this.setUniforms(((e={})[L.EMISSIVE]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"shininess",get:function(){return this.props.shininess},set:function(n){var e;this.props.shininess=n,this.setUniforms(((e={})[L.SHININESS]=n,e))}},{key:"specular",get:function(){return this.props.specular},set:function(n){var e;this.props.specular=n;var t=i.parseColor(n);this.setUniforms(((e={})[L.SPECULAR]=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255],e))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(n){var e;this.props.map!==n&&(this.props.specularMap=n,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!n,this.setUniforms(((e={})[L.SPECULAR_MAP]=n,e))}},{key:"bumpMap",get:function(){return this.props.bumpMap},set:function(n){var e;this.props.map!==n&&(this.props.bumpMap=n,this.programDirty=!0),this.defines.USE_BUMPMAP=!!n,this.setUniforms(((e={})[L.BUMP_MAP]=n,e[L.BUMP_SCALE]=this.bumpScale,e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(n){var e;this.props.bumpScale=n,this.setUniforms(((e={})[L.BUMP_SCALE]=n,e))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(n){this.props.doubleSide=n,this.defines.USE_DOUBLESIDE=n}}]),e}(I);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder",n.SIZE="u_Size"}(O||(O={}));var F=function(n){function e(e,i){var o,r;(r=n.call(this,e,a({vertexShader:"#define GLSLIFY 1\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n float u_Size;\n vec4 u_Placeholder;\n};\n\nlayout(location = MODEL_MATRIX0) in vec4 a_ModelMatrix0;\nlayout(location = MODEL_MATRIX1) in vec4 a_ModelMatrix1;\nlayout(location = MODEL_MATRIX2) in vec4 a_ModelMatrix2;\nlayout(location = MODEL_MATRIX3) in vec4 a_ModelMatrix3;\nlayout(location = COLOR) in vec4 a_Color;\nlayout(location = STROKE_COLOR) in vec4 a_StrokeColor;\nlayout(location = PACKED_STYLE1) in vec4 a_StylePacked1;\nlayout(location = PACKED_STYLE2) in vec4 a_StylePacked2;\nlayout(location = PICKING_COLOR) in vec4 a_PickingColor;\n\nout vec4 v_PickingResult;\nout vec4 v_Color;\nout vec4 v_StrokeColor;\nout vec4 v_StylePacked1;\nout vec4 v_StylePacked2;\n\n#define COLOR_SCALE 1. / 255.\nvoid setPickingColor(vec3 pickingColor) {\n v_PickingResult.rgb = pickingColor * COLOR_SCALE;\n}\nvec4 project(vec4 pos, mat4 pm, mat4 vm, mat4 mm) {\n return pm * vm * mm * pos;\n}\n\nlayout(location = POSITION) in vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = UV) in vec2 a_Uv;\n out vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = BARYCENTRIC) in vec3 a_Barycentric;\n out vec3 v_Barycentric;\n#endif\n\nvoid main() {\n mat4 u_ModelMatrix = mat4(a_ModelMatrix0, a_ModelMatrix1, a_ModelMatrix2, a_ModelMatrix3);\nvec4 u_StrokeColor = a_StrokeColor;\nfloat u_Opacity = a_StylePacked1.x;\nfloat u_FillOpacity = a_StylePacked1.y;\nfloat u_StrokeOpacity = a_StylePacked1.z;\nfloat u_StrokeWidth = a_StylePacked1.w;\nfloat u_ZIndex = a_PickingColor.w;\nvec2 u_Anchor = a_StylePacked2.yz;\nfloat u_IncreasedLineWidthForHitTesting = a_StylePacked2.w;\n\nsetPickingColor(a_PickingColor.xyz);\n\nv_Color = a_Color;\nv_StrokeColor = a_StrokeColor;\nv_StylePacked1 = a_StylePacked1;\nv_StylePacked2 = a_StylePacked2;\n\n#ifdef CLIPSPACE_NEAR_ZERO\n gl_Position.z = gl_Position.z * 0.5 + 0.5;\n#endif\n\n gl_PointSize = u_Size;\n gl_Position = project(vec4(a_Position, 1.0), u_ProjectionMatrix, u_ViewMatrix, u_ModelMatrix);\n\n #ifdef USE_UV\n v_Uv = a_Uv;\n #ifdef VIEWPORT_ORIGIN_TL\n v_Uv.y = 1.0 - v_Uv.y;\n #endif\n#endif\n\n #ifdef USE_WIREFRAME\n v_Barycentric = a_Barycentric;\n#endif\n\n}",fragmentShader:"#define GLSLIFY 1\n#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n\n#ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\n\nfloat pow2( const in float x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\n\n// expects values in the range of [0,1]x[0,1], returns values in the [0,1] range.\n// do not collapse into a single function per: http://byteblacksmith.com/improvements-to-the-canonical-one-liner-glsl-rand-for-opengl-es-2-0/\nhighp float rand( const in vec2 uv ) {\n const highp float a = 12.9898, b = 78.233, c = 43758.5453;\n highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\n return fract( sin( sn ) * c );\n}\n\nmat3 transposeMat3(mat3 inMatrix) {\n vec3 i0 = inMatrix[0];\n vec3 i1 = inMatrix[1];\n vec3 i2 = inMatrix[2];\n\n mat3 outMatrix = mat3(\n vec3(i0.x, i1.x, i2.x),\n vec3(i0.y, i1.y, i2.y),\n vec3(i0.z, i1.z, i2.z)\n );\n\n return outMatrix;\n}\n\n// https://github.com/glslify/glsl-inverse/blob/master/index.glsl\nmat3 inverseMat3(mat3 inMatrix) {\n float a00 = inMatrix[0][0], a01 = inMatrix[0][1], a02 = inMatrix[0][2];\n float a10 = inMatrix[1][0], a11 = inMatrix[1][1], a12 = inMatrix[1][2];\n float a20 = inMatrix[2][0], a21 = inMatrix[2][1], a22 = inMatrix[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n}\n\nstruct DirectionalLight {\n vec3 direction;\n float intensity;\n vec3 color;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\nlayout(std140) uniform ub_SceneParams {\n mat4 u_ProjectionMatrix;\n mat4 u_ViewMatrix;\n vec3 u_CameraPosition;\n float u_DevicePixelRatio;\n vec2 u_Viewport;\n float u_IsOrtho;\n float u_IsPicking;\n};\nlayout(std140) uniform ub_MaterialParams {\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor;\n float u_WireframeLineWidth;\n #endif\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n float u_Size;\n vec4 u_Placeholder;\n};\n\nin vec4 v_PickingResult;\nin vec4 v_Color;\nin vec4 v_StrokeColor;\nin vec4 v_StylePacked1;\nin vec4 v_StylePacked2;\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_FOG\n #define FOGMODE_NONE 0.\n #define FOGMODE_EXP 1.\n #define FOGMODE_EXP2 2.\n #define FOGMODE_LINEAR 3.\n\n // in float v_FogDepth;\n\n float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\n // float depth = v_FogDepth;\n float fogFactor;\n float fogStart = u_FogInfos.y;\n float fogEnd = u_FogInfos.z;\n float fogDensity = u_FogInfos.w;\n\n if (u_FogInfos.x == FOGMODE_NONE) {\n fogFactor = 1.0;\n } else if (u_FogInfos.x == FOGMODE_EXP) {\n fogFactor = exp(-depth * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_EXP2) {\n fogFactor = exp(-depth * depth * fogDensity * fogDensity);\n } else if (u_FogInfos.x == FOGMODE_LINEAR) {\n fogFactor = (fogEnd - depth) / (fogEnd - fogStart);\n }\n\n fogFactor = clamp(fogFactor, 0.0, 1.0);\n return mix(u_FogColor * dBlendModeFogFactor, color, fogFactor);\n }\n#endif\n\nout vec4 outputColor;\n\nvoid main() {\n vec4 u_Color = v_Color;\nvec4 u_StrokeColor = v_StrokeColor;\nfloat u_Opacity = v_StylePacked1.x;\nfloat u_FillOpacity = v_StylePacked1.y;\nfloat u_StrokeOpacity = v_StylePacked1.z;\nfloat u_StrokeWidth = v_StylePacked1.w;\nfloat u_Visible = v_StylePacked2.x;\nvec3 u_PickingColor = v_PickingResult.xyz;\n\nif (u_Visible < 0.5) {\n discard;\n}\n #ifdef USE_MAP\n vec2 uv = vec2(gl_PointCoord.x, 1.0 - gl_PointCoord.y);\n\tvec4 mapTexel = texture(SAMPLER_2D(u_Map), uv);\n u_Color *= mapTexel;\n#endif\n\n if (u_IsPicking > 0.5) {\n if (u_PickingColor.x == 0.0 && u_PickingColor.y == 0.0 && u_PickingColor.z == 0.0) {\n discard;\n }\n outputColor = vec4(u_PickingColor, 1.0);\n } else {\n outputColor = u_Color;\n outputColor.a = outputColor.a * u_Opacity;\n vec4 diffuseColor = outputColor;\n\n vec3 outgoingLight = diffuseColor.rgb;\n \n outputColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_FOG\n outputColor.rgb = addFog(outputColor.rgb);\n#endif\n }\n}",cullMode:t.CullMode.Back},i))||this).defines=a({},r.defines,{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var c=i||{},l=c.map,u=c.size;return l&&(r.map=l),r.setUniforms(((o={})[O.PLACE_HOLDER]=[0,0,0,0],o[O.SIZE]=u||1,o)),r}return c(e,n),r(e,[{key:"map",get:function(){return this.props.map},set:function(n){var e;this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.setUniforms(((e={})[O.MAP]=n,e))}},{key:"size",get:function(){return this.props.size},set:function(n){var e;this.props.size=n,this.setUniforms(((e={})[O.SIZE]=n,e))}}]),e}(t.Material),k=["style"],A=function(n){function e(e){var t,i=void 0===e?{}:e,o=i.style,r=u(i,k);return(t=n.call(this,a({style:a({fill:"black"},o)},r))||this).define="NUM_AMBIENT_LIGHTS",t.order=-1,t}return c(e,n),e.prototype.uploadUBO=function(n,e){var t=this.parsedStyle.fill;if(t instanceof i.CSSRGB){var o=[Number(t.r)/255,Number(t.g)/255,Number(t.b)/255];n.push({name:"u_AmbientLightColor",value:o})}},e}(t.Light),D=["style"],U=function(n){function e(e){var t,i=void 0===e?{}:e,o=i.style,r=u(i,D);return(t=n.call(this,a({style:a({direction:v(0,-1,0)},o)},r))||this).define="NUM_DIR_LIGHTS",t.order=10,t}c(e,n);var t=e.prototype;return t.getUniformWordCount=function(){return 8},t.uploadUBO=function(n,e){var t=this.parsedStyle,o=t.fill,r=t.direction,a=t.intensity;if(o instanceof i.CSSRGB){var c=[Number(o.r)/255,Number(o.g)/255,Number(o.b)/255];n.push({name:"directionalLights["+e+"].direction",value:r}),n.push({name:"directionalLights["+e+"].intensity",value:a}),n.push({name:"directionalLights["+e+"].color",value:c})}},e}(t.Light),B=e.Module((function(n){})),N=function(){function n(){this.name="3d"}var e=n.prototype;return e.init=function(n){n.load(B,!0)},e.destroy=function(n){n.unload(B)},n}();Object.defineProperty(n,"BlendFactor",{enumerable:!0,get:function(){return t.BlendFactor}}),Object.defineProperty(n,"BlendMode",{enumerable:!0,get:function(){return t.BlendMode}}),Object.defineProperty(n,"BufferFrequencyHint",{enumerable:!0,get:function(){return t.BufferFrequencyHint}}),Object.defineProperty(n,"BufferGeometry",{enumerable:!0,get:function(){return t.BufferGeometry}}),Object.defineProperty(n,"ChannelWriteMask",{enumerable:!0,get:function(){return t.ChannelWriteMask}}),Object.defineProperty(n,"CompareMode",{enumerable:!0,get:function(){return t.CompareMode}}),Object.defineProperty(n,"CullMode",{enumerable:!0,get:function(){return t.CullMode}}),Object.defineProperty(n,"Fog",{enumerable:!0,get:function(){return t.Fog}}),Object.defineProperty(n,"FogType",{enumerable:!0,get:function(){return t.FogType}}),Object.defineProperty(n,"Format",{enumerable:!0,get:function(){return t.Format}}),Object.defineProperty(n,"FrontFaceMode",{enumerable:!0,get:function(){return t.FrontFaceMode}}),Object.defineProperty(n,"GL",{enumerable:!0,get:function(){return t.GL}}),Object.defineProperty(n,"Light",{enumerable:!0,get:function(){return t.Light}}),Object.defineProperty(n,"Material",{enumerable:!0,get:function(){return t.Material}}),Object.defineProperty(n,"Mesh",{enumerable:!0,get:function(){return t.Mesh}}),Object.defineProperty(n,"MipFilterMode",{enumerable:!0,get:function(){return t.MipFilterMode}}),Object.defineProperty(n,"PrimitiveTopology",{enumerable:!0,get:function(){return t.PrimitiveTopology}}),Object.defineProperty(n,"SamplerFormatKind",{enumerable:!0,get:function(){return t.SamplerFormatKind}}),Object.defineProperty(n,"ShaderMaterial",{enumerable:!0,get:function(){return t.ShaderMaterial}}),Object.defineProperty(n,"StencilOp",{enumerable:!0,get:function(){return t.StencilOp}}),Object.defineProperty(n,"TextureDimension",{enumerable:!0,get:function(){return t.TextureDimension}}),Object.defineProperty(n,"TextureUsage",{enumerable:!0,get:function(){return t.TextureUsage}}),Object.defineProperty(n,"VertexAttributeBufferIndex",{enumerable:!0,get:function(){return t.VertexAttributeBufferIndex}}),Object.defineProperty(n,"VertexAttributeLocation",{enumerable:!0,get:function(){return t.VertexAttributeLocation}}),Object.defineProperty(n,"VertexBufferFrequency",{enumerable:!0,get:function(){return t.VertexBufferFrequency}}),Object.defineProperty(n,"WrapMode",{enumerable:!0,get:function(){return t.WrapMode}}),n.AmbientLight=A,n.CubeGeometry=x,n.DirectionalLight=U,n.MeshBasicMaterial=I,n.MeshPhongMaterial=R,n.PlaneGeometry=C,n.Plugin=N,n.PointMaterial=F,n.ProceduralGeometry=y,n.SphereGeometry=E,n.TorusGeometry=b,n.containerModule=B,Object.defineProperty(n,"__esModule",{value:!0})}));
{
"name": "@antv/g-plugin-3d",
"version": "1.1.3",
"version": "1.1.4",
"description": "Provide 3D extension for G",

@@ -30,4 +30,4 @@ "keywords": [

"dependencies": {
"@antv/g-plugin-device-renderer": "^1.1.3",
"@antv/g-shader-components": "^1.1.3",
"@antv/g-plugin-device-renderer": "^1.1.4",
"@antv/g-shader-components": "^1.1.4",
"tslib": "^2.3.1"

@@ -49,3 +49,3 @@ },

},
"gitHead": "3a02a5b5f99a5bddbc52fabf6f3be6a38e3c746e",
"gitHead": "8c7cefec629c4a036903a55e9b435ef4ddbcf9c3",
"glslify": {

@@ -52,0 +52,0 @@ "transform": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc