Class MeshEntity

mesh实体

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

_app?: App
_bloomRef: Ref<boolean>

是否辉光

_boxHelperObject: BoxHelper
_boxHelperRef: Ref<boolean>

是否显示包围盒

_childrens: Entity[] = []
_destroyed: boolean = false
_isDisposed?: boolean

是否已销毁

_matrixRef: Matrix4

本地矩阵响应式对象

_matrixWorldRef: Matrix4

世界矩阵响应式对象

_node: Object3D<Object3DEventMap>
_outlineRef: Ref<boolean>

是否描边效果

_ownerScene?: Scene
_pointerEventsRef: Ref<boolean>
_positionRef: Vector3

位置响应式对象

_quaternionRef: Quaternion

四元数响应式对象

_rayIntersectRecursive?: boolean

拾取时是否遍历子对象 默认为true

_rayQueryType?: RayQueryType

射线查询类型 默认为1

_rotationRef: Euler

旋转响应式对象

_scaleRef: Vector3

缩放响应式对象

_sceneData?: Record<string, any> = {}
_selectedRef: Ref<boolean>

是否选中

_visualRef: Ref<boolean>

可视响应式对象

addEdges: ((option?, isHideMesh?) => void)

增加模型边框线

Type declaration

    • (option?, isHideMesh?): void
    • 增加模型边框线

      Parameters

      • Optional option: LineBasicMaterialParameters
      • Optional isHideMesh: boolean

        是否隐藏mesh本身(默认false)

      Returns void

Param: option

Param: isHideMesh

是否隐藏mesh本身(默认false)

clearEdges: (() => void)

移除模型边框线

Type declaration

    • (): void
    • 移除模型边框线

      Returns void

clearHighlight: (() => void)

清除高亮

Type declaration

    • (): void
    • 清除高亮

      Returns void

data: ShallowReactive<{
    [key: string]: any;
}> = ...

Type declaration

  • [key: string]: any
entityType: string = "Entity"

实体类型

extData: {
    [key: string]: any;
} = {}

Type declaration

  • [key: string]: any
getEdges: (() => any)

获取模型边框线

Type declaration

    • (): any
    • 获取模型边框线

      Returns any

highlightMaterial: (() => Material | Material[])

获取高亮材质

Type declaration

    • (): Material | Material[]
    • 获取高亮材质

      Returns Material | Material[]

instanceId: number = ++AppObject._instanceIdCounter
isEntity: boolean = true
isHighlight: (() => boolean)

是否高亮

Type declaration

    • (): boolean
    • 是否高亮

      Returns boolean

material: Material | Material[]

获取可修改的材质对象

mesh: Mesh<BufferGeometry<NormalBufferAttributes>, Material | Material[], Object3DEventMap>

mesh对象

moduleManager: ModuleManager = ...
nativeMaterial: (() => Material | Material[])

获取最开始的原生材质,为空表示没有修改过

Type declaration

    • (): Material | Material[]
    • 获取最开始的原生材质,为空表示没有修改过

      Returns Material | Material[]

onSetApp: Signal = ...
opacityMaterial: (() => Material | Material[])

获取透明度材质

Type declaration

    • (): Material | Material[]
    • 获取透明度材质

      Returns Material | Material[]

options: EntityOptions
rayIntersectObject?: Object3D<Object3DEventMap>

拾取时实体对象,默认为entity.node

replaceMaterial: ((material) => void)

替换材质

Type declaration

    • (material): void
    • 替换材质

      Parameters

      • material: Material | Material[]

      Returns void

resetMaterial: (() => void)

恢复材质

Type declaration

    • (): void
    • 恢复材质

      Returns void

setHeatmapDataMaterial: ((options) => Promise<{
    lut: Lut;
    material: ShaderMaterial;
    reset: (() => void);
}>)

设置热力图数据分析材质

Type declaration

    • (options): Promise<{
          lut: Lut;
          material: ShaderMaterial;
          reset: (() => void);
      }>
    • 设置热力图数据分析材质

      Parameters

      • options: {
            colorCount?: number;
            colorMap?: [number, number][];
            data: {
                value: number;
                x: number;
                y: number;
                z: number;
            }[];
            dataMax?: number;
            dataMin?: number;
            interpolation?: {
                alpha?: number;
                model?: "circle" | "linear" | "gaussian" | "exponential" | "spherical";
                power?: number;
                sigma2?: number;
                useInvDistWeight?: boolean;
            };
            segmentX?: number;
            segmentY?: number;
            segmentZ?: number;
        }
        • Optional colorCount?: number

          颜色表分的总数 默认100

        • Optional colorMap?: [number, number][]

          颜色表[值(0-1),颜色],默认为 [[ 0.0, 0x0000FF ], [ 0.2, 0x00FFFF ], [ 0.5, 0x00FF00 ], [ 0.8, 0xFFFF00 ], [ 1.0, 0xFF0000 ]]

        • data: {
              value: number;
              x: number;
              y: number;
              z: number;
          }[]

          数据

        • Optional dataMax?: number

          数据最大值

        • Optional dataMin?: number

          数据最小值

        • Optional interpolation?: {
              alpha?: number;
              model?: "circle" | "linear" | "gaussian" | "exponential" | "spherical";
              power?: number;
              sigma2?: number;
              useInvDistWeight?: boolean;
          }

          插值选项

          • Optional alpha?: number

            Alpha α对应方差函数的先验值,此参数可能控制钻孔扩散范围,越小范围越大,少量点效果明显,但点多了且分布均匀以后改变该数字即基本无效果了,默认设置为100

          • Optional model?: "circle" | "linear" | "gaussian" | "exponential" | "spherical"

            模型 默认 exponential

          • Optional power?: number

            反距离幂指数,用于控制距离和权重之间的关系 缺省值2

          • Optional sigma2?: number

            sigma2是σ²,对应高斯过程的方差参数,也就是这组数据z的距离,方差参数σ²的似然性反映了高斯过程中的误差,并应手动设置。一般设置为 0 ,其他数值设了可能会出空白图

          • Optional useInvDistWeight?: boolean

            使用反距离权重插值法

        • Optional segmentX?: number

          x轴分段数 默认20

        • Optional segmentY?: number

          y轴分段数 默认20

        • Optional segmentZ?: number

          z轴分段数 默认20

      Returns Promise<{
          lut: Lut;
          material: ShaderMaterial;
          reset: (() => void);
      }>

setHighlight: ((color, opacity) => {})

设置高亮

Type declaration

    • (color, opacity): {}
    • 设置高亮

      Parameters

      • color: ColorRepresentation
      • opacity: number

      Returns {}

    setOpacity: ((opacity, isAccOpacity?) => void)

    设置透明度

    Type declaration

      • (opacity, isAccOpacity?): void
      • 设置透明度

        Parameters

        • opacity: number

          透明度0(完全透明)-1(不透明)

        • Optional isAccOpacity: boolean

          是否累加透明度(ture和之前透明度相乘,false直接设置透明度)

        Returns void

    Param: opacity

    透明度0(完全透明)-1(不透明)

    Param: isAccOpacity

    是否累加透明度(ture和之前透明度相乘,false直接设置透明度)

    signal: {
        onAdd: Signal;
        onBeforeAdd: Signal;
        onBeforeRemove: Signal;
        onKeyDown: Signal;
        onKeyUp: Signal;
        onMouseClick: Signal;
        onMouseDblClick: Signal;
        onMouseDown: Signal;
        onMouseEnter: Signal;
        onMouseLeave: Signal;
        onMouseMove: Signal;
        onMouseOut: Signal;
        onMouseOver: Signal;
        onMouseUp: Signal;
        onMouseWheel: Signal;
        onPointerDown: Signal;
        onPointerMove: Signal;
        onPointerUp: Signal;
        onRayIntersect: Signal;
        onRemove: Signal;
    } = ...

    Type declaration

    useMaterial: (() => Material | Material[])

    获取替换后的正使用的材质,为空表示没有修改过

    Type declaration

      • (): Material | Material[]
      • 获取替换后的正使用的材质,为空表示没有修改过

        Returns Material | Material[]

    uuid: string = ...
    defaultModules: (EntityModuleConstructor | [EntityModuleConstructor, any])[] = []

    Accessors

    • get app(): App
    • Returns App

    • set app(value): void
    • Parameters

      Returns void

    • get bloom(): boolean
    • Returns boolean

    • set bloom(val): void
    • Parameters

      • val: boolean

      Returns void

    • get bloomRef(): Ref<boolean>
    • Returns Ref<boolean>

    • get boxHelperRef(): Ref<boolean>
    • Returns Ref<boolean>

    • get castShadow(): boolean
    • Returns boolean

    • set castShadow(val): void
    • Parameters

      • val: boolean

      Returns void

    • get childrens(): Entity[]
    • Returns Entity[]

    • set childrens(child): void
    • Parameters

      Returns void

    • get destroyed(): boolean
    • Whether it has been destroyed.

      Returns boolean

    • get frustumCulled(): boolean
    • Returns boolean

    • set frustumCulled(val): void
    • Parameters

      • val: boolean

      Returns void

    • get isDisposed(): boolean
    • Returns boolean

    • get matrix(): Matrix4
    • Returns Matrix4

    • get matrixWorld(): Matrix4
    • Returns Matrix4

    • get node(): Object3D<Object3DEventMap>
    • Returns Object3D<Object3DEventMap>

    • set node(obj): void
    • Parameters

      • obj: Object3D<Object3DEventMap>

      Returns void

    • get outline(): boolean
    • Returns boolean

    • set outline(val): void
    • Parameters

      • val: boolean

      Returns void

    • get outlineRef(): Ref<boolean>
    • Returns Ref<boolean>

    • get parent(): Entity
    • Returns Entity

    • set parent(val): void
    • Parameters

      Returns void

    • get pointerEvents(): boolean
    • Returns boolean

    • set pointerEvents(b): void
    • Parameters

      • b: boolean

      Returns void

    • get pointerEventsRef(): Ref<boolean>
    • Returns Ref<boolean>

    • get position(): Vector3
    • Returns Vector3

    • get quaternion(): Quaternion
    • Returns Quaternion

    • get rayIntersectRecursive(): boolean
    • Returns boolean

    • set rayIntersectRecursive(b): void
    • Parameters

      • b: boolean

      Returns void

    • get rayQueryType(): RayQueryType
    • Returns RayQueryType

    • set rayQueryType(b): void
    • Parameters

      Returns void

    • get receiveShadow(): boolean
    • Returns boolean

    • set receiveShadow(val): void
    • Parameters

      • val: boolean

      Returns void

    • get rotation(): Euler
    • Returns Euler

    • get scale(): Vector3
    • Returns Vector3

    • get selected(): boolean
    • Returns boolean

    • set selected(val): void
    • Parameters

      • val: boolean

      Returns void

    • get selectedRef(): Ref<boolean>
    • Returns Ref<boolean>

    • get visible(): boolean
    • Returns boolean

    • set visible(val): void
    • Parameters

      • val: boolean

      Returns void

    • get visibleRef(): Ref<boolean>
    • Returns Ref<boolean>

    Methods

    • 增加模块,如果模块已存在,则返回之前的模型,等同于this.addModule(xxx)

      Type Parameters

      Parameters

      • type: (new (entity?, obj?) => T)
          • new (entity?, obj?): T
          • Parameters

            • Optional entity: any
            • Optional obj: U

            Returns T

      • Optional params: U

      Returns T

    • 增加一个自定义动作脚本

      Parameters

      • func: ((context) => void | BehaviorStatus)

        脚本函数

          • (context): void | BehaviorStatus
          • Parameters

            • context: {
                  elapsed: number;
                  entity: Entity;
                  timeDelta: number;
                  [key: string]: any;
              }
              • [key: string]: any
              • elapsed: number
              • entity: Entity
              • timeDelta: number

            Returns void | BehaviorStatus

      • Optional id: string

        脚本id

      Returns (() => void)

        • (): void
        • Returns void

    • Parameters

      • cb: Function

      Returns void

    • 增加模块,如果模块已存在,则返回之前的模型,等同于this.add(xxx)

      Type Parameters

      Parameters

      • type: (new (entity?, obj?) => T)

        模块类

          • new (entity?, obj?): T
          • Parameters

            • Optional entity: any
            • Optional obj: U

            Returns T

      • Optional params: U

        参数

      Returns T

    • Parameters

      • objs: Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[]

      Returns void

    • Parameters

      • toClassInst: any
      • Optional methodNames: string[]
      • Optional addMethods: string[]
      • Optional filterName: string[]

      Returns void

    • 调用模块中的函数

      Parameters

      • methodName: string
      • Rest ...args: any

      Returns void

    • Destroy self.

      Returns void

    • 触发指定事件名称.

      Parameters

      • event: string

        Event name

      • Rest ...data: any

        Data

      Returns boolean

      • Whether the dispatching is successful
    • Parameters

      • fn: (() => any)
          • (): any
          • Returns any

      Returns void

    • 返回注册的所有事件名.

      Returns string[]

      所有事件名

    • 获取物体的外包盒

      Parameters

      • Optional inLocalSpace: boolean

        局部空间

      • Optional mapModeSceneSpace: boolean

        地图模式下返回场景空间坐标

      Returns Box3

    • 获取模块

      Type Parameters

      Parameters

      • type: (new (entity?, obj?) => T)

        模型类型

          • new (entity?, obj?): T
          • Parameters

            • Optional entity: any
            • Optional obj: U

            Returns T

      Returns T

    • Parameters

      • id: string

      Returns Object3D<Object3DEventMap>

    • Parameters

      • name: string

      Returns Object3D<Object3DEventMap>

    • Parameters

      • name: string
      • value: string

      Returns Object3D<Object3DEventMap>

    • Parameters

      • uuid: string

      Returns Object3D<Object3DEventMap>

    • Parameters

      • name: string

      Returns Object3D<Object3DEventMap>[]

    • Parameters

      • name: string
      • value: string

      Returns Object3D<Object3DEventMap>[]

    • 确定是否存在事件侦听

      Parameters

      • event: string

        事件名

      Returns boolean

      返回是否存在相应的事件

    • 根据同一个实体上的两个射线的交点信息,来决定是否是不同的事件。默认false不再触发

      Parameters

      Returns boolean

    • 判断实体是否是mesh实体或包含mesh实体模块

      Returns boolean

    • 返回具有指定事件名称的侦听总数.

      Parameters

      • event: string

        Event name

      Returns number

      The count of listeners

    • 移除监听.

      Parameters

      • event: string

        Event name

      • Optional fn: Function

        Function, If is undefined, delete all corresponding event listeners.

      Returns EventDispatcher

    • Parameters

      • callback: ((app) => void)
          • (app): void
          • Parameters

            Returns void

      Returns void

    • 移除一个自定义动作脚本

      Parameters

      • id: string

        脚本id

      Returns void

    • 通过事件名移除所有监听.

      Parameters

      • Optional event: string

        Event name, delete all events if not passed

      Returns void

    • 移除模块

      Type Parameters

      Parameters

      • type: (new (entity?, obj?) => T)

        模型类型

          • new (entity?, obj?): T
          • Parameters

            • Optional entity: any
            • Optional obj: U

            Returns T

      Returns void

    • Parameters

      • objs: Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[]

      Returns void

    • Parameters

      • callback: ((ent) => any)
          • (ent): any
          • Parameters

            Returns any

      • Optional filter: ((ent) => boolean)
          • (ent): boolean
          • Parameters

            Returns boolean

      Returns void

    • Parameters

      • callback: ((ent) => any)
          • (ent): any
          • Parameters

            Returns any

      • Optional filter: ((ent) => boolean)
          • (ent): boolean
          • Parameters

            Returns boolean

      Returns void

    • 给一个已加入场景中的对象关联一个实体

      Parameters

      • obj: Object3D<Object3DEventMap>

        已加入场景中的对象

      • Optional splitSubEntity: boolean

        是否把子对象拆成子实体 (默认false)

      • Optional overwriteEntity: boolean

        当有关联的实体时,重新再生成一个实体相关联 (默认false)

      • Optional app: App

        应用对象,默认用当前的

      Returns Entity

    • Parameters

      • json: Record<string, any>
      • objects: Map<string, Object3D<Object3DEventMap>>

      Returns Entity

    • 通过一个或多个object3d对象创建一个实体

      Parameters

      • objs: Object3D<Object3DEventMap> | Object3D<Object3DEventMap>[]

      Returns Entity

    • 通过一个obejct获取所属的实体

      Parameters

      • object: Object3D<Object3DEventMap>

        物体对象

      • Optional canChildEntity: boolean

        是否获取到子实体。默认false. false的话表示获取的是最上级的实体对象。true获取的是所属的子实体对象

      Returns Entity