3
3
* @Date : 2023-08-18 00:56:13
4
4
* @Description : Do not edit
5
5
* @LastEditors : zouyaoji 370681295@qq.com
6
- * @LastEditTime : 2023-08-18 01:15:38
6
+ * @LastEditTime : 2023-10-31 19:38:24
7
7
* @FilePath : \vue-cesium\packages\shared\extends\materials\MaterialExtend.ts
8
8
*/
9
9
10
10
import { VcCircleWaveMaterial , VcLineFlowMaterial } from '@vue-cesium/shared/shaders/materials'
11
11
12
12
let isExtended = false
13
13
export default class MaterialExtend {
14
- static extend ( viewer ? : Cesium . Viewer ) {
14
+ static extend ( viewer : Cesium . Viewer ) {
15
15
if ( isExtended ) {
16
16
return
17
17
}
18
18
19
19
const { Material, Color, Cartesian2 } = Cesium
20
+ const webgl2 = ( viewer as any ) . context ?. webgl2
21
+
22
+ let shaderSourceTextVcLine = VcLineFlowMaterial
23
+ let shaderSourceTextVcCircle = VcCircleWaveMaterial
24
+
25
+ if ( ! webgl2 ) {
26
+ shaderSourceTextVcLine = shaderSourceTextVcLine . replace ( / t e x t u r e \( / g, 'texture2D(' )
27
+ shaderSourceTextVcCircle = shaderSourceTextVcCircle . replace ( / t e x t u r e \( / g, 'texture2D(' )
28
+ }
20
29
21
30
/**
22
31
* Gets the name of the VcCircleWave material.
@@ -33,7 +42,7 @@ export default class MaterialExtend {
33
42
count : 1 ,
34
43
gradient : 0.1
35
44
} ,
36
- source : VcCircleWaveMaterial
45
+ source : shaderSourceTextVcCircle
37
46
} ,
38
47
translucent ( ) {
39
48
return true
@@ -62,7 +71,7 @@ export default class MaterialExtend {
62
71
color2 : new Color ( 1 , 1 , 1 ) ,
63
72
globalAlpha : 1
64
73
} ,
65
- source : VcLineFlowMaterial
74
+ source : shaderSourceTextVcLine
66
75
} ,
67
76
translucent ( ) {
68
77
return true
0 commit comments