我决定不从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 =precision highp float; precision mediump float; uniform float battery; uniform float time; vec2 resolution = vec2(1.0,1.0); varying vec2 vUv; voidmain(void){ vec2 uv = (vUv -0.5) * 2.0 ; vec2 cen = vec2(0.5,0.2); float circle = distance(uv,cen); float outCir = step(circle,0.25); float inCir = step(circle,.18); float t1 = time * 3.0; vec2 v0 = vec2(cos(t1),sin(t1)); vec2 v00 = vec2(cos(t1 - 1.57), sin(t1 - 1.57)); vec2 v1 = normalize(uv - cen); float line = ceil(dot(v00,v1)); float fade = (dot(v0,v1) + 1.0) / 2.0; float color = fade * line * (outCir - inCir); gl_FragColor = vec4(color); }
const vertexShader = `
attribute vec3 position: POSITION;
Arcgis 与 Claygl 可视化 glsl 特效篇(三十九) - 小专栏