Class: SubmarineView

SubmarineView(simulator)

Class representing the view of a submarine in the scene. Manages the loading, initialization, and updating of submarine models.

Constructor

new SubmarineView(simulator)

Constructor for the SubmarineView class. Initializes submarines scene models. Sets up the initial submarine and debug tools.
Parameters:
Name Type Description
simulator Simulator The simulator instance.
Source:

Methods

bakeRotationIntoGeometry(object)

Function to bake rotation into geometry. Ensures the object's world matrix is up-to-date and applies the world matrix to the geometry.
Parameters:
Name Type Description
object THREE.Object3D The object whose rotation to bake into its geometry.
Source:

getSceneFromResource(resourceName, submarineType) → {THREE.Scene}

Retrieves the submarine scene from the given resource and scales it according to the desired length.
Parameters:
Name Type Description
resourceName ResourceNames The name of the resource to load.
submarineType SubmarineType The type of the submarine.
Source:
Returns:
- The scaled submarine scene.
Type
THREE.Scene

initOhioSubmarineMesh() → {THREE.Scene}

Initializes the Ohio submarine mesh by loading it from resources, applying necessary transformations, and baking its rotation into the geometry.
Source:
Returns:
- The transformed Ohio submarine scene.
Type
THREE.Scene

initSubmarines()

Initializes the submarine meshes for different submarine types and stores them in the items map.
Source:

initTyhpponSubmarineMesh() → {THREE.Scene}

Initializes the Typhoon submarine mesh by loading it from resources.
Source:
Returns:
- The Typhoon submarine scene.
Type
THREE.Scene

setSubmarineDataAndScene()

Sets the current submarine data and updates the scene with the corresponding submarine model.
Source:

updateSubmarine()

Updates the submarine's position and orientation in the scene based on its current state.
Source: