Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cesium-frame
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jlc
cesium-frame
Commits
db9e408f
Commit
db9e408f
authored
Jul 24, 2024
by
jlc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:添加雾的场景
parent
38e513e6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
3 deletions
+67
-3
Fog.png
src/assets/Fog.png
+0
-0
CodeMap.js
src/examples/CodeMap.js
+3
-1
FunctionMap.js
src/examples/FunctionMap.js
+3
-1
fog-function.js
src/examples/fog-function.js
+42
-0
fog.vue
src/examples/fog.vue
+18
-0
ElementMap.js
src/views/ElementMap.js
+1
-1
No files found.
src/assets/Fog.png
0 → 100644
View file @
db9e408f
633 KB
src/examples/CodeMap.js
View file @
db9e408f
...
...
@@ -4,6 +4,7 @@ import vueCodePlane from '@/examples/plane.vue?raw'
import
vueCodeRain
from
'@/examples/rain.vue?raw'
import
vueCodeSnow
from
'@/examples/snow.vue?raw'
import
vueCodeFog
from
'@/examples/fog.vue?raw'
const
vueCodeMap
=
{
点
:
vueCodePoint
,
...
...
@@ -11,7 +12,8 @@ const vueCodeMap = {
多面
:
vueCodePlane
,
雨
:
vueCodeRain
,
雪
:
vueCodeSnow
雪
:
vueCodeSnow
,
雾
:
vueCodeFog
}
export
function
findVueCodeById
(
id
){
...
...
src/examples/FunctionMap.js
View file @
db9e408f
...
...
@@ -4,6 +4,7 @@ import functionCodePlane from '@/examples/plane-function.js?raw'
import
functionCodeRain
from
'@/examples/rain-function.js?raw'
import
functionCodeSnow
from
'@/examples/snow-function.js?raw'
import
functionCodeFog
from
'@/examples/fog-function.js?raw'
const
functionCodeMap
=
{
点
:
functionCodePoint
,
...
...
@@ -11,7 +12,8 @@ const functionCodeMap = {
多面
:
functionCodePlane
,
雨
:
functionCodeRain
,
雪
:
functionCodeSnow
雪
:
functionCodeSnow
,
雾
:
functionCodeFog
}
export
function
findFunctionCodeById
(
id
){
...
...
src/examples/fog-function.js
0 → 100644
View file @
db9e408f
export
function
addFog
()
{
const
script
=
document
.
createElement
(
'script'
);
script
.
src
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Cesium.js'
;
script
.
onload
=
()
=>
{
window
.
Cesium
.
Ion
.
defaultAccessToken
=
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI3Njg4ZWU5Yi1iZDhiLTRhYmUtOTRiYS04YjM5NmUwNjVmMDMiLCJpZCI6MjI3MzQ3LCJpYXQiOjE3MjA1MjA4Mjh9.E5XW4LnwgfVAaBC-znaYr61m4yK0-j2qEQhi9qwFFPE'
const
viewer
=
new
window
.
Cesium
.
Viewer
(
'cesiumContainer'
,
{
infoBox
:
false
,
});
viewer
.
scene
.
postProcessStages
.
add
(
new
Cesium
.
PostProcessStage
({
fragmentShader
:
`
uniform sampler2D colorTexture;
uniform sampler2D depthTexture;
uniform float visibility;
uniform vec4 fogColor;
in vec2 v_textureCoordinates;
out vec4 fragColor;
void main(void)
{
vec4 origcolor = texture(colorTexture, v_textureCoordinates);
float depth = czm_readDepth(depthTexture, v_textureCoordinates);
vec4 depthcolor = texture(depthTexture, v_textureCoordinates);
float f = visibility * (depthcolor.r - 0.3) / 0.2;
if (f < 0.0) f = 0.0;
else if (f > 1.0) f = 1.0;
fragColor = mix(origcolor, fogColor, f);
}
`
,
uniforms
:
{
visibility
:
0.1
,
fogColor
:
new
Cesium
.
Color
(
0.8
,
0.8
,
0.8
,
0.8
),
},
}));
};
document
.
head
.
appendChild
(
script
);
const
link
=
document
.
createElement
(
'link'
);
link
.
rel
=
'stylesheet'
;
link
.
href
=
'https://cesium.com/downloads/cesiumjs/releases/1.119/Build/Cesium/Widgets/widgets.css'
;
document
.
head
.
appendChild
(
link
);
}
src/examples/fog.vue
0 → 100644
View file @
db9e408f
<
template
>
<div
id=
"cesiumContainer"
class=
"cesium-container"
></div>
</
template
>
<
script
setup
>
import
{
onMounted
}
from
'vue'
;
import
{
addFog
}
from
'./function'
;
onMounted
(()
=>
{
addFog
()
});
</
script
>
<
style
>
.cesium-container
{
width
:
100%
;
height
:
100vh
;
}
</
style
>
\ No newline at end of file
src/views/ElementMap.js
View file @
db9e408f
...
...
@@ -24,7 +24,7 @@ export const elementWeatherMap = {
},
Three
:
{
title
:
'雾'
,
pngUrl
:
'/src/assets/
Line
.png'
pngUrl
:
'/src/assets/
Fog
.png'
},
Four
:
{
title
:
'水面'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment