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.0.24 to 1.0.25

2

dist/geometries/CubeGeometry.d.ts

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

import type { Device } from '@antv/g-plugin-webgl-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';

@@ -3,0 +3,0 @@ export interface CubeGeometryProps {

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

import type { Device } from '@antv/g-plugin-webgl-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';

@@ -3,0 +3,0 @@ export interface PlaneGeometryProps {

import { AABB } from '@antv/g';
import { BufferGeometry } from '@antv/g-plugin-webgl-renderer';
import { BufferGeometry } from '@antv/g-plugin-device-renderer';
import { mat4 } from 'gl-matrix';

@@ -4,0 +4,0 @@ export declare abstract class ProceduralGeometry<GeometryProps> extends BufferGeometry<GeometryProps> {

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

import type { Device } from '@antv/g-plugin-webgl-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';

@@ -3,0 +3,0 @@ export interface SphereGeometryProps {

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

import type { Device } from '@antv/g-plugin-webgl-renderer';
import type { Device } from '@antv/g-plugin-device-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';

@@ -3,0 +3,0 @@ export interface TorusGeometryProps {

import type { RendererPlugin } from '@antv/g';
import type { Syringe } from 'mana-syringe';
import { BlendFactor, BlendMode, BufferFrequencyHint, BufferGeometry, ChannelWriteMask, CompareMode, CullMode, Fog, FogType, Format, FrontFaceMode, GPUMapMode, GPUTextureUsage, Light, Material, Mesh, MipFilterMode, PrimitiveTopology, SamplerFormatKind, ShaderMaterial, StencilOp, TextureDimension, TextureUsage, GL, VertexAttributeBufferIndex, VertexAttributeLocation, VertexBufferFrequency, WrapMode } from '@antv/g-plugin-webgl-renderer';
import { BlendFactor, BlendMode, BufferFrequencyHint, BufferGeometry, ChannelWriteMask, CompareMode, CullMode, Fog, FogType, Format, FrontFaceMode, Light, Material, Mesh, MipFilterMode, PrimitiveTopology, SamplerFormatKind, ShaderMaterial, StencilOp, TextureDimension, TextureUsage, GL, VertexAttributeBufferIndex, VertexAttributeLocation, VertexBufferFrequency, WrapMode } from '@antv/g-plugin-device-renderer';
export * from './geometries';
export * from './materials';
export * from './lights';
export { BlendFactor, BlendMode, BufferFrequencyHint, BufferGeometry, ChannelWriteMask, CompareMode, CullMode, Fog, FogType, Format, FrontFaceMode, GPUMapMode, GPUTextureUsage, Light, Material, Mesh, MipFilterMode, PrimitiveTopology, SamplerFormatKind, ShaderMaterial, StencilOp, TextureDimension, TextureUsage, GL, VertexAttributeBufferIndex, VertexAttributeLocation, VertexBufferFrequency, WrapMode, };
export { BlendFactor, BlendMode, BufferFrequencyHint, BufferGeometry, ChannelWriteMask, CompareMode, CullMode, Fog, FogType, Format, FrontFaceMode, Light, Material, Mesh, MipFilterMode, PrimitiveTopology, SamplerFormatKind, ShaderMaterial, StencilOp, TextureDimension, TextureUsage, GL, VertexAttributeBufferIndex, VertexAttributeLocation, VertexBufferFrequency, WrapMode, };
export declare const containerModule: import("mana-syringe").SyringeModule;
export declare class Plugin implements RendererPlugin {
name: string;
init(container: Syringe.Container): void;

@@ -11,0 +12,0 @@ destroy(container: Syringe.Container): void;

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mana-syringe"),require("@antv/g-plugin-webgl-renderer"),require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","mana-syringe","@antv/g-plugin-webgl-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.WebGL.WebGLRenderer,n.window.G)}(this,(function(n,e,t,i){"use strict";function o(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,i)}return t}function r(n){for(var e=1;arguments.length>e;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){u(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function a(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function c(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 l(n,e,t){return e&&c(n.prototype,e),t&&c(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function u(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function f(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&d(n,e)}function s(n){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},s(n)}function d(n,e){return d=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},d(n,e)}function _(n,e){if(null==n)return{};var t,i,o=function(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}(n,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(i=0;r.length>i;i++)0>e.indexOf(t=r[i])&&Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}function v(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function p(n,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(n)}function g(n){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,i=s(n);if(e){var o=s(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return p(this,t)}}var h="undefined"!=typeof Float32Array?Float32Array:Array;function m(){var n=new h(16);return h!=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 y(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 M(){var n=new h(3);return h!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function S(n,e,t){var i=new h(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 x,b=function(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};x=M();function E(){var n=new h(4);return h!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function C(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=E()}();var L,O=function(n){f(o,n);var e=g(o);function o(){var n;a(this,o);for(var t=arguments.length,i=Array(t),r=0;t>r;r++)i[r]=arguments[r];return(n=e.call.apply(e,[this].concat(i))).flipYMatrix=y(m(),S(1,-1,1)),n}return l(o,[{key:"applyMa4Position",value:function(n,e){for(var i=E(),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,C(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))}},{key:"applyMa4Normal",value:function(n,e){var i,o,r=E(),a=((i=m())[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,y=t*l-o*a,M=t*u-r*a,S=i*l-o*c,P=i*u-r*c,x=o*u-r*l,b=f*p-s*v,E=f*g-d*v,C=f*h-_*v,L=s*g-d*p,O=s*h-_*p,I=d*h-_*g,R=m*I-y*O+M*L+S*C-P*E+x*b;R&&(n[0]=(c*I-l*O+u*L)*(R=1/R),n[1]=(o*O-i*I-r*L)*R,n[2]=(p*x-g*P+h*S)*R,n[3]=(d*P-s*x-_*S)*R,n[4]=(l*C-a*I-u*E)*R,n[5]=(t*I-o*C+r*E)*R,n[6]=(g*M-v*x-h*y)*R,n[7]=(f*x-d*M+_*y)*R,n[8]=(a*O-c*C+u*b)*R,n[9]=(i*C-t*O-r*b)*R,n[10]=(v*P-p*M+h*m)*R,n[11]=(s*M-f*P-_*m)*R,n[12]=(c*E-a*L-l*b)*R,n[13]=(t*L-i*E+o*b)*R,n[14]=(p*y-v*S-g*m)*R,n[15]=(f*S-s*y+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,C(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))}},{key:"rebuildPosition",value:function(){var n=this.createTopology(),e=Float32Array.from(n.positions);this.applyMa4Position(this.flipYMatrix,e),this.dirty=!0}},{key:"applyMat4",value:function(n){this.applyMa4Position(n,this.vertices[t.VertexAttributeBufferIndex.POSITION]),this.applyMa4Normal(n,this.vertices[t.VertexAttributeBufferIndex.NORMAL])}},{key:"computeBoundingBox",value:function(){return new i.AABB}},{key:"build",value: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}}]),o}(t.BufferGeometry),I=4/64,R=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},i))}return l(t,[{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())}},{key:"createTopology",value: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,_=[S(-f,-s,d),S(f,-s,d),S(f,s,d),S(-f,s,d),S(f,-s,-d),S(-f,-s,-d),S(-f,s,-d),S(f,s,-d)],v=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],p=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],g=1,h=2,m=3,y=4,x=5,E=[],C=[],L=[],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=M(),s=M(),d=M(),g=M();P(f,_[v[n][0]],_[v[n][1]],r/e),P(s,_[v[n][0]],_[v[n][2]],a/t),b(d,s,_[v[n][0]]),(c=g)[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,E.push(g[0],g[1],g[2]),C.push(p[n][0],p[n][1],p[n][2]),L.push(i,1-o),i=.875*(i/=3)+I,o=.875*(o/=3)+I,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(g,c,l),k(h,c,u),k(m,c,u),k(y,u,l),k(x,u,l),{indices:R,positions:E,normals:C,uvs:L,uv1s:O}}}]),t}(O),F=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({radius:.5,latitudeBands:16,longitudeBands:16},i))}return l(t,[{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())}},{key:"createTopology",value: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,y=v.longitudeBands,M=void 0===y?16:y,S=[],P=[],x=[],b=[];for(e=0;m>=e;e++)for(i=Math.sin(t=e*Math.PI/m),o=Math.cos(t),n=0;M>=n;n++)a=Math.sin(r=2*n*Math.PI/M-Math.PI/2),d=1-n/M,_=1-e/m,S.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;M>n;++n)b.push((c=e*(M+1)+n)+1,l=c+M+1,c),b.push(c+1,l+1,l);return{indices:b,positions:S,normals:P,uvs:x,uv1s:x}}}]),t}(O),k=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({tubeRadius:.2,ringRadius:.3,segments:30,sides:20},i))}return l(t,[{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())}},{key:"createTopology",value: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,y=[],M=[],S=[],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,y.push(n,e,t),M.push(i,o,r),S.push(a,1-c),g>l&&v>u){var x=(l+1)*(v+1)+u,b=l*(v+1)+(u+1),E=(l+1)*(v+1)+(u+1);P.push(l*(v+1)+u,x,b),P.push(x,E,b)}return{indices:P,positions:y,normals:M,uvs:S,uv1s:S}}}]),t}(O),A=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({width:1,depth:1,widthSegments:5,depthSegments:5},i))}return l(t,[{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())}},{key:"createTopology",value: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}}}]),t}(O);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder"}(L||(L={}));var D,U=function(n){f(i,n);var e=g(i);function i(n,o){var c;a(this,i),(c=e.call(this,n,r({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;\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},o))).defines=r(r({},c.defines),{},{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var l=o||{},f=l.map,s=l.wireframe;return f&&(c.map=f),c.wireframe=s,c.setUniforms(u({},L.PLACE_HOLDER,[0,0,0,0])),c}return l(i,[{key:"map",get:function(){return this.props.map},set:function(n){this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.defines.USE_MAP=!!n,this.setUniforms(u({},L.MAP,n))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(n){this.props.aoMap=n}}]),i}(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"}(D||(D={}));var w,B=function(n){f(t,n);var e=g(t);function t(n,o){var c,l;a(this,t);var f=v(l=e.call(this,n,r({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;\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},o))),s=f.specularMap,d=f.bumpMap,_=f.doubleSide,p=f.shininess,g=f.specular,h=i.parseColor(f.emissive),m=i.parseColor(g);return l.setUniforms((u(c={u_Placeholder:null},D.EMISSIVE,[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255]),u(c,D.SHININESS,p),u(c,D.SPECULAR,[Number(m.r)/255,Number(m.g)/255,Number(m.b)/255]),c)),s&&(l.specularMap=s),d&&(l.bumpMap=d),l.doubleSide=_,l.defines=r({},l.defines),l}return l(t,[{key:"emissive",get:function(){return this.props.emissive},set:function(n){this.props.emissive=n;var e=i.parseColor(n);this.setUniforms(u({},D.EMISSIVE,[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255]))}},{key:"shininess",get:function(){return this.props.shininess},set:function(n){this.props.shininess=n,this.setUniforms(u({},D.SHININESS,n))}},{key:"specular",get:function(){return this.props.specular},set:function(n){this.props.specular=n;var e=i.parseColor(n);this.setUniforms(u({},D.SPECULAR,[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255]))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(n){this.props.map!==n&&(this.props.specularMap=n,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!n,this.setUniforms(u({},D.SPECULAR_MAP,n))}},{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((u(e={},D.BUMP_MAP,n),u(e,D.BUMP_SCALE,this.bumpScale),e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(n){this.props.bumpScale=n,this.setUniforms(u({},D.BUMP_SCALE,n))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(n){this.props.doubleSide=n,this.defines.USE_DOUBLESIDE=n}}]),t}(U);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder",n.SIZE="u_Size"}(w||(w={}));var N=function(n){f(i,n);var e=g(i);function i(n,o){var c,l;a(this,i),(l=e.call(this,n,r({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;\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},o))).defines=r(r({},l.defines),{},{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var f=o||{},s=f.map,d=f.size;return s&&(l.map=s),l.setUniforms((u(c={},w.PLACE_HOLDER,[0,0,0,0]),u(c,w.SIZE,d||1),c)),l}return l(i,[{key:"map",get:function(){return this.props.map},set:function(n){this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.defines.USE_MAP=!!n,this.setUniforms(u({},w.MAP,n))}},{key:"size",get:function(){return this.props.size},set:function(n){this.props.size=n,this.setUniforms(u({},w.SIZE,n))}}]),i}(t.Material),G=["style"],T=function(n){f(t,n);var e=g(t);function t(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.style,c=_(i,G);return a(this,t),(n=e.call(this,r({style:r({fill:"black"},o)},c))).define="NUM_AMBIENT_LIGHTS",n.order=-1,n}return l(t,[{key:"uploadUBO",value: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]})}}]),t}(t.Light),V=["style"],z=function(n){f(t,n);var e=g(t);function t(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.style,c=_(i,V);return a(this,t),(n=e.call(this,r({style:r({direction:S(0,-1,0)},o)},c))).define="NUM_DIR_LIGHTS",n.order=10,n}return l(t,[{key:"getUniformWordCount",value:function(){return 8}},{key:"uploadUBO",value: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[".concat(e,"].direction"),value:r}),n.push({name:"directionalLights[".concat(e,"].intensity"),value:a}),n.push({name:"directionalLights[".concat(e,"].color"),value:c})}}}]),t}(t.Light),j=e.Module((function(n){})),W=function(){function n(){a(this,n)}return l(n,[{key:"init",value:function(n){n.load(j,!0)}},{key:"destroy",value:function(n){n.unload(j)}}]),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,"GPUMapMode",{enumerable:!0,get:function(){return t.GPUMapMode}}),Object.defineProperty(n,"GPUTextureUsage",{enumerable:!0,get:function(){return t.GPUTextureUsage}}),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=T,n.CubeGeometry=R,n.DirectionalLight=z,n.MeshBasicMaterial=U,n.MeshPhongMaterial=B,n.PlaneGeometry=A,n.Plugin=W,n.PointMaterial=N,n.ProceduralGeometry=O,n.SphereGeometry=F,n.TorusGeometry=k,n.containerModule=j,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){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),t.push.apply(t,i)}return t}function r(n){for(var e=1;arguments.length>e;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?o(Object(t),!0).forEach((function(e){u(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function a(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function c(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 l(n,e,t){return e&&c(n.prototype,e),t&&c(n,t),Object.defineProperty(n,"prototype",{writable:!1}),n}function u(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function f(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),Object.defineProperty(n,"prototype",{writable:!1}),e&&d(n,e)}function s(n){return s=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},s(n)}function d(n,e){return d=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},d(n,e)}function _(n,e){if(null==n)return{};var t,i,o=function(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}(n,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);for(i=0;r.length>i;i++)0>e.indexOf(t=r[i])&&Object.prototype.propertyIsEnumerable.call(n,t)&&(o[t]=n[t])}return o}function v(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function p(n,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return v(n)}function g(n){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(n){return!1}}();return function(){var t,i=s(n);if(e){var o=s(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return p(this,t)}}var h="undefined"!=typeof Float32Array?Float32Array:Array;function m(){var n=new h(16);return h!=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 y(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 M(){var n=new h(3);return h!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function S(n,e,t){var i=new h(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 x,b=function(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};x=M();function E(){var n=new h(4);return h!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function C(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=E()}();var L,I=function(n){f(o,n);var e=g(o);function o(){var n;a(this,o);for(var t=arguments.length,i=Array(t),r=0;t>r;r++)i[r]=arguments[r];return(n=e.call.apply(e,[this].concat(i))).flipYMatrix=y(m(),S(1,-1,1)),n}return l(o,[{key:"applyMa4Position",value:function(n,e){for(var i=E(),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,C(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))}},{key:"applyMa4Normal",value:function(n,e){var i,o,r=E(),a=((i=m())[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,y=t*l-o*a,M=t*u-r*a,S=i*l-o*c,P=i*u-r*c,x=o*u-r*l,b=f*p-s*v,E=f*g-d*v,C=f*h-_*v,L=s*g-d*p,I=s*h-_*p,O=d*h-_*g,R=m*O-y*I+M*L+S*C-P*E+x*b;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*S)*R,n[3]=(d*P-s*x-_*S)*R,n[4]=(l*C-a*O-u*E)*R,n[5]=(t*O-o*C+r*E)*R,n[6]=(g*M-v*x-h*y)*R,n[7]=(f*x-d*M+_*y)*R,n[8]=(a*I-c*C+u*b)*R,n[9]=(i*C-t*I-r*b)*R,n[10]=(v*P-p*M+h*m)*R,n[11]=(s*M-f*P-_*m)*R,n[12]=(c*E-a*L-l*b)*R,n[13]=(t*L-i*E+o*b)*R,n[14]=(p*y-v*S-g*m)*R,n[15]=(f*S-s*y+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,C(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))}},{key:"rebuildPosition",value:function(){var n=this.createTopology(),e=Float32Array.from(n.positions);this.applyMa4Position(this.flipYMatrix,e),this.dirty=!0}},{key:"applyMat4",value:function(n){this.applyMa4Position(n,this.vertices[t.VertexAttributeBufferIndex.POSITION]),this.applyMa4Normal(n,this.vertices[t.VertexAttributeBufferIndex.NORMAL])}},{key:"computeBoundingBox",value:function(){return new i.AABB}},{key:"build",value: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}}]),o}(t.BufferGeometry),O=4/64,R=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({width:1,height:1,depth:1,widthSegments:1,heightSegments:1,depthSegments:1},i))}return l(t,[{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())}},{key:"createTopology",value: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,_=[S(-f,-s,d),S(f,-s,d),S(f,s,d),S(-f,s,d),S(f,-s,-d),S(-f,-s,-d),S(-f,s,-d),S(f,s,-d)],v=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],p=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],g=1,h=2,m=3,y=4,x=5,E=[],C=[],L=[],I=[],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=M(),s=M(),d=M(),g=M();P(f,_[v[n][0]],_[v[n][1]],r/e),P(s,_[v[n][0]],_[v[n][2]],a/t),b(d,s,_[v[n][0]]),(c=g)[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,E.push(g[0],g[1],g[2]),C.push(p[n][0],p[n][1],p[n][2]),L.push(i,1-o),i=.875*(i/=3)+O,o=.875*(o/=3)+O,I.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(g,c,l),k(h,c,u),k(m,c,u),k(y,u,l),k(x,u,l),{indices:R,positions:E,normals:C,uvs:L,uv1s:I}}}]),t}(I),F=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({radius:.5,latitudeBands:16,longitudeBands:16},i))}return l(t,[{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())}},{key:"createTopology",value: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,y=v.longitudeBands,M=void 0===y?16:y,S=[],P=[],x=[],b=[];for(e=0;m>=e;e++)for(i=Math.sin(t=e*Math.PI/m),o=Math.cos(t),n=0;M>=n;n++)a=Math.sin(r=2*n*Math.PI/M-Math.PI/2),d=1-n/M,_=1-e/m,S.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;M>n;++n)b.push((c=e*(M+1)+n)+1,l=c+M+1,c),b.push(c+1,l+1,l);return{indices:b,positions:S,normals:P,uvs:x,uv1s:x}}}]),t}(I),k=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({tubeRadius:.2,ringRadius:.3,segments:30,sides:20},i))}return l(t,[{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())}},{key:"createTopology",value: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,y=[],M=[],S=[],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,y.push(n,e,t),M.push(i,o,r),S.push(a,1-c),g>l&&v>u){var x=(l+1)*(v+1)+u,b=l*(v+1)+(u+1),E=(l+1)*(v+1)+(u+1);P.push(l*(v+1)+u,x,b),P.push(x,E,b)}return{indices:P,positions:y,normals:M,uvs:S,uv1s:S}}}]),t}(I),A=function(n){f(t,n);var e=g(t);function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return a(this,t),e.call(this,n,r({width:1,depth:1,widthSegments:5,depthSegments:5},i))}return l(t,[{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())}},{key:"createTopology",value: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}}}]),t}(I);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder"}(L||(L={}));var D,U=function(n){f(i,n);var e=g(i);function i(n,o){var c;a(this,i),(c=e.call(this,n,r({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},o))).defines=r(r({},c.defines),{},{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var l=o||{},f=l.map,s=l.wireframe;return f&&(c.map=f),c.wireframe=s,c.setUniforms(u({},L.PLACE_HOLDER,[0,0,0,0])),c}return l(i,[{key:"map",get:function(){return this.props.map},set:function(n){this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.defines.USE_MAP=!!n,this.setUniforms(u({},L.MAP,n))}},{key:"aoMap",get:function(){return this.props.aoMap},set:function(n){this.props.aoMap=n}}]),i}(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"}(D||(D={}));var w,B=function(n){f(t,n);var e=g(t);function t(n,o){var c,l;a(this,t);var f=v(l=e.call(this,n,r({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},o))),s=f.specularMap,d=f.bumpMap,_=f.doubleSide,p=f.shininess,g=f.specular,h=i.parseColor(f.emissive),m=i.parseColor(g);return l.setUniforms((u(c={u_Placeholder:null},D.EMISSIVE,[Number(h.r)/255,Number(h.g)/255,Number(h.b)/255]),u(c,D.SHININESS,p),u(c,D.SPECULAR,[Number(m.r)/255,Number(m.g)/255,Number(m.b)/255]),c)),s&&(l.specularMap=s),d&&(l.bumpMap=d),l.doubleSide=_,l.defines=r({},l.defines),l}return l(t,[{key:"emissive",get:function(){return this.props.emissive},set:function(n){this.props.emissive=n;var e=i.parseColor(n);this.setUniforms(u({},D.EMISSIVE,[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255]))}},{key:"shininess",get:function(){return this.props.shininess},set:function(n){this.props.shininess=n,this.setUniforms(u({},D.SHININESS,n))}},{key:"specular",get:function(){return this.props.specular},set:function(n){this.props.specular=n;var e=i.parseColor(n);this.setUniforms(u({},D.SPECULAR,[Number(e.r)/255,Number(e.g)/255,Number(e.b)/255]))}},{key:"specularMap",get:function(){return this.props.specularMap},set:function(n){this.props.map!==n&&(this.props.specularMap=n,this.programDirty=!0),this.defines.USE_SPECULARMAP=!!n,this.setUniforms(u({},D.SPECULAR_MAP,n))}},{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((u(e={},D.BUMP_MAP,n),u(e,D.BUMP_SCALE,this.bumpScale),e))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(n){this.props.bumpScale=n,this.setUniforms(u({},D.BUMP_SCALE,n))}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(n){this.props.doubleSide=n,this.defines.USE_DOUBLESIDE=n}}]),t}(U);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder",n.SIZE="u_Size"}(w||(w={}));var N=function(n){f(i,n);var e=g(i);function i(n,o){var c,l;a(this,i),(l=e.call(this,n,r({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},o))).defines=r(r({},l.defines),{},{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var f=o||{},s=f.map,d=f.size;return s&&(l.map=s),l.setUniforms((u(c={},w.PLACE_HOLDER,[0,0,0,0]),u(c,w.SIZE,d||1),c)),l}return l(i,[{key:"map",get:function(){return this.props.map},set:function(n){this.props.map!==n&&(this.props.map=n,this.programDirty=!0),this.defines.USE_MAP=!!n,this.setUniforms(u({},w.MAP,n))}},{key:"size",get:function(){return this.props.size},set:function(n){this.props.size=n,this.setUniforms(u({},w.SIZE,n))}}]),i}(t.Material),G=["style"],T=function(n){f(t,n);var e=g(t);function t(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.style,c=_(i,G);return a(this,t),(n=e.call(this,r({style:r({fill:"black"},o)},c))).define="NUM_AMBIENT_LIGHTS",n.order=-1,n}return l(t,[{key:"uploadUBO",value: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]})}}]),t}(t.Light),V=["style"],z=function(n){f(t,n);var e=g(t);function t(){var n,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=i.style,c=_(i,V);return a(this,t),(n=e.call(this,r({style:r({direction:S(0,-1,0)},o)},c))).define="NUM_DIR_LIGHTS",n.order=10,n}return l(t,[{key:"getUniformWordCount",value:function(){return 8}},{key:"uploadUBO",value: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[".concat(e,"].direction"),value:r}),n.push({name:"directionalLights[".concat(e,"].intensity"),value:a}),n.push({name:"directionalLights[".concat(e,"].color"),value:c})}}}]),t}(t.Light),j=e.Module((function(n){})),W=function(){function n(){a(this,n),this.name="3d"}return l(n,[{key:"init",value:function(n){n.load(j,!0)}},{key:"destroy",value:function(n){n.unload(j)}}]),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=T,n.CubeGeometry=R,n.DirectionalLight=z,n.MeshBasicMaterial=U,n.MeshPhongMaterial=B,n.PlaneGeometry=A,n.Plugin=W,n.PointMaterial=N,n.ProceduralGeometry=I,n.SphereGeometry=F,n.TorusGeometry=k,n.containerModule=j,Object.defineProperty(n,"__esModule",{value:!0})}));
import type { DisplayObjectConfig } from '@antv/g';
import type { LightProps, RenderInstUniform } from '@antv/g-plugin-webgl-renderer';
import { Light } from '@antv/g-plugin-webgl-renderer';
import type { LightProps, RenderInstUniform } from '@antv/g-plugin-device-renderer';
import { Light } from '@antv/g-plugin-device-renderer';
export declare type AmbientLightProps = LightProps;

@@ -5,0 +5,0 @@ export declare class AmbientLight extends Light {

import type { DisplayObjectConfig } from '@antv/g';
import type { LightProps, RenderInstUniform } from '@antv/g-plugin-webgl-renderer';
import { Light } from '@antv/g-plugin-webgl-renderer';
import type { LightProps, RenderInstUniform } from '@antv/g-plugin-device-renderer';
import { Light } from '@antv/g-plugin-device-renderer';
import { vec3 } from 'gl-matrix';

@@ -5,0 +5,0 @@ export interface DirectionalLightProps extends LightProps {

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

import type { IMaterial, Texture, Device } from '@antv/g-plugin-webgl-renderer';
import { Material } from '@antv/g-plugin-webgl-renderer';
import type { IMaterial, Texture, Device } from '@antv/g-plugin-device-renderer';
import { Material } from '@antv/g-plugin-device-renderer';
export interface IMeshBasicMaterial extends IMaterial {

@@ -4,0 +4,0 @@ /**

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

import type { Device, Texture } from '@antv/g-plugin-webgl-renderer';
import type { Device, Texture } from '@antv/g-plugin-device-renderer';
import type { IMeshBasicMaterial } from './MeshBasicMaterial';

@@ -3,0 +3,0 @@ import { MeshBasicMaterial } from './MeshBasicMaterial';

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

import type { IMaterial, Texture, Device } from '@antv/g-plugin-webgl-renderer';
import { Material } from '@antv/g-plugin-webgl-renderer';
import type { IMaterial, Texture, Device } from '@antv/g-plugin-device-renderer';
import { Material } from '@antv/g-plugin-device-renderer';
export interface IPointMaterial extends IMaterial {

@@ -4,0 +4,0 @@ /**

{
"name": "@antv/g-plugin-3d",
"version": "1.0.24",
"version": "1.0.25",
"description": "Provide 3D extension for G",

@@ -40,4 +40,4 @@ "main": "dist/index.js",

"dependencies": {
"@antv/g-plugin-webgl-renderer": "^1.0.26",
"@antv/g-shader-components": "^1.0.18",
"@antv/g-plugin-device-renderer": "^1.0.1",
"@antv/g-shader-components": "^1.0.19",
"tslib": "^2.3.1"

@@ -47,3 +47,3 @@ },

"@antv/g": "^5.0.1",
"@antv/g-plugin-webgl-renderer": "^1.0.1",
"@antv/g-plugin-device-renderer": "^1.0.0",
"mana-syringe": "^0.3.0"

@@ -56,3 +56,3 @@ },

},
"gitHead": "e2325a6285d12ef05abd9f9e12cf095280006167"
"gitHead": "98a28060c701e8c9c6c23fca672534677c4401b3"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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