![]() |
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 #include <vrvGraphics/DtPrimitiveStyle.h> 00014 #include <vrvGraphics/DtTextured2DRenderer.h> 00015 #include <boost/unordered_map.hpp> 00016 #include <vector> 00017 00018 namespace makVrv 00019 { 00020 00021 class DtOverlayResourceProvider; 00022 class DtProjected2DTexturedEffect; 00023 00026 class DT_DLL_VRVGRAPHICS DtTexturedPrimitiveStyle : public DtPrimitiveStyle 00027 { 00028 public: 00029 00031 DtTexturedPrimitiveStyle( DtOverlayResourceProvider& provider, 00032 unsigned int vertexCount ); 00033 00035 virtual ~DtTexturedPrimitiveStyle(); 00036 00038 virtual void add( unsigned int* indexPtr ); 00039 00041 virtual void remove( unsigned int index ); 00042 00044 virtual void render( int mode, unsigned int groupCount, bool geocentric, 00045 float geocentricAlpha, const double cameraLocation[3] = 0, 00046 const double positionMatrix[16] = 0, int offset = 0 ); 00047 00048 00051 00053 virtual void set3DVertexPosition( unsigned int index, unsigned int vertex, 00054 float x, float y, float z, float w ); 00055 00057 virtual void get3DVertexPosition( unsigned int index, unsigned int vertex, 00058 float& x, float& y, float& z, float& w ) const; 00059 00061 virtual void set2DVertexPosition( unsigned int index, unsigned int vertex, 00062 float x, float y ); 00063 00065 virtual void get2DVertexPosition( unsigned int index, unsigned int vertex, 00066 float& x, float& y ) const; 00067 00069 virtual void set2DOffsetRotation( unsigned int index, 00070 unsigned int vertIndex, float angle ); 00071 00073 virtual void get2DOffsetRotation( unsigned int index, 00074 unsigned int vertIndex, float& angle ) const; 00075 00077 virtual void setColor( unsigned int index, unsigned int vertex, 00078 float r, float g, float b, float a ); 00079 00081 virtual void getColor( unsigned int index, unsigned int vertex, 00082 float& r, float& g, float& b, float& a ) const; 00083 00085 virtual void setUVCoordinates( unsigned int index, 00086 unsigned int vertIndex, float u, float v ); 00087 00089 virtual void getUVCoordinates( unsigned int index, 00090 unsigned int vertIndex, float& u, float& v ) const; 00091 00093 00094 00097 00100 virtual void setFillParameters( unsigned int index, void* fill, 00101 unsigned int fullStipplePattern[32] = 0 ); 00102 00105 virtual void getFillParameters( unsigned int index, void*& fill, 00106 unsigned int fullStipplePattern[32] ) const; 00107 00110 virtual void setGroup( unsigned int index, float zFactor ); 00111 00114 virtual float group( unsigned int index ) const; 00115 00117 00118 protected: 00119 00121 virtual float* vertexData() const; 00122 00124 virtual unsigned int vertexDataSize() const; 00125 00127 void addIndexedTextureCache( unsigned int index, void* textureHandle ); 00128 00130 void removeIndexedTextureCache( unsigned int index, void* textureHandle ); 00131 00132 protected: 00133 00134 struct TexturedQuadInfo 00135 { 00136 unsigned int* indexPtr; 00137 void* TextureHandle; 00138 }; 00139 00140 typedef std::vector<DtOffsetColoredTexturedVertex> TexturedQuadVertexList; 00141 typedef std::vector<TexturedQuadInfo> TexturedQuadInfoList; 00142 typedef boost::unordered_map<void*,std::vector<unsigned int> > TextureIndexMap; 00143 00144 DtOverlayResourceProvider& myResourceProvider; 00145 TexturedQuadVertexList myTexturedQuadsVertices; 00146 TexturedQuadInfoList myTexturedQuads; 00147 TextureIndexMap myTextureIndexMap; 00148 DtProjected2DTexturedEffect* myEffect; 00149 00150 }; 00151 00152 }