00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CS_POL2D_H__
00020 #define __CS_POL2D_H__
00021
00022 #include "csutil/scf.h"
00023 #include "csgeom/math2d.h"
00024 #include "csgeom/math3d.h"
00025 #include "csgeom/poly2d.h"
00026 #include "ivideo/graph3d.h"
00027
00028 class csPolygon3D;
00029 class csPolyPlane;
00030 struct iRenderView;
00031 struct iGraphics2D;
00032 struct iGraphics3D;
00033
00041 class csPolygon2D : public csPoly2D
00042 {
00043 public:
00047 void AddPerspective (const csVector3& v);
00048
00054 void AddPerspectiveUnit (const csVector3& v);
00055
00061 void AddPerspectiveAspect (const csVector3& v, float ratio, float shift);
00062
00066 void Draw (iGraphics2D* g2d, int col);
00067
00074 void DrawFilled (iRenderView* rview, csPolygon3D* poly, csPolyPlane* plane,
00075 csZBufMode zbufMode = CS_ZBUF_FILL);
00076
00081 void FillZBuf (iRenderView* rview, csPolygon3D* poly, csPolyPlane* plane);
00082
00087 void AddFogPolygon (iGraphics3D* g3d, csPolygon3D* poly, csPolyPlane* plane,
00088 bool mirror, CS_ID id, int fog_type);
00089 };
00090
00094 class csPolygon2DFactory : public csPoly2DFactory
00095 {
00096 public:
00098 static csPolygon2DFactory* SharedFactory();
00099
00101 virtual csPoly2D* Create () { csPolygon2D* p = new csPolygon2D (); return (csPoly2D*)p; }
00102 };
00103
00104
00105 struct G3DPolygonDPFX;
00106 struct csVertexStatus;
00107
00112 extern void PreparePolygonFX (G3DPolygonDPFX* g3dpoly, csVector2* clipped_poly,
00113 int num_vertices, csVector2 *orig_triangle, bool gouraud);
00114 extern void PreparePolygonFX2 (G3DPolygonDPFX* g3dpoly, csVector2* clipped_poly,
00115 int num_vertices, csVertexStatus* clipped_vtstats,
00116 int orig_num_vertices, bool gouraud);
00117
00118
00119
00120
00121 struct csQueueElement
00122 {
00123 csPolygon3D* poly3d;
00124 csPolygon2D* poly2d;
00125 };
00126
00137 class csPolygon2DQueue
00138 {
00139 private:
00140
00141 csQueueElement* queue;
00142
00143
00144 int max_queue;
00145
00146
00147 int num_queue;
00148
00149 public:
00151 csPolygon2DQueue (int max_size);
00152
00154 ~csPolygon2DQueue ();
00155
00157 void Push (csPolygon3D* poly3d, csPolygon2D* poly2d);
00158
00163 bool Pop (csPolygon3D** poly3d, csPolygon2D** poly2d);
00164 };
00165
00166
00167 #endif // __CS_POL2D_H__