00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
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
00063
00064
00065
00066 class DRAWINGCONTEXT3D {
00067
00068 public:
00069
00070 DRAWINGCONTEXT3D (
00071 );
00072
00073 virtual ~DRAWINGCONTEXT3D (
00074 );
00075
00076
00077 void DrawBegin (
00078 SCENE3D* scene,
00079 MGD::CONTEXT* context
00080 );
00081
00082
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
00096 void DrawTriangles (
00097 const TRIANGULATIONVECTOR& triangulations
00098 );
00099
00100
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 }
00179
00180 #endif
00181