我决定不从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 = `
- #ifdef GL_ES
- precision mediump float;
- #endif
- vec2 resolution = vec2(1.0,1.0);
- varying vec2 vUv;
- uniform float time;
- varying vec2 surfacePosition;
- vec4 textureRND2D(vec2 uv){
- uv = floor(fract(uv)*1e3);
- float v = uv.x+uv.y*1e3;
- return fract(1e5*sin(vec4(v*1e-2, (v+1.)*1e-2, (v+1e3)*1e-2, (v+1e3+1.)*1e-2)));
- }
- floatnoise(vec2 p) {
- vec2 f = fract(p*1e3);
- vec4 r = textureRND2D(p);
- f = f*f*(3.0-2.0*f);
- return (mix(mix(r.x, r.y, f.x), mix(r.z, r.w, f.x), f.y));
- }
- floatcloud(vec2 p) {
- float v = 0.0;
- v += noise(p*1.)*.5000;
- v += noise(p*2.)*.2500;
- v += noise(p*4.)*.1250;
- v += noise(p*8.)*.0625;
- v += noise(p*16.)*.03125;
- return v;
- }
- vec3 func( vec2 p) {
- p = p*.1+.5;
Arcgis 与 Claygl 可视化 glsl 特效篇(三十六) - 小专栏
标签:glsl,claygl,noise,uv,Claygl,Arcgis,1e3,vec2,可视化 From: https://www.cnblogs.com/haibalai/p/17349664.html