Triton
Visual simulation library for ocean rendering.
TidalStreamWake.h
Go to the documentation of this file.
1 // Copyright (c) 2014 Sundog Software LLC. All rights reserved worldwide.
2 
3 #ifndef TRITON_TIDAL_STREAM_WAKE_H
4 #define TRITON_TIDAL_STREAM_WAKE_H
5 
6 #ifdef SWIG
7 %module TritonTidalStreamWake
8 %import "Ocean.h"
9 #define TRITONAPI
10 %{
11 #include "TidalStreamWake.h"
12  using namespace Triton;
13 %}
14 #endif
15 
16 #define NUM_TS_DECALS 1
17 
22 #include "TritonCommon.h"
23 #include "Vector3.h"
24 
25 #pragma pack(push)
26 #pragma pack(8)
27 
28 namespace Triton
29 {
30 class Ocean;
31 class Decal;
32 
34 class TidalStreamWake : public MemObject
35 {
36 public:
50  TidalStreamWake(Ocean *pOcean, double pSize, double pDraft, double pWaveMax = 1.0, double pOffset = 0,
51  bool pUseDecals = true, bool pUseDisplacement = true);
52 
53  virtual ~TidalStreamWake();
54 
65  void TRITONAPI Update(const Vector3& pPosition, const Vector3& pDirection, double pVelocity, double pTime);
66 
67  // Used internally to clear out the ocean reference when it is deleted.
68  void OceanDestroyed() {
69  ocean = 0;
70  registered = false;
71  }
72 
73  // Used internally to clear out the wake manager reference when it is deleted.
74  void WakeManagerDestroyed() {
75  wakeManagerRegistered = false;
76  }
77 
78  // Used internally when ocean quality changes
79  void OceanQualityChanged();
80 
81 protected:
82 
83  void UpdateDecals(double time, const Vector3& position, double distanceDampening, const Vector3& direction, double velocity);
84 
85  float CoherentNoise(float t);
86 
87  Ocean *ocean;
88  double draft, waveMax, size;
89  bool registered, wakeManagerRegistered;
90  double amplitudeVariance, directionVariance;
91  double amplitudeSpeed, directionSpeed;
92  double offset;
93  bool useDecal, useDisplacement;
94 
95  float noiseVerts[256];
96 
97  double decalIntensity;
98  Decal *decals[NUM_TS_DECALS];
99  float decalPeriod;
100  double decalStartTimes[NUM_TS_DECALS];
101  int currentDecal;
102  float decalMinScale, decalMaxScale;
103  Vector3 lastPosition;
104  double lastTime;
105  float animationScale;
106 };
107 }
108 
109 #pragma pack(pop)
110 
111 #endif
An static wake pointing in a given direction at a fixed location, for example from a buoy or bridge p...
Definition: TidalStreamWake.h:34
Common typedefs and defines used within Triton.
An object that generates a static wake wave in a given direction, such as that generated by a buoy in...
This base class for all Triton objects intercepts the new and delete operators, routing them through ...
Definition: MemAlloc.h:70
TidalStreamWake(Ocean *pOcean, double pSize, double pDraft, double pWaveMax=1.0, double pOffset=0, bool pUseDecals=true, bool pUseDisplacement=true)
Construct a TidalStreamWake with the same Triton::Ocean it will be associated with.
A 3D double-precision Vector class and its operations.
Definition: Vector3.h:35
The Ocean class allows you to configure and draw Triton's water simulation.
Definition: Ocean.h:80
void TRITONAPI Update(const Vector3 &pPosition, const Vector3 &pDirection, double pVelocity, double pTime)
For any active TidalStreamWake, this should be called every frame to update its position and velocity...
A 3D Vector class and its operations.