00001
00026 #ifndef INC_GRE_3DDC_H
00027 #define INC_GRE_3DDC_H
00028
00029 #ifndef INC_GRE_3DUTILS_H
00030 #include <gre/3dutils.h>
00031 #endif
00032
00033 #ifndef INC_GRE_3DSCENE_H
00034 #include <gre/3dscene.h>
00035 #endif
00036
00037 #ifndef INC_MI32_FILLPOLY_H
00038 #include <mi32/fillpoly.h>
00039 #endif
00040
00041 #ifndef INC_MI32_POLYLINE_H
00042 #include <mi32/polyline.h>
00043 #endif
00044
00045 #ifndef INC_MI32_MGD2_H
00046 #include <mi32/mgd2.h>
00047 #endif
00048
00049
00050 namespace GRE {
00051
00053 class DRAWINGCONTEXT3D {
00054 public:
00055
00056 DRAWINGCONTEXT3D ();
00057
00058 virtual ~DRAWINGCONTEXT3D ();
00059
00061 void DrawBegin (
00062 SCENE3D* scene,
00063 MGD::CONTEXT* context
00064 );
00065
00067 void DrawEnd ();
00068
00069 void DrawPoint (
00070 const DPOINT3D& point
00071 );
00072
00073 void DrawLine (
00074 const DPOINT3D& begin,
00075 const DPOINT3D& end
00076 );
00077
00079 void DrawTriangles (
00080 const TRIANGULATIONVECTOR& triangulations
00081 );
00082
00084 void DrawPixels (
00085 const PIXALIZATIONVECTOR& pixalizations
00086 );
00087
00088 void RenderPixel (
00089 const INT32 col,
00090 const INT32 lin,
00091 const double z
00092 );
00093
00094 void SetColor (
00095 const COLOR& color
00096 ) { if (m_Context != 0) m_Context->SetColor(color); }
00097
00098 SCENE3D* GetScene (
00099 ) { return m_Scene; }
00100
00101 double GetPixelSizeInMM (
00102 ) const;
00103
00104 private:
00105 #ifndef GENERATING_DOXYGEN_OUTPUT
00106
00107 class SPAN : public FILLPOLYGON::SPAN {
00108 public:
00109
00110 SPAN (
00111 DRAWINGCONTEXT3D *dc3d
00112 ) :
00113 m_DC3D(dc3d)
00114 { }
00115
00116 private:
00117
00118 void VProcess (
00119 const double x1,
00120 const double x2,
00121 const double y
00122 );
00123
00124 SPAN (
00125 );
00126
00127 DRAWINGCONTEXT3D *m_DC3D;
00128 };
00129
00130 friend class SPAN;
00131
00132 MGD::CONTEXT *m_Context;
00133 SCENE3D *m_Scene;
00134
00135 TRIANGULATION *m_Triangulation;
00136
00137 DOUBLE_ARRAY<DPOINT3DH> m_Vertices;
00138 DOUBLE_ARRAY<DPOINT3DH> m_Points;
00139
00140 DOUBLE_ARRAY<DPOINT3DH> m_TempPoints;
00141 POLYLINE m_Polyline;
00142
00143 SCREENPLANE m_ScreenPlane;
00144
00145 void FillSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00146 void FillSolidSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00147 void FillPointsFieldSpan (const INT32 col1, const INT32 col2, const INT32 lin);
00148
00149 void DrawTINWireframe (const TRIANGULATION *triangulation);
00150 void DrawTINSolid (const TRIANGULATION *triangulation);
00151
00152 void DrawStripWireframe (const TRIANGULATION *triangulation);
00153 void DrawStripSolid (const TRIANGULATION *triangulation);
00154
00155 void DrawFanWireframe (const TRIANGULATION *triangulation);
00156 void DrawFanSolid (const TRIANGULATION *triangulation);
00157
00158 void DrawTexturizedPixels (const PIXALIZATION *pixalization);
00159 void DrawColoredPixels (const PIXALIZATION *pixalization);
00160 void DrawPointsFieldPixels (const PIXALIZATION *pixalization);
00161 void DrawBitmapPixels (const PIXALIZATION *pixalization);
00162
00163 #endif // GENERATING_DOXYGEN_OUTPUT
00164 };
00165
00166 }
00167
00168 #endif