我决定不从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 =
- `
- #ifdef GL_ES
- precision mediump float;
- #endif
- // glslsandbox uniforms
- uniform float time;
- vec2 resolution = vec2(1.0,1.0);
- varying vec2 vUv;
- // shadertoy emulation
- #define iTime time
- #define iResolution resolution
- floatnoise(vec3 p) //Thx to Las^Mercury
- {
- vec3 i = floor(p);
- vec4 a = dot(i, vec3(1., 57., 21.)) + vec4(0., 57., 21., 78.);
- vec3 f = cos((p-i)*acos(-1.))*(-.5)+.5;
- a = mix(sin(cos(a)*a),sin(cos(1.+a)*(1.+a)), f.x);
- a.xy = mix(a.xz, a.yw, f.y);
- return mix(a.x, a.y, f.z);
https://xiaozhuanlan.com/topic/
标签:glsl,haibalai,cos,babylonjs,js,cesium,vec2,vec3,Cesium From: https://www.cnblogs.com/haibalai/p/17219822.html