VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 
41 
43  : public DtOceanStateInterface
44  , public DtVirtualBaseClass
45  {
46  public:
47  static DtTritonManager& instance(makVrv::DtDe& de);
48  ~DtTritonManager();
49 
50  void addToScene();
51 
52  virtual void oceanLayerAdded();
53  virtual void oceanLayerToBeDeleted();
54 
55  void setSeaLevel(float level);
56  float seaLevel() const;
57 
58  void setElevationLod(double maxElevation);
59  double elevationLod() const;
60 
65  void setWind(double speed, double direction, double fetch = 0.0);
66 
75  void setDouglasSeaState(
76  int seaState, double seaStateDirection,
77  int swellState, double swellStateDirection);
78 
79  void addSwell(float wavelength, float waveHeight, float radiansClockwiseFromNorth);
80  void clearSwells();
81 
84  void setChoppiness(float chop);
85 
86  // Water visibility when below water
87  bool getIsUnderwater() const;
88  void setUnderwaterVisibility(double distance);
89  bool setUnderwaterFogColor(const DtVector& fogColor);
90  void setUnderwaterFogEnabled(bool enabled);
91 
92  // Color used for refracted water, pre-lighting
93  void setWaterColor(const DtVector& waterColor);
94  DtVector waterColor() const;
95 
96  // Water transparency when above water
97  double waterVisibility() const;
98  void setWaterVisibility(double distance);
99  void setSurfaceTransparency(double transparency);
100 
101  // Depth at which wave displacements start getting dampened
102  bool setSurgeDepth(float depth);
103  bool getSurgeDepth(float& depth) const;
104 
105  void setDepthOffset(float offset);
106 
109  bool intersect(const DtVector& position, DtVector& positionOut,
110  DtVector& normalOut);
111 
114  bool intersectSeaLevel(const DtVector& position,
115  const DtVector& direction, DtVector& positionOut);
116 
119  bool getHeight(const DtVector& position, const DtVector& direction,
120  double& height, DtVector& normalOut);
121 
122  Triton::WakeGenerator* createWake(
123  const Triton::WakeGeneratorParameters& parameters );
124 
125  Triton::RotorWash* createRotorWash(double rotorDiameter);
126  Triton::Impact *createImpact(double impactorDiameter, double mass,
127  double sprayScale);
128 
134  Triton::TidalStreamWake* createTidalStreamWake(double size,
135  double draft, double maxWaveHeight, double offset);
136 
138  void setSplashEffects(bool screenSplashEnabled);
139  bool splashEffects() const;
140 
142  void setSprayEffects(bool screenSprayEnabled);
143  bool sprayEffects() const;
144 
146  void setWaveSprayEffects(bool waveSprayEnabled);
147  bool waveSprayEffects() const;
148 
150  void setDecalEffects(bool decalsEnabled);
151  bool decalEffects() const;
152 
154  void setGodRayEffects(bool godRaysEnabled);
155  bool godRayEffects() const;
156 
157  void setBreakingWaveAmplitude(float meters);
158  float getBreakingWaveAmplitude() const;
159 
161  float getMaximumWaveHeight();
162 
164  void setHeightMapResolution(float metersPerTexel);
165  bool getHeightMapResolution(float &metersPerTexel) const;
166 
167  void setSeaState(unsigned int beaufortScale);
168  unsigned int seaState() const;
169 
170  void setBeach(const DtVector& origin, const DtVector& normal);
171 
172  void setPlanarReflections(bool enable);
173  bool planarReflections() const;
174 
175  void setHeightMap(bool enable);
176  bool heightMap() const;
177 
178  void setWaveDampingDistance(float distance);
179  float waveDampingDistance() const;
180 
181  void setCorrelateIntersectionsToVisuals(bool visualCorrelation);
182  bool correlateIntersectionsToVisuals() const;
183 
187  TritonQuality_Best
188  };
189 
193  virtual void setQuality(TritonQuality quality);
194  virtual TritonQuality getQuality() const;
195 
206  virtual bool isOverWater(const DtVector& localPosition, bool isVisible=true);
207 
208  bool addedToScene();
209 
210  // Called by traversal. If any call for the given frame number is true, then
211  // the ocean is visible in at least one viewport.
212  void setIsVisible(bool visible, unsigned int frameNum);
213 
214  // Is the ocean currently rendered in at least one viewport?
215  bool getIsVisible();
216 
217  // Get the time (in seconds) that triton is using for its simulation
218  // This may be simulation time or wall clock time
219  DtTime oceanTime() const;
220 
221  DtTritonDrawable* tritonDrawable() const;
222 
223  boost::signal<void ()> signal_addedToScene;
224  boost::signal<void ()> signal_removedFromScene;
225 
226  // This is just a hack to support the demo ship
227  boost::signal<void (double)> signal_shipSpeedChanged;
228 
229  virtual double getOceanZoomOverride() const;
230  virtual void setOceanZoomOverride(double zoomOverride);
231 
232  protected:
234 
235  void slot_postInitialize();
236  void slot_driverToBeDestroyed(DtDriver& driver);
237 
239  DtDynamicOceanObject* dynamicOcean() const;
240 
241  protected:
244 
245  osg::ref_ptr<DtTritonDrawable> myTritonDrawable;
246  osg::ref_ptr<DtTritonGroup> myTritonRoot;
247 
249  float mySeaLevel;
253  unsigned int myLastFrameNum;
258  };
259 
260 
261 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)