Panda3D
 All Classes Functions Variables Enumerations
wdxGraphicsWindow8.h
00001 // Filename: wdxGraphicsWindow8.h
00002 // Created by:  mike (09Jan97)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef WDXGRAPHICSWINDOW8_H
00016 #define WDXGRAPHICSWINDOW8_H
00017 
00018 #include "pandabase.h"
00019 #include "winGraphicsWindow.h"
00020 #include "dxGraphicsStateGuardian8.h"
00021 #include "dxInput8.h"
00022 #include "wdxGraphicsPipe8.h"
00023 
00024 class wdxGraphicsPipe8;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : wdxGraphicsWindow8
00028 // Description : A single graphics window for rendering DirectX under
00029 //               Microsoft Windows.
00030 ////////////////////////////////////////////////////////////////////
00031 class EXPCL_PANDADX wdxGraphicsWindow8 : public WinGraphicsWindow {
00032 public:
00033   wdxGraphicsWindow8(GraphicsEngine *engine, GraphicsPipe *pipe,
00034                      const string &name,
00035                      const FrameBufferProperties &fb_prop,
00036                      const WindowProperties &win_prop,
00037                      int flags,
00038                      GraphicsStateGuardian *gsg,
00039                      GraphicsOutput *host);
00040   virtual ~wdxGraphicsWindow8();
00041 
00042   virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00043   virtual void end_frame(FrameMode mode, Thread *current_thread);
00044   virtual void end_flip();
00045 
00046   virtual int verify_window_sizes(int numsizes, int *dimen);
00047 
00048 protected:
00049   virtual void close_window();
00050   virtual bool open_window();
00051   virtual void reset_window(bool swapchain);
00052 
00053   virtual void fullscreen_restored(WindowProperties &properties);
00054   virtual void handle_reshape();
00055   virtual bool do_fullscreen_resize(int x_size, int y_size);
00056 
00057 private:
00058   struct DXDeviceInfo {
00059     UINT cardID;
00060     char szDriver[MAX_DEVICE_IDENTIFIER_STRING];
00061     char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
00062     GUID guidDeviceIdentifier;
00063     DWORD VendorID, DeviceID;
00064     HMONITOR _monitor;
00065   };
00066   typedef pvector<DXDeviceInfo> DXDeviceInfoVec;
00067 
00068   bool create_screen_buffers_and_device(DXScreenData &display,
00069                                         bool force_16bpp_zbuffer);
00070 
00071   bool choose_device();
00072   bool search_for_device(wdxGraphicsPipe8 *dxpipe, DXDeviceInfo *device_info);
00073 
00074   bool reset_device_resize_window(UINT new_xsize, UINT new_ysize);
00075   void init_resized_window();
00076   void make_current();
00077   static int D3DFMT_to_DepthBits(D3DFORMAT fmt);
00078   static bool is_badvidmem_card(D3DADAPTER_IDENTIFIER8 *pDevID);
00079 
00080   DXGraphicsStateGuardian8 *_dxgsg;
00081   DXScreenData _wcontext;
00082 
00083   int _depth_buffer_bpp;
00084   bool _awaiting_restore;
00085 
00086 public:
00087   static TypeHandle get_class_type() {
00088     return _type_handle;
00089   }
00090   static void init_type() {
00091     WinGraphicsWindow::init_type();
00092     register_type(_type_handle, "wdxGraphicsWindow8",
00093                   WinGraphicsWindow::get_class_type());
00094   }
00095   virtual TypeHandle get_type() const {
00096     return get_class_type();
00097   }
00098   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00099 
00100 private:
00101   static TypeHandle _type_handle;
00102   friend class wdxGraphicsPipe8;
00103 };
00104 
00105 
00106 #include "wdxGraphicsWindow8.I"
00107 
00108 #endif
 All Classes Functions Variables Enumerations