VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtOsgChannel3dViewCompassInstance.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvOsg/vrvOsg.h>
16 #include <osg/Vec2>
17 #include <osg/Vec4>
18 #include <osg/ref_ptr>
19 
20 namespace osg
21 {
22  class Texture;
23 }
24 
25 namespace makVrv
26 {
27  class DtDe;
28  class DtChannel;
29  class DtChannelConfiguration;
30  class DtChannelManager;
31  class DtModelDefinition;
32  class DtOsgChannel;
33  class DtOverlayRenderer;
34  class DtQuadProxy;
35  class DtWindowConfiguration;
36  class DtLineSegment;
37  class DtCoordinateSystem;
38  class DtOsgTextureWrapper;
39 
49  {
50  public:
51 
54 
57 
60 
63  const DtOsgChannel3dViewCompassInstance &other) = delete;
64 
67  const DtOsgChannel3dViewCompassInstance &other) = delete;
68 
70  virtual void setVisible(bool isVisible);
71 
73  virtual bool visible();
74 
76  virtual void setChannelName(const std::string& deName,
77  const std::string& winName, const std::string& channelName);
78 
81  virtual void setModelDefinition(const std::string& modelDefinition);
82 
85  virtual void updateCompass( bool force);
86 
88  virtual void setDarkTickColor(float r, float g, float b, float a);
89 
91  virtual void setLightTickColor(float r, float g, float b, float a);
92 
94  virtual void setSymbolsFilename(const std::string& filename);
95 
98  virtual void setPixelRatio(float pixelRatio);
99 
101  // to override the pixel ratio
102  virtual float getPixelRatio();
103 
104  protected:
105 
109  {
111  : numCharacters(0)
112  , lightSide(0)
113  , darkSide(0)
114  {
115  for (int i = 0; i < 4; ++i)
116  {
117  characterValue[i] = 0;
118  characters[i] = 0;
119  }
120  }
121 
123  unsigned char characterValue[4];
124  DtQuadProxy* characters[4];
127  };
128 
130  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
131 
133  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
134 
137  virtual void slot_channelConfigurationModified(const std::string& deName,
138  const std::string& winName, const std::string& oldChannelName,
139  const DtChannelConfiguration& config);
140 
143  virtual void slot_windowConfigurationModified( const std::string& deName,
144  const std::string& winName, const DtWindowConfiguration& config );
145 
148  virtual void slot_displayUnitUnitChanged(
149  const DtUnicode& displayUnitCollectionName,
150  const DtUnicode& displayUnitName, unsigned int newUnit,
151  unsigned int oldUnit);
152 
154  virtual void slot_update();
155 
157  virtual void slot_coordinateSystemChanged();
158 
161  bool updateCompassCharacter(const std::string& filename,
162  DtQuadProxy* quad, DtOsgTextureWrapper* texture,
163  const osg::Vec4& texCoords);
164 
166  virtual void parseModelDefinition(const DtModelDefinition* definition);
167 
169  virtual void createCompass();
170 
172  void destroyCompass();
173 
176  osg::Vec2 calcCompassCenterPosition();
177 
179  DtLineSegment* createDarkSide(DtOverlayRenderer& overlay);
180 
182  DtLineSegment* createLightSide(DtOverlayRenderer& overlay);
183 
185  virtual bool updateOrientationUnits();
186 
188  virtual void updateCompass();
189 
194  virtual void computeCenteringOffsets(float* offsets,
195  const int numCharacters, const float characterWidth);
196 
200  virtual void computeHeadingString(const float radHeading,
201  std::string& outString);
202 
204  virtual void computeCharacterCoords(const unsigned char value,
205  osg::Vec4& coords);
206 
210  virtual void initCompassSymbolCharacterDisplay(CompassSymbol& symbol,
211  const std::string& text, DtOverlayRenderer& overlay);
212 
215  virtual void initPopoutSymbolCharacterDisplay(CompassSymbol& symbol,
216  DtOverlayRenderer& overlay);
217 
221  virtual bool initCompassSymbolCharacters(CompassSymbol& symbol);
222 
224  typedef std::vector<float> VertexList;
225 
227  static void rotate(const DtOsgChannel3dViewCompassInstance::VertexList& in,
229 
231  static void translate(
233  const osg::Vec2& translation,
235 
237  static void scale(const DtOsgChannel3dViewCompassInstance::VertexList& in,
239 
240  protected:
241 
244  struct TickMark
245  {
247  : lightSide(0)
248  , darkSide(0)
249  {
250  // intentional noop
251  }
252 
255  };
256 
259 
261 
263 
265 
266  int myCreateState; // 0 = need create, 1 = created, -1 = creation error
267 
269 
272  CompassSymbol myCompassSymbols[24];
277 
279 
282  DtCoordinateSystem* myCoordinateSystem = nullptr;
283  };
284 }
285 
A unicode string. DtUnicode stores a UTF-16 encoded unicode string. Code Point, a Unicode character...
Definition: DtUnicode.h:33
DtSignalConnectionManager myConnections
Definition: DtOsgChannel3dViewCompassInstance.h:257
vrvGraphics-based implementation of a model-like object that draws a 3d view first person shooter sty...
Definition: DtOsgChannel3dViewCompassInstance.h:47
#define DT_DLL_VRVOSG
Definition: vrvOsg.h:23
A stucture to define a set of characters and tickmark associated with a direction on the compass...
Definition: DtOsgChannel3dViewCompassInstance.h:108
Interface for a DtChannel3dViewCompassInstance A model-like object that draws a 3d view first person ...
Definition: DtChannel3dViewCompassInstance.h:29
osg::Vec2 myCompassCenterPosition
Definition: DtOsgChannel3dViewCompassInstance.h:271
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:26
bool myCompassDirty
Definition: DtOsgChannel3dViewCompassInstance.h:276
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:55
CompassSymbol()
Definition: DtOsgChannel3dViewCompassInstance.h:110
A model definition Interaction any number of named parameters, and also can be used to store cached d...
Definition: DtModelDefinition.h:42
std::vector< float > VertexList
This type can be used to provide a list of vertices to the polygon objects.
Definition: DtOsgChannel3dViewCompassInstance.h:224
bool myIsExactHeadingAlwaysShown
Definition: DtOsgChannel3dViewCompassInstance.h:264
int myCreateState
Definition: DtOsgChannel3dViewCompassInstance.h:266
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannel3dViewCompassInstance.h:258
int numCharacters
Definition: DtOsgChannel3dViewCompassInstance.h:122
A structure to contain light and dark line segments for a compass tick mark.
Definition: DtOsgChannel3dViewCompassInstance.h:244
Contains the DtSharedDisplayUnitsSettings class declaration.
The abstract Channel Class.
Definition: DtChannel.h:35
TickMark myPopoutL
Definition: DtOsgChannel3dViewCompassInstance.h:274
TickMark()
Definition: DtOsgChannel3dViewCompassInstance.h:246
A class which represents a single line segment.
Definition: DtLineSegment.h:23
CompassSymbol myPopoutSymbol
Definition: DtOsgChannel3dViewCompassInstance.h:273
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
TickMark myPopoutR
Definition: DtOsgChannel3dViewCompassInstance.h:275
float myPixelRatio
Definition: DtOsgChannel3dViewCompassInstance.h:268
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtOsgTextureWrapper.h:24
The DtCoordinateSystem is used to manage the current coordinate system of the scene.
Definition: DtCoordinateSystem.h:40
OrientationUnits
Enumeration of the different orientation units.
Definition: DtDisplayUnitsSettingsRecord.h:102
DtSharedDisplayUnitsSettings::OrientationUnits myOrientationUnit
Definition: DtOsgChannel3dViewCompassInstance.h:278
A flyweight class for controlling a single quad owned by the DtQuadRenderer.
Definition: DtQuadProxy.h:26
Base class for handling DtChannels. Derived classes should override the tick() method and advance the...
Definition: DtChannelManager.h:32
Base class to provide boost signal/slot management.
Configuration for a single channel Serialized and sent to remote displays as necessary to configure r...
Definition: DtChannelConfiguration.h:24
Contains makVrv::DtChannel3dViewCompassInstance class.
Contains DLL export macros.
DtOsgChannel * myChannel
Definition: DtOsgChannel3dViewCompassInstance.h:260
bool myCompassIsMagnetic
Definition: DtOsgChannel3dViewCompassInstance.h:262
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:72
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:254
DtOsgTextureWrapper * myCompassSymbolsTexture
Definition: DtOsgChannel3dViewCompassInstance.h:270
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:126
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:125
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:253
The DtOverlayRenderer implements the overlay concept. An overlay is a 2D scene that is drawn on top o...
Definition: DtOverlayRenderer.h:69

Document ID: Generated on Tue Sep 24 19:28:17 EDT 2024 from SVN revision 269799
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)