![]() |
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/DtPrimitiveStyle.h> 00013 #include <vrvGraphics/DtFlat2DRenderer.h> 00014 00015 #include <vector> 00016 #include <map> 00017 00018 namespace makVrv 00019 { 00020 00021 class DtOverlayResourceProvider; 00022 00025 class DT_DLL_VRVGRAPHICS DtStippledPrimitiveStyle : public DtPrimitiveStyle 00026 { 00027 public: 00028 00030 DtStippledPrimitiveStyle( DtOverlayResourceProvider& provider, 00031 unsigned int vertexCount ); 00032 00034 virtual ~DtStippledPrimitiveStyle(); 00035 00037 virtual void add( unsigned int* ); 00038 00040 virtual void remove( unsigned int index ); 00041 00043 virtual void render( int mode, unsigned int groupCount, bool geocentric, 00044 float geocentricAlpha, const double cameraLocation[3] = 0, 00045 const double positionMatrix[16] = 0, int offset = 0 ); 00046 00048 virtual void update( int renderMode ); 00049 00050 00053 00055 virtual void set3DVertexPosition( unsigned int index, unsigned int vertex, 00056 float x, float y, float z, float w = 0 ); 00057 00059 virtual void get3DVertexPosition( unsigned int index, unsigned int vertex, 00060 float& x, float& y, float& z, float& w ) const; 00061 00063 virtual void set2DVertexPosition( unsigned int index, unsigned int vertex, 00064 float x, float y ); 00065 00067 virtual void get2DVertexPosition( unsigned int index, unsigned int vertex, 00068 float& x, float& y ) const; 00069 00071 virtual void set2DOffsetRotation( unsigned int index, 00072 unsigned int vertIndex, float angle ); 00073 00075 virtual void get2DOffsetRotation( unsigned int index, 00076 unsigned int vertIndex, float& angle ) const; 00077 00079 virtual void setColor( unsigned int index, unsigned int vertIndex, 00080 float r, float g, float b, float a ); 00081 00083 virtual void getColor( unsigned int index, unsigned int vertIndex, 00084 float& r, float& g, float& b, float& a ) const; 00085 00087 virtual void setUVCoordinates( unsigned int index, 00088 unsigned int vertIndex, float u, float v ); 00089 00091 virtual void getUVCoordinates( unsigned int index, 00092 unsigned int vertIndex, float& u, float& v ) const; 00093 00095 00096 00099 00102 virtual void setFillParameters( unsigned int index, void* fill, 00103 unsigned int fullStipplePattern[32] = 0 ); 00104 00107 virtual void getFillParameters( unsigned int index, void*& fill, 00108 unsigned int fullStipplePattern[32] = 0 ) const; 00109 00112 virtual void setGroup( unsigned int index, float zFactor ); 00113 00116 virtual float group( unsigned int index ) const; 00117 00119 00120 protected: 00121 00123 virtual float* vertexData() const; 00124 00126 virtual unsigned int vertexDataSize() const; 00127 00128 protected: 00129 00130 struct StippledPrimitiveInfo 00131 { 00132 unsigned int* indexPtr; 00133 unsigned int quadStipple[32]; 00134 }; 00135 00136 struct StipplePattern 00137 { 00138 unsigned int key[32]; 00139 bool operator<(const StipplePattern& b) const; 00140 }; 00141 00142 typedef std::vector<DtOffsetColoredVertex> VertexList; 00143 typedef std::vector<StippledPrimitiveInfo> StippledPrimitiveInfoList; 00144 typedef std::map< StipplePattern, std::vector<unsigned int> > StippleIndexMap; 00145 00146 DtOverlayResourceProvider& myResourceProvider; 00147 VertexList myStippleVertices; 00148 StippledPrimitiveInfoList myStipplePrimitives; 00149 StippleIndexMap myStippleIndexMap; 00150 00151 DtProjected2DFlatEffect* myEffect; 00152 00153 }; 00154 00155 }