Skip to content

@simversus/yjvisDocs


@simversus/yjvis / Model

Class: Model

模型,代表一个可渲染对象

Extends

Extended by

Constructors

new Model()

new Model(p): Model

Parameters

p: Partial<object> = {}

Returns

Model

Overrides

Node.constructor

Defined in

scene/Model.ts:112

Properties

castShadow

castShadow: boolean = false

是否产生阴影

Defined in

scene/Model.ts:19


children

children: Node[] = []

子节点

Inherited from

Node.children

Defined in

scene/Node.ts:44


classHierarchy

classHierarchy: ClassEnum[]

Deprecated

Inherited from

Node.classHierarchy

Defined in

core/baseObject.ts:96


instanceColors

instanceColors: Color[]

每个实例的颜色

Defined in

scene/Model.ts:67


instanceCount

instanceCount: number = 0

实例化的数量

Defined in

scene/Model.ts:59


instanceMatrixs

instanceMatrixs: Mat4[]

每个实例的模型矩阵

Defined in

scene/Model.ts:63


instancePositions

instancePositions: Vec3[]

每个实例的坐标

Defined in

scene/Model.ts:71


label

label: string

自定义标识

Inherited from

Node.label

Defined in

core/baseObject.ts:104


layerMask

layerMask: number = 0

层级

Inherited from

Node.layerMask

Defined in

scene/Node.ts:93


material

material: Material

材质参数,如果渲染实体设置过自身的材质属性,将不再从此处获取

Defined in

scene/Model.ts:27


matrix

matrix: Mat4

本地矩阵

Inherited from

Node.matrix

Defined in

scene/Node.ts:53


modelData

modelData: ModelData

模型数据

Defined in

scene/Model.ts:36


onAfterRender()

onAfterRender: (node) => void

渲染后的回调

Parameters

node: Node

Returns

void

Inherited from

Node.onAfterRender

Defined in

scene/Node.ts:89


onBeforeRender()

onBeforeRender: (node) => void

渲染前的回调

Parameters

node: Node

Returns

void

Inherited from

Node.onBeforeRender

Defined in

scene/Node.ts:85


parent?

optional parent: Node

父节点

Inherited from

Node.parent

Defined in

scene/Node.ts:49


position

position: Vec3

位置

Inherited from

Node.position

Defined in

scene/Node.ts:67


quaternion

quaternion: Quat

旋转

Inherited from

Node.quaternion

Defined in

scene/Node.ts:77


receiveShadow

receiveShadow: boolean = true

是否接受阴影

Defined in

scene/Model.ts:23


renderEntities

readonly renderEntities: Record<RenderEntityType, RenderEntity>

模型所属的渲染实体

Defined in

scene/Model.ts:55


renderOrder

renderOrder: 0

渲染优先级,越小越先渲染

Defined in

scene/Model.ts:40


representation

representation: Representation = Representation.faceAlineApoint

模型的表现形式

Defined in

scene/Model.ts:51


scaling

scaling: Vec3

缩放

Inherited from

Node.scaling

Defined in

scene/Node.ts:72


selectId

selectId: number = -1

Internal

拾取时的序号

Defined in

scene/Model.ts:32


up

up: Vec3

上方向

Inherited from

Node.up

Defined in

scene/Node.ts:62


userData

userData: any

用户自定义数据

Inherited from

Node.userData

Defined in

core/baseObject.ts:100


uuid

uuid: number

唯一标识符

Inherited from

Node.uuid

Defined in

core/baseObject.ts:92


visible

visible: boolean = true

是否可见

Inherited from

Node.visible

Defined in

scene/Node.ts:39


worldMatrix

worldMatrix: Mat4

世界矩阵

Inherited from

Node.worldMatrix

Defined in

scene/Node.ts:57


zDepth

zDepth: number

Internal

在相机中的深度,用于排序

Defined in

scene/Model.ts:45

Accessors

lodData

get lodData(): ModelData[]

模型的LOD数据

set lodData(data): void

设置模型的LOD数据,内部会创建相应数量的模型

Parameters

data: ModelData[]

Returns

ModelData[]

Defined in

scene/Model.ts:89


maxInstanceCount

get maxInstanceCount(): number

获取最大实例数量

set maxInstanceCount(v): void

设置最大实例数量,实例所需的资源会根据这个数量进行分配,如果未设置则默认等于实例数量

Parameters

v: number

Returns

number

Defined in

scene/Model.ts:77


mtime

get mtime(): number

Returns

number

Inherited from

Node.mtime

Defined in

core/baseObject.ts:118


scene

get scene(): Scene

获取模型所处的场景

Returns

Scene

Defined in

scene/Model.ts:108

Methods

add()

add(...nodes): void

添加子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

Node.add

Defined in

scene/Node.ts:276


changed()

changed(): void

标记对象为已修改

Returns

void

Inherited from

Node.changed

Defined in

core/baseObject.ts:128


getRootNode()

getRootNode(): Node

Internal

获取根节点

Returns

Node

Inherited from

Node.getRootNode

Defined in

scene/Node.ts:303


getRotation()

getRotation(): Number3

获取旋转信息

Returns

Number3

Inherited from

Node.getRotation

Defined in

scene/Node.ts:132


getWorldDirection()

getWorldDirection(): Vec3

获取在世界空间下的朝向

Returns

Vec3

Inherited from

Node.getWorldDirection

Defined in

scene/Node.ts:264


is()

is(t): boolean

Parameters

t: ClassEnum

Returns

boolean

Inherited from

Node.is

Defined in

core/baseObject.ts:122


lookAt()

lookAt(target): void

看向某个点

Parameters

target: Vec3 = ...

Returns

void

Inherited from

Node.lookAt

Defined in

scene/Node.ts:208


lookTo()

lookTo(direction): void

看向某个方向

Parameters

direction: Vec3

Returns

void

Inherited from

Node.lookTo

Defined in

scene/Node.ts:220


release()

release(): void

Returns

void

Overrides

Node.release

Defined in

scene/Model.ts:156


remove()

remove(...nodes): void

移除子节点

Parameters

• ...nodes: Node[]

Returns

void

Inherited from

Node.remove

Defined in

scene/Node.ts:290


rotate()

rotate(__namedParameters): void

绕自身坐标系xyz轴旋转指定弧度

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

Node.rotate

Defined in

scene/Node.ts:189


rotateOnAxis()

rotateOnAxis(axis, radian): void

绕指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

Node.rotateOnAxis

Defined in

scene/Node.ts:173


rotateOnWorldAxis()

rotateOnWorldAxis(axis, radian): void

绕世界坐标系指定轴旋转

Parameters

axis: Vec3

radian: number

Returns

void

Inherited from

Node.rotateOnWorldAxis

Defined in

scene/Node.ts:181


scale()

scale(__namedParameters): void

缩放节点

Parameters

__namedParameters

__namedParameters.dx?: number

__namedParameters.dy?: number

__namedParameters.dz?: number

Returns

void

Inherited from

Node.scale

Defined in

scene/Node.ts:198


setLodModel()

setLodModel(cb): void

对每个lod模型执行传入的回调函数

Parameters

cb

Returns

void

Defined in

scene/Model.ts:130


setMatrix()

setMatrix(m): void

设置模型的矩阵

Parameters

m: Mat4

Returns

void

Inherited from

Node.setMatrix

Defined in

scene/Node.ts:114


setRotation()

setRotation(x, y, z): void

设置旋转

Parameters

x: number

y: number = x

z: number = x

Returns

void

Inherited from

Node.setRotation

Defined in

scene/Node.ts:142


translate()

translate(param0): void

延xyz轴移动

Parameters

param0

param0.dx?: number

param0.dy?: number

param0.dz?: number

Returns

void

Inherited from

Node.translate

Defined in

scene/Node.ts:162


translateOnAxis()

translateOnAxis(axis, distance): Model

延指定轴移动

Parameters

axis: Vec3

distance: number

Returns

Model

Inherited from

Node.translateOnAxis

Defined in

scene/Node.ts:152


traverse()

traverse(cb): void

遍历执行

Parameters

cb

Returns

void

Inherited from

Node.traverse

Defined in

scene/Node.ts:123


updateLod()

updateLod(): void

Internal

更新lod模型的可见性

Returns

void

Defined in

scene/Model.ts:137


updateMatrix()

updateMatrix(): void

更新本地矩阵

Returns

void

Inherited from

Node.updateMatrix

Defined in

scene/Node.ts:228


updateWorldMatrix()

updateWorldMatrix(updateParant, updateChildren): void

更新世界矩阵

Parameters

updateParant: boolean = false

updateChildren: boolean = true

Returns

void

Inherited from

Node.updateWorldMatrix

Defined in

scene/Node.ts:245