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) 2025 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  protected:
82 
84  DtTriangleRenderer(DtDe& de, DtOverlayResourceProvider& resourceProvider);
85 
87  void add( DtTriangleProxy* toAdd );
88 
90  void remove( const DtTriangleProxy* const proxy,
91  bool isBeingDeleted = false );
92 
94  void dirty( DtTriangleProxy* proxy );
95 
97  void updateRenderData();
98 
99  protected:
100 
101  typedef std::vector<DtTriangleProxy*> TriangleProxyList;
102 
103  DtPrimitiveStyle* myStyles[Styles_End];
106 
107  tbb::mutex myUpdateMutex;
108 
109  };
110 
111 
116  {
117  public:
118 
119  friend class DtTriangleRenderer;
120 
122  ~DtTriangleProxy();
123 
125  void setGroup( float order );
126 
128  float group() const;
129 
131  void set3DPositions(
132  float x1, float y1, float z1, float w1,
133  float x2, float y2, float z2, float w2,
134  float x3, float y3, float z3, float w3 );
135 
139  void set3DPosition( float x, float y, float z, float w );
140 
142  void set3DPosition( unsigned int index, float x, float y, float z,
143  float w );
144 
146  void get3DPosition( unsigned int index, float& x, float& y, float& z,
147  float& w );
148 
150  void set2DPositions( float x1, float y1, float x2, float y2, float x3, float y3 );
151 
153  void set2DPosition( unsigned int index, float x, float y );
154 
156  void get2DPosition( unsigned int index, float& x, float& y ) const;
157 
159  void setStyle( int style );
160 
162  int style() const;
163 
165  void setColor( unsigned int vertIndex, float r, float g, float b,
166  float a );
167 
169  void setColor( float r, float g, float b, float a );
170 
172  void getColor( float& r, float& g, float& b, float& a ) const;
173 
180  void projectUVCoordinates(const DtVector& origin,
181  const DtVector& axisU, const DtVector& axisV, float scale);
182 
189  void setFillPatternFrequency(float frequency);
190 
192  void setFillParameters( unsigned int fullStipplePattern[32] = 0 );
193 
194  void setTextureHandle( DtTextureInterface* textureHandle );
195 
197  void setIndex( unsigned int index );
198 
200  unsigned int index() const;
201 
205  virtual void setIsNormalisedScreenCoordinates( bool isNormalisedScreenCoords );
206  protected:
207 
209  DtTriangleProxy( DtTriangleRenderer& renderer, unsigned int style );
210 
211  protected:
212 
214  unsigned int myIndex;
215  unsigned char myStyle;
217 
218  };
219 
220 }
Triangle with stippled pattern.
Definition: DtTriangleRenderer.h:55
DtTriangleRenderer * myParent
Definition: DtTriangleRenderer.h:213
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:216
Variadic templated creator class for defining a DtVirtualBaseClass creator that is automatically regi...
Definition: DtVirtualBaseClassCreator.h:23
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:115
Abstract primitive rendering base class.
Definition: DtPrimitiveRenderer.h:19
TriangleProxyList myDirtyList
Definition: DtTriangleRenderer.h:105
TriangleProxyList myTriangles
Definition: DtTriangleRenderer.h:104
DtVirtualBaseClassCreator< DtTriangleRenderer, DtOverlayResourceProvider & > DtTriangleRendererCreator
creator
Definition: DtTriangleRenderer.h:36
unsigned int myIndex
Definition: DtTriangleRenderer.h:214
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:43
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:76
tbb::mutex myUpdateMutex
Definition: DtTriangleRenderer.h:107
Definition: DtCommonRenderData.h:33
unsigned char myStyle
Definition: DtTriangleRenderer.h:215
std::vector< DtTriangleProxy * > TriangleProxyList
Definition: DtTriangleRenderer.h:101

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)