Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
s3xysteak committed May 22, 2024
2 parents 2dad778 + 9242937 commit d579486
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cesium-use",
"type": "module",
"version": "0.8.1",
"version": "0.8.2",
"private": false,
"description": "Vue powered CesiumJS utility library",
"author": "s3xysteak",
Expand Down
8 changes: 7 additions & 1 deletion src/core/composables/useWaterPlane/demo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { reactive, watchEffect } from 'vue'
import * as Cesium from 'cesium'
import WaterImage from './waterNormals.jpg'
import { useWaterPlane } from '.'
import { useViewer } from '~/index'
import { useViewer, defineColor } from '~/index'
const viewer = useViewer()
Expand Down Expand Up @@ -50,13 +50,15 @@ const form = reactive({
height: 10,
reflectivity: 0.15,
rippleSize: 100,
waterColor: '#020E12',
waterAlpha: 0.9,
distortionScale: 10,
})
watchEffect(() => {
primitive.height = form.height
primitive.reflectivity = form.reflectivity
primitive.rippleSize = form.rippleSize
primitive.waterColor = defineColor(form.waterColor)
primitive.waterAlpha = form.waterAlpha
primitive.distortionScale = form.distortionScale
})
Expand All @@ -80,6 +82,10 @@ function toggleShow() {
rippleSize:
<input v-model="form.rippleSize" input type="number">
</label>
<label>
waterColor:
<input v-model="form.waterColor" input type="color">
</label>
<label>
waterAlpha:
<input v-model="form.waterAlpha" input step="0.05" max="1" min="0" type="number">
Expand Down
2 changes: 2 additions & 0 deletions src/core/composables/useWaterPlane/index-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const form = reactive({
height: 10,
reflectivity: 0.15,
rippleSize: 100,
waterColor: '#020E12',
waterAlpha: 0.9,
distortionScale: 10,
})
watchEffect(() => {
primitive.height = form.height
primitive.reflectivity = form.reflectivity
primitive.rippleSize = form.rippleSize
primitive.waterColor = defineColor(form.waterColor)
primitive.waterAlpha = form.waterAlpha
primitive.distortionScale = form.distortionScale
})
Expand Down
2 changes: 2 additions & 0 deletions src/core/composables/useWaterPlane/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ const form = reactive({
height: 10,
reflectivity: 0.15,
rippleSize: 100,
waterColor: '#020E12',
waterAlpha: 0.9,
distortionScale: 10,
})
watchEffect(() => {
primitive.height = form.height
primitive.reflectivity = form.reflectivity
primitive.rippleSize = form.rippleSize
primitive.waterColor = defineColor(form.waterColor)
primitive.waterAlpha = form.waterAlpha
primitive.distortionScale = form.distortionScale
})
Expand Down
8 changes: 8 additions & 0 deletions src/core/composables/useWaterPlane/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,14 @@ class WaterPrimitive {
this._material!.uniforms.size = val
}

get waterColor() {
return this._material!.uniforms.waterColor
}

set waterColor(val) {
this._material!.uniforms.waterColor = val
}

get waterAlpha() {
return this._material!.uniforms.waterAlpha
}
Expand Down

0 comments on commit d579486

Please sign in to comment.