VR-Forces 4.3 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 
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 
200  virtual bool isOverWater(const DtVector& localPosition);
201 
202  bool addedToScene();
203 
204  // Called by traversal. If any call for the given frame number is true, then
205  // the ocean is visible in at least one viewport.
206  void setIsVisible(bool visible, unsigned int frameNum);
207 
208  // Is the ocean currently rendered in at least one viewport?
209  bool getIsVisible();
210 
211  // Get the time (in seconds) that triton is using for its simulation
212  // This may be simulation time or wall clock time
213  DtTime oceanTime() const;
214 
215  DtTritonDrawable* tritonDrawable() const;
216 
217  boost::signal<void ()> signal_addedToScene;
218  boost::signal<void ()> signal_removedFromScene;
219 
220  // This is just a hack to support the demo ship
221  boost::signal<void (double)> signal_shipSpeedChanged;
222 
223  private:
225 
226  void slot_postInitialize();
227  void slot_driverToBeDestroyed(DtDriver& driver);
228 
230  DtDynamicOceanObject* dynamicOcean() const;
231 
232  private:
236 
237  osg::ref_ptr<DtTritonDrawable> myTritonDrawable;
238  osg::ref_ptr<DtTritonGroup> myTritonRoot;
239 
241  float mySeaLevel;
245  unsigned int myLastFrameNum;
249  };
250 
251 
252 }

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)