Triton
Visual simulation library for ocean rendering.
RotorWash.h
Go to the documentation of this file.
1// Copyright (c) 2013-2015 Sundog Software, LLC. All rights reserved worldwide.
2
3#ifndef TRITON_ROTOR_WASH_H
4#define TRITON_ROTOR_WASH_H
5
6#ifdef SWIG
7%module TritonRotorWash
8%import "Ocean.h"
9#define TRITONAPI
10%{
11#include "RotorWash.h"
12using namespace Triton;
13%}
14#endif
15
16#define NUM_DECALS 3
17#define SMOOTH_BUFFER_SIZE 10
18
19#include "TritonCommon.h"
20#include "Vector3.h"
21
26#pragma pack(push)
27#pragma pack(8)
28
29namespace Triton
30{
31class Ocean;
32class Decal;
33
36class RotorWash : public MemObject
37{
38public:
47 RotorWash(Ocean *pOcean, double pRotorDiameter, bool pSprayEffects = false, bool pUseDecals = false);
48
49 virtual ~RotorWash();
50
60 void TRITONAPI Update(const Vector3& pPosition, const Vector3& pDirection, double pVelocity, double pTime);
61
65 Vector3 TRITONAPI GetPosition() const {
66 return position;
67 }
68
73 double TRITONAPI GetVelocity() const {
74 return velocity;
75 }
76
77 // Used internally to clear out the ocean reference when it is deleted.
78 void OceanDestroyed() {
79 ocean = 0;
80 }
81
82 // Used internally when ocean quality changes
83 void OceanQualityChanged();
84
85 // toggle decals at run time
86 void setUseDecals(bool useDecals);
87 bool GetUseDecals(void) const;
88protected:
89 void UpdateDecals(double time, const Vector3& position, double distanceDampening);
90
91 Vector3 position, lastEmitPosition, lastLastEmitPosition, lastEmitSourcePosition;
92 double velocity, rotorDiameter;
93 Ocean *ocean;
94 double lastWaveEmitTime, lastSprayEmitTime;
95 double waveGenerationPeriod, sprayGenerationPeriod;
96 double washDiameter;
97 double windScale;
98 double maxVelocity;
99 double particleSize;
100 double decayRate;
101 double decalIntensity;
102 float transparency;
103 bool sprayEffects, firstEmit;
104 int wakeNumber, lastWakeNumber;
105 Decal *decals[NUM_DECALS];
106 float decalPeriod;
107 double decalStartTimes[NUM_DECALS];
108 int currentDecal;
109 float decalMinScale, decalMaxScale;
110 double phaseOffset, phaseRandomness;
111 bool useDecal;
112 bool registered;
113 Vector3 lastPosition;
114 double lastTime, rotorDecalSpeedLimit;
115 double velocitySmoothBuffer[SMOOTH_BUFFER_SIZE];
116 int bufferEntry;
117};
118}
119
120#pragma pack(pop)
121
122#endif
An object that generates rotor wash wave and spray effects.
Common typedefs and defines used within Triton.
A 3D Vector class and its operations.
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 RotorWash object will generate spray and circular waves on the ocean surface in the direction it is...
Definition: RotorWash.h:37
Vector3 TRITONAPI GetPosition() const
Retrieves the world position of the RotorWash.
Definition: RotorWash.h:65
double TRITONAPI GetVelocity() const
Retrieves the airspeed velocity of the RotorWash.
Definition: RotorWash.h:73
RotorWash(Ocean *pOcean, double pRotorDiameter, bool pSprayEffects=false, bool pUseDecals=false)
Construct a RotorWash with the same Triton::Ocean it will be associated with.
void TRITONAPI Update(const Vector3 &pPosition, const Vector3 &pDirection, double pVelocity, double pTime)
For any active RotorWash, this should be called every frame to update its position and velocity.
A 3D double-precision Vector class and its operations.
Definition: Vector3.h:36