From f6e2112b0f496d953c9bad55cad3977ddbc41123 Mon Sep 17 00:00:00 2001 From: "Asad M. Zaman" Date: Wed, 30 Jul 2003 19:39:46 +0000 Subject: [PATCH] forgot to add graphicsDevice.* --- panda/src/display/graphicsDevice.cxx | 74 +++++++++++++++++++++++++ panda/src/display/graphicsDevice.h | 76 ++++++++++++++++++++++++++ panda/src/display/graphicsDevice.i | 30 ++++++++++ panda/src/dxgsg8/dxGraphicsDevice8.h | 55 +++++++++++++++++++ panda/src/dxgsg8/dxgraphicsDevice8.cxx | 46 ++++++++++++++++ 5 files changed, 281 insertions(+) create mode 100755 panda/src/display/graphicsDevice.cxx create mode 100755 panda/src/display/graphicsDevice.h create mode 100755 panda/src/display/graphicsDevice.i create mode 100755 panda/src/dxgsg8/dxGraphicsDevice8.h create mode 100755 panda/src/dxgsg8/dxgraphicsDevice8.cxx diff --git a/panda/src/display/graphicsDevice.cxx b/panda/src/display/graphicsDevice.cxx new file mode 100755 index 0000000000..3b016784c1 --- /dev/null +++ b/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 +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#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); +} + diff --git a/panda/src/display/graphicsDevice.h b/panda/src/display/graphicsDevice.h new file mode 100755 index 0000000000..5b6799609c --- /dev/null +++ b/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 +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#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 ©); + void operator = (const GraphicsDevice ©); + +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 */ diff --git a/panda/src/display/graphicsDevice.i b/panda/src/display/graphicsDevice.i new file mode 100755 index 0000000000..ac94f3e303 --- /dev/null +++ b/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 +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + + +//////////////////////////////////////////////////////////////////// +// Function: GraphicsDevice::get_pipe +// Access: Published +// Description: Returns the GraphicsPipe that this device is +// associated with. +//////////////////////////////////////////////////////////////////// +INLINE GraphicsPipe *GraphicsDevice:: +get_pipe() const { + return _pipe; +} + diff --git a/panda/src/dxgsg8/dxGraphicsDevice8.h b/panda/src/dxgsg8/dxGraphicsDevice8.h new file mode 100755 index 0000000000..2ee6afc63c --- /dev/null +++ b/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 +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#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 + diff --git a/panda/src/dxgsg8/dxgraphicsDevice8.cxx b/panda/src/dxgsg8/dxgraphicsDevice8.cxx new file mode 100755 index 0000000000..c096aaf2d9 --- /dev/null +++ b/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 +// panda3d@yahoogroups.com . +// +//////////////////////////////////////////////////////////////////// + +#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() { + +} +