![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /***************************************************************************** 00002 * Copyright (c) 2011 MAK Technologies, Inc. 00003 * All rights reserved. 00004 *****************************************************************************/ 00005 00009 00010 #pragma once 00011 00012 #include <vrvGraphics/vrvGraphics.h> 00013 00014 #include <vrvGraphics/DtPrimitiveRenderer.h> 00015 00016 #include <vector> 00017 00018 namespace makVrv 00019 { 00020 00021 class DtBufferObject; 00022 class DtTriangleProxy; 00023 class DtPrimitiveStyle; 00024 00027 class DT_DLL_VRVGRAPHICS DtTriangleRenderer : public DtPrimitiveRenderer 00028 { 00029 public: 00030 00031 friend class DtTriangleProxy; 00032 00034 DtTriangleRenderer( DtOverlayResourceProvider& resourceProvider ); 00035 00037 virtual ~DtTriangleRenderer(); 00038 00040 virtual int numberOfPrimitives() const; 00041 00043 virtual void render( bool geocentric, float geocentricAlpha, 00044 const double location[3], const double positionMatrix[16] ); 00045 00047 virtual void releaseResources(); 00048 00050 virtual bool isRenderModeSupported( int mode ); 00051 00053 DtTriangleProxy* allocateProxy(); 00054 00055 protected: 00056 00058 void add( DtTriangleProxy* toAdd ); 00059 00061 void remove( const DtTriangleProxy* const proxy, 00062 bool isBeingDeleted = false ); 00063 00065 void dirty( DtTriangleProxy* proxy ); 00066 00068 void updateRenderData(); 00069 00070 protected: 00071 00072 enum Styles 00073 { 00074 Style_Flat = 0, 00075 Style_Stippled, 00076 //Style_Textured, 00077 Styles_End 00078 }; 00079 00080 typedef std::vector<DtTriangleProxy*> TriangleProxyList; 00081 00082 DtPrimitiveStyle* myStyles[Styles_End]; 00083 TriangleProxyList myTriangles; 00084 TriangleProxyList myDirtyList; 00085 00086 }; 00087 00088 00092 class DT_DLL_VRVGRAPHICS DtTriangleProxy 00093 { 00094 public: 00095 00096 friend class DtTriangleRenderer; 00097 00099 ~DtTriangleProxy(); 00100 00102 void setGroup( float order ); 00103 00105 float group() const; 00106 00108 void set3DPositions( 00109 float x1, float y1, float z1, float w1, 00110 float x2, float y2, float z2, float w2, 00111 float x3, float y3, float z3, float w3 ); 00112 00116 void set3DPosition( float x, float y, float z, float w ); 00117 00119 void set3DPosition( unsigned int index, float x, float y, float z, 00120 float w ); 00121 00123 void get3DPosition( unsigned int index, float& x, float& y, float& z, 00124 float& w ); 00125 00127 void set2DPositions( float x1, float y1, float x2, float y2, float x3, float y3 ); 00128 00130 void set2DPosition( unsigned int index, float x, float y ); 00131 00133 void get2DPosition( unsigned int index, float& x, float& y ) const; 00134 00136 void setStyle( int style ); 00137 00139 int style() const; 00140 00142 void setColor( unsigned int vertIndex, float r, float g, float b, 00143 float a ); 00144 00146 void setColor( float r, float g, float b, float a ); 00147 00149 void getColor( float& r, float& g, float& b, float& a ) const; 00150 00152 void setFillParameters( unsigned int fill, 00153 unsigned int fullStipplePattern[32] = 0 ); 00154 00156 void setIndex( unsigned int index ); 00157 00159 unsigned int index() const; 00160 00161 protected: 00162 00164 DtTriangleProxy( DtTriangleRenderer& renderer, unsigned int style ); 00165 00166 protected: 00167 00168 DtTriangleRenderer* myParent; 00169 unsigned int myIndex; 00170 unsigned char myStyle; 00171 bool myDirtyBit; 00172 00173 }; 00174 00175 }