00001
00002
00003
00004
00005
00006
00007
00008
00009 #pragma once
00010 #include "baseinterface.h"
00011 #include "strbasic.h"
00012 #include "matrix3.h"
00013 #include "GraphicsConstants.h"
00014 #include "GraphicsTypes.h"
00015 #include "Strip.h"
00016
00017 class Light;
00018 class Camera;
00019 class Material;
00020 class IPoint3;
00021 class GWFace;
00022 class BitArray;
00023 class HitRegion;
00024 class VertexBuffer;
00025 class LineBuffer;
00026 namespace GFX_MESH
00027 {
00028 class HWTupleMesh;
00029 class IHWSubMesh;
00030 };
00031
00032
00065 #pragma warning(push)
00066 #pragma warning(disable:4100)
00067 class GraphicsWindow : public InterfaceServer {
00068 public:
00069 virtual ~GraphicsWindow() {}
00072 virtual void postCreate(int ct, GraphicsWindow **gw) = 0;
00074 virtual void shutdown() = 0;
00076 virtual int getVersion() = 0;
00078 virtual MCHAR * getDriverString(void) = 0;
00084 virtual void config(HWND hWnd) = 0;
00148 virtual int querySupport(int what) = 0;
00149
00152 virtual HWND getHWnd(void) = 0;
00165 virtual void setPos(int x, int y, int w, int h) = 0;
00174 virtual void setDisplayState(int s) = 0;
00179 virtual int getDisplayState() = 0;
00181 virtual int getWinSizeX() = 0;
00183 virtual int getWinSizeY() = 0;
00185 virtual DWORD getWinDepth(void) = 0;
00187 virtual DWORD getHitherCoord(void) = 0;
00189 virtual DWORD getYonCoord(void) = 0;
00198 virtual void getTextExtents(MCHAR *text, SIZE *sp) = 0;
00201 virtual int getMaxStripLength() { return GFX_MAX_STRIP; }
00202 virtual void setFlags(DWORD f) = 0;
00203 virtual DWORD getFlags() = 0;
00204
00212 virtual void resetUpdateRect() = 0;
00218 virtual void enlargeUpdateRect(RECT *rp) = 0;
00224 virtual int getUpdateRect(RECT *rp) = 0;
00227 virtual void updateScreen() = 0;
00228
00247 virtual BOOL setBufAccess(int which, int b) = 0;
00260 virtual BOOL getBufAccess(int which) = 0;
00276 virtual BOOL getBufSize(int which, int *size) = 0;
00290 virtual BOOL getBuf(int which, int size, void *buf) = 0;
00305 virtual BOOL setBuf(int which, int size, void *buf, RECT *rp) = 0;
00353 virtual BOOL getDIB(BITMAPINFO *bmi, int *size) = 0;
00355 virtual BOOL setBackgroundDIB(int width, int height, BITMAPINFO *bmi) = 0;
00357 virtual void setBackgroundOffset(int x, int y) = 0;
00358 virtual int useClosestTextureSize(int bkg=FALSE) = 0;
00368 virtual int getTextureSize(int bkg=FALSE) = 0;
00383 virtual DWORD_PTR getTextureHandle(BITMAPINFO *bmi) = 0;
00390 virtual void freeTextureHandle(DWORD_PTR handle) = 0;
00396 virtual BOOL setTextureByHandle(DWORD_PTR handle, int texStage=0) = 0;
00397 virtual void setTextureColorOp(int texStage=0, int texOp=GW_TEX_MODULATE, int texAlphaSource=GW_TEX_TEXTURE, int texScale=GW_TEX_SCALE_1X) = 0;
00398 virtual void setTextureAlphaOp(int texStage=0, int texOp=GW_TEX_MODULATE, int texAlphaSource=GW_TEX_TEXTURE, int texScale=GW_TEX_SCALE_1X) = 0;
00418 virtual BOOL setTextureTiling(int u, int v, int w=GW_TEX_NO_TILING, int texStage=0) = 0;
00437 virtual int getTextureTiling(int which, int texStage=0) = 0;
00438
00442 virtual void beginFrame() = 0;
00446 virtual void endFrame() = 0;
00465 virtual void setViewport(int x, int y, int w, int h) = 0;
00469 virtual void setVirtualViewportParams(float zoom, float xOffset, float yOffset) = 0;
00476 virtual void setUseVirtualViewport(int onOff) = 0;
00485 virtual void clearScreen(RECT *rp, int useBkg = FALSE) = 0;
00507 virtual void setTransform(const Matrix3 &m) = 0;
00508 virtual Matrix3 getTransform(void) = 0;
00509 virtual void multiplePass(int pass, BOOL onOff, float scaleFact = 1.005f) = 0;
00517 virtual void setTransparency(DWORD settings) = 0;
00523 virtual void setTexTransform(const Matrix3 &m, int texStage=0) = 0;
00527 virtual BOOL getFlipped(void)=0;
00539 virtual void setSkipCount(int c) = 0;
00541 virtual int getSkipCount(void) = 0;
00542 virtual void setViewportLimits(DWORD l) = 0;
00543 virtual DWORD getViewportLimits(void) = 0;
00564 virtual void setRndLimits(DWORD l) = 0;
00567 virtual DWORD getRndLimits(void) = 0;
00572 virtual DWORD getRndMode(void) = 0;
00575 virtual int getMaxLights(void) = 0;
00590 virtual void setLight(int num, const Light *l) = 0;
00599 virtual void setLightExclusion(DWORD exclVec) = 0;
00601 virtual void setCamera(const Camera& c) = 0;
00616 virtual void setCameraMatrix(float mat[4][4], Matrix3 *invTM, int persp, float hither, float yon) = 0;
00630 virtual void getCameraMatrix(float mat[4][4], Matrix3 *invTM, int *persp, float *hither, float *yon) = 0;
00651 virtual void setColor(ColorType t, float r, float g, float b) = 0;
00652 void setColor(ColorType t, Point3 clr) { setColor(t,clr.x,clr.y,clr.z); }
00662 virtual void setMaterial(const Material& m, int index = 0) = 0;
00665 virtual Material *getMaterial(void) = 0;
00666 virtual int getMaxTextures(void) = 0;
00667
00686 virtual DWORD hTransPoint(const Point3 *in, IPoint3 *out) = 0;
00705 virtual DWORD wTransPoint(const Point3 *in, IPoint3 *out) = 0;
00725 virtual DWORD transPoint(const Point3 *in, Point3 *out) = 0;
00738 virtual void lightVertex(const Point3 &pos, const Point3 &nor, Point3 &rgb) = 0;
00739
00748 virtual void hText(IPoint3 *xyz, MCHAR *s) = 0;
00756 virtual void hMarker(IPoint3 *xyz, MarkerType type) = 0;
00787 virtual void hPolyline(int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es) = 0;
00823 void hPolyline(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
00824 { hPolyline(ct, xyz, rgb, closed, es); }
00841 virtual void hPolygon(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
00866 virtual void hTriStrip(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
00867
00876 virtual void wText(IPoint3 *xyz, MCHAR *s) = 0;
00883 virtual void wMarker(IPoint3 *xyz, MarkerType type) = 0;
00914 virtual void wPolyline(int ct, IPoint3 *xyz, Point3 *rgb, int closed, int *es) = 0;
00950 void wPolyline(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
00951 { wPolyline(ct, xyz, rgb, closed, es); }
00952
00969 virtual void wPolygon(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
00970
00995 virtual void wTriStrip(int ct, IPoint3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
00996
01012 virtual void text(Point3 *xyz, MCHAR *s) = 0;
01013 virtual void startMarkers() = 0;
01028 virtual void marker(Point3 *xyz, MarkerType type) = 0;
01029 virtual void endMarkers() = 0;
01030 virtual void polyline(int ct, Point3 *xyz, Point3 *rgb, int closed, int *es) = 0;
01080 void polyline(int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int closed, int *es)
01081 { polyline(ct, xyz, rgb, closed, es); }
01123 virtual void polylineN(int ct, Point3 *xyz, Point3 *nor, int closed, int *es) = 0;
01127 virtual void startSegments() = 0;
01135 virtual void segment(Point3 *xyz, int vis) = 0;
01137 virtual void endSegments() = 0;
01164 virtual void polygon(int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
01188 virtual void polygonN(int ct, Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1) = 0;
01211 virtual void triStrip(int ct, Point3 *xyz, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
01233 virtual void triStripN(int ct, Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1) = 0;
01237 virtual void startTriangles() = 0;
01255 virtual void triangle(Point3 *xyz, Point3 *rgb) = 0;
01272 virtual void triangleN(Point3 *xyz, Point3 *nor, Point3 *uvw, int texNum=1) = 0;
01289 virtual void triangleNC(Point3 *xyz, Point3 *nor, Point3 *rgb) = 0;
01308 virtual void triangleNCT(Point3 *xyz, Point3 *nor, Point3 *rgb, Point3 *uvw, int texNum=1) = 0;
01309 virtual void triangleW(Point3 *xyz, int *es) = 0;
01310 virtual void triangleNW(Point3 *xyz, Point3 *nor, int *es) = 0;
01313 virtual void endTriangles() = 0;
01314 virtual void loadMeshData(DWORD_PTR id, int xyzCt, Point3 *xyz, int norCt, Point3 *nor, int texNum, int uvwCt, Point3 *uvw, int mtlCt, Material *mtl) = 0;
01315 virtual void processStrips(DWORD_PTR id, int stripCt, StripTab *s, GFX_ESCAPE_FN fn) = 0;
01316 virtual void processWireFaces(int xyzCt, Point3 *xyz, int faceCt, GWFace *face, int dispFlags, BitArray *faceSel, BitArray *edgeSel, int mtlCt, Material *mtl, GFX_ESCAPE_FN fn) = 0;
01317
01323 virtual void setHitRegion(HitRegion *rgn) = 0;
01326 virtual void clearHitCode(void) = 0;
01329 virtual BOOL checkHitCode(void) = 0;
01398 virtual void setHitCode(BOOL h) = 0;
01405 virtual DWORD getHitDistance(void) = 0;
01414 virtual void setHitDistance(DWORD d) = 0;
01415
01418 virtual int isPerspectiveView(void) = 0;
01420 virtual float interpWorld(Point3 *world1, Point3 *world2, float sParam, Point3 *interpPt) = 0;
01421
01422
01423 virtual void MarkerBufferSetMarkerType( MarkerType type) {};
01424 virtual DWORD MarkerGetDXColor(Point3 p) {return 0;};
01425
01426 virtual VertexBuffer* MarkerBufferLock() { return NULL;};
01427 virtual void MarkerBufferUnLock() {};
01428 virtual int MarkerBufferSize( ) {return 0;};
01429 virtual int MarkerBufferStride( ){ return 0;};
01430 virtual void MarkerBufferDraw(int numberOfMarkers) {};
01431
01432
01433 virtual DWORD LineGetDXColor(Point3 p) {return 0;};
01434
01435 virtual LineBuffer* LineBufferLock() { return NULL;};
01436 virtual void LineBufferUnLock() {};
01437 virtual int LineBufferSize( ) {return 0;};
01438 virtual int LineBufferStride( ){ return 0;};
01439 virtual void LineBufferDraw(int numberOfSegments) {};
01440
01441 virtual void escape(GFX_ESCAPE_FN fn, void *data) = 0;
01451 virtual BOOL getDepthValue(float x, float y, float* z) { return FALSE; }
01457 virtual void clearViewportDepth() {};
01458
01462 virtual GFX_MESH::IHWSubMesh* CreateHWDrawMesh(GFX_MESH::HWTupleMesh* hwMesh) {return NULL;};
01463
01468 virtual void DrawHWDrawMesh(GFX_MESH::HWTupleMesh* hwMesh) {};
01469
01470 };
01471 #pragma warning(pop)
01472
01473