3#ifndef TRITON_WAKE_GENERATOR_H
4#define TRITON_WAKE_GENERATOR_H
7%module TritonWakeGenerator
12using namespace Triton;
18#include "TritonVector.h"
31struct SBowSprayEmitter
35 double sprayVelocityScale;
38 double spraySizeScale;
40 SBowSprayEmitter(
int _numSprays,
double _sprayVelocityScale,
double _spraySizeScale)
41 : numSprays(_numSprays), offset(0,0,0), sprayVelocityScale(_sprayVelocityScale), spraySizeScale(_spraySizeScale)
64 std::vector<SBowSprayEmitter> bowSprayEmitters;
158 void TRITONAPI
Update(
const Vector3& pPosition,
const Vector3& pDirection,
double pVelocity,
double pTime,
bool pDisableWash =
false);
172 return sternPosition;
196 lodDistance = distance;
212 void OceanDestroyed() {
218 void WakeManagerDestroyed() {
219 registeredWakeManager =
false;
223 int GetMaxWakeNumber()
const {
224 return wakeNumber - 1;
228 double GetDistanceTravelled()
const {
229 return distanceTravelled;
234 const Ocean *GetOcean()
const {
239 Vector3 position, sternPosition, lastPosition, washPosition, lastEmitPosition, lastWaveEmitPosition, lastLastEmitPosition;
240 Vector3 lastEmitSourcePosition, lastWakePosition;
242 double distanceTravelled;
244 double lastSprayEmitTime, lastWaveEmitTime;
245 double lodDistance, hullSpeed;
246 double sprayCullDist;
247 bool firstEmit, firstWaveEmit, registered, registeredWakeManager;
248 int wakeNumber, lastWakeNumber;
249 double minPropSegmentLength, decayRate, washDecayRate;
250 double sprayPositionVariation, curveGenerationFactor;
251 double gravity, maxDistanceSquared;
253 bool wakesAffectHeight;
Common typedefs and defines used within Triton.
A 3D Vector class and its operations.
An object that generates a ship Kelvin wake as it moves.
This base class for all Triton objects intercepts the new and delete operators, routing them through ...
Definition: MemAlloc.h:71
The Ocean class allows you to configure and draw Triton's water simulation.
Definition: Ocean.h:81
A 3D double-precision Vector class and its operations.
Definition: Vector3.h:36
A 3D single-precision vector class, and its operations.
Definition: Vector3.h:149
A WakeGenerator represents an object on the water that generates a wake as it moves,...
Definition: WakeGenerator.h:132
void TRITONAPI SetParameters(const WakeGeneratorParameters ¶meters)
Set this WakeGenerator's parameters using the WakeGeneratorParameters provided.
Vector3 TRITONAPI GetSternPosition() const
Retrieves the world position of the point where stern wakes originate from.
Definition: WakeGenerator.h:171
bool TRITONAPI HasPropWash() const
Retrieves whether propeller backwash was enabled for this wake generator.
Definition: WakeGenerator.h:184
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.
const WakeGeneratorParameters &TRITONAPI GetParameters() const
Returns the current parameters for this WakeGenerator.
Vector3 TRITONAPI GetPosition() const
Retrieves the world position of the WakeGenerator.
Definition: WakeGenerator.h:166
WakeGenerator(Ocean *pOcean, const WakeGeneratorParameters ¶meters)
Construct a WakeGenerator with the same Triton::Ocean it will be associated with.
void TRITONAPI SetLODDistance(double distance)
Sets the distance at which the number of visible wake waves will be halved.
Definition: WakeGenerator.h:195
double TRITONAPI GetVelocity() const
Retrieves the velocity of the WakeGenerator.
Definition: WakeGenerator.h:179
void ClearWakes()
Clears all previously emitted wakes from the Ocean.
double TRITONAPI GetLODDistance() const
Retrieves the LOD distance set in Triton::WakeGenerator::SetLODDistance(), or 0 if LOD is disabled.
Definition: WakeGenerator.h:201
WakeGeneratorParameters contains the parameters required to construct a Triton::WakeGenerator object.
Definition: WakeGenerator.h:49
double hullSprayStartOffset
The offset at which hull spray effects begin.
Definition: WakeGenerator.h:106
float shipSpeedMaxFoam
Ship speed corresponding to maximum foam.
Definition: WakeGenerator.h:123
double hullSprayVerticalOffset
A vertical offset to the starting point of new hull spray particles.
Definition: WakeGenerator.h:114
double draft
The "draft" of the ship, or the depth the hull extends to underwater.
Definition: WakeGenerator.h:89
bool sternWaves
Whether stern wakes should be generated from this object.
Definition: WakeGenerator.h:80
float hullWakeLength
Multiplier for length of hull wake.
Definition: WakeGenerator.h:122
double hullSprayScale
The initial velocity of hull spray particles as a percent of the ship velocity (0-1)
Definition: WakeGenerator.h:110
double propWashOffset
Use this to have propeller backwash effects generated from a point different from the ship position.
Definition: WakeGenerator.h:95
bool sprayEffects
Whether you wish this wake to emit spray particles originating from this wake generator.
Definition: WakeGenerator.h:57
double bowSprayOffset
Use this to have spray particles emitted from a point different from the ship position.
Definition: WakeGenerator.h:59
double sternWaveOffset
Offset for the stern wakes.
Definition: WakeGenerator.h:82
double sternWakeMultiplier
A scaling factor applied to the stern Kelvin wake effects.
Definition: WakeGenerator.h:118
double bowWaveOffset
Offset from the ship position, along the direction of travel, at which bow waves will originate.
Definition: WakeGenerator.h:69
double bowSize
The size of the bow in world units; affects the wavelength of the bow wave, and the initial spread of...
Definition: WakeGenerator.h:76
double propWashWidthMultiplier
Multiplies the beam width by this value to arrive at the width of the prop wash effect.
Definition: WakeGenerator.h:98
double length
The length of the object generating the wake.
Definition: WakeGenerator.h:85
float hullWakeWidth
Mulitplier for width of hull wake.
Definition: WakeGenerator.h:121
double bowWaveScale
A scaling factor for the bow wave's amplitude at the bow of the ship.
Definition: WakeGenerator.h:72
bool bowWave
Whether the bow wave effect should exist on this object.
Definition: WakeGenerator.h:67
double bowWaveMax
The maximum amplitude of the bow wave, or -1.0 for unbounded.
Definition: WakeGenerator.h:74
WakeGeneratorParameters()
The constructor populates all data members with reasonable default values, although you will at a min...
double bowWakeMultiplier
A scaling factor applied to the bow Kelvin wake effect.
Definition: WakeGenerator.h:116
bool propWash
Whether you want propeller backwash effects generated from this wake generator.
Definition: WakeGenerator.h:93
int numHullSprays
How many spray particle systems are emitted periodically along the hull of the ship.
Definition: WakeGenerator.h:103
double hullSpraySizeScale
A scaling factor applied to the hull spray particles.
Definition: WakeGenerator.h:112
double propWashFadeTime
The amount of time, in seconds, over which the prop wash will dissipate.
Definition: WakeGenerator.h:100
float shipSpeedMinFoam
Minimum ship speed before foam is created.
Definition: WakeGenerator.h:124
double hullSprayEndOffset
The offset at which hull spray effects end.
Definition: WakeGenerator.h:108
double beamWidth
The width of the object generating the wake.
Definition: WakeGenerator.h:87