-
-
Notifications
You must be signed in to change notification settings - Fork 335
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(components): 🐛 crashing when enabling webgl2 in the new version o…
…f Cesium
- Loading branch information
Showing
12 changed files
with
150 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
/* | ||
* @Author: zouyaoji@https://github.com/zouyaoji | ||
* @Date: 2021-10-28 09:20:11 | ||
* @LastEditTime: 2021-10-28 15:46:30 | ||
* @LastEditors: zouyaoji | ||
* @LastEditTime: 2023-06-12 20:22:45 | ||
* @LastEditors: zouyaoji [email protected] | ||
* @Description: | ||
* @FilePath: \vue-cesium@next\packages\components\overlays\wind\glsl\postProcessingPosition.frag.ts | ||
*/ | ||
const text = ` | ||
uniform sampler2D nextParticlesPosition; | ||
uniform sampler2D particlesSpeed; // (u, v, w, norm) | ||
|
@@ -18,7 +19,7 @@ uniform float randomCoefficient; // use to improve the pseudo-random generator | |
uniform float dropRate; // drop rate is a chance a particle will restart at random position to avoid degeneration | ||
uniform float dropRateBump; | ||
varying vec2 v_textureCoordinates; | ||
in vec2 v_textureCoordinates; | ||
// pseudo-random generator | ||
const vec3 randomConstants = vec3(12.9898, 78.233, 4375.85453); | ||
|
@@ -43,8 +44,8 @@ bool particleOutbound(vec3 particle) { | |
} | ||
void main() { | ||
vec3 nextParticle = texture2D(nextParticlesPosition, v_textureCoordinates).rgb; | ||
vec4 nextSpeed = texture2D(particlesSpeed, v_textureCoordinates); | ||
vec3 nextParticle = texture(nextParticlesPosition, v_textureCoordinates).rgb; | ||
vec4 nextSpeed = texture(particlesSpeed, v_textureCoordinates); | ||
float speedNorm = nextSpeed.a; | ||
float particleDropRate = dropRate + dropRateBump * speedNorm; | ||
|
@@ -54,9 +55,9 @@ void main() { | |
float randomNumber = rand(seed2, normalRange); | ||
if (randomNumber < particleDropRate || particleOutbound(nextParticle)) { | ||
gl_FragColor = vec4(randomParticle, 1.0); // 1.0 means this is a random particle | ||
out_FragColor = vec4(randomParticle, 1.0); // 1.0 means this is a random particle | ||
} else { | ||
gl_FragColor = vec4(nextParticle, 0.0); | ||
out_FragColor = vec4(nextParticle, 0.0); | ||
} | ||
} | ||
` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
/* | ||
* @Author: zouyaoji@https://github.com/zouyaoji | ||
* @Date: 2021-10-28 09:20:11 | ||
* @LastEditTime: 2021-10-28 09:37:17 | ||
* @LastEditors: zouyaoji | ||
* @LastEditTime: 2023-06-12 18:10:22 | ||
* @LastEditors: zouyaoji [email protected] | ||
* @Description: | ||
* @FilePath: \vue-cesium@next\packages\components\overlays\wind\glsl\screenDraw.frag.ts | ||
*/ | ||
const text = ` | ||
uniform sampler2D trailsColorTexture; | ||
uniform sampler2D trailsDepthTexture; | ||
varying vec2 textureCoordinate; | ||
in vec2 textureCoordinate; | ||
void main() { | ||
vec4 trailsColor = texture2D(trailsColorTexture, textureCoordinate); | ||
float trailsDepth = texture2D(trailsDepthTexture, textureCoordinate).r; | ||
float globeDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, textureCoordinate)); | ||
vec4 trailsColor = texture(trailsColorTexture, textureCoordinate); | ||
float trailsDepth = texture(trailsDepthTexture, textureCoordinate).r; | ||
float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, textureCoordinate)); | ||
if (trailsDepth < globeDepth) { | ||
gl_FragColor = trailsColor; | ||
out_FragColor = trailsColor; | ||
} else { | ||
gl_FragColor = vec4(0.0); | ||
out_FragColor = vec4(0.0); | ||
} | ||
} | ||
` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.