首页 > 其他分享 >Arcgis 与 Claygl 可视化 glsl 特效篇(四)

Arcgis 与 Claygl 可视化 glsl 特效篇(四)

时间:2023-03-25 12:06:38浏览次数:36  
标签:glsl claygl cos 1.0 float Claygl Arcgis vec2 pts


我决定不从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 ratio;
 float PI2 = 6.28318530718;
 float PI = 3.1416;
 varying vec2 vUv;
 uniform float iTime;
 const vec2 iResolution = vec2(1.0,1.0);
 floatvorocloud(vec2 p){
 float f = 0.0;
 vec2 pp = cos(vec2(p.x * 14.0, (16.0 * p.y + cos(floor(p.x * 30.0)) + iTime * PI2)) );
 p = cos(p * 12.1 + pp * 10.0 + 0.5 * cos(pp.x * 10.0));
 vec2 pts[4];
 pts[0] = vec2(0.5, 0.6);
 pts[1] = vec2(-0.4, 0.4);
 pts[2] = vec2(0.2, -0.7);
 pts[3] = vec2(-0.3, -0.4);
 float d = 5.0;
 for(int i = 0; i < 4; i++){
 pts[i].x += 0.03 * cos(float(i)) + p.x;
 pts[i].y += 0.03 * sin(float(i)) + p.y;
 d = min(d, distance(pts[i], pp));
 }
 f = 2.0 * pow(1.0 - 0.3 * d, 13.0);
 f = min(f, 1.0);
 return f;
 }
 vec4 scene(vec2 UV){
 float x = UV.x;
 float y = UV.y;
 vec2 p = vec2(x, y) - vec2(0.5);
 vec4 col = vec4(0.0);
 col.g += 0.02;


Arcgis 与 Claygl 可视化 glsl 特效篇(四) - 小专栏


标签:glsl,claygl,cos,1.0,float,Claygl,Arcgis,vec2,pts
From: https://blog.51cto.com/u_15142957/6149121

相关文章