Panda3D
wdxGraphicsWindow9.h
1 // Filename: wdxGraphicsWindow9.h
2 // Created by: mike (09Jan97)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef WDXGRAPHICSWINDOW9_H
16 #define WDXGRAPHICSWINDOW9_H
17 
18 #include "pandabase.h"
19 #include "winGraphicsWindow.h"
20 #include "dxGraphicsStateGuardian9.h"
21 #include "dxInput9.h"
22 #include "wdxGraphicsPipe9.h"
23 
24 class wdxGraphicsPipe9;
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : wdxGraphicsWindow9
28 // Description : A single graphics window for rendering DirectX under
29 // Microsoft Windows.
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDADX wdxGraphicsWindow9 : public WinGraphicsWindow {
32 public:
34  const string &name,
35  const FrameBufferProperties &fb_prop,
36  const WindowProperties &win_prop,
37  int flags,
39  GraphicsOutput *host);
40  virtual ~wdxGraphicsWindow9();
41 
42  virtual bool begin_frame(FrameMode mode, Thread *current_thread);
43  virtual void end_frame(FrameMode mode, Thread *current_thread);
44  virtual void end_flip();
45 
46  virtual int verify_window_sizes(int numsizes, int *dimen);
47 
48 protected:
49  virtual void close_window();
50  virtual bool open_window();
51  virtual void reset_window(bool swapchain);
52 
53  virtual void fullscreen_restored(WindowProperties &properties);
54  virtual void handle_reshape();
55  virtual bool do_fullscreen_resize(int x_size, int y_size);
56 
57 private:
58  struct DXDeviceInfo {
59  UINT cardID;
60  char szDriver[MAX_DEVICE_IDENTIFIER_STRING];
61  char szDescription[MAX_DEVICE_IDENTIFIER_STRING];
62  GUID guidDeviceIdentifier;
63  DWORD VendorID, DeviceID;
64  LARGE_INTEGER _driver_version;
65  HMONITOR _monitor;
66  };
68 
69  bool create_screen_buffers_and_device(DXScreenData &display,
70  bool force_16bpp_zbuffer);
71 
72  bool choose_device();
73  bool consider_device(wdxGraphicsPipe9 *dxpipe, DXDeviceInfo *device_info);
74 
75  bool reset_device_resize_window(UINT new_xsize, UINT new_ysize);
76  void init_resized_window();
77  void make_current();
78  static int D3DFMT_to_DepthBits(D3DFORMAT fmt);
79  static bool is_badvidmem_card(D3DADAPTER_IDENTIFIER9 *pDevID);
80 
82  DXScreenData _wcontext;
83 
84  int _depth_buffer_bpp;
85  bool _awaiting_restore;
86 
87 public:
88  static TypeHandle get_class_type() {
89  return _type_handle;
90  }
91  static void init_type() {
92  WinGraphicsWindow::init_type();
93  register_type(_type_handle, "wdxGraphicsWindow9",
94  WinGraphicsWindow::get_class_type());
95  }
96  virtual TypeHandle get_type() const {
97  return get_class_type();
98  }
99  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
100 
101 private:
102  static TypeHandle _type_handle;
103  friend class wdxGraphicsPipe9;
104 };
105 
106 
107 #include "wdxGraphicsWindow9.I"
108 
109 #endif
A GraphicsStateGuardian for rendering into DirectX9 contexts.
virtual void end_flip()
This function will be called within the draw thread after begin_flip() has been called on all windows...
virtual void end_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread after rendering is completed for a given frame...
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
A container for the various kinds of properties we might ask to have on a graphics window before we o...
An abstract base class for glGraphicsWindow and dxGraphicsWindow (and, in general, graphics windows that interface with the Microsoft Windows API).
An object to create GraphicsOutputs that share a particular 3-D API.
Definition: graphicsPipe.h:58
virtual int verify_window_sizes(int numsizes, int *dimen)
Determines which of the indicated window sizes are supported by available hardware (e...
This is a base class for the various different classes that represent the result of a frame of render...
A single graphics window for rendering DirectX under Microsoft Windows.
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates all the communication with a particular instance of a given rendering backend...
This graphics pipe represents the interface for creating DirectX9 graphics windows.
This class is the main interface to controlling the render process.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
A container for the various kinds of properties we might ask to have on a graphics frameBuffer before...
virtual bool begin_frame(FrameMode mode, Thread *current_thread)
This function will be called within the draw thread before beginning rendering for a given frame...