VR-Forces 4.0.4 Class Documentation
include/vrvGraphics/DtQuadRenderer.h
Go to the documentation of this file.
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/DtPrimitiveRenderer.h>
00014 
00015 #include <vector>
00016 
00017 namespace makVrv
00018 {
00019 
00020    class DtQuadProxy;
00021    class DtPrimitiveStyle;
00022    class DtOverlayResourceProvider;
00023 
00026    class DT_DLL_VRVGRAPHICS DtQuadRenderer : public DtPrimitiveRenderer
00027    {
00028    public:
00029 
00030       friend class DtQuadProxy;
00031 
00033       DtQuadRenderer( DtOverlayResourceProvider& provider );
00034 
00036       virtual ~DtQuadRenderer();
00037 
00039       virtual int numberOfPrimitives() const;
00040 
00042       virtual void render( bool geocentric, float geocentricAlpha,
00043          const double location[3] = 0, const double positionMatrix[16] = 0 );
00044 
00046       virtual void releaseResources();
00047 
00049       virtual bool isRenderModeSupported( int mode );
00050 
00052       DtQuadProxy* allocateProxy();
00053 
00054    protected:
00055 
00057       void add( DtQuadProxy* toAdd );
00058 
00060       void remove( const DtQuadProxy* const proxy, bool isBeingDeleted = false );
00061 
00063       void dirty( DtQuadProxy* proxy );
00064 
00066       void updateRenderData();
00067 
00068    protected:
00069 
00070       enum Styles
00071       {
00072          Style_Flat = 0,
00073          Style_Stippled,
00074          Style_Textured,
00075          Styles_End
00076       };
00077 
00078       typedef std::vector<DtQuadProxy*> QuadProxyList;
00079 
00080       DtPrimitiveStyle* myStyles[Styles_End];
00081       QuadProxyList myQuads;
00082       QuadProxyList myDirtyList;
00083 
00084    };
00085 
00086 
00090    class DT_DLL_VRVGRAPHICS DtQuadProxy
00091    {
00092    public:
00093 
00094       friend class DtQuadRenderer;
00095 
00096       ~DtQuadProxy();
00097 
00099       void setGroup( float order );
00100 
00102       float group() const;
00103 
00105       void set3DPosition( float x, float y, float z, float w = 0 );
00106 
00108       void get3DPosition( float& x, float& y, float& z, float& w ) const;
00109 
00111       void set2DRotation( float angle );
00112 
00114       void get2DRotation( float& angle ) const;
00115 
00117       void setPoints( const float points[8] );
00118 
00120       void getPoints( float points[8] ) const;
00121 
00123       void getBounds( float bounds[4] ) const;
00124 
00126       void setStyle( int style );
00127 
00129       int style() const;
00130 
00132       void setColor( float r, float g, float b, float a );
00133 
00135       void getColor( float& r, float& g, float& b, float& a ) const;
00136 
00138       void setStippleParameters( unsigned int fill,
00139          unsigned int fullStipplePattern[32] = 0 );
00140 
00142       void setTextureParameters( void* textureHangle,
00143          float left = 0.0f, float right = 1.0f,
00144          float bottom = 0.0f, float top = 1.0f );
00145 
00147       void* textureHandle() const;
00148 
00150       unsigned int index() const;
00151 
00153       void setIndex( unsigned int index );
00154 
00155    protected:
00156 
00158       DtQuadProxy( DtQuadRenderer& renderer, unsigned char effect );
00159 
00163       static void getBoundsFromPoints(float bounds[4], const float points[8]);
00164 
00165    protected:
00166 
00167       DtQuadRenderer* myParent;
00168       unsigned int myIndex;
00169       unsigned char myStyle;
00170       bool myDirtyBit;
00171 
00172    };
00173 
00174 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)