|
pol2d.h00001 /* 00002 Copyright (C) 1998-2001 by Jorrit Tyberghein 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 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 CS_DECLARE_STATIC_CLASSVAR(sharedFactory,SharedFactory,csPolygon2DFactory) 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 * An element for the queue. 00120 */ 00121 struct csQueueElement 00122 { 00123 csPolygon3D* poly3d; 00124 csPolygon2D* poly2d; 00125 }; 00126 00137 class csPolygon2DQueue 00138 { 00139 private: 00140 // The queue. 00141 csQueueElement* queue; 00142 00143 // Maximum number of elements in the queue. 00144 int max_queue; 00145 00146 // Current number of elements in the queue. 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__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |