我决定不从claygl基础来讲了 直接整合arcgis与claygl可视化来讲
关于整合clagyl 有兴趣看我这篇文章 arcgis 与 claygl 引擎结合做地图可视化
我整合一个类库 后续不断更新中
- npm i @haibalai/gismap4-claygl
初始化gismap4-claygl 类库, view是arcgis的sceneView对象
- import { ClayglMapManager} from "@haibalai/gismap4-claygl";
- ClayglMapManager.init(view);
添加特效
- import { ClayglMapManager} from "@haibalai/gismap4-claygl";
- import * as clay from "claygl";
- const fragmentShader = `
- uniform float iTime;
- varying vec2 vUv;
- vec3 hsb2rgb(in vec3 c)
- {
- vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
- 6.0)-3.0)-1.0,
- 0.0,
- 1.0 );
- rgb = rgb*rgb*(3.0-2.0*rgb);
- return c.z * mix( vec3(1.0), rgb, c.y);
- }
- voidmain(void) {
- // float time = iTime*1.;
- vec2 uv = (vUv - 0.5) * 4.0;
- float r = length(uv) * 0.9;
- vec3 color = hsb2rgb(vec3(0.24, 0.7, 0.4));
- float a = pow(r, 2.0);
- float b = sin(r * 0.8 - 1.6);
- float c = sin(r - 0.010);
- float s = sin(a - iTime * 3.0 + b) * c;
- color *= abs(1.0 / (s * 10.8)) - 0.01;
- gl_FragColor = vec4(color, color.x);
- }
- `;
- const vertexShader = `
- attribute vec3 position: POSITION;