{"version":3,"file":"index.mjs","sources":["../../../../../../packages/components/primitives/primitive/index.ts"],"sourcesContent":["/*\n * @Author: zouyaoji@https://github.com/zouyaoji\n * @Date: 2021-09-16 09:28:13\n * @LastEditTime: 2022-03-28 09:46:50\n * @LastEditors: zouyaoji\n * @Description:\n * @FilePath: \\vue-cesium@next\\packages\\components\\primitives\\primitive\\index.ts\n */\nimport { createCommentVNode, defineComponent, getCurrentInstance, h, Ref, VNode } from 'vue'\nimport type { VcAppearance, VcComponentInternalInstance, VcComponentPublicInstance, VcPickEvent, VcReadyObject } from '@vue-cesium/utils/types'\nimport { usePrimitives } from '@vue-cesium/composables'\nimport {\n  geometryInstances,\n  appearance,\n  depthFailAppearance,\n  show,\n  modelMatrix,\n  vertexCacheOptimize,\n  interleave,\n  compressVertices,\n  releaseGeometryInstances,\n  allowPicking,\n  asynchronous,\n  debugShowBoundingVolume,\n  shadows,\n  enableMouseEvent\n} from '@vue-cesium/utils/cesium-props'\nimport { kebabCase } from '@vue-cesium/utils/util'\nimport { hSlot } from '@vue-cesium/utils/private/render'\nimport { primitiveEmits } from '@vue-cesium/utils/emits'\n\nexport const primitiveProps = {\n  ...geometryInstances,\n  ...appearance,\n  ...depthFailAppearance,\n  ...show,\n  ...modelMatrix,\n  ...vertexCacheOptimize,\n  ...interleave,\n  ...compressVertices,\n  ...releaseGeometryInstances,\n  ...allowPicking,\n  cull: {\n    type: Boolean,\n    default: true\n  },\n  ...asynchronous,\n  ...debugShowBoundingVolume,\n  ...shadows,\n  ...enableMouseEvent\n}\nexport default defineComponent({\n  name: 'VcPrimitive',\n  props: primitiveProps,\n  emits: primitiveEmits,\n  setup(props, ctx) {\n    // state\n    const instance = getCurrentInstance() as VcComponentInternalInstance\n    instance.cesiumClass = 'Primitive'\n    usePrimitives(props, ctx, instance)\n\n    const name = instance.proxy?.$options.name || ''\n    return () =>\n      ctx.slots.default\n        ? h(\n            'i',\n            {\n              class: kebabCase(name),\n              style: { display: 'none !important' }\n            },\n            hSlot(ctx.slots.default)\n          )\n        : createCommentVNode(kebabCase(instance.proxy?.$options.name || ''))\n  }\n})\n\nexport type VcPrimitiveProps = {\n  /**\n   * The geometry instances - or a single geometry instance - to render.\n   */\n  geometryInstances?: Cesium.GeometryInstance | Array<Cesium.GeometryInstance>\n  /**\n   * The appearance used to render the primitive.\n   */\n  appearance?: VcAppearance\n  /**\n   * The appearance used to shade this primitive when it fails the depth test.\n   */\n  depthFailAppearance?: VcAppearance\n  /**\n   * Determines if this primitive will be shown.\n   * Default value: true\n   */\n  show?: boolean\n  /**\n   * The 4x4 transformation matrix that transforms the primitive (all geometry instances) from model to world coordinates.\n   */\n  modelMatrix?: Cesium.Matrix4\n  /**\n   * When true, geometry vertices are optimized for the pre and post-vertex-shader caches.\n   * Default value: false\n   */\n  vertexCacheOptimize?: boolean\n  /**\n   * When true, geometry vertex attributes are interleaved, which can slightly improve rendering performance but increases load time.\n   * Default value: false\n   */\n  interleave?: boolean\n  /**\n   * When true, the geometry vertices are compressed, which will save memory.\n   * Default value: true\n   */\n  compressVertices?: boolean\n  /**\n   * When true, the primitive does not keep a reference to the input geometryInstances to save memory.\n   * Default value: true\n   */\n  releaseGeometryInstances?: boolean\n  /**\n   * When true, each geometry instance will only be pickable with Scene#pick. When false, GPU memory is saved.\n   * Default value: true\n   */\n  allowPicking?: boolean\n  /**\n   * When true, the renderer frustum culls and horizon culls the primitive's commands based on their bounding volume. Set this to false for a small performance gain if you are manually culling the primitive.\n   * Default value: true\n   */\n  cull?: boolean\n  /**\n   * Determines if the primitive will be created asynchronously or block until ready.\n   * Default value: true\n   */\n  asynchronous?: boolean\n  /**\n   * For debugging only. Determines if this primitive's commands' bounding spheres are shown.\n   */\n  debugShowBoundingVolume?: boolean\n  /**\n   * Determines whether this primitive casts or receives shadows from light sources.\n   */\n  shadows?: number\n  /**\n   * Specifies whether to respond to mouse pick events.\n   * Default Value: true\n   */\n  enableMouseEvent?: boolean\n  /**\n   * Triggers before the component is loaded.\n   */\n  onBeforeLoad?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the component is successfully loaded.\n   */\n  onReady?: (readyObject: VcReadyObject) => void\n  /**\n   * Triggers when the component load failed.\n   */\n  onUnready?: (e: any) => void\n  /**\n   * Triggers when the component is destroyed.\n   */\n  onDestroyed?: (instance: VcComponentInternalInstance) => void\n  /**\n   * Triggers when the mouse is pressed on this primitive.\n   */\n  onMousedown?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse bounces up on this primitive.\n   */\n  onMouseup?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks on this primitive.\n   */\n  onClick?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse clicks outside this primitive.\n   */\n  onClickout?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the left mouse button double-clicks this primitive.\n   */\n  onDblclick?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves on this primitive.\n   */\n  onMousemove?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves over to this primitive.\n   */\n  onMouseover?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the mouse moves out of this primitive.\n   */\n  onMouseout?: (evt: VcPickEvent) => void\n  /**\n   * Triggers when the primitive is ready to render.\n   */\n  onReadyPromise?: (primitive: Cesium.Primitive, viewer: Cesium.Viewer, instance: VcComponentPublicInstance) => void\n  'onUpdate:geometryInstances'?: (instances: Array<Cesium.GeometryInstance>) => void\n}\n\nexport interface VcPrimitiveRef extends VcComponentPublicInstance<VcPrimitiveProps> {\n  /**\n   * private but needed by VcGeometryInstance\n   * @param geometryInstance\n   * @param index\n   */\n  __updateGeometryInstances?(geometryInstance: Cesium.GeometryInstance, index: number): boolean\n  /**\n   * private but needed by VcGeometryInstance\n   * @param geometryInstance\n   */\n  __removeGeometryInstances?(geometryInstance: Cesium.GeometryInstance): boolean\n  /**\n   * private but needed by VcGeometryInstance\n   */\n  __childCount?: Ref<number>\n}\n\nexport interface VcPrimitiveSlots {\n  /**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