VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTritonManager.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
8 
9 #pragma once
10 #include <vrvTriton/vrvTriton.h>
11 
12 #include <vrvCore/DtEnvironment.h>
14 
15 #include <vlutil/vlTime.h>
16 
17 #include <boost/signal.hpp>
18 #include <osg/ref_ptr>
19 
20 #include <map>
21 
22 namespace Triton
23 {
24  class WakeGenerator;
25  class WakeGeneratorParameters;
26  class RotorWash;
27  class Impact;
28  class TidalStreamWake;
29 }
30 
31 namespace makVrv
32 {
33  class DtDe;
34  class DtDriver;
35  class DtDynamicOceanObject;
36  class DtRenderer;
37  class DtTritonDrawable;
38  class DtTritonEventProcessor;
39  class DtTritonGroup;
40  class DtDynamicOceanObjectManager;
41 
42 
44  : public DtOceanStateInterface
45  , public DtVirtualBaseClass
46  {
47  public:
48  static DtTritonManager& instance(makVrv::DtDe& de);
49  virtual ~DtTritonManager();
50 
51  void addToScene();
52 
53  virtual void oceanLayerAdded();
54  virtual void oceanLayerToBeDeleted();
55 
56  void setSeaLevel(float level);
57  float seaLevel() const;
58 
59  void setElevationLod(double maxElevation);
60  double elevationLod() const;
61 
66  void setWind(double speed, double direction, double fetch = 0.0);
67 
76  void setDouglasSeaState(
77  int seaState, double seaStateDirection,
78  int swellState, double swellStateDirection);
79 
80  void addSwell(float wavelength, float waveHeight, float radiansClockwiseFromNorth);
81  void clearSwells();
82 
85  void setChoppiness(float chop);
86 
87  // Water visibility when below water
88  bool getIsUnderwater() const;
89  void setUnderwaterVisibility(double distance);
90  bool setUnderwaterFogColor(const DtVector& fogColor);
91  void setUnderwaterFogEnabled(bool enabled);
92 
93  // Color used for refracted water, pre-lighting
94  void setWaterColor(const DtVector& waterColor);
95  DtVector waterColor() const;
96 
97  // Water transparency when above water
98  double waterVisibility() const;
99  void setWaterVisibility(double distance);
100  void setSurfaceTransparency(double transparency);
101 
102  // Depth at which wave displacements start getting dampened
103  bool setSurgeDepth(float depth);
104  bool getSurgeDepth(float& depth) const;
105 
106  void setDepthOffset(float offset);
107 
110  bool intersect(const DtVector& position, DtVector& positionOut,
111  DtVector& normalOut, float waterlineAdjustment=0.0);
112 
115  bool intersectSeaLevel(const DtVector& position,
116  const DtVector& direction, DtVector& positionOut);
117 
120  bool getHeight(const DtVector& position, const DtVector& direction,
121  double& height, DtVector& normalOut);
122 
123  Triton::WakeGenerator* createWake(
124  const Triton::WakeGeneratorParameters& parameters );
125 
126  Triton::RotorWash* createRotorWash(double rotorDiameter);
127  Triton::Impact *createImpact(double impactorDiameter, double mass,
128  double sprayScale);
129 
135  Triton::TidalStreamWake* createTidalStreamWake(double size,
136  double draft, double maxWaveHeight, double offset);
137 
139  void setSplashEffects(bool screenSplashEnabled);
140  bool splashEffects() const;
141 
143  void setSprayEffects(bool screenSprayEnabled);
144  bool sprayEffects() const;
145 
147  void setWaveSprayEffects(bool waveSprayEnabled);
148  bool waveSprayEffects() const;
149 
151  void setDecalEffects(bool decalsEnabled);
152  bool decalEffects() const;
153 
155  void setGodRayEffects(bool godRaysEnabled);
156  bool godRayEffects() const;
157 
158  void setBreakingWaveAmplitude(float meters);
159  float getBreakingWaveAmplitude() const;
160 
162  float getMaximumWaveHeight();
163 
165  void setHeightMapResolution(float metersPerTexel);
166  bool getHeightMapResolution(float &metersPerTexel) const;
167 
168  void setSeaState(unsigned int beaufortScale);
169  unsigned int seaState() const;
170 
171  void setBeach(const DtVector& origin, const DtVector& normal);
172 
173  void setPlanarReflections(bool enable);
174  bool planarReflections() const;
175 
176  void setHeightMap(bool enable);
177  bool heightMap() const;
178 
179  void setWaveDampingDistance(float distance);
180  float waveDampingDistance() const;
181 
182  void setCorrelateIntersectionsToVisuals(bool visualCorrelation);
183  bool correlateIntersectionsToVisuals() const;
184 
188  TritonQuality_Best
189  };
190 
194  virtual void setQuality(unsigned int quality);
195  virtual TritonQuality getQuality() const;
196 
207  virtual bool isOverWater(const DtVector& localPosition, bool isVisible=true);
208 
209  bool addedToScene();
210 
211  // Called by traversal. If any call for the given frame number is true, then
212  // the ocean is visible in at least one viewport.
213  void setIsVisible(bool visible, unsigned int frameNum);
214 
215  // Is the ocean currently rendered in at least one viewport?
216  bool getIsVisible();
217 
218  // Get the time (in seconds) that triton is using for its simulation
219  // This may be simulation time or wall clock time
220  DtTime oceanTime() const;
221 
222  DtTritonDrawable* tritonDrawable() const;
223 
224  boost::signal<void ()> signal_oceanInitialized;
225  boost::signal<void()> signal_addedToScene;
226  boost::signal<void()> signal_removedFromScene;
227 
228  // This is just a hack to support the demo ship
229  boost::signal<void (double)> signal_shipSpeedChanged;
230 
231  virtual double getOceanZoomOverride() const;
232  virtual void setOceanZoomOverride(double zoomOverride);
233 
234  protected:
236 
237  void slot_postInitialize();
238  void slot_driverToBeDestroyed(DtDriver& driver);
239 
241  DtDynamicOceanObject* dynamicOcean() const;
242 
243  protected:
246 
247  osg::ref_ptr<DtTritonDrawable> myTritonDrawable;
248  osg::ref_ptr<DtTritonGroup> myTritonRoot;
249 
251  float mySeaLevel;
255  unsigned int myLastFrameNum;
262  };
263 
264 
265 }

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)