我决定不从Babylonjs 基础来讲了 直接整合cesium与babylonjs可视化来讲
我整合一个类库 后续不断更新中
- npm i @haibalai/cesium-babylonjs
初始化cesium -babylonjs 类库, map 是cesium 的viewer对象
- import { BabylonMapManager } from "@haibalai/cesium-babylonjs";
- BabylonMapManager.init(map);
添加特效
- import { BabylonMapManager } from "@haibalai/cesium-babylonjs";
- const fragmentShader = `
- uniform float iTime;
- varying vec2 vUv;
- vec3 hsb2rgb(in vec3 c)
- {
- vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
- 6.0)-3.0)-1.0,
- 0.0,
- 1.0 );
- rgb = rgb*rgb*(3.0-2.0*rgb);
- return c.z * mix( vec3(1.0), rgb, c.y);
- }
- voidmain(void) {
- // float time = iTime*1.;
- vec2 uv = (vUv - 0.5) * 4.0;
- float r = length(uv) * 0.9;
- vec3 color = hsb2rgb(vec3(0.24, 0.7, 0.4));
- float a = pow(r, 2.0);
- float b = sin(r * 0.8 - 1.6);
- float c = sin(r - 0.010);
Cesium 与 Babylon.js 可视化 glsl 特效篇(三十二) - 小专栏
标签:glsl,babylonjs,float,js,cesium,rgb,可视化,vec3,Cesium From: https://www.cnblogs.com/haibalai/p/17219799.html