Triton
Visual simulation library for ocean rendering.
Public Member Functions | List of all members
Triton::WakeGenerator Class Reference

A WakeGenerator represents an object on the water that generates a wake as it moves, such as a ship. More...

#include <WakeGenerator.h>

Inheritance diagram for Triton::WakeGenerator:
Inheritance graph
[legend]
Collaboration diagram for Triton::WakeGenerator:
Collaboration graph
[legend]

Public Member Functions

 WakeGenerator (Ocean *pOcean, const WakeGeneratorParameters &parameters)
 Construct a WakeGenerator with the same Triton::Ocean it will be associated with. More...
 
void TRITONAPI Update (const Vector3 &pPosition, const Vector3 &pDirection, double pVelocity, double pTime, bool pDisableWash=false)
 For any active WakeGenerator, this should be called every frame to update its position and velocity. More...
 
void ClearWakes ()
 Clears all previously emitted wakes from the Ocean. More...
 
Vector3 TRITONAPI GetPosition () const
 Retrieves the world position of the WakeGenerator. More...
 
Vector3 TRITONAPI GetSternPosition () const
 Retrieves the world position of the point where stern wakes originate from. More...
 
double TRITONAPI GetVelocity () const
 Retrieves the velocity of the WakeGenerator. More...
 
bool TRITONAPI HasPropWash () const
 Retrieves whether propeller backwash was enabled for this wake generator. More...
 
void TRITONAPI SetLODDistance (double distance)
 Sets the distance at which the number of visible wake waves will be halved. More...
 
double TRITONAPI GetLODDistance () const
 Retrieves the LOD distance set in Triton::WakeGenerator::SetLODDistance(), or 0 if LOD is disabled. More...
 
const WakeGeneratorParameters &TRITONAPI GetParameters () const
 Returns the current parameters for this WakeGenerator. More...
 
void TRITONAPI SetParameters (const WakeGeneratorParameters &parameters)
 Set this WakeGenerator's parameters using the WakeGeneratorParameters provided. More...
 

Detailed Description

A WakeGenerator represents an object on the water that generates a wake as it moves, such as a ship.

Simply call Triton::WakeGenerator::Update() to move the object and generate a realistic wake behind it. Any WakeGenerator moving at constant velocity will generate a wake of 19.46 degrees behind it, but acceleration, deceleration, and curved paths are all handled properly as well.

Constructor & Destructor Documentation

◆ WakeGenerator()

Triton::WakeGenerator::WakeGenerator ( Ocean pOcean,
const WakeGeneratorParameters parameters 
)

Construct a WakeGenerator with the same Triton::Ocean it will be associated with.

This form of the constructor takes a WakeGeneratorParameters class instead of a long list of parameters, and is the preferred constructor to ensure code readability and prevent errors from misplaced parameters.

Parameters
pOceanThe Triton::Ocean object you will associate this WakeGenerator with. A common error is to create a WakeGenerator before the Ocean has been created, so make sure this is a valid, non-null pointer.
parametersA Triton::WakeGeneratorParameters object containing the properties of this WakeGenerator.

Member Function Documentation

◆ ClearWakes()

void Triton::WakeGenerator::ClearWakes ( )

Clears all previously emitted wakes from the Ocean.

◆ GetLODDistance()

double TRITONAPI Triton::WakeGenerator::GetLODDistance ( ) const
inline

Retrieves the LOD distance set in Triton::WakeGenerator::SetLODDistance(), or 0 if LOD is disabled.

◆ GetParameters()

const WakeGeneratorParameters& TRITONAPI Triton::WakeGenerator::GetParameters ( ) const

Returns the current parameters for this WakeGenerator.

◆ GetPosition()

Vector3 TRITONAPI Triton::WakeGenerator::GetPosition ( ) const
inline

Retrieves the world position of the WakeGenerator.

Returns
The world position of the WakeGenerator, as last specified by Triton::WakeGenerator::Update().

◆ GetSternPosition()

Vector3 TRITONAPI Triton::WakeGenerator::GetSternPosition ( ) const
inline

Retrieves the world position of the point where stern wakes originate from.

◆ GetVelocity()

double TRITONAPI Triton::WakeGenerator::GetVelocity ( ) const
inline

Retrieves the velocity of the WakeGenerator.

Returns
The velocity of the WakeGenerator in world units per second, as last specified by Triton::WakeGenerator::Update().

◆ HasPropWash()

bool TRITONAPI Triton::WakeGenerator::HasPropWash ( ) const
inline

Retrieves whether propeller backwash was enabled for this wake generator.

◆ SetLODDistance()

void TRITONAPI Triton::WakeGenerator::SetLODDistance ( double  distance)
inline

Sets the distance at which the number of visible wake waves will be halved.

For example, if a WakeGenerator has built up 8 wake waves and propeller wash segments and you pass a distance of 1000 meters, all 8 will be visible when the camera is closer than 1km to the WakeGenerator's position. Between 1 and 2km, every other wave will be skipped, resulting in 4 waves. From 3 to 4km, you'll get 2, which is as low as it will go.

Set this to 0 to disable LOD, which is the default.

◆ SetParameters()

void TRITONAPI Triton::WakeGenerator::SetParameters ( const WakeGeneratorParameters parameters)

Set this WakeGenerator's parameters using the WakeGeneratorParameters provided.

◆ Update()

void TRITONAPI Triton::WakeGenerator::Update ( const Vector3 pPosition,
const Vector3 pDirection,
double  pVelocity,
double  pTime,
bool  pDisableWash = false 
)

For any active WakeGenerator, this should be called every frame to update its position and velocity.

No wake will be generated until this is called.

Parameters
pPositionThe position of the object generating the wake, such as the stern of a ship, in world coordinates.
pDirectionA normalized direction vector indicating the direction this object is moving in.
pVelocityThe velocity of the object generating the wake, in world units per second.
pTimeThe current simulated time sample, in seconds. This should be realtive to the same start time used for the time stamps sent into Triton::Ocean::Draw().
pDisableWashTemporarily stops emission of prop wash segments, allowing you to simulate engines turning on or off.

The documentation for this class was generated from the following file: