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

Generated on Tue Dec 14 13:18:11 2004 for TNTsdk by  doxygen 1.3.8-20040913