Ver código fonte

add globe filterColor

tags/2.10.0
Caven Chen 3 anos atrás
pai
commit
4b0d258f11
1 arquivos alterados com 8 adições e 10 exclusões
  1. 8
    10
      modules/option/ViewerOption.js

+ 8
- 10
modules/option/ViewerOption.js Ver arquivo

@@ -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

Carregando…
Cancelar
Salvar