我决定不从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;
- constfloat PI = 3.14159265359;
- uniform vec2 windowSize: WINDOW_SIZE;
- varying vec2 vUv;
- floatrandom(float p){
- return fract(sin(p) * 10000.0);
- }
- floatnoise(vec2 p){
- float t = iTime / 2000.0;
- if(t > 1.0) t -= floor(t);
- return random(p.x * 14. + p.y * sin(t) * 0.5);
- }
- vec2 sw(vec2 p){
- return vec2(floor(p.x), floor(p.y));
- }
- vec2 se(vec2 p){
- return vec2(ceil(p.x), floor(p.y));
- }
- vec2 nw(vec2 p){
- return vec2(floor(p.x), ceil(p.y));
- }
- vec2 ne(vec2 p){
- return vec2(ceil(p.x), ceil(p.y));
- }
- floatsmoothNoise(vec2 p){
- vec2 inter = smoothstep(0.0, 1.0, fract(p));
- float s = mix(noise(sw(p)), noise(se(p)), inter.x);
- float n = mix(noise(nw(p)), noise(ne(p)), inter.x);
- return mix(s, n, inter.y);
- }
- mat2 rotate (infloat theta){
- float c = cos(theta);
- float s = sin(theta);
Arcgis 与 Claygl 可视化 glsl 特效篇(一) - 小专栏
标签:glsl,claygl,return,floor,float,Claygl,Arcgis,vec2,可视化 From: https://www.cnblogs.com/haibalai/p/17328397.html