我决定不从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;
- const vec2 iResolution = vec2(1.0,1.0);
- varying vec2 vUv;
- floathash(float x)
- {
- return fract(21654.6512 * sin(385.51 * x));
- }
- floathash(vec2 p)
- {
- return fract(21654.65155 * sin(35.51 * p.x + 45.51 * p.y));
- }
- floatlhash(float x, float y)
- {
- float h = 0.0;
- for(int i = 0;i < 5;i++)
- {
- h += (fract(21654.65155 * float(i) * sin(35.51 * x + 45.51 * float(i) * y * (5.0 / float(i))))* 2.0 - 1.0) / 10.0;
- }
- return h / 5.0 + 0.02;
- return (fract(21654.65155 * sin(35.51 * x + 45.51 * y))* 2.0 - 1.0) / 20.0;
- }
- floatnoise(vec2 p)
- {
- vec2 fl = floor(p);
- vec2 fr = fract(p);
- fr.x = smoothstep(0.0,1.0,fr.x);
- fr.y = smoothstep(0.0,1.0,fr.y);
- float a = mix(hash(fl + vec2(0.0,0.0)), hash(fl + vec2(1.0,0.0)),fr.x);
- float b = mix(hash(fl + vec2(0.0,1.0)), hash(fl + vec2(1.0,1.0)),fr.x);
Arcgis 与 Claygl 可视化 glsl 特效篇(三十) - 小专栏
标签:glsl,claygl,fr,1.0,0.0,float,Claygl,Arcgis,vec2 From: https://www.cnblogs.com/haibalai/p/17349651.html