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
28namespace Triton
29{
30class Ocean;
31class Decal;
32
35{
36public:
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
81protected:
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 object that generates a static wake wave in a given direction, such as that generated by a buoy in...
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
An static wake pointing in a given direction at a fixed location, for example from a buoy or bridge p...
Definition: TidalStreamWake.h:35
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...
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:36