VR-Forces 4.3.1 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 <matrix/vlVector.h>
16 #include <boost/signal.hpp>
17 #include <osg/ref_ptr>
18 
19 #include <map>
20 
21 namespace Triton
22 {
23  class WakeGenerator;
24  class WakeGeneratorParameters;
25  class RotorWash;
26  class Impact;
27  class TidalStreamWake;
28 }
29 
30 class DtVector;
31 
32 namespace makVrv
33 {
34  class DtDe;
35  class DtDriver;
36  class DtDynamicOceanObject;
37  class DtRenderer;
38  class DtTritonDrawable;
39  class DtTritonEventProcessor;
40  class DtTritonGroup;
41 
42 
44  : public DtOceanStateInterface
45  , public DtVirtualBaseClass
46  {
47  public:
48  static DtTritonManager& instance(makVrv::DtDe& de);
49  ~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);
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(TritonQuality quality);
195  virtual TritonQuality getQuality() const;
196 
201  virtual bool isOverWater(const DtVector& localPosition);
202 
203  bool addedToScene();
204 
205  // Called by traversal. If any call for the given frame number is true, then
206  // the ocean is visible in at least one viewport.
207  void setIsVisible(bool visible, unsigned int frameNum);
208 
209  // Is the ocean currently rendered in at least one viewport?
210  bool getIsVisible();
211 
212  // Get the time (in seconds) that triton is using for its simulation
213  // This may be simulation time or wall clock time
214  DtTime oceanTime() const;
215 
216  DtTritonDrawable* tritonDrawable() const;
217 
218  boost::signal<void ()> signal_addedToScene;
219  boost::signal<void ()> signal_removedFromScene;
220 
221  // This is just a hack to support the demo ship
222  boost::signal<void (double)> signal_shipSpeedChanged;
223 
224  virtual double getOceanZoomOverride() const;
225  virtual void setOceanZoomOverride(double zoomOverride);
226 
227  private:
229 
230  void slot_postInitialize();
231  void slot_driverToBeDestroyed(DtDriver& driver);
232 
234  DtDynamicOceanObject* dynamicOcean() const;
235 
236  private:
240 
241  osg::ref_ptr<DtTritonDrawable> myTritonDrawable;
242  osg::ref_ptr<DtTritonGroup> myTritonRoot;
243 
245  float mySeaLevel;
249  unsigned int myLastFrameNum;
254  };
255 
256 
257 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)