|
csgfxppl.h00001 /* 00002 Crystal Space Windowing System: Graphics Pipeline class 00003 Copyright (C) 1998,1999 by Andrew Zabolotny <bit@eltech.ru> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the 9License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CSGFXPPL_H__ 00021 #define __CSGFXPPL_H__ 00022 00023 #include "csgeom/csrect.h" 00024 #include "cstool/cspixmap.h" 00025 #include "ivideo/graph2d.h" 00026 00027 class csMouse; 00028 struct iGraphics2D; 00029 struct iObjectRegistry; 00030 00031 // Maximal number of primitives which can be drawn IN ONE FRAME 00032 #define MAX_CSWS_PIPELINE_LENGTH 16384 00033 // Maximal number of video pages to sync image 00034 #define MAX_SYNC_PAGES 8 00035 00063 class csGraphicsPipeline 00064 { 00065 private: 00067 friend class csApp; 00068 00071 csImageArea *SyncArea [MAX_SYNC_PAGES]; 00073 csRect RefreshRect; 00075 csRect PageCarry; 00077 int MaxPage; 00079 int CurPage; 00080 00082 int DrawMode; 00084 csRect ClipRect; 00086 csRect OrigClip; 00087 00088 // Frame width and height 00089 int FrameWidth, FrameHeight; 00090 00091 // The 2D graphics driver 00092 iGraphics2D *G2D; 00093 // The 3D graphics driver 00094 iGraphics3D *G3D; 00095 00096 // Do not cache the image of current frame 00097 bool DontCacheFrame; 00098 00100 void Initialize (iObjectRegistry *object_reg); 00102 virtual ~csGraphicsPipeline (); 00103 00105 void Sync (int CurPage, int &xmin, int &ymin, int &xmax, int &ymax); 00106 00108 void Desync (); 00109 00111 void Box (int xmin, int ymin, int xmax, int ymax, int color); 00112 00114 void Line (float x1, float y1, float x2, float y2, int color); 00115 00117 void Pixel (int x, int y, int color); 00118 00120 void Text (int x, int y, int fg, int bg, iFont *font, int fontsize, const char *s); 00121 00123 void Pixmap (csPixmap *s2d, int x, int y, int w, int h, uint8 Alpha); 00124 00126 void TiledPixmap (csPixmap *s2d, int x, int y, int w, int h, 00127 int orgx, int orgy, uint8 Alpha); 00128 00130 void Texture (iTextureHandle *hTex, int sx, int sy, int sw, int sh, 00131 int tx, int ty, int tw, int th, uint8 Alpha); 00132 00134 void SaveArea (csImageArea **Area, int x, int y, int w, int h); 00135 00137 void RestoreArea (csImageArea *Area, bool Free); 00138 00140 void FreeArea (csImageArea *Area); 00141 00143 void Clear (int color); 00144 00146 void SetClipRect (int xmin, int ymin, int xmax, int ymax); 00147 00149 void RestoreClipRect(); 00150 00152 void Polygon3D (G3DPolygonDPFX &poly, uint mode); 00153 00155 bool ClipLine (float &x1, float &y1, float &x2, float &y2, 00156 int ClipX1, int ClipY1, int ClipX2, int ClipY2); 00157 00159 void GetPixel (int x, int y, uint8 &oR, uint8 &oG, uint8 &oB); 00160 00162 bool SwitchMouseCursor (csMouseCursorID Shape); 00163 00165 void ClearZbuffer () 00166 { DrawMode |= CSDRAW_CLEARZBUFFER; } 00167 00169 void ClearZbuffer (int x1, int y1, int x2, int y2); 00170 00172 void SetZbufferMode (unsigned mode) 00173 { G3D->SetRenderState (G3DRENDERSTATE_ZBUFFERMODE, mode); } 00174 00176 void StartFrame (csMouse *Mouse); 00177 00179 void FinishFrame (csMouse *Mouse); 00180 00182 bool BeginDraw (int iMode) 00183 { return (iMode != DrawMode) ? BeginDrawImp (iMode) : true; } 00184 00186 void FinishDraw (); 00187 00189 bool BeginDrawImp (int iMode); 00190 00192 void FinishDrawImp (); 00193 00195 void Invalidate (csRect &rect); 00196 00198 void CanvasResize (); 00199 }; 00200 00201 #endif // __CSGFXPPL_H__ Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000 |