VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtTriangleRenderer.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright (c) 2020 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
14 
16 
17 #include <vector>
18 
19 #include <tbb/mutex.h>
20 
21 namespace makVrv
22 {
23 
24  class DtDe;
25  class DtOverlayResourceProvider;
26  class DtBufferObject;
27  class DtTriangleProxy;
28  class DtPrimitiveStyle;
29 
32 
35 
37  template <>
38  inline const char* creatorTypeName<DtTriangleRenderer>(void) { return "DtTriangleRendererCreator"; }
39 
43  {
44  public:
45 
46  enum Styles
47  {
48  Style_Flat = 0,
50  //Style_Textured,
51  Styles_End
52  };
53 
55  friend class DtTriangleProxy;
56 
58  virtual ~DtTriangleRenderer();
59 
61  virtual int numberOfPrimitives() const;
62 
64  virtual void render( bool geocentric, float geocentricAlpha
65  , const double location[3]
66  , const double positionMatrix[16]
67  , const double projectionMatrix[16]);
68 
70  virtual void releaseResources();
71 
73  virtual bool isRenderModeSupported( int mode );
74 
76  DtTriangleProxy* allocateProxy(Styles = Style_Flat);
77 
78  protected:
79 
81  DtTriangleRenderer(DtDe& de, DtOverlayResourceProvider& resourceProvider);
82 
84  void add( DtTriangleProxy* toAdd );
85 
87  void remove( const DtTriangleProxy* const proxy,
88  bool isBeingDeleted = false );
89 
91  void dirty( DtTriangleProxy* proxy );
92 
94  void updateRenderData();
95 
96  protected:
97 
98  typedef std::vector<DtTriangleProxy*> TriangleProxyList;
99 
100  DtPrimitiveStyle* myStyles[Styles_End];
103 
104  tbb::mutex myUpdateMutex;
105 
106  };
107 
108 
113  {
114  public:
115 
116  friend class DtTriangleRenderer;
117 
119  ~DtTriangleProxy();
120 
122  void setGroup( float order );
123 
125  float group() const;
126 
128  void set3DPositions(
129  float x1, float y1, float z1, float w1,
130  float x2, float y2, float z2, float w2,
131  float x3, float y3, float z3, float w3 );
132 
136  void set3DPosition( float x, float y, float z, float w );
137 
139  void set3DPosition( unsigned int index, float x, float y, float z,
140  float w );
141 
143  void get3DPosition( unsigned int index, float& x, float& y, float& z,
144  float& w );
145 
147  void set2DPositions( float x1, float y1, float x2, float y2, float x3, float y3 );
148 
150  void set2DPosition( unsigned int index, float x, float y );
151 
153  void get2DPosition( unsigned int index, float& x, float& y ) const;
154 
156  void setStyle( int style );
157 
159  int style() const;
160 
162  void setColor( unsigned int vertIndex, float r, float g, float b,
163  float a );
164 
166  void setColor( float r, float g, float b, float a );
167 
169  void getColor( float& r, float& g, float& b, float& a ) const;
170 
172  void setFillParameters( unsigned int fill,
173  unsigned int fullStipplePattern[32] = 0 );
174 
176  void setIndex( unsigned int index );
177 
179  unsigned int index() const;
180 
181  protected:
182 
184  DtTriangleProxy( DtTriangleRenderer& renderer, unsigned int style );
185 
186  protected:
187 
189  unsigned int myIndex;
190  unsigned char myStyle;
192 
193  };
194 
195 }
DtTriangleRenderer * myParent
Definition: DtTriangleRenderer.h:188
Styles
Definition: DtTriangleRenderer.h:46
The abstract base class for the various primitive styles.
Definition: DtPrimitiveStyle.h:21
const char * creatorTypeName< DtTriangleRenderer >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtTriangleRenderer.h:38
Triangle without patterns.
Definition: DtTriangleRenderer.h:49
bool myDirtyBit
Definition: DtTriangleRenderer.h:191
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
The triangle renderer.
Definition: DtTriangleRenderer.h:42
The overlay resource provider class provies resources for overlay drawing classes.
Definition: DtOverlayResourceProvider.h:23
#define DT_DLL_VRVGRAPHICS
Contains DLL export macros.
Definition: vrvGraphics.h:19
A flyweight class for controlling a triangle owned by the triangle renderer.
Definition: DtTriangleRenderer.h:112
Abstract primitive rendering base class.
Definition: DtPrimitiveRenderer.h:19
TriangleProxyList myDirtyList
Definition: DtTriangleRenderer.h:102
TriangleProxyList myTriangles
Definition: DtTriangleRenderer.h:101
DtVirtualBaseClassCreator< DtTriangleRenderer, DtOverlayResourceProvider & > DtTriangleRendererCreator
creator
Definition: DtTriangleRenderer.h:31
unsigned int myIndex
Definition: DtTriangleRenderer.h:189
friend DtTriangleRendererCreator
Definition: DtTriangleRenderer.h:54
const char int mode
Definition: ioapi.h:38
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:70
tbb::mutex myUpdateMutex
Definition: DtTriangleRenderer.h:104
unsigned char myStyle
Definition: DtTriangleRenderer.h:190
std::vector< DtTriangleProxy * > TriangleProxyList
Definition: DtTriangleRenderer.h:98

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)