我决定不从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;
- uniform vec2 iResolution;
- varying vec2 vUv;
- mat2 m(float a){float c=cos(a), s=sin(a);return mat2(c,-s,s,c);}
- floatmap(vec3 p){
- p.xz*= m(iTime*0.4);p.xy*= m(iTime*0.3);
- vec3 q = p*2.+iTime;
- return length(p+vec3(sin(iTime*0.7)))*log(length(p)+1.) + sin(q.x+sin(q.z+sin(q.y)))*0.5 - 1.;
- }
- voidmain(void) {
- vec2 p = (vUv - 0.5) * 2.0 ;
- vec3 cl = vec3(0.);
- float d = 2.5;
- for(int i=0; i<=5; i++) {
- vec3 p = vec3(0,0,5.) + normalize(vec3(p, -1.))*d;
- float rz = map(p);
- float f = clamp((rz - map(p+.1))*0.5, -.1, 1. );
- vec3 l = vec3(0.1,0.3,.4) + vec3(5., 2.5, 3.)*f;
- cl = cl*l + smoothstep(2.5, .0, rz)*.7*l;
- d += min(rz, 1.);
- }
- gl_FragColor = vec4(cl, cl.x);
- }
- `;
- const vertexShader = `
Arcgis 与 Claygl 可视化 glsl 特效篇(二十四) - 小专栏
标签:glsl,claygl,iTime,cl,float,Claygl,Arcgis,vec3,sin From: https://www.cnblogs.com/haibalai/p/17328446.html