Bläddra i källkod

forgot to add graphicsDevice.*

Asad M. Zaman 22 år sedan
förälder
incheckning
f6e2112b0f

+ 74 - 0
panda/src/display/graphicsDevice.cxx

@@ -0,0 +1,74 @@
+// Filename: graphicsDevice.cxx
+// Created by:  masad (21Jul03)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "graphicsDevice.h"
+#include "graphicsPipe.h"
+#include "config_display.h"
+
+TypeHandle GraphicsDevice::_type_handle;
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsDevice::Constructor
+//       Access: Protected
+//  Description: Normally, the GraphicsDevice constructor holds 
+//               a reference to the Graphics Pipe that it is part of
+////////////////////////////////////////////////////////////////////
+GraphicsDevice::
+GraphicsDevice(GraphicsPipe *pipe) {
+#ifdef DO_MEMORY_USAGE
+  MemoryUsage::update_type(this, this);
+#endif
+  _pipe = pipe;
+
+  if (display_cat.is_debug()) {
+    display_cat.debug()
+      << "Creating new device using pipe " << (void *)pipe << "\n";
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsDevice::Copy Constructor
+//       Access: Private
+//  Description:
+////////////////////////////////////////////////////////////////////
+GraphicsDevice::
+GraphicsDevice(const GraphicsDevice &) {
+  nassertv(false);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsDevice::Copy Assignment Operator
+//       Access: Private
+//  Description:
+////////////////////////////////////////////////////////////////////
+void GraphicsDevice::
+operator = (const GraphicsDevice &) {
+  nassertv(false);
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsDevice::Destructor
+//       Access: Published, Virtual
+//  Description:
+////////////////////////////////////////////////////////////////////
+GraphicsDevice::
+~GraphicsDevice() {
+  // And we shouldn't have a GraphicsPipe pointer anymore.
+  //  nassertv(_pipe == (GraphicsPipe *)NULL);
+}
+

+ 76 - 0
panda/src/display/graphicsDevice.h

@@ -0,0 +1,76 @@
+// Filename: graphicsDevice.h
+// Created by:  masad (21Jul03)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef GRAPHICSDEVICE_H
+#define GRAPHICSDEVICE_H
+
+#include "pandabase.h"
+
+#include "graphicsPipe.h"
+#include "graphicsStateGuardian.h"
+
+#include "typedReferenceCount.h"
+////////////////////////////////////////////////////////////////////
+//       Class : GraphicsDevice
+// Description : An abstract device object that is part of Graphics
+//               Pipe. This device is set to NULL for OpenGL. But 
+//               DirectX uses it to take control of multiple windows
+//               under single device or multiple devices (i.e. more
+//               than one adapters in the machine).   
+//
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDA GraphicsDevice : public TypedReferenceCount {
+public:
+  GraphicsDevice(GraphicsPipe *pipe);
+
+private:
+  GraphicsDevice(const GraphicsDevice &copy);
+  void operator = (const GraphicsDevice &copy);
+
+PUBLISHED:
+  virtual ~GraphicsDevice();
+
+  INLINE GraphicsPipe *get_pipe() const;
+
+protected:
+  PT(GraphicsPipe) _pipe;
+
+public:
+  static TypeHandle get_class_type() {
+    return _type_handle;
+  }
+  static void init_type() {
+    TypedReferenceCount::init_type();
+    register_type(_type_handle, "GraphicsDevice",
+                  TypedReferenceCount::get_class_type());
+  }
+  virtual TypeHandle get_type() const {
+    return get_class_type();
+  }
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+
+private:
+  static TypeHandle _type_handle;
+
+  friend class GraphicsPipe;
+  friend class GraphicsEngine;
+};
+
+#include "graphicsDevice.I"
+
+#endif /* GRAPHICSDEVICE_H */

+ 30 - 0
panda/src/display/graphicsDevice.i

@@ -0,0 +1,30 @@
+// Filename: graphicsDevice.I
+// Created by:  masad (21Jul03)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: GraphicsDevice::get_pipe
+//       Access: Published
+//  Description: Returns the GraphicsPipe that this device is
+//               associated with.
+////////////////////////////////////////////////////////////////////
+INLINE GraphicsPipe *GraphicsDevice::
+get_pipe() const {
+  return _pipe;
+}
+

+ 55 - 0
panda/src/dxgsg8/dxGraphicsDevice8.h

@@ -0,0 +1,55 @@
+// Filename: dxGraphicsDevice.h
+// Created by:  masad (22Jul03)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#ifndef DXGRAPHICSDEVICE_H
+#define DXGRAPHICSDEVICE_H
+
+//#define GSG_VERBOSE 1
+
+#include "dxgsg8base.h"
+#include "graphicsDevice.h"
+#include "wdxGraphicsPipe8.h"
+
+
+////////////////////////////////////////////////////////////////////
+//   Class : DXGraphicsDevice8
+// Description : A GraphicsDevice necessary for multi-window rendering
+//               in DX. 
+////////////////////////////////////////////////////////////////////
+class EXPCL_PANDADX DXGraphicsDevice8 : public GraphicsDevice {
+  friend class wdxGraphicsPipe8;
+
+public:
+  DXGraphicsDevice8(wdxGraphicsPipe8 *pipe);
+  ~DXGraphicsDevice8();
+
+  DXScreenData *_pScrn;
+  LPDIRECT3DDEVICE8 _pD3DDevice;  // same as pScrn->_pD3DDevice, cached for spd
+  IDirect3DSwapChain8 *_pSwapChain;
+
+#if 0
+protected:
+  static TypeHandle get_class_type(void);
+  static void init_type(void);
+  virtual TypeHandle get_type(void) const;
+  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
+#endif
+};
+
+#endif
+

+ 46 - 0
panda/src/dxgsg8/dxgraphicsDevice8.cxx

@@ -0,0 +1,46 @@
+// Filename: dxGraphicsDevice.cxx
+// Created by:  masad (22Jul03)
+//
+////////////////////////////////////////////////////////////////////
+//
+// PANDA 3D SOFTWARE
+// Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
+//
+// All use of this software is subject to the terms of the Panda 3d
+// Software license.  You should have received a copy of this license
+// along with this source code; you will also find a current copy of
+// the license at http://www.panda3d.org/license.txt .
+//
+// To contact the maintainers of this program write to
+// [email protected] .
+//
+////////////////////////////////////////////////////////////////////
+
+#include "config_dxgsg8.h"
+#include "dxGraphicsDevice8.h"
+
+
+////////////////////////////////////////////////////////////////////
+//     Function: DXGraphicsDevice8::Constructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+DXGraphicsDevice8::
+DXGraphicsDevice8(wdxGraphicsPipe8 *pipe) :
+  GraphicsDevice(pipe) {
+
+    _pScrn = NULL;
+    _pD3DDevice = NULL;
+    _pSwapChain = NULL;
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: DXGraphicsDevice8::Destructor
+//       Access: Public
+//  Description:
+////////////////////////////////////////////////////////////////////
+DXGraphicsDevice8::
+~DXGraphicsDevice8() {
+
+}
+