|
1 |
| -import { createCommentVNode, defineComponent, getCurrentInstance, onUnmounted, PropType, watch, WatchStopHandle } from 'vue' |
| 1 | +import { createCommentVNode, defineComponent, getCurrentInstance, onUnmounted, PropType, toRaw, watch, WatchStopHandle } from 'vue' |
2 | 2 | import type { VcColor, VcComponentInternalInstance } from '@vue-cesium/utils/types'
|
3 | 3 | import { useCommon } from '@vue-cesium/composables'
|
4 | 4 | import { scene } from '@vue-cesium/utils/cesium-props'
|
5 | 5 | import { kebabCase } from '@vue-cesium/utils/util'
|
6 | 6 | import { commonEmits } from '@vue-cesium/utils/emits'
|
7 | 7 | import { Viewshed } from '@vue-cesium/shared'
|
8 |
| -import { makeColor } from '@vue-cesium/utils/cesium-helpers' |
| 8 | +import { makeCartesian3, makeColor } from '@vue-cesium/utils/cesium-helpers' |
9 | 9 | import fragmentShader from '@vue-cesium/shared/shaders/Viewshed'
|
10 | 10 |
|
11 | 11 | export const viewshedProps = {
|
@@ -82,7 +82,8 @@ export default defineComponent({
|
82 | 82 | if (!instance.mounted) {
|
83 | 83 | return
|
84 | 84 | }
|
85 |
| - updateViewshed(newStartPosition, newEndPosition) |
| 85 | + |
| 86 | + updateViewshed(makeCartesian3(toRaw(newStartPosition)), makeCartesian3(toRaw(newEndPosition))) |
86 | 87 | },
|
87 | 88 | {
|
88 | 89 | deep: true
|
@@ -219,7 +220,6 @@ export default defineComponent({
|
219 | 220 | invisibleColor: makeColor(props.invisibleColor),
|
220 | 221 | showGridLine: props.showGridLine
|
221 | 222 | })
|
222 |
| - |
223 | 223 | ;(viewshed._viewshedShadowMap as any).cascadesEnabled = false
|
224 | 224 | viewshed._viewshedShadowMap.softShadows = false
|
225 | 225 | viewshed._viewshedShadowMap.normalOffset = false
|
@@ -248,7 +248,7 @@ export default defineComponent({
|
248 | 248 | shaderSourceText = shaderSourceText.replace(/out_FragColor/g, 'gl_FragColor')
|
249 | 249 | }
|
250 | 250 |
|
251 |
| - updateViewshed(props.startPosition, props.endPosition) |
| 251 | + updateViewshed(makeCartesian3(toRaw(props.startPosition)), makeCartesian3(toRaw(props.endPosition))) |
252 | 252 | attachedViewshedStage = new PostProcessStage({
|
253 | 253 | fragmentShader: props.fragmentShader || shaderSourceText,
|
254 | 254 | uniforms: props.uniforms || {
|
@@ -333,6 +333,7 @@ export default defineComponent({
|
333 | 333 |
|
334 | 334 | const updateViewshed = (startPosition, endPosition) => {
|
335 | 335 | const viewshed = instance.cesiumObject as Viewshed
|
| 336 | + |
336 | 337 | const { Cartesian3 } = Cesium
|
337 | 338 | let diffrence = Cartesian3.subtract(endPosition, startPosition, new Cartesian3())
|
338 | 339 | const magnitudeSquared = Cartesian3.magnitudeSquared(diffrence)
|
|
0 commit comments