我决定不从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;
- uniform float iTime;
- const vec2 iResolution = vec2(1.0,1.0);
- varying vec2 vUv;
- const mat2 m = mat2( 0.80, 0.60, -0.60, 0.80 );
- floatnoise( in vec2 p )
- {
- return sin(p.x)*sin(p.y);
- }
- floatfbm4( vec2 p )
- {
- float f = 0.0;
- f += 0.5000*noise( p ); p = m*p*2.02;
- f += 0.2500*noise( p ); p = m*p*2.03;
- f += 0.1250*noise( p ); p = m*p*2.01;
- f += 0.0625*noise( p );
- return f/0.9375;
- }
- floatfbm6( vec2 p )
- {
- float f = 0.0;
- f += 0.500000*(0.5+0.5*noise( p )); p = m*p*2.02;
- f += 0.250000*(0.5+0.5*noise( p )); p = m*p*2.03;
- f += 0.125000*(0.5+0.5*noise( p )); p = m*p*2.01;
- f += 0.062500*(0.5+0.5*noise( p )); p = m*p*2.04;
- f += 0.031250*(0.5+0.5*noise( p )); p = m*p*2.01;
- f += 0.015625*(0.5+0.5*noise( p ));
- return f/0.96875;
- }
- vec2 fbm4_2( vec2 p )
- {
- return vec2(fbm4(p), fbm4(p+vec2(7.8)));
- }
- vec2 fbm6_2( vec2 p )
- {
- return vec2(fbm6(p+vec2(16.8)), fbm6(p+vec2(11.5)));
- }
- //====================================================================
- floatfunc( vec2 q, out vec4 ron )
- {
- q += 0.03*sin( vec2(0.27,0.23)*iTime + length(q)*vec2(4.1,4.3));
- vec2 o = fbm4_2( 0.9*q );
- o += 0.04*sin( vec2(0.12,0.14)*iTime + length(o));
- vec2 n = fbm6_2( 3.0*o );
Arcgis 与 Claygl 可视化 glsl 特效篇(十八) - 小专栏
标签:glsl,claygl,noise,return,0.5,Claygl,Arcgis,vec2,可视化 From: https://www.cnblogs.com/haibalai/p/17328434.html