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
Name | Type | Description |
---|---|---|
parameters | MainParameters | Configuration parameters for initializing the Main class. |
Defined in
Properties
ticks
▪ Static
ticks: number
= 0
A static counter representing the number of animation frames elapsed.
Defined in
Accessors
activeCamera
• get
activeCamera(): Camera
The Camera associated with the currently active RenderView.
Returns
Camera
Defined in
activeComposer
• get
activeComposer(): EffectComposer
The EffectComposer (used for post-processing) associated with the currently active RenderView.
Returns
EffectComposer
Defined in
activeScene
• get
activeScene(): Scene
The Scene associated with the currently active RenderView.
Returns
Scene
Defined in
activeView
• get
activeView(): RenderView
The currently active RenderView (activated by mouse position).
Returns
Defined in
backgroundAlpha
• get
backgroundAlpha(): number
The default alpha (transparency) value for the background.
Returns
number
Defined in
backgroundColor
• get
backgroundColor(): ColorRepresentation
The default background color used in the application.
Returns
ColorRepresentation
Defined in
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
enableCursor
• get
enableCursor(): boolean
Indicates whether to enable cursor handling in the application.
Returns
boolean
Defined in
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
multitouch
• get
multitouch(): boolean
Indicates whether to enable multitouch interactions.
Returns
boolean
Defined in
pointerOnCanvas
• get
pointerOnCanvas(): boolean
Indicates if the pointer is over the canvas.
Returns
boolean
Defined in
raycaster
• get
raycaster(): Raycaster
A Raycaster instance responsible for handling raycasting operations in the application.
Returns
Raycaster
Defined in
raycasterSortComparer
• get
raycasterSortComparer(): RaycasterSortComparer
A custom sorting comparer function used to order intersections when performing raycasting.
Returns
Defined in
renderer
• get
renderer(): WebGLRenderer
The WebGLRenderer instance used for rendering the 3D scene.
Returns
WebGLRenderer
Defined in
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
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
Defined in
Methods
addView
▸ addView(view
): void
Adds a RenderView to the RenderManager.
Parameters
Name | Type | Description |
---|---|---|
view | RenderView | The RenderView instance to add. |
Returns
void
Defined in
clearViews
▸ clearViews(): void
Clears all RenderViews from the RenderManager.
Returns
void
Defined in
createView
▸ createView(view
): RenderView
Creates a new RenderView and adds it to the RenderManager.
Parameters
Name | Type | Description |
---|---|---|
view | ViewParameters | The parameters for the new RenderView. |
Returns
The created RenderView instance.
Defined in
getViewByMouse
▸ getViewByMouse(mouse
): void
Retrieves a RenderView by mouse position.
Parameters
Name | Type | Description |
---|---|---|
mouse | Vector2 | The mouse position as a Vector2. |
Returns
void
Defined in
getViewByTag
▸ getViewByTag(tag
): RenderView
Retrieves a RenderView by its tag.
Parameters
Name | Type | Description |
---|---|---|
tag | string | The tag to search for. |
Returns
The RenderView with the specified tag, if found, otherwise, undefined.
Defined in
removeView
▸ removeView(view
): void
Removes a RenderView from the RenderManager.
Parameters
Name | Type | Description |
---|---|---|
view | RenderView | The RenderView instance to remove. |
Returns
void
Defined in
removeViewByTag
▸ removeViewByTag(tag
): void
Removes a RenderView from the RenderManager by its tag.
Parameters
Name | Type | Description |
---|---|---|
tag | string | The tag of the RenderView to remove. |
Returns
void
Defined in
setActiveViewsByTag
▸ setActiveViewsByTag(tag
): void
Sets active RenderViews by tag.
Parameters
Name | Type | Description |
---|---|---|
tag | string | The tag of the RenderViews to set as active. |
Returns
void