gre/3ddc.h

Go to the documentation of this file.
00001 /**
00002  * \file gre/3ddc.h 
00003  * \brief Class for drawing context in 3d
00004  *
00005  * \if NODOC
00006  * $Id: 3ddc.h_v 1.15 2005/07/22 21:48:31 vdronov Exp $
00007  *
00008  * $Log: 3ddc.h_v $
00009  * Revision 1.15  2005/07/22 21:48:31  vdronov
00010  * added bitmap pattern rendering
00011  *
00012  * Revision 1.14  2005/03/10 21:42:18  vdronov
00013  * *** empty log message ***
00014  *
00015  * Revision 1.13  2005/02/17 17:54:51  vdronov
00016  * *** empty log message ***
00017  *
00018  * Revision 1.12  2004/11/23 23:52:02  vdronov
00019  * ALIGN16
00020  *
00021  * Revision 1.11  2004/09/03 16:54:06  vdronov
00022  * *** empty log message ***
00023  *
00024  * Revision 1.10  2004/07/30 22:41:09  vdronov
00025  * *** empty log message ***
00026  *
00027  * Revision 1.9  2003/10/02 16:14:06  linux32build!build
00028  * Doxygen
00029  *
00030  * Revision 1.8  2003/09/26 17:18:49  vdronov
00031  * added triangle drawing for strip and fan mode
00032  *
00033  * Revision 1.7  2003/08/20 18:00:52  vdronov
00034  * changed m_Vertices from FPOINT3DH to DPOINT3DH because of precision loss
00035  *
00036  * Revision 1.6  2003/08/14 21:00:08  vdronov
00037  * added docs
00038  *
00039  * Revision 1.5  2003/07/30 13:33:52  mju
00040  * Check inclusion guards.
00041  * Ignore private section.
00042  *
00043  * Revision 1.4  2003/05/05 19:59:51  vdronov
00044  * added 2 new methods
00045  *
00046  * Revision 1.3  2003/04/09 19:10:51  vdronov
00047  * terrain null value
00048  *
00049  * Revision 1.2  2003/04/08 17:51:23  vdronov
00050  * changed triangulation structure
00051  *
00052  * Revision 1.1  2003/03/26 14:25:32  vdronov
00053  * Initial revision
00054  * \endif
00055 **/ 
00056 
00057 #ifndef  INC_GRE_3DDC_H
00058 #define  INC_GRE_3DDC_H
00059 
00060 #ifndef  INC_FILLPOLY_H
00061 #include <mi32/fillpoly.h>
00062 #endif
00063 
00064 #ifndef  INC_GRE_3DFILTER_H
00065 #include <gre/3dfilter.h>
00066 #endif
00067 
00068 #ifndef  INC_GRE_3DTEXTUR_H
00069 #include <gre/3dtextur.h>
00070 #endif
00071 
00072 namespace GRE {
00073 
00074 // DRAWINGCONTEXT3D class.
00075 //
00076 //!   Provide common methods to draw in 3D view
00077 //!
00078 class DRAWINGCONTEXT3D {
00079 
00080    public:
00081 
00082       DRAWINGCONTEXT3D (
00083          );
00084 
00085       virtual ~DRAWINGCONTEXT3D (
00086          );
00087 
00088       //!   Initialization of drawing context
00089       void DrawBegin (
00090          SCENE3D* scene,
00091          MGD::CONTEXT* context 
00092          );
00093 
00094       //!   Finalization of drawing context
00095       void DrawEnd (
00096          );
00097 
00098       void DrawPoint (
00099          const DPOINT3D& point
00100          );
00101 
00102       void DrawLine (
00103          const DPOINT3D& begin,
00104          const DPOINT3D& end
00105          );
00106 
00107       //!   Draw array of triangles using generic structure TRIANGULATION
00108       void DrawTriangles (    
00109          const TRIANGULATIONVECTOR& triangulations
00110          );
00111 
00112       //!   Draw array of pixels using generic structure PIXALIZATION
00113       void DrawPixels (    
00114          const PIXALIZATIONVECTOR& pixalizations
00115          );
00116 
00117       void RenderPixel (
00118          const INT32 col, 
00119          const INT32 lin, 
00120          const double z
00121          ); 
00122 
00123       void SetColor (
00124          const COLOR& color
00125          ) {
00126          if (m_Context != 0) m_Context->SetColor(color);
00127          return;
00128          };
00129 
00130       SCENE3D* GetScene (
00131          ) { return m_Scene; }
00132 
00133       double GetPixelSizeInMM (
00134          ) const;
00135 
00136    private:
00137 
00138       #ifndef GENERATING_DOXYGEN_OUTPUT
00139 
00140       class SPAN : public FILLPOLYGON::SPAN {
00141 
00142          public:
00143 
00144          SPAN (
00145             DRAWINGCONTEXT3D *dc3d
00146             ) :
00147             m_DC3D(dc3d)
00148             {
00149             };
00150 
00151          private:
00152 
00153          void VProcess (
00154             const double x1, 
00155             const double x2, 
00156             const double y
00157             );
00158 
00159          SPAN (
00160             );
00161 
00162          DRAWINGCONTEXT3D *m_DC3D;
00163          };
00164 
00165       friend class SPAN;
00166 
00167       MGD::CONTEXT *m_Context; 
00168       SCENE3D *m_Scene;
00169 
00170       TRIANGULATION *m_Triangulation;
00171 
00172       DOUBLE_ARRAY<DPOINT3DH> m_Vertices;
00173       DOUBLE_ARRAY<DPOINT3DH> m_Points;
00174 
00175       DOUBLE_ARRAY<DPOINT3DH> m_TempPoints;
00176       POLYLINE m_Polyline;
00177 
00178       SCREENPLANE m_ScreenPlane;
00179 
00180       void FillSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00181       void FillSolidSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00182       void FillPointsFieldSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00183 
00184       void DrawTINWireframe (const TRIANGULATION *triangulation);
00185       void DrawTINSolid (const TRIANGULATION *triangulation);
00186 
00187       void DrawStripWireframe (const TRIANGULATION *triangulation);
00188       void DrawStripSolid (const TRIANGULATION *triangulation);
00189 
00190       void DrawFanWireframe (const TRIANGULATION *triangulation);
00191       void DrawFanSolid (const TRIANGULATION *triangulation);
00192 
00193       void DrawTexturizedPixels (const PIXALIZATION *pixalization);
00194       void DrawColoredPixels (const PIXALIZATION *pixalization);
00195       void DrawPointsFieldPixels (const PIXALIZATION *pixalization);
00196       void DrawBitmapPixels (const PIXALIZATION *pixalization);
00197 
00198       };
00199 
00200    #endif  // GENERATING_DOXYGEN_OUTPUT   
00201 
00202    }     // End of namespace
00203 
00204 #endif
00205 

Generated on Thu Apr 26 04:03:28 2007 for TNTsdk by  doxygen 1.5.2