VR-Forces 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) 2023 MAK Technologies, Inc.
3  * All rights reserved.
4  *****************************************************************************/
5 
9 
10 #pragma once
11 
14 
16 
17 #include <matrix/vlVector.h>
18 
19 #include <vector>
20 
21 #include <tbb/mutex.h>
22 
23 namespace makVrv
24 {
25 
26  class DtDe;
27  class DtOverlayResourceProvider;
28  class DtBufferObject;
29  class DtTriangleProxy;
30  class DtPrimitiveStyle;
31  struct DtObserverRenderData;
32  struct DtOverlayRenderData;
33  class DtTextureInterface;
34 
37 
40 
42  template <>
43  inline const char* creatorTypeName<DtTriangleRenderer>(void) { return "DtTriangleRendererCreator"; }
44 
48  {
49  public:
50 
51  enum Styles
52  {
53  Style_Flat = 0,
56  Styles_End
57  };
58 
60  friend class DtTriangleProxy;
61 
63  virtual ~DtTriangleRenderer();
64 
66  virtual int numberOfPrimitives() const;
67 
69  virtual void render(const DtOverlayRenderData& overlayRenderData,
70  const DtObserverRenderData& observerRenderData,
71  const double projectionMatrix[16]);
72 
74  virtual void releaseResources();
75 
77  virtual bool isRenderModeSupported( int mode );
78 
80  DtTriangleProxy* allocateProxy(Styles = Style_Flat);
81 
82  protected:
83 
85  DtTriangleRenderer(DtDe& de, DtOverlayResourceProvider& resourceProvider);
86 
88  void add( DtTriangleProxy* toAdd );
89 
91  void remove( const DtTriangleProxy* const proxy,
92  bool isBeingDeleted = false );
93 
95  void dirty( DtTriangleProxy* proxy );
96 
98  void updateRenderData();
99 
100  protected:
101 
102  typedef std::vector<DtTriangleProxy*> TriangleProxyList;
103 
104  DtPrimitiveStyle* myStyles[Styles_End];
107 
108  tbb::mutex myUpdateMutex;
109 
110  };
111 
112 
117  {
118  public:
119 
120  friend class DtTriangleRenderer;
121 
123  ~DtTriangleProxy();
124 
126  void setGroup( float order );
127 
129  float group() const;
130 
132  void set3DPositions(
133  float x1, float y1, float z1, float w1,
134  float x2, float y2, float z2, float w2,
135  float x3, float y3, float z3, float w3 );
136 
140  void set3DPosition( float x, float y, float z, float w );
141 
143  void set3DPosition( unsigned int index, float x, float y, float z,
144  float w );
145 
147  void get3DPosition( unsigned int index, float& x, float& y, float& z,
148  float& w );
149 
151  void set2DPositions( float x1, float y1, float x2, float y2, float x3, float y3 );
152 
154  void set2DPosition( unsigned int index, float x, float y );
155 
157  void get2DPosition( unsigned int index, float& x, float& y ) const;
158 
160  void setStyle( int style );
161 
163  int style() const;
164 
166  void setColor( unsigned int vertIndex, float r, float g, float b,
167  float a );
168 
170  void setColor( float r, float g, float b, float a );
171 
173  void getColor( float& r, float& g, float& b, float& a ) const;
174 
181  void projectUVCoordinates(const DtVector& origin,
182  const DtVector& axisU, const DtVector& axisV, float scale);
183 
190  void setFillPatternFrequency(float frequency);
191 
193  void setFillParameters( unsigned int fullStipplePattern[32] = 0 );
194 
195  void setTextureHandle( DtTextureInterface* textureHandle );
196 
198  void setIndex( unsigned int index );
199 
201  unsigned int index() const;
202 
203  protected:
204 
206  DtTriangleProxy( DtTriangleRenderer& renderer, unsigned int style );
207 
208  protected:
209 
211  unsigned int myIndex;
212  unsigned char myStyle;
214 
215  };
216 
217 }
Triangle with stippled pattern.
Definition: DtTriangleRenderer.h:55
DtTriangleRenderer * myParent
Definition: DtTriangleRenderer.h:210
Styles
Definition: DtTriangleRenderer.h:51
The abstract base class for the various primitive styles.
Definition: DtPrimitiveStyle.h:25
voidpf uLong int origin
Definition: ioapi.h:42
const char * creatorTypeName< DtTriangleRenderer >(void)
template specialization for the creator (pass the class being created to the creatorTypeName template...
Definition: DtTriangleRenderer.h:43
Interface for a texture. Used to pass in a texture to vrvGraphics.
Definition: DtTextureInterface.h:24
Triangle without patterns.
Definition: DtTriangleRenderer.h:54
bool myDirtyBit
Definition: DtTriangleRenderer.h:213
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:22
The triangle renderer.
Definition: DtTriangleRenderer.h:47
The overlay resource provider class provides resources for overlay drawing classes.
Definition: DtOverlayResourceProvider.h:28
#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:116
Abstract primitive rendering base class.
Definition: DtPrimitiveRenderer.h:19
TriangleProxyList myDirtyList
Definition: DtTriangleRenderer.h:106
TriangleProxyList myTriangles
Definition: DtTriangleRenderer.h:105
DtVirtualBaseClassCreator< DtTriangleRenderer, DtOverlayResourceProvider & > DtTriangleRendererCreator
creator
Definition: DtTriangleRenderer.h:36
unsigned int myIndex
Definition: DtTriangleRenderer.h:211
friend DtTriangleRendererCreator
Definition: DtTriangleRenderer.h:59
A structure to hold rendering information for overlays. This is used to pass to various overlay rende...
Definition: DtCommonRenderData.h:42
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:72
tbb::mutex myUpdateMutex
Definition: DtTriangleRenderer.h:108
Definition: DtCommonRenderData.h:32
unsigned char myStyle
Definition: DtTriangleRenderer.h:212
std::vector< DtTriangleProxy * > TriangleProxyList
Definition: DtTriangleRenderer.h:102

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)