UNPKG

bytev-charts-beta

Version:

基于echarts和JavaScript及ES6封装的一个可以直接调用的图表组件库,内置主题设计,简单快捷,且支持用户自定义配置; npm 安装方式: npm install bytev-charts 若启动提示还需额外install插件,则运行 npm install @babel/runtime-corejs2 即可;

56 lines (50 loc) 2.24 kB
import "core-js/modules/es.array.join.js"; console.warn("THREE.ConvolutionShader: As part of the transition to ES6 Modules, the files in 'examples/js' were deprecated in May 2020 (r117) and will be deleted in December 2020 (r124). You can find more information about developing using ES6 Modules in https://threejs.org/docs/#manual/en/introduction/Installation."); /** * Convolution shader * ported from o3d sample to WebGL / GLSL * http://o3d.googlecode.com/svn/trunk/samples/convolution.html */ THREE.ConvolutionShader = { defines: { "KERNEL_SIZE_FLOAT": "25.0", "KERNEL_SIZE_INT": "25" }, uniforms: { "tDiffuse": { value: null }, "uImageIncrement": { value: new THREE.Vector2(0.001953125, 0.0) }, "cKernel": { value: [] } }, vertexShader: ["uniform vec2 uImageIncrement;", "varying vec2 vUv;", "void main() {", " vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", "}"].join("\n"), fragmentShader: ["uniform float cKernel[ KERNEL_SIZE_INT ];", "uniform sampler2D tDiffuse;", "uniform vec2 uImageIncrement;", "varying vec2 vUv;", "void main() {", " vec2 imageCoord = vUv;", " vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", " for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", " sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", " imageCoord += uImageIncrement;", " }", " gl_FragColor = sum;", "}"].join("\n"), buildKernel: function buildKernel(sigma) { // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway. function gauss(x, sigma) { return Math.exp(-(x * x) / (2.0 * sigma * sigma)); } var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil(sigma * 3.0) + 1; if (kernelSize > kMaxKernelSize) kernelSize = kMaxKernelSize; halfWidth = (kernelSize - 1) * 0.5; values = new Array(kernelSize); sum = 0.0; for (i = 0; i < kernelSize; ++i) { values[i] = gauss(i - halfWidth, sigma); sum += values[i]; } // normalize the kernel for (i = 0; i < kernelSize; ++i) { values[i] /= sum; } return values; } };