我决定不从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 = `
- constfloat PI = 3.14159265359;
- uniform float iTime;
- const vec2 iResolution = vec2(1.0,1.0);
- varying vec2 vUv;
- vec3 firePalette(float i){
- float T = 1400. + 1300.*i;
- vec3 L = vec3(7.4, 5.6, 4.4);
- L = pow(L,vec3(5)) * (exp(1.43876719683e5/(T*L)) - 1.);
- return 1. - exp(-5e8/L);
- }
- vec3 hash33(vec3 p){
- float n = sin(dot(p, vec3(7, 157, 113)));
- return fract(vec3(2097152, 262144, 32768)*n);
- }
- floatvoronoi(vec3 p){
- vec3 b, r, g = floor(p);
- p = fract(p);
- float d = 1.;
- for(int j = -1; j <= 1; j++) {
- for(int i = -1; i <= 1; i++) {
- b = vec3(i, j, -1);
- r = b - p + hash33(g+b);
- d = min(d, dot(r,r));
- b.z = 0.0;
- r = b - p + hash33(g+b);
- d = min(d, dot(r,r));
- b.z = 1.;
- r = b - p + hash33(g+b);
- d = min(d, dot(r,r));
- }
- }
- return d; // Range: [0, 1]
- }
- floatnoiseLayers(in vec3 p) {
- vec3 t = vec3(0., 0., p.z + iTime*1.5);
- constint iter = 5; // Just five layers is enough.
- float tot = 0., sum = 0., amp = 1.;
- for (int i = 0; i < iter; i++) {
- tot += voronoi(p + t) * amp;
- p *= 2.;
- t *= 1.5;
- sum += amp;
https://xiaozhuanlan.com/topic/
标签:glsl,claygl,float,hash33,Claygl,Arcgis,gismap4,vec3,dot From: https://www.cnblogs.com/haibalai/p/17328401.html