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) 2023 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 
100  protected:
101 
105  {
107  : numCharacters(0)
108  , lightSide(0)
109  , darkSide(0)
110  {
111  for (int i = 0; i < 4; ++i)
112  {
113  characterValue[i] = 0;
114  characters[i] = 0;
115  }
116  }
117 
119  unsigned char characterValue[4];
120  DtQuadProxy* characters[4];
123  };
124 
126  virtual void slot_channelCreated(DtChannelManager*, DtChannel*);
127 
129  virtual void slot_channelToBeDestroyed(DtChannelManager*, DtChannel*);
130 
133  virtual void slot_channelConfigurationModified(const std::string& deName,
134  const std::string& winName, const std::string& oldChannelName,
135  const DtChannelConfiguration& config);
136 
139  virtual void slot_windowConfigurationModified( const std::string& deName,
140  const std::string& winName, const DtWindowConfiguration& config );
141 
144  virtual void slot_displayUnitUnitChanged(
145  const DtUnicode& displayUnitCollectionName,
146  const DtUnicode& displayUnitName, unsigned int newUnit,
147  unsigned int oldUnit);
148 
150  virtual void slot_update();
151 
153  virtual void slot_coordinateSystemChanged();
154 
157  bool updateCompassCharacter(const std::string& filename,
158  DtQuadProxy* quad, DtOsgTextureWrapper* texture,
159  const osg::Vec4& texCoords);
160 
162  virtual void parseModelDefinition(const DtModelDefinition* definition);
163 
165  virtual void createCompass();
166 
168  void destroyCompass();
169 
172  osg::Vec2 calcCompassCenterPosition();
173 
175  DtLineSegment* createDarkSide(DtOverlayRenderer& overlay);
176 
178  DtLineSegment* createLightSide(DtOverlayRenderer& overlay);
179 
181  virtual bool updateOrientationUnits();
182 
184  virtual void updateCompass();
185 
190  virtual void computeCenteringOffsets(float* offsets,
191  const int numCharacters, const float characterWidth);
192 
196  virtual void computeHeadingString(const float radHeading,
197  std::string& outString);
198 
200  virtual void computeCharacterCoords(const unsigned char value,
201  osg::Vec4& coords);
202 
206  virtual void initCompassSymbolCharacterDisplay(CompassSymbol& symbol,
207  const std::string& text, DtOverlayRenderer& overlay);
208 
211  virtual void initPopoutSymbolCharacterDisplay(CompassSymbol& symbol,
212  DtOverlayRenderer& overlay);
213 
217  virtual bool initCompassSymbolCharacters(CompassSymbol& symbol);
218 
220  typedef std::vector<float> VertexList;
221 
223  static void rotate(const DtOsgChannel3dViewCompassInstance::VertexList& in,
225 
227  static void translate(
229  const osg::Vec2& translation,
231 
233  static void scale(const DtOsgChannel3dViewCompassInstance::VertexList& in,
235 
236  protected:
237 
240  struct TickMark
241  {
243  : lightSide(0)
244  , darkSide(0)
245  {
246  // intentional noop
247  }
248 
251  };
252 
255 
257 
259 
261 
262  int myCreateState; // 0 = need create, 1 = created, -1 = creation error
263 
265 
268  CompassSymbol myCompassSymbols[24];
273 
275 
278  DtCoordinateSystem* myCoordinateSystem = nullptr;
279  };
280 }
281 
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:253
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:104
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:267
This owns a list of channel configurations.
Definition: DtWindowConfiguration.h:26
bool myCompassDirty
Definition: DtOsgChannel3dViewCompassInstance.h:272
This class provides the OSG-specific implementation of a DtChannel.
Definition: DtOsgChannel.h:55
CompassSymbol()
Definition: DtOsgChannel3dViewCompassInstance.h:106
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:220
bool myIsExactHeadingAlwaysShown
Definition: DtOsgChannel3dViewCompassInstance.h:260
int myCreateState
Definition: DtOsgChannel3dViewCompassInstance.h:262
DtSignalConnectionManager myPixelRatioConnection
Definition: DtOsgChannel3dViewCompassInstance.h:254
int numCharacters
Definition: DtOsgChannel3dViewCompassInstance.h:118
A structure to contain light and dark line segments for a compass tick mark.
Definition: DtOsgChannel3dViewCompassInstance.h:240
Contains the DtSharedDisplayUnitsSettings class declaration.
The abstract Channel Class.
Definition: DtChannel.h:35
TickMark myPopoutL
Definition: DtOsgChannel3dViewCompassInstance.h:270
TickMark()
Definition: DtOsgChannel3dViewCompassInstance.h:242
A class which represents a single line segment.
Definition: DtLineSegment.h:23
CompassSymbol myPopoutSymbol
Definition: DtOsgChannel3dViewCompassInstance.h:269
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
TickMark myPopoutR
Definition: DtOsgChannel3dViewCompassInstance.h:271
float myPixelRatio
Definition: DtOsgChannel3dViewCompassInstance.h:264
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:274
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:256
bool myCompassIsMagnetic
Definition: DtOsgChannel3dViewCompassInstance.h:258
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:250
DtOsgTextureWrapper * myCompassSymbolsTexture
Definition: DtOsgChannel3dViewCompassInstance.h:266
DtLineSegment * darkSide
Definition: DtOsgChannel3dViewCompassInstance.h:122
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:121
DtLineSegment * lightSide
Definition: DtOsgChannel3dViewCompassInstance.h:249
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 Wed Mar 27 22:49:11 EDT 2024 from SVN revision 264633
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)