Skip to main content

View3D

Description:

  Class used for rendering 3D content inside the 2D scene tree.

Inherits from: Node.

scene

Type: Readonly Field.

Description:

  The root node of the 3D scene.

Signature:

const scene: Node3D

stats

Type: Readonly Field.

Description:

  Statistics from the most recent 3D render and current 3D registries.

Signature:

const stats: RenderStats3D

showAABB

Type: Field.

Description:

  Whether current world AABBs are drawn for debugging.

Signature:

showAABB: boolean

shadowMapSize

Type: Field.

Description:

  The shadow map side length. The value is normalized to 256, 512, 1024, 2048, or 4096.

Signature:

shadowMapSize: number

getRayOrigin

Type: Function.

Description:

  Returns the world-space origin of the picking ray through a view point.

Signature:

getRayOrigin: function(self: View3D, viewPoint: Vec2): Vec3

getRayDirection

Type: Function.

Description:

  Returns the world-space direction of the picking ray through a view point.

Signature:

getRayDirection: function(self: View3D, viewPoint: Vec2): Vec3

pick

Type: Function.

Description:

  Returns the nearest visible model intersected by a view point.

Signature:

pick: function(self: View3D, viewPoint: Vec2): Model3D | nil

setEnvironmentMap

Type: Function.

Description:

  Loads an environment map for image based lighting.

Signature:

setEnvironmentMap: function(self: View3D, path: string): boolean

Parameters:

ParameterTypeDescription
pathstringThe environment texture path. Empty string clears the environment map.

Returns:

Return TypeDescription
booleanTrue when the environment map is loaded or cleared successfully.

setEnvironmentIntensity

Type: Function.

Description:

  Sets diffuse, specular and exposure intensity for environment lighting.

Signature:

setEnvironmentIntensity: function(
self: View3D,
diffuse: number,
specular: number,
exposure?: number --[[1.0]]
)

Parameters:

ParameterTypeDescription
diffusenumberThe diffuse lighting intensity.
specularnumberThe specular lighting intensity.
exposurenumber[optional] The exposure value. Default is 1.0.