Bläddra i källkod

add globe filterColor

tags/2.10.0
Caven Chen 3 år sedan
förälder
incheckning
4b0d258f11
1 ändrade filer med 8 tillägg och 10 borttagningar
  1. 8
    10
      modules/option/ViewerOption.js

+ 8
- 10
modules/option/ViewerOption.js Visa fil

@@ -132,18 +132,16 @@ class ViewerOption {

if (globeOption?.filterColor) {
let filterColor = globeOption?.filterColor

let globeFS = globe._surfaceShaderSet.baseFragmentShaderSource
let oriShder = globeFS.sources[globeFS.sources.length - 1]
globeFS.sources[globeFS.sources.length - 1] = oriShder
.replace(
'gl_FragColor = finalColor;',
`gl_FragColor = finalColor * vec4(${filterColor.red},${filterColor.green},${filterColor.blue},${filterColor.alpha});`
)
.replace(
/^gl_FragColor = finalColor[ * vec4([(\d.\d),?]+\)]?$/,
`gl_FragColor = finalColor * vec4(${filterColor.red},${filterColor.green},${filterColor.blue},${filterColor.alpha});`
)
globeFS.sources[globeFS.sources.length - 1] = oriShder.replace(
'gl_FragColor = finalColor;',
`gl_FragColor = finalColor * vec4(${filterColor.red.toFixed(
2
)},${filterColor.green.toFixed(2)},${filterColor.blue.toFixed(
2
)},${filterColor.alpha.toFixed(2)});`
)
}

return this

Laddar…
Avbryt
Spara