Skip to main content

Class: Main

Core.Main

The Main class serves as the core component for managing a 3D application. It provides configuration options and methods for setting up and controlling the application's behavior.

Constructors​

constructor​

• new Main(parameters?)

Parameters​

NameTypeDescription
parametersMainParametersConfiguration parameters for initializing the Main class.

Defined in​

src/core/Main.ts:157

Properties​

ticks​

▪ Static ticks: number = 0

A static counter representing the number of animation frames elapsed.

Defined in​

src/core/Main.ts:47

Accessors​

activeCamera​

• get activeCamera(): Camera

The Camera associated with the currently active RenderView.

Returns​

Camera

Defined in​

src/core/Main.ts:79


activeComposer​

• get activeComposer(): EffectComposer

The EffectComposer (used for post-processing) associated with the currently active RenderView.

Returns​

EffectComposer

Defined in​

src/core/Main.ts:84


activeScene​

• get activeScene(): Scene

The Scene associated with the currently active RenderView.

Returns​

Scene

Defined in​

src/core/Main.ts:74


activeView​

• get activeView(): RenderView

The currently active RenderView (activated by mouse position).

Returns​

RenderView

Defined in​

src/core/Main.ts:69


backgroundAlpha​

• get backgroundAlpha(): number

The default alpha (transparency) value for the background.

Returns​

number

Defined in​

src/core/Main.ts:140


backgroundColor​

• get backgroundColor(): ColorRepresentation

The default background color used in the application.

Returns​

ColorRepresentation

Defined in​

src/core/Main.ts:134


dragButtons​

• get dragButtons(): number[]

Defines the mouse buttons that can be used for dragging objects. Specify the button values as an array of PointerEvent button values.

Returns​

number[]

Defined in​

src/core/Main.ts:111


enableCursor​

• get enableCursor(): boolean

Indicates whether to enable cursor handling in the application.

Returns​

boolean

Defined in​

src/core/Main.ts:117


mousePosition​

• get mousePosition(): Vector2

The current mouse position represented as a Vector2. Provides the x and y coordinates of the mouse pointer within the application.

Returns​

Vector2

Defined in​

src/core/Main.ts:147


multitouch​

• get multitouch(): boolean

Indicates whether to enable multitouch interactions.

Returns​

boolean

Defined in​

src/core/Main.ts:104


pointerOnCanvas​

• get pointerOnCanvas(): boolean

Indicates if the pointer is over the canvas.

Returns​

boolean

Defined in​

src/core/Main.ts:152


raycaster​

• get raycaster(): Raycaster

A Raycaster instance responsible for handling raycasting operations in the application.

Returns​

Raycaster

Defined in​

src/core/Main.ts:129


raycasterSortComparer​

• get raycasterSortComparer(): RaycasterSortComparer

A custom sorting comparer function used to order intersections when performing raycasting.

Returns​

RaycasterSortComparer

Defined in​

src/core/Main.ts:123


renderer​

• get renderer(): WebGLRenderer

The WebGLRenderer instance used for rendering the 3D scene.

Returns​

WebGLRenderer

Defined in​

src/core/Main.ts:58


showStats​

• get showStats(): boolean

Indicates whether to display performance statistics. If set to true, statistics will be shown; otherwise, they will be hidden.

Returns​

boolean

Defined in​

src/core/Main.ts:90


views​

• get views(): RenderView[]

An array of all RenderView instances managed by the application. Lists all views created and managed by the application, each representing a separate viewport or scene.

Returns​

RenderView[]

Defined in​

src/core/Main.ts:64

Methods​

addView​

▸ addView(view): void

Adds a RenderView to the RenderManager.

Parameters​

NameTypeDescription
viewRenderViewThe RenderView instance to add.

Returns​

void

Defined in​

src/core/Main.ts:229


clearViews​

▸ clearViews(): void

Clears all RenderViews from the RenderManager.

Returns​

void

Defined in​

src/core/Main.ts:261


createView​

▸ createView(view): RenderView

Creates a new RenderView and adds it to the RenderManager.

Parameters​

NameTypeDescription
viewViewParametersThe parameters for the new RenderView.

Returns​

RenderView

The created RenderView instance.

Defined in​

src/core/Main.ts:221


getViewByMouse​

▸ getViewByMouse(mouse): void

Retrieves a RenderView by mouse position.

Parameters​

NameTypeDescription
mouseVector2The mouse position as a Vector2.

Returns​

void

Defined in​

src/core/Main.ts:269


getViewByTag​

▸ getViewByTag(tag): RenderView

Retrieves a RenderView by its tag.

Parameters​

NameTypeDescription
tagstringThe tag to search for.

Returns​

RenderView

The RenderView with the specified tag, if found, otherwise, undefined.

Defined in​

src/core/Main.ts:238


removeView​

▸ removeView(view): void

Removes a RenderView from the RenderManager.

Parameters​

NameTypeDescription
viewRenderViewThe RenderView instance to remove.

Returns​

void

Defined in​

src/core/Main.ts:246


removeViewByTag​

▸ removeViewByTag(tag): void

Removes a RenderView from the RenderManager by its tag.

Parameters​

NameTypeDescription
tagstringThe tag of the RenderView to remove.

Returns​

void

Defined in​

src/core/Main.ts:254


setActiveViewsByTag​

▸ setActiveViewsByTag(tag): void

Sets active RenderViews by tag.

Parameters​

NameTypeDescription
tagstringThe tag of the RenderViews to set as active.

Returns​

void

Defined in​

src/core/Main.ts:277