Socket
Socket
Sign inDemoInstall

@antv/g-plugin-3d

Package Overview
Dependencies
Maintainers
56
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.6 to 1.0.7

dist/geometries/PlaneGeometry.d.ts

14

dist/geometries/CubeGeometry.d.ts

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

import { Mesh } from '@antv/g-plugin-webgl-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';
import { Mesh, VertexAttributeLocation } from '@antv/g-plugin-webgl-renderer';
import { ProceduralGeometry, ProceduralGeometryAttributeLocation } from './ProceduralGeometry';
export interface CubeGeometryProps {

@@ -12,3 +12,3 @@ height: number;

export declare class CubeGeometry extends ProceduralGeometry<CubeGeometryProps> {
createTopology(meshes: Mesh<CubeGeometryProps>[]): {
createTopology(mesh: Mesh<CubeGeometryProps>): {
indices: number[];

@@ -18,5 +18,9 @@ positions: number[];

uvs: number[];
uvs1: number[];
vertexCountPerInstance: number;
uv1s: number[];
};
update<Key extends keyof CubeGeometryProps>(index: number, mesh: Mesh, name: Key, value: CubeGeometryProps[Key]): {
bufferIndex: ProceduralGeometryAttributeLocation;
location: VertexAttributeLocation;
data: Float32Array;
}[];
}

@@ -5,1 +5,2 @@ export * from './ProceduralGeometry';

export * from './TorusGeometry';
export * from './PlaneGeometry';

@@ -11,5 +11,9 @@ import { BufferGeometry, Mesh } from '@antv/g-plugin-webgl-renderer';

/**
* flip Y, since +Y is down in G's world coords
*/
protected flipYMatrix: mat4;
/**
* create geometry attributes
*/
protected abstract createTopology(meshes: Mesh<GeometryProps>[]): {
protected abstract createTopology(mesh: Mesh<GeometryProps>): {
indices: number[];

@@ -19,8 +23,10 @@ positions: number[];

uvs: number[];
uvs1: number[];
vertexCountPerInstance: number;
uv1s: number[];
};
protected applyMa4Position(mat: mat4, positions: ArrayBufferView): void;
protected applyMa4Normal(mat: mat4, normals: ArrayBufferView): void;
applyMat4(mat: mat4): void;
getBoundingBox(): void;
build(meshes: Mesh<GeometryProps>[]): void;
update<Key extends keyof GeometryProps>(index: number, mesh: Mesh, name: Key, value: GeometryProps[Key]): any[];
}

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

import { Mesh } from '@antv/g-plugin-webgl-renderer';
import { ProceduralGeometry } from './ProceduralGeometry';
import { Mesh, VertexAttributeLocation } from '@antv/g-plugin-webgl-renderer';
import { ProceduralGeometry, ProceduralGeometryAttributeLocation } from './ProceduralGeometry';
export interface SphereGeometryProps {

@@ -9,3 +9,3 @@ radius: number;

export declare class SphereGeometry extends ProceduralGeometry<SphereGeometryProps> {
createTopology(meshes: Mesh<SphereGeometryProps>[]): {
createTopology(mesh: Mesh<SphereGeometryProps>): {
indices: number[];

@@ -15,5 +15,9 @@ positions: number[];

uvs: number[];
uvs1: number[];
vertexCountPerInstance: number;
uv1s: number[];
};
update<Key extends keyof SphereGeometryProps>(index: number, mesh: Mesh, name: Key, value: SphereGeometryProps[Key]): {
bufferIndex: ProceduralGeometryAttributeLocation;
location: VertexAttributeLocation;
data: Float32Array;
}[];
}

@@ -10,3 +10,3 @@ import { Mesh } from '@antv/g-plugin-webgl-renderer';

export declare class TorusGeometry extends ProceduralGeometry<TorusGeometryProps> {
createTopology(meshes: Mesh<TorusGeometryProps>[]): {
createTopology(mesh: Mesh<TorusGeometryProps>): {
indices: number[];

@@ -16,5 +16,4 @@ positions: number[];

uvs: number[];
uvs1: number[];
vertexCountPerInstance: number;
uv1s: number[];
};
}
/// <reference path="../../../../../../../../Users/panyuqi/Documents/webgl/g/packages/g-plugin-3d/src/glsl.d.ts" />
import { RendererPlugin } from '@antv/g';
import { Syringe } from 'mana-syringe';
import { Mesh, Texture2D, Sampler, FogType } from '@antv/g-plugin-webgl-renderer';
export * from '@antv/g-plugin-webgl-renderer';
export * from './geometries';
export * from './materials';
export * from './lights';
export { Mesh, Texture2D, Sampler, FogType };
export declare const containerModule: import("mana-syringe").SyringeModule;

@@ -10,0 +9,0 @@ export declare class Plugin implements RendererPlugin {

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mana-syringe"),require("@antv/g-plugin-webgl-renderer")):"function"==typeof define&&define.amd?define(["exports","mana-syringe","@antv/g-plugin-webgl-renderer"],e):e(((n="undefined"!=typeof globalThis?globalThis:n||self).G=n.G||{},n.G["3D"]={}),n.window.G.ManaSyringe,n.window.G.WebGL.WebGLRenderer)}(this,(function(n,e,t){"use strict";function i(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 o(n){for(var e=1;arguments.length>e;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?i(Object(t),!0).forEach((function(e){l(n,e,t[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):i(Object(t)).forEach((function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))}))}return n}function r(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function a(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 c(n,e,t){return e&&a(n.prototype,e),t&&a(n,t),n}function l(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}}),e&&d(n,e)}function u(n){return u=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},u(n)}function d(n,e){return d=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},d(n,e)}function s(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,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 function(n){if(void 0===n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}(n)}function _(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=u(n);if(e){var o=u(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return v(this,t)}}function g(n,e){for(;!Object.prototype.hasOwnProperty.call(n,e)&&null!==(n=u(n)););return n}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(n,e,t){var i=g(n,e);if(i){var o=Object.getOwnPropertyDescriptor(i,e);return o.get?o.get.call(3>arguments.length?n:t):o.value}},p.apply(this,arguments)}var h="undefined"!=typeof Float32Array?Float32Array:Array;function y(){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 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 M,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};M=m();function L(){var n=new h(4);return h!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0,n[3]=0),n}function E(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}var x;!function(){var n=L()}();(x=n.ProceduralGeometryAttributeLocation||(n.ProceduralGeometryAttributeLocation={}))[x.POSITION=1]="POSITION",x[x.NORMAL=2]="NORMAL",x[x.UV=3]="UV",x[x.MAX=4]="MAX";var I=function(e){f(o,e);var i=_(o);function o(){return r(this,o),i.apply(this,arguments)}return c(o,[{key:"applyMat4",value:function(e){for(var t=this.vertexBuffers[n.ProceduralGeometryAttributeLocation.POSITION],i=L(),o=0;t.byteLength/4>o;o+=3)i[0]=t[o],i[1]=t[o+1],i[2]=t[o+2],i[3]=1,E(i,i,e),t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2];var r,a,c=this.vertexBuffers[n.ProceduralGeometryAttributeLocation.NORMAL],l=((r=y())[0]=(a=e)[0],r[1]=a[1],r[2]=a[2],r[3]=a[3],r[4]=a[4],r[5]=a[5],r[6]=a[6],r[7]=a[7],r[8]=a[8],r[9]=a[9],r[10]=a[10],r[11]=a[11],r[12]=a[12],r[13]=a[13],r[14]=a[14],r[15]=a[15],r);!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],f=e[7],u=e[8],d=e[9],s=e[10],v=e[11],_=e[12],g=e[13],p=e[14],h=e[15],y=t*c-i*a,m=t*l-o*a,S=t*f-r*a,P=i*l-o*c,M=i*f-r*c,b=o*f-r*l,L=u*g-d*_,E=u*p-s*_,x=u*h-v*_,I=d*p-s*g,C=d*h-v*g,F=s*h-v*p,O=y*F-m*C+S*I+P*x-M*E+b*L;O&&(n[0]=(c*F-l*C+f*I)*(O=1/O),n[1]=(o*C-i*F-r*I)*O,n[2]=(g*b-p*M+h*P)*O,n[3]=(s*M-d*b-v*P)*O,n[4]=(l*x-a*F-f*E)*O,n[5]=(t*F-o*x+r*E)*O,n[6]=(p*S-_*b-h*m)*O,n[7]=(u*b-s*S+v*m)*O,n[8]=(a*C-c*x+f*L)*O,n[9]=(i*x-t*C-r*L)*O,n[10]=(_*M-g*S+h*y)*O,n[11]=(d*S-u*M-v*y)*O,n[12]=(c*E-a*I-l*L)*O,n[13]=(t*I-i*E+o*L)*O,n[14]=(g*m-_*P-p*y)*O,n[15]=(u*P-d*m+s*y)*O)}(l,l),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]}(l,l);for(var f=0;c.byteLength/4>f;f+=3)i[0]=c[f],i[1]=c[f+1],i[2]=c[f+2],i[3]=1,E(i,i,l),c[f]=i[0],c[f+1]=i[1],c[f+2]=i[2]}},{key:"getBoundingBox",value:function(){}},{key:"build",value:function(e){var i,o,r=this.createTopology(e),a=r.positions,c=r.normals,l=r.uvs,f=r.vertexCountPerInstance;this.setIndices(new Uint32Array(r.indices)),this.vertexCount=f,this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.POSITION,byteStride:12,frequency:1,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:10}],data:Float32Array.from(a)}),this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.NORMAL,byteStride:12,frequency:1,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:11}],data:Float32Array.from(c)}),this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.UV,byteStride:8,frequency:1,attributes:[{format:t.Format.F32_RG,bufferByteOffset:0,location:12}],data:Float32Array.from(l)}),this.applyMat4((i=y(),o=S(1,-1,1),i[0]=o[0],i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o[1],i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=o[2],i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,i))}}]),o}(t.BufferGeometry),C=4/64,F=function(n){f(t,n);var e=_(t);function t(){return r(this,t),e.apply(this,arguments)}return c(t,[{key:"createTopology",value:function(n){var e=[],t=[],i=[],o=[],r=[],a=0,c=0;return n.map((function(n){return n.style})).forEach((function(n){var l=n.widthSegments,f=n.heightSegments,u=n.depthSegments,d=n.height,s=n.width,v=n.depth,_=void 0===l?1:l,g=void 0===f?1:f,p=void 0===u?1:u,h=(void 0===s?0:s)/2,y=(void 0===d?0:d)/2,M=(void 0===v?0:v)/2,L=[S(-h,-y,M),S(h,-y,M),S(h,y,M),S(-h,y,M),S(h,-y,-M),S(-h,-y,-M),S(-h,y,-M),S(h,y,-M)],E=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],x=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],I=1,F=2,O=3,D=4,R=5,U=[],k=[],w=[],A=[],G=[],B=0,N=function(n,e,t){var i,o,r,c,l,f,u;for(r=0;e>=r;r++)for(c=0;t>=c;c++){var d=m(),s=m(),v=m(),_=m();P(d,L[E[n][0]],L[E[n][1]],r/e),P(s,L[E[n][0]],L[E[n][2]],c/t),b(v,s,L[E[n][0]]),(l=_)[0]=(f=d)[0]+(u=v)[0],l[1]=f[1]+u[1],l[2]=f[2]+u[2],i=r/e,o=c/t,U.push(_[0],_[1],_[2]),k.push(x[n][0],x[n][1],x[n][2]),w.push(i,1-o),i=.875*(i/=3)+C,o=.875*(o/=3)+C,A.push(i+=n%3/3,1-(o+=Math.floor(n/3)/3)),e>r&&t>c&&(G.push(B+t+1+a,B+1+a,B+a),G.push(B+t+1+a,B+t+2+a,B+1+a)),B++}};N(0,_,g),N(I,_,g),N(F,_,p),N(O,_,p),N(D,p,g),N(R,p,g),a+=c=G.length,e.push.apply(e,U),t.push.apply(t,k),i.push.apply(i,w),o.push.apply(o,A),r.push.apply(r,G)})),{indices:r,positions:e,normals:t,uvs:i,uvs1:o,vertexCountPerInstance:c}}}]),t}(I),O=function(n){f(t,n);var e=_(t);function t(){return r(this,t),e.apply(this,arguments)}return c(t,[{key:"createTopology",value:function(n){var e,t,i,o,r,a,c,l,f,u,d,s,v,_,g=[],p=[],h=[],y=[],m=0,S=0;return n.map((function(n){return n.style})).forEach((function(n){var P=n.radius,M=void 0===P?.5:P,b=n.latitudeBands,L=void 0===b?16:b,E=n.longitudeBands,x=void 0===E?16:E,I=[],C=[],F=[],O=[];for(t=0;L>=t;t++)for(o=Math.sin(i=t*Math.PI/L),r=Math.cos(i),e=0;x>=e;e++)c=Math.sin(a=2*e*Math.PI/x-Math.PI/2),v=1-e/x,_=1-t/L,I.push((u=Math.cos(a)*o)*M,(d=r)*M,(s=c*o)*M),C.push(u,d,s),F.push(v,1-_);for(t=0;L>t;++t)for(e=0;x>e;++e)O.push((l=t*(x+1)+e)+1+m,(f=l+x+1)+m,l+m),O.push(l+1+m,f+1+m,f+m);m+=S=O.length,g.push.apply(g,I),p.push.apply(p,C),h.push.apply(h,F),y.push.apply(y,O)})),{indices:y,positions:g,normals:p,uvs:h,uvs1:h,vertexCountPerInstance:S}}}]),t}(I),D=function(n){f(t,n);var e=_(t);function t(){return r(this,t),e.apply(this,arguments)}return c(t,[{key:"createTopology",value:function(n){var e,t,i,o,r,a,c,l,f,u,d=[],s=[],v=[],_=[],g=0,p=0;return n.map((function(n){return n.style})).forEach((function(n){var h=n.tubeRadius,y=n.ringRadius,m=n.segments,S=void 0===m?30:m,P=n.sides,M=void 0===P?20:P,b=void 0===h?.2:h,L=void 0===y?.3:y,E=[],x=[],I=[],C=[];for(f=0;M>=f;f++)for(u=0;S>=u;u++)if(e=Math.cos(2*Math.PI*u/S)*(L+b*Math.cos(2*Math.PI*f/M)),t=Math.sin(2*Math.PI*f/M)*b,i=Math.sin(2*Math.PI*u/S)*(L+b*Math.cos(2*Math.PI*f/M)),o=Math.cos(2*Math.PI*u/S)*Math.cos(2*Math.PI*f/M),r=Math.sin(2*Math.PI*f/M),a=Math.sin(2*Math.PI*u/S)*Math.cos(2*Math.PI*f/M),c=f/M,l=1-u/S,E.push(e,t,i),x.push(o,r,a),I.push(c,1-l),M>f&&S>u){var F,O,D;D=(f+1)*(S+1)+(u+1),C.push(f*(S+1)+u+g,(F=(f+1)*(S+1)+u)+g,(O=f*(S+1)+(u+1))+g),C.push(F+g,D+g,O+g)}g+=p=C.length,d.push.apply(d,E),s.push.apply(s,x),v.push.apply(v,I),_.push.apply(_,C)})),{indices:_,positions:d,normals:s,uvs:v,uvs1:v,vertexCountPerInstance:p}}}]),t}(I),R=function(n){f(t,n);var e=_(t);function t(n){var i;r(this,t),(i=e.call(this,o({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 bool u_IsOrtho;\n};\nlayout(std140) uniform ub_MaterialParams {\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n vec3 u_AmbientLightColor;\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n #ifdef USE_LIGHT\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n};\n\nlayout(location = 0) attribute vec4 a_ModelMatrix0;\nlayout(location = 1) attribute vec4 a_ModelMatrix1;\nlayout(location = 2) attribute vec4 a_ModelMatrix2;\nlayout(location = 3) attribute vec4 a_ModelMatrix3;\nlayout(location = 4) attribute vec4 a_Color;\nlayout(location = 5) attribute vec4 a_StrokeColor;\nlayout(location = 6) attribute vec4 a_StylePacked1;\nlayout(location = 7) attribute vec4 a_StylePacked2;\nlayout(location = 8) attribute vec4 a_PickingColor;\nlayout(location = 9) attribute vec2 a_Anchor;\n// layout(location = {AttributeLocation.a_Uv}) attribute vec2 a_Uv;\n\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying 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 = 10) attribute vec3 a_Position;\nlayout(location = 11) attribute vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = 12) attribute vec2 a_Uv;\n varying vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = 13) attribute vec3 a_Barycentric;\n varying 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;\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\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 bool u_IsOrtho;\n};\nlayout(std140) uniform ub_MaterialParams {\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n vec3 u_AmbientLightColor;\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n #ifdef USE_LIGHT\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n\n #ifdef USE_BUMPMAP\n float u_BumpScale;\n #endif\n};\n\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying vec4 v_StylePacked2;\n#ifdef USE_UV\n varying vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n// uniform vec3 u_WireframeLineColor;\n// uniform float u_WireframeLineWidth;\n\n#ifdef USE_WIREFRAME\n varying vec3 v_Barycentric;\n\n float edgeFactor() {\n float u_WireframeLineWidth = 1.0;\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 float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\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\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;\n\ngbuf_picking = vec4(v_PickingResult.rgb, 1.0);\n\nif (u_Visible < 1.0) {\n discard;\n}\n #ifdef USE_MAP\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n#endif\n\n gl_FragColor = u_Color;\n gl_FragColor.a = gl_FragColor.a * u_Opacity;\n\n #ifdef USE_FOG\n gl_FragColor.rgb = addFog(gl_FragColor.rgb);\n #endif\n\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor = vec3(0.);\n vec3 wireframeAoColor = vec3(1.);\n vec3 color;\n // draw wireframe with ao\n color = mix(gl_FragColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n gl_FragColor.xyz = color;\n #endif\n}",cullMode:2},n))).defines={USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1};var a=n||{},c=a.wireframe;return i.setMap(a.map),i.setWireframe(c),i.setFog(),i}return c(t,[{key:"getUniformWordCount",value:function(){return 12}},{key:"setAttribute",value:function(n,e){p(u(t.prototype),"setAttribute",this).call(this,n,e),"map"===n?this.setMap(e):"fogType"!==n&&"fogColor"!==n&&"fogStart"!==n&&"fogEnd"!==n&&"fogDensity"!==n||this.setFog()}},{key:"setMap",value:function(n){this.defines.USE_MAP=!!n,this.addTexture(n,"map")}},{key:"setWireframe",value:function(n){this.defines.USE_WIREFRAME=!!n}},{key:"setFog",value:function(){this.defines.USE_FOG=!!this.props.fogType}}]),t}(t.Material),U=function(n){f(t,n);var e=_(t);function t(n){var i;r(this,t),i=e.call(this,o({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\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 bool u_IsOrtho;\n};\nlayout(std140) uniform ub_MaterialParams {\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n vec3 u_AmbientLightColor;\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n #ifdef USE_LIGHT\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n\n #ifdef USE_BUMPMAP\n float u_BumpScale;\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 = 0) attribute vec4 a_ModelMatrix0;\nlayout(location = 1) attribute vec4 a_ModelMatrix1;\nlayout(location = 2) attribute vec4 a_ModelMatrix2;\nlayout(location = 3) attribute vec4 a_ModelMatrix3;\nlayout(location = 4) attribute vec4 a_Color;\nlayout(location = 5) attribute vec4 a_StrokeColor;\nlayout(location = 6) attribute vec4 a_StylePacked1;\nlayout(location = 7) attribute vec4 a_StylePacked2;\nlayout(location = 8) attribute vec4 a_PickingColor;\nlayout(location = 9) attribute vec2 a_Anchor;\n// layout(location = {AttributeLocation.a_Uv}) attribute vec2 a_Uv;\n\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying 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 = 10) attribute vec3 a_Position;\nlayout(location = 11) attribute vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = 12) attribute vec2 a_Uv;\n varying vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = 13) attribute vec3 a_Barycentric;\n varying vec3 v_Barycentric;\n#endif\n\nvarying vec3 v_ViewPosition;\nvarying 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;\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(transpose(inverse(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\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 bool u_IsOrtho;\n};\nlayout(std140) uniform ub_MaterialParams {\n vec3 u_Emissive;\n float u_Shininess;\n vec3 u_Specular;\n vec3 u_AmbientLightColor;\n\n #ifdef USE_FOG\n vec4 u_FogInfos;\n vec3 u_FogColor;\n #endif\n\n #ifdef USE_LIGHT\n #if NUM_DIR_LIGHTS > 0\n DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n #endif\n #endif\n\n #ifdef USE_BUMPMAP\n float u_BumpScale;\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\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying vec4 v_StylePacked2;\n#ifdef USE_UV\n varying vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_BUMPMAP\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// uniform vec3 u_WireframeLineColor;\n// uniform float u_WireframeLineWidth;\n\n#ifdef USE_WIREFRAME\n varying vec3 v_Barycentric;\n\n float edgeFactor() {\n float u_WireframeLineWidth = 1.0;\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 float dBlendModeFogFactor = 1.0;\n\n vec3 addFog(vec3 color) {\n float depth = gl_FragCoord.z / gl_FragCoord.w;\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\nvarying vec3 v_ViewPosition;\nvarying vec3 v_Normal;\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;\n\ngbuf_picking = vec4(v_PickingResult.rgb, 1.0);\n\nif (u_Visible < 1.0) {\n discard;\n}\n #ifdef USE_MAP\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n#endif\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\n float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n vec3 normal = normalize(v_Normal);\n #ifdef USE_DOUBLESIDE\n\t\tnormal = normal * faceDirection;\n\t#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 // #endif\n\n #ifdef USE_BUMPMAP\n\tnormal = perturbNormalArb( - v_ViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif\n\n gl_FragColor = u_Color;\n gl_FragColor.a = gl_FragColor.a * u_Opacity;\n\n #ifdef USE_LIGHT\n vec4 diffuseColor = gl_FragColor;\n ReflectedLight reflectedLight = ReflectedLight(vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ));\n vec3 totalEmissiveRadiance = u_Emissive;\n\n BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = u_Specular;\nmaterial.specularShininess = u_Shininess;\nmaterial.specularStrength = specularStrength;\n\n GeometricContext geometry;\n geometry.position = - v_ViewPosition;\n geometry.normal = normal;\n geometry.viewDir = u_IsOrtho ? vec3(0, 0, 1) : normalize(v_ViewPosition);\n\n IncidentLight directLight;\n #if ( 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 irradiance = getAmbientLightIrradiance(u_AmbientLightColor);\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 gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n #endif\n\n #ifdef USE_FOG\n gl_FragColor.rgb = addFog(gl_FragColor.rgb);\n #endif\n\n #ifdef USE_WIREFRAME\n vec3 u_WireframeLineColor = vec3(0.);\n vec3 wireframeAoColor = vec3(1.);\n vec3 color;\n // draw wireframe with ao\n color = mix(gl_FragColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n gl_FragColor.xyz = color;\n #endif\n}",emissive:"black",specular:"#111111",shininess:30,bumpScale:1,doubleSide:!1},n));var a=n||{},c=a.bumpMap,l=a.doubleSide;return i.setSpecularMap(a.specularMap),i.setBumpMap(c),i.setDoubleSide(l),i}return c(t,[{key:"setAttribute",value:function(n,e){p(u(t.prototype),"setAttribute",this).call(this,n,e),"specularMap"===n?this.setSpecularMap(e):"bumpMap"===n?this.setBumpMap(e):"doubleSide"===n&&this.setDoubleSide(e)}},{key:"setSpecularMap",value:function(n){this.defines.USE_SPECULARMAP=!!n,this.addTexture(n,"specular-map")}},{key:"setBumpMap",value:function(n){this.defines.USE_BUMPMAP=!!n,this.addTexture(n,"bump-map")}},{key:"setDoubleSide",value:function(n){this.defines.USE_DOUBLESIDE=n}},{key:"getUniformWordCount",value:function(){return 12}}]),t}(R),k=["style"],w=function(n){f(t,n);var e=_(t);function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=n.style,a=s(n,k);return r(this,t),e.call(this,o({style:o({direction:S(0,-1,0)},i)},a))}return c(t,[{key:"getUniformWordCount",value:function(){return 8}}]),t}(t.Light),A=e.Module((function(n){})),G=function(){function n(){r(this,n)}return c(n,[{key:"init",value:function(n){n.load(A,!0)}},{key:"destroy",value:function(n){}}]),n}();Object.defineProperty(n,"FogType",{enumerable:!0,get:function(){return t.FogType}}),Object.defineProperty(n,"Mesh",{enumerable:!0,get:function(){return t.Mesh}}),Object.defineProperty(n,"Sampler",{enumerable:!0,get:function(){return t.Sampler}}),Object.defineProperty(n,"Texture2D",{enumerable:!0,get:function(){return t.Texture2D}}),n.CubeGeometry=F,n.DirectionalLight=w,n.MeshBasicMaterial=R,n.MeshPhongMaterial=U,n.Plugin=G,n.ProceduralGeometry=I,n.SphereGeometry=O,n.TorusGeometry=D,n.containerModule=A,Object.defineProperty(n,"__esModule",{value:!0})}));
!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){f(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),n}function f(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function u(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}}),e&&s(n,e)}function d(n){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},d(n)}function s(n,e){return s=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n},s(n,e)}function v(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 _(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 _(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=d(n);if(e){var o=d(this).constructor;t=Reflect.construct(i,arguments,o)}else t=i.apply(this,arguments);return p(this,t)}}function h(n){return function(n){if(Array.isArray(n))return m(n)}(n)||function(n){if("undefined"!=typeof Symbol&&null!=n[Symbol.iterator]||null!=n["@@iterator"])return Array.from(n)}(n)||function(n,e){if(!n)return;if("string"==typeof n)return m(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return m(n,e)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,i=Array(e);e>t;t++)i[t]=n[t];return i}var y="undefined"!=typeof Float32Array?Float32Array:Array;function S(){var n=new y(16);return y!=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 P(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 y(3);return y!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function E(n,e,t){var i=new y(3);return i[0]=n,i[1]=e,i[2]=t,i}function L(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 b,x=function(n,e,t){return n[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};b=M();function I(){var n=new y(4);return y!=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}var O;!function(){var n=I()}();(O=n.ProceduralGeometryAttributeLocation||(n.ProceduralGeometryAttributeLocation={}))[O.POSITION=1]="POSITION",O[O.NORMAL=2]="NORMAL",O[O.UV=3]="UV",O[O.MAX=4]="MAX";var F,A,R=function(e){u(o,e);var i=g(o);function o(){var n;a(this,o);for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return(n=i.call.apply(i,[this].concat(t))).flipYMatrix=P(S(),E(1,-1,1)),n}return l(o,[{key:"applyMa4Position",value:function(n,e){for(var t=I(),i=0;e.byteLength/4>i;i+=3)t[0]=e[i],t[1]=e[i+1],t[2]=e[i+2],t[3]=1,C(t,t,n),e[i]=t[0],e[i+1]=t[1],e[i+2]=t[2]}},{key:"applyMa4Normal",value:function(n,e){var t,i,o=I(),r=((t=S())[0]=(i=n)[0],t[1]=i[1],t[2]=i[2],t[3]=i[3],t[4]=i[4],t[5]=i[5],t[6]=i[6],t[7]=i[7],t[8]=i[8],t[9]=i[9],t[10]=i[10],t[11]=i[11],t[12]=i[12],t[13]=i[13],t[14]=i[14],t[15]=i[15],t);!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],f=e[7],u=e[8],d=e[9],s=e[10],v=e[11],_=e[12],p=e[13],g=e[14],h=e[15],m=t*c-i*a,y=t*l-o*a,S=t*f-r*a,P=i*l-o*c,M=i*f-r*c,E=o*f-r*l,L=u*p-d*_,b=u*g-s*_,x=u*h-v*_,I=d*g-s*p,C=d*h-v*p,O=s*h-v*g,F=m*O-y*C+S*I+P*x-M*b+E*L;F&&(n[0]=(c*O-l*C+f*I)*(F=1/F),n[1]=(o*C-i*O-r*I)*F,n[2]=(p*E-g*M+h*P)*F,n[3]=(s*M-d*E-v*P)*F,n[4]=(l*x-a*O-f*b)*F,n[5]=(t*O-o*x+r*b)*F,n[6]=(g*S-_*E-h*y)*F,n[7]=(u*E-s*S+v*y)*F,n[8]=(a*C-c*x+f*L)*F,n[9]=(i*x-t*C-r*L)*F,n[10]=(_*M-p*S+h*m)*F,n[11]=(d*S-u*M-v*m)*F,n[12]=(c*b-a*I-l*L)*F,n[13]=(t*I-i*b+o*L)*F,n[14]=(p*y-_*P-g*m)*F,n[15]=(u*P-d*y+s*m)*F)}(r,r),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]}(r,r);for(var a=0;e.byteLength/4>a;a+=3)o[0]=e[a],o[1]=e[a+1],o[2]=e[a+2],o[3]=1,C(o,o,r),e[a]=o[0],e[a+1]=o[1],e[a+2]=o[2]}},{key:"applyMat4",value:function(e){this.applyMa4Position(e,this.vertexBuffers[n.ProceduralGeometryAttributeLocation.POSITION]),this.applyMa4Normal(e,this.vertexBuffers[n.ProceduralGeometryAttributeLocation.NORMAL])}},{key:"getBoundingBox",value:function(){}},{key:"build",value:function(e){var i=this,o=[],r=[],a=[],c=[],l=[],f=0;e.forEach((function(n){var e=i.createTopology(n),t=e.indices,u=e.normals,d=e.uvs,s=e.uv1s;o.push.apply(o,h(e.positions)),r.push.apply(r,h(u)),a.push.apply(a,h(d)),c.push.apply(c,h(s)),l.push.apply(l,h(t.map((function(n){return n+f})))),f=t.length})),this.setIndices(new Uint32Array(l)),this.vertexCount=l.length/e.length,this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.POSITION,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.POSITION}],data:Float32Array.from(o)}),this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.NORMAL,byteStride:12,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RGB,bufferByteOffset:0,location:t.VertexAttributeLocation.NORMAL}],data:Float32Array.from(r)}),this.setVertexBuffer({bufferIndex:n.ProceduralGeometryAttributeLocation.UV,byteStride:8,frequency:t.VertexBufferFrequency.PerVertex,attributes:[{format:t.Format.F32_RG,bufferByteOffset:0,location:t.VertexAttributeLocation.UV}],data:Float32Array.from(a)}),this.applyMat4(this.flipYMatrix)}},{key:"update",value:function(n,e,t,i){return[]}}]),o}(t.BufferGeometry),U=4/64,D=function(e){u(o,e);var i=g(o);function o(){return a(this,o),i.apply(this,arguments)}return l(o,[{key:"createTopology",value:function(n){var e=n.style,t=e.widthSegments,i=e.heightSegments,o=e.depthSegments,r=e.height,a=e.width,c=e.depth,l=void 0===t?1:t,f=void 0===i?1:i,u=void 0===o?1:o,d=(void 0===a?0:a)/2,s=(void 0===r?0:r)/2,v=(void 0===c?0:c)/2,_=[E(-d,-s,v),E(d,-s,v),E(d,s,v),E(-d,s,v),E(d,-s,-v),E(-d,-s,-v),E(-d,s,-v),E(d,s,-v)],p=[[0,1,3],[4,5,7],[3,2,6],[1,0,4],[1,4,2],[5,0,6]],g=[[0,0,1],[0,0,-1],[0,1,0],[0,-1,0],[1,0,0],[-1,0,0]],h=1,m=2,y=3,S=4,P=5,b=[],I=[],C=[],O=[],F=[],A=0,R=function(n,e,t){var i,o,r,a,c,l,f;for(r=0;e>=r;r++)for(a=0;t>=a;a++){var u=M(),d=M(),s=M(),v=M();L(u,_[p[n][0]],_[p[n][1]],r/e),L(d,_[p[n][0]],_[p[n][2]],a/t),x(s,d,_[p[n][0]]),(c=v)[0]=(l=u)[0]+(f=s)[0],c[1]=l[1]+f[1],c[2]=l[2]+f[2],i=r/e,o=a/t,b.push(v[0],v[1],v[2]),I.push(g[n][0],g[n][1],g[n][2]),C.push(i,1-o),i=.875*(i/=3)+U,o=.875*(o/=3)+U,O.push(i+=n%3/3,1-(o+=Math.floor(n/3)/3)),e>r&&t>a&&(F.push(A+t+1,A+1,A),F.push(A+t+1,A+t+2,A+1)),A++}};return R(0,l,f),R(h,l,f),R(m,l,u),R(y,l,u),R(S,u,f),R(P,u,f),{indices:F,positions:b,normals:I,uvs:C,uv1s:O}}},{key:"update",value:function(e,i,o,r){if("width"===o||"height"===o||"depth"===o){var a=this.createTopology(i),c=Float32Array.from(a.positions);return this.applyMa4Position(this.flipYMatrix,c),[{bufferIndex:n.ProceduralGeometryAttributeLocation.POSITION,location:t.VertexAttributeLocation.POSITION,data:c}]}return[]}}]),o}(R),k=function(e){u(o,e);var i=g(o);function o(){return a(this,o),i.apply(this,arguments)}return l(o,[{key:"createTopology",value:function(n){var e,t,i,o,r,a,c,l,f,u,d,s,v,_,p=n.style,g=p.radius,h=void 0===g?.5:g,m=p.latitudeBands,y=void 0===m?16:m,S=p.longitudeBands,P=void 0===S?16:S,M=[],E=[],L=[],b=[];for(t=0;y>=t;t++)for(o=Math.sin(i=t*Math.PI/y),r=Math.cos(i),e=0;P>=e;e++)c=Math.sin(a=2*e*Math.PI/P-Math.PI/2),v=1-e/P,_=1-t/y,M.push((u=Math.cos(a)*o)*h,(d=r)*h,(s=c*o)*h),E.push(u,d,s),L.push(v,1-_);for(t=0;y>t;++t)for(e=0;P>e;++e)b.push((l=t*(P+1)+e)+1,f=l+P+1,l),b.push(l+1,f+1,f);return{indices:b,positions:M,normals:E,uvs:L,uv1s:L}}},{key:"update",value:function(e,i,o,r){if("radius"===o){var a=this.createTopology(i),c=Float32Array.from(a.positions);return this.applyMa4Position(this.flipYMatrix,c),[{bufferIndex:n.ProceduralGeometryAttributeLocation.POSITION,location:t.VertexAttributeLocation.POSITION,data:c}]}return[]}}]),o}(R),w=function(n){u(t,n);var e=g(t);function t(){return a(this,t),e.apply(this,arguments)}return l(t,[{key:"createTopology",value:function(n){var e,t,i,o,r,a,c,l,f,u,d=n.style,s=d.tubeRadius,v=d.ringRadius,_=d.segments,p=void 0===_?30:_,g=d.sides,h=void 0===g?20:g,m=void 0===s?.2:s,y=void 0===v?.3:v,S=[],P=[],M=[],E=[];for(f=0;h>=f;f++)for(u=0;p>=u;u++)if(e=Math.cos(2*Math.PI*u/p)*(y+m*Math.cos(2*Math.PI*f/h)),t=Math.sin(2*Math.PI*f/h)*m,i=Math.sin(2*Math.PI*u/p)*(y+m*Math.cos(2*Math.PI*f/h)),o=Math.cos(2*Math.PI*u/p)*Math.cos(2*Math.PI*f/h),r=Math.sin(2*Math.PI*f/h),a=Math.sin(2*Math.PI*u/p)*Math.cos(2*Math.PI*f/h),c=f/h,l=1-u/p,S.push(e,t,i),P.push(o,r,a),M.push(c,1-l),h>f&&p>u){var L,b,x;x=(f+1)*(p+1)+(u+1),E.push(f*(p+1)+u,L=(f+1)*(p+1)+u,b=f*(p+1)+(u+1)),E.push(L,x,b)}return{indices:E,positions:S,normals:P,uvs:M,uv1s:M}}}]),t}(R),B=function(e){u(o,e);var i=g(o);function o(){return a(this,o),i.apply(this,arguments)}return l(o,[{key:"createTopology",value:function(n){var e,t,i,o,r=[],a=[],c=[],l=[],f=n.style,u=f.widthSegments,d=f.depthSegments,s=f.width,v=f.depth,_=(void 0===s?1:s)/2,p=(void 0===v?1:v)/2,g=void 0===u?5:u,h=void 0===d?5:d,m=0;for(e=0;g>=e;e++)for(t=0;h>=t;t++)0,i=e/g,o=t/h,r.push(2*_*e/g-_,0,-(2*p*t/h-p)),a.push(0,1,0),c.push(i,1-o),g>e&&h>t&&(l.push(m+h+1,m+1,m),l.push(m+h+1,m+h+2,m+1)),m++;return{indices:l,positions:r,normals:a,uvs:c,uv1s:c}}},{key:"update",value:function(e,i,o,r){if("width"===o||"depth"===o){var a=this.createTopology(i),c=Float32Array.from(a.positions);return this.applyMa4Position(this.flipYMatrix,c),[{bufferIndex:n.ProceduralGeometryAttributeLocation.POSITION,location:t.VertexAttributeLocation.POSITION,data:c}]}return[]}}]),o}(R);!function(n){n.MAP="u_Map",n.PLACE_HOLDER="u_Placeholder"}(F||(F={})),function(n){n[n.MAP=0]="MAP"}(A||(A={}));var N,G,T=function(n){u(i,n);var e=g(i);function i(n){var o;a(this,i),(o=e.call(this,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};\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 = 0) attribute vec4 a_ModelMatrix0;\nlayout(location = 1) attribute vec4 a_ModelMatrix1;\nlayout(location = 2) attribute vec4 a_ModelMatrix2;\nlayout(location = 3) attribute vec4 a_ModelMatrix3;\nlayout(location = 4) attribute vec4 a_Color;\nlayout(location = 5) attribute vec4 a_StrokeColor;\nlayout(location = 6) attribute vec4 a_StylePacked1;\nlayout(location = 7) attribute vec4 a_StylePacked2;\nlayout(location = 8) attribute vec4 a_PickingColor;\nlayout(location = 9) attribute vec2 a_Anchor;\n// layout(location = {AttributeLocation.a_Uv}) attribute vec2 a_Uv;\n\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying 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 = 10) attribute vec3 a_Position;\n\n#ifdef USE_UV\n layout(location = 12) attribute vec2 a_Uv;\n varying vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = 13) attribute vec3 a_Barycentric;\n varying 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;\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\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};\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\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying vec4 v_StylePacked2;\n#ifdef USE_UV\n varying vec2 v_Uv;\n#endif\n#ifdef USE_MAP\n uniform sampler2D u_Map;\n#endif\n#ifdef USE_WIREFRAME\n varying 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 // varying 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\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;\n\ngbuf_picking = vec4(v_PickingResult.rgb, 1.0);\n\nif (u_Visible < 1.0) {\n discard;\n}\n #ifdef USE_MAP\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\n#endif\n\n gl_FragColor = u_Color;\n gl_FragColor.a = gl_FragColor.a * u_Opacity;\n vec4 diffuseColor = gl_FragColor;\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 *= gl_FragColor.rgb;\n\n vec3 outgoingLight = reflectedLight.indirectDiffuse;\n \n gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(gl_FragColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n gl_FragColor.xyz = color;\n#endif\n #ifdef USE_FOG\n gl_FragColor.rgb = addFog(gl_FragColor.rgb);\n#endif\n}",cullMode:t.CullMode.Back},n))).defines=r(r({},o.defines),{},{USE_UV:!0,USE_MAP:!1,USE_WIREFRAME:!1,USE_FOG:!1,USE_LIGHT:!1});var c=n||{},l=c.map,f=c.wireframe;return l&&(o.map=l),o.wireframe=f,o.addUniform({name:F.PLACE_HOLDER,format:t.Format.F32_RGBA,data:[0,0,0,0]}),o}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,n?this.addTexture(n,F.MAP,A.MAP):this.removeTexture(F.MAP)}},{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"}(N||(N={})),function(n){n[n.BUMP_MAP=1]="BUMP_MAP",n[n.SPECULAR_MAP=2]="SPECULAR_MAP"}(G||(G={}));var V=function(n){u(o,n);var e=g(o);function o(n){var c;a(this,o);var l=_(c=e.call(this,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\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};\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 = 0) attribute vec4 a_ModelMatrix0;\nlayout(location = 1) attribute vec4 a_ModelMatrix1;\nlayout(location = 2) attribute vec4 a_ModelMatrix2;\nlayout(location = 3) attribute vec4 a_ModelMatrix3;\nlayout(location = 4) attribute vec4 a_Color;\nlayout(location = 5) attribute vec4 a_StrokeColor;\nlayout(location = 6) attribute vec4 a_StylePacked1;\nlayout(location = 7) attribute vec4 a_StylePacked2;\nlayout(location = 8) attribute vec4 a_PickingColor;\nlayout(location = 9) attribute vec2 a_Anchor;\n// layout(location = {AttributeLocation.a_Uv}) attribute vec2 a_Uv;\n\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying 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 = 10) attribute vec3 a_Position;\nlayout(location = 11) attribute vec3 a_Normal;\n\n#ifdef USE_UV\n layout(location = 12) attribute vec2 a_Uv;\n varying vec2 v_Uv;\n#endif\n\n#ifdef USE_WIREFRAME\n layout(location = 13) attribute vec3 a_Barycentric;\n varying vec3 v_Barycentric;\n#endif\n\nvarying vec3 v_ViewPosition;\nvarying 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;\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(transpose(inverse(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\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};\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\nvarying vec4 v_PickingResult;\nvarying vec4 v_Color;\nvarying vec4 v_StrokeColor;\nvarying vec4 v_StylePacked1;\nvarying vec4 v_StylePacked2;\n#ifdef USE_UV\n varying 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 varying 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 // varying 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\nvarying vec3 v_ViewPosition;\nvarying vec3 v_Normal;\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;\n\ngbuf_picking = vec4(v_PickingResult.rgb, 1.0);\n\nif (u_Visible < 1.0) {\n discard;\n}\n\n // diffusemap\n #ifdef USE_MAP\n vec4 texelColor = texture(SAMPLER_2D(u_Map), v_Uv);\n u_Color = texelColor;\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 gl_FragColor = u_Color;\n gl_FragColor.a = gl_FragColor.a * u_Opacity;\n\n vec4 diffuseColor = gl_FragColor;\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 gl_FragColor = vec4(outgoingLight, diffuseColor.a);\n\n #ifdef USE_WIREFRAME\n vec3 color = mix(gl_FragColor.xyz, u_WireframeLineColor, (1.0 - edgeFactor()));\n gl_FragColor.xyz = color;\n#endif\n #ifdef USE_FOG\n gl_FragColor.rgb = addFog(gl_FragColor.rgb);\n#endif\n}",emissive:"black",shininess:30,specular:"#111111",bumpScale:1,doubleSide:!1},n))),f=l.specularMap,u=l.bumpMap,d=l.doubleSide,s=l.shininess,v=l.specular,p=i.parseColor(l.emissive).value,g=i.parseColor(v).value;return c.removeUniform("u_Placeholder"),c.addUniform({name:N.EMISSIVE,format:t.Format.F32_RGB,data:p}),c.addUniform({name:N.SHININESS,format:t.Format.F32_R,data:s}),c.addUniform({name:N.SPECULAR,format:t.Format.F32_RGB,data:g}),f&&(c.specularMap=f),u&&(c.bumpMap=u),c.doubleSide=d,c}return l(o,[{key:"emissive",get:function(){return this.props.emissive},set:function(n){this.props.emissive=n;var e=i.parseColor(n).value;this.updateUniformData(N.EMISSIVE,e.slice(0,3))}},{key:"shininess",get:function(){return this.props.shininess},set:function(n){this.props.shininess=n,this.updateUniformData(N.SHININESS,n)}},{key:"specular",get:function(){return this.props.specular},set:function(n){this.props.specular=n;var e=i.parseColor(n).value;this.updateUniformData(N.SPECULAR,e.slice(0,3))}},{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,n?this.addTexture(n,N.SPECULAR_MAP,G.SPECULAR_MAP):this.removeTexture(N.SPECULAR_MAP)}},{key:"bumpMap",get:function(){return this.props.bumpMap},set:function(n){this.props.map!==n&&(this.props.bumpMap=n,this.programDirty=!0),this.defines.USE_BUMPMAP=!!n,n?(this.addTexture(n,N.BUMP_MAP,G.BUMP_MAP),this.addUniform({name:N.BUMP_SCALE,format:t.Format.F32_R,data:this.bumpScale})):(this.removeTexture(N.BUMP_MAP),this.removeUniform(N.BUMP_SCALE))}},{key:"bumpScale",get:function(){return this.props.bumpScale},set:function(n){this.props.bumpScale=n,this.updateUniformData(N.BUMP_SCALE,n)}},{key:"doubleSide",get:function(){return this.props.doubleSide},set:function(n){this.props.doubleSide=n,this.defines.USE_DOUBLESIDE=n}}]),o}(T),H=["style"],W=function(n){u(o,n);var e=g(o);function o(){var n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.style,c=v(t,H);return a(this,o),(n=e.call(this,r({style:r({fill:"black"},i)},c))).define="NUM_AMBIENT_LIGHTS",n.order=-1,n}return l(o,[{key:"getUniformWordCount",value:function(){return 4}},{key:"uploadUBO",value:function(n,e){var o=this.parsedStyle.fill;(null==o?void 0:o.type)===i.PARSED_COLOR_TYPE.Constant&&(e+=t.fillVec4.apply(void 0,[n,e].concat(h(o.value))));return e}}]),o}(t.Light),z=["style"],j=function(n){u(o,n);var e=g(o);function o(){var n,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=t.style,c=v(t,z);return a(this,o),(n=e.call(this,r({style:r({direction:E(0,-1,0)},i)},c))).define="NUM_DIR_LIGHTS",n.order=10,n}return l(o,[{key:"getUniformWordCount",value:function(){return 8}},{key:"uploadUBO",value:function(n,e){var o=this.parsedStyle,r=o.fill,a=o.intensity;if((null==r?void 0:r.type)===i.PARSED_COLOR_TYPE.Constant){var c=r.value;e+=t.fillVec4.apply(void 0,[n,e].concat(h(o.direction),[a])),e+=t.fillVec4.apply(void 0,[n,e].concat(h(c)))}return e}}]),o}(t.Light),X=e.Module((function(n){})),Y=function(){function n(){a(this,n)}return l(n,[{key:"init",value:function(n){n.load(X,!0)}},{key:"destroy",value:function(n){}}]),n}();Object.keys(t).forEach((function(e){"default"!==e&&Object.defineProperty(n,e,{enumerable:!0,get:function(){return t[e]}})})),n.AmbientLight=W,n.CubeGeometry=D,n.DirectionalLight=j,n.MeshBasicMaterial=T,n.MeshPhongMaterial=V,n.PlaneGeometry=B,n.Plugin=Y,n.ProceduralGeometry=R,n.SphereGeometry=k,n.TorusGeometry=w,n.containerModule=X,Object.defineProperty(n,"__esModule",{value:!0})}));

@@ -8,4 +8,7 @@ import { DisplayObjectConfig } from '@antv/g';

export declare class DirectionalLight extends Light {
define: string;
order: number;
constructor({ style, ...rest }?: DisplayObjectConfig<DirectionalLightProps>);
getUniformWordCount(): number;
uploadUBO(d: Float32Array, offs: number): number;
}

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

export * from './AmbientLight';
export * from './DirectionalLight';

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

import { Material, Texture2D, MaterialProps } from '@antv/g-plugin-webgl-renderer';
export interface MeshBasicMaterialProps extends MaterialProps {
import { Material, Texture2D, IMaterial } from '@antv/g-plugin-webgl-renderer';
export interface IMeshBasicMaterial extends IMaterial {
/**

@@ -16,9 +16,14 @@ * color map, will override fill color

*/
export declare class MeshBasicMaterial extends Material<MeshBasicMaterialProps> {
constructor(props?: MeshBasicMaterialProps);
getUniformWordCount(): number;
protected setAttribute<Key extends keyof MeshBasicMaterialProps>(name: Key, value: MeshBasicMaterialProps[Key]): void;
private setMap;
private setWireframe;
private setFog;
export declare class MeshBasicMaterial<T extends IMeshBasicMaterial> extends Material<T> {
/**
* color map, will override fill color
*/
get map(): string | TexImageSource | Texture2D;
set map(v: string | TexImageSource | Texture2D);
/**
* AO map
*/
get aoMap(): string | TexImageSource | Texture2D;
set aoMap(v: string | TexImageSource | Texture2D);
constructor(props?: Partial<IMeshBasicMaterial>);
}
import { Texture2D } from '@antv/g-plugin-webgl-renderer';
import { MeshBasicMaterial, MeshBasicMaterialProps } from './MeshBasicMaterial';
export interface MeshPhongMaterialProps extends MeshBasicMaterialProps {
import { MeshBasicMaterial, IMeshBasicMaterial } from './MeshBasicMaterial';
export interface IMeshPhongMaterial extends IMeshBasicMaterial {
emissive: string;

@@ -12,9 +12,18 @@ shininess: number;

}
export declare class MeshPhongMaterial extends MeshBasicMaterial {
constructor(props?: MeshPhongMaterialProps);
protected setAttribute<Key extends keyof MeshPhongMaterialProps>(name: Key, value: MeshPhongMaterialProps[Key]): void;
private setSpecularMap;
private setBumpMap;
private setDoubleSide;
getUniformWordCount(): number;
export declare class MeshPhongMaterial extends MeshBasicMaterial<IMeshPhongMaterial> {
get emissive(): string;
set emissive(v: string);
get shininess(): number;
set shininess(v: number);
get specular(): string;
set specular(v: string);
get specularMap(): string | TexImageSource | Texture2D;
set specularMap(v: string | TexImageSource | Texture2D);
get bumpMap(): string | TexImageSource | Texture2D;
set bumpMap(v: string | TexImageSource | Texture2D);
get bumpScale(): number;
set bumpScale(v: number);
get doubleSide(): boolean;
set doubleSide(v: boolean);
constructor(props?: Partial<IMeshPhongMaterial>);
}
{
"name": "@antv/g-plugin-3d",
"version": "1.0.6",
"version": "1.0.7",
"description": "Provide 3D extension for G",

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

"dependencies": {
"@antv/g-plugin-webgl-renderer": "^1.0.8",
"@antv/g-shader-components": "^1.0.3",
"@antv/g-plugin-webgl-renderer": "^1.0.9",
"@antv/g-shader-components": "^1.0.4",
"@antv/util": "^2.0.13",

@@ -56,3 +56,3 @@ "tslib": "^2.3.1"

},
"gitHead": "dce0982c006f8205d73b6537ef620b15218a47d0"
"gitHead": "aaa26a747017b8407bdbd3c9bcc24b058cdf06c9"
}

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

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