add old files

This commit is contained in:
David Rose 2003-01-09 20:36:57 +00:00
parent ea59108287
commit ba6dd38df7
8 changed files with 8725 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
// Filename: wdxGraphicsPipe.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// 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 WDXGRAPHICSPIPE_H
#define WDXGRAPHICSPIPE_H
//
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include <string>
#include "wdxGraphicsWindow.h"
#include <interactiveGraphicsPipe.h>
////////////////////////////////////////////////////////////////////
// Class : wdxGraphicsPipe
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDADX wdxGraphicsPipe : public InteractiveGraphicsPipe {
public:
wdxGraphicsPipe(const PipeSpecifier&);
wdxGraphicsWindow* find_window(HWND win);
// ButtonHandle lookup_key(WPARAM wparam) const;
virtual TypeHandle get_window_type() const;
public:
static GraphicsPipe* make_wdxGraphicsPipe(const FactoryParams &params);
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();}
private:
static TypeHandle _type_handle;
// int _width;
// int _height;
// bool _shift;
protected:
wdxGraphicsPipe(void);
wdxGraphicsPipe(const wdxGraphicsPipe&);
wdxGraphicsPipe& operator=(const wdxGraphicsPipe&);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,176 @@
// Filename: wdxGraphicsWindow.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// 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 WDXGRAPHICSWINDOW_H
#define WDXGRAPHICSWINDOW_H
//#define WBD_GL_MODE 1 // if setting this, do it in wdxGraphicsStateGuardian.h too
//
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include "dxGraphicsStateGuardian.h"
////////////////////////////////////////////////////////////////////
// Defines
////////////////////////////////////////////////////////////////////
class wdxGraphicsPipe;
class wdxGraphicsWindowGroup;
const int WDXWIN_CONFIGURE = 4;
const int WDXWIN_EVENT = 8;
typedef HRESULT (WINAPI * LPDIRECTDRAWCREATEEX)(GUID FAR * lpGuid, LPVOID *lplpDD, REFIID iid,IUnknown FAR *pUnkOuter);
typedef struct {
char szDriver[MAX_DDDEVICEID_STRING];
char szDescription[MAX_DDDEVICEID_STRING];
GUID guidDeviceIdentifier;
HMONITOR hMon;
} DXDeviceInfo;
typedef vector<DXDeviceInfo> DXDeviceInfoVec;
////////////////////////////////////////////////////////////////////
// Class : wdxGraphicsWindow
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDADX wdxGraphicsWindow : public GraphicsWindow {
friend class DXGraphicsStateGuardian;
friend class DXTextureContext;
friend class wdxGraphicsWindowGroup;
public:
wdxGraphicsWindow(GraphicsPipe* pipe);
wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props);
// this constructor will not initialize the wdx stuff, only the panda graphicswindow stuff
wdxGraphicsWindow(GraphicsPipe* pipe,const GraphicsWindow::Properties& props,wdxGraphicsWindowGroup *pParentGroup);
virtual ~wdxGraphicsWindow(void);
virtual TypeHandle get_gsg_type() const;
static GraphicsWindow* make_wdxGraphicsWindow(const FactoryParams &params);
void set_window_handle(HWND hwnd);
LONG window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
void process_events(void);
INLINE void handle_mouse_motion(int x, int y);
INLINE void handle_mouse_entry(bool bEntering, int x, int y);
INLINE void handle_keypress(ButtonHandle key, int x, int y );
INLINE void handle_keyrelease(ButtonHandle key);
void handle_window_move(int x, int y);
void dx_setup();
virtual bool resize(unsigned int xsize,unsigned int ysize);
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
bool special_check_fullscreen_resolution(UINT xsize,UINT ysize);
virtual int get_depth_bitwidth(void);
protected:
void CreateScreenBuffersAndDevice(LPDIRECTDRAW7 pDD,LPDIRECT3D7 pD3DI);
ButtonHandle lookup_key(WPARAM wparam) const;
// virtual void config(void);
void config_single_window(void);
void config_window(wdxGraphicsWindowGroup *pParentGroup);
void finish_window_setup(void);
bool search_for_device(int devnum,DXDeviceInfo *pDevinfo);
void setup_colormap(void);
public:
UINT_PTR _PandaPausedTimer;
DXGraphicsStateGuardian *_dxgsg;
void CreateScreenBuffersAndDevice(DXScreenData &Display);
private:
INLINE void track_mouse_leaving(HWND hwnd);
wdxGraphicsWindowGroup *_pParentWindowGroup;
HDC _hdc;
HPALETTE _colormap;
typedef enum { NotAdjusting,MovingOrResizing,Resizing } WindowAdjustType;
WindowAdjustType _WindowAdjustingType;
bool _bSizeIsMaximized;
bool _cursor_in_windowclientarea;
bool _tracking_mouse_leaving;
bool _ime_open;
bool _ime_active;
bool _ime_composition_w;
bool _exiting_window;
bool _window_inactive;
bool _active_minimized_fullscreen;
bool _return_control_to_app;
int _depth_buffer_bpp;
public:
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();}
void DestroyMe(bool bAtExitFnCalled);
virtual void do_close_window();
void deactivate_window(void);
void reactivate_window(void);
void handle_reshape(bool bDoDXReset);
private:
static TypeHandle _type_handle;
};
// this class really belongs in panda, not here
class EXPCL_PANDADX wdxGraphicsWindowGroup {
// group of windows are all created at the same time
friend class wdxGraphicsWindow;
PUBLISHED:
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&);
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&,const GraphicsWindow::Properties&);
wdxGraphicsWindowGroup(GraphicsPipe *,const GraphicsWindow::Properties&,const GraphicsWindow::Properties&,
const GraphicsWindow::Properties&);
public:
wdxGraphicsWindowGroup(wdxGraphicsWindow *OneWindow);
// dont publish variable length one, since FFI wont support it
wdxGraphicsWindowGroup(GraphicsPipe *pipe,int num_windows,GraphicsWindow::Properties *WinPropArray);
~wdxGraphicsWindowGroup();
void SetCoopLevelsAndDisplayModes(void);
public:
void CreateWindows(void);
void make_windows(GraphicsPipe *,int num_windows,GraphicsWindow::Properties *pWinPropArray);
void initWindowGroup(void);
pvector<wdxGraphicsWindow *> _windows;
DXDeviceInfoVec *_pDeviceInfoVec; // only used during init to store valid devices
HWND _hParentWindow;
HINSTANCE _hDDrawDLL;
HWND _hOldForegroundWindow;
HCURSOR _hMouseCursor;
bool _bLoadedCustomCursor;
bool _bClosingAllWindows;
int _numMonitors;
LPDIRECTDRAWCREATEEX _pDDCreateEx;
DXDeviceInfoVec _DeviceInfoVec;
// win32 fns that dont exist on w95
typedef BOOL (WINAPI* PFN_GETMONITORINFO)(HMONITOR, LPMONITORINFO);
PFN_GETMONITORINFO _pfnGetMonitorInfo;
typedef BOOL (WINAPI* PFN_TRACKMOUSEEVENT)(LPTRACKMOUSEEVENT);
PFN_TRACKMOUSEEVENT _pfnTrackMouseEvent;
};
extern void set_global_parameters(void);
extern void restore_global_parameters(void);
#endif

View File

@ -0,0 +1,82 @@
// Filename: wglGraphicsPipe.cxx
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// 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 "wglGraphicsPipe.h"
#include "config_wgldisplay.h"
////////////////////////////////////////////////////////////////////
// Static variables
////////////////////////////////////////////////////////////////////
TypeHandle wglGraphicsPipe::_type_handle;
wglGraphicsPipe::wglGraphicsPipe(const PipeSpecifier& spec)
: InteractiveGraphicsPipe(spec)
{}
////////////////////////////////////////////////////////////////////
// Function: wglGraphicsPipe::get_window_type
// Access: Public, Virtual
// Description: Returns the TypeHandle of the kind of window
// preferred by this kind of pipe.
////////////////////////////////////////////////////////////////////
TypeHandle wglGraphicsPipe::
get_window_type() const {
return wglGraphicsWindow::get_class_type();
}
GraphicsPipe *wglGraphicsPipe::
make_wglGraphicsPipe(const FactoryParams &params) {
GraphicsPipe::PipeSpec *pipe_param;
if (!get_param_into(pipe_param, params)) {
return new wglGraphicsPipe(PipeSpecifier());
} else {
return new wglGraphicsPipe(pipe_param->get_specifier());
}
}
TypeHandle wglGraphicsPipe::get_class_type(void) {
return _type_handle;
}
const char *pipe_type_name="wglGraphicsPipe";
void wglGraphicsPipe::init_type(void) {
InteractiveGraphicsPipe::init_type();
register_type(_type_handle, pipe_type_name,
InteractiveGraphicsPipe::get_class_type());
}
TypeHandle wglGraphicsPipe::get_type(void) const {
return get_class_type();
}
wglGraphicsPipe::wglGraphicsPipe(void) {
wgldisplay_cat.error()
<< pipe_type_name <<"s should not be created with the default constructor" << endl;
}
wglGraphicsPipe::wglGraphicsPipe(const wglGraphicsPipe&) {
wgldisplay_cat.error()
<< pipe_type_name << "s should not be copied" << endl;
}
wglGraphicsPipe& wglGraphicsPipe::operator=(const wglGraphicsPipe&) {
wgldisplay_cat.error()
<< pipe_type_name << "s should not be assigned" << endl;
return *this;
}

View File

@ -0,0 +1,63 @@
// Filename: wglGraphicsPipe.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// 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 WGLGRAPHICSPIPE_H
#define WGLGRAPHICSPIPE_H
//
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
#include <pandabase.h>
#include <string>
#include <interactiveGraphicsPipe.h>
#include "wglGraphicsWindow.h"
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#undef WINDOWS_LEAN_AND_MEAN
////////////////////////////////////////////////////////////////////
// Class : wglGraphicsPipe
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL wglGraphicsPipe : public InteractiveGraphicsPipe {
public:
wglGraphicsPipe(const PipeSpecifier&);
virtual TypeHandle get_window_type() const;
public:
static GraphicsPipe* make_wglGraphicsPipe(const FactoryParams &params);
static TypeHandle get_class_type();
static void init_type();
virtual TypeHandle get_type() const;
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
protected:
wglGraphicsPipe();
wglGraphicsPipe(const wglGraphicsPipe&);
wglGraphicsPipe& operator=(const wglGraphicsPipe&);
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,158 @@
// Filename: wglGraphicsWindow.h
// Created by: mike (09Jan97)
//
////////////////////////////////////////////////////////////////////
//
// 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 WGLGRAPHICSWINDOW_H
#define WGLGRAPHICSWINDOW_H
//
////////////////////////////////////////////////////////////////////
// Includes
////////////////////////////////////////////////////////////////////
// include win32 defns for everything up to XP, and assume I'm smart enough to
// use GetProcAddress for backward compat on w95/w98 for newer fns
#define _WIN32_WINNT 0x0501
#define WINDOWS_LEAN_AND_MEAN
#include <windows.h>
#undef WINDOWS_LEAN_AND_MEAN
#include <pandabase.h>
#include <graphicsWindow.h>
////////////////////////////////////////////////////////////////////
// Defines
////////////////////////////////////////////////////////////////////
class wglGraphicsPipe;
#if 0
#define GLX_USE_GL 1 /* support GLX rendering */
#define GLX_BUFFER_SIZE 2 /* depth of the color buffer */
#define GLX_LEVEL 3 /* level in plane stacking */
#define GLX_RGBA 4 /* true if RGBA mode */
#define GLX_DOUBLEBUFFER 5 /* double buffering supported */
#define GLX_STEREO 6 /* stereo buffering supported */
#define GLX_AUX_BUFFERS 7 /* number of aux buffers */
#define GLX_RED_SIZE 8 /* number of red component bits */
#define GLX_GREEN_SIZE 9 /* number of green component bits */
#define GLX_BLUE_SIZE 10 /* number of blue component bits */
#define GLX_ALPHA_SIZE 11 /* number of alpha component bits */
#define GLX_DEPTH_SIZE 12 /* number of depth bits */
#define GLX_STENCIL_SIZE 13 /* number of stencil bits */
#define GLX_ACCUM_RED_SIZE 14 /* number of red accum bits */
#define GLX_ACCUM_GREEN_SIZE 15 /* number of green accum bits */
#define GLX_ACCUM_BLUE_SIZE 16 /* number of blue accum bits */
#define GLX_ACCUM_ALPHA_SIZE 17 /* number of alpha accum bits */
#endif
////////////////////////////////////////////////////////////////////
// Class : wglGraphicsWindow
// Description :
////////////////////////////////////////////////////////////////////
class EXPCL_PANDAGL wglGraphicsWindow : public GraphicsWindow {
public:
wglGraphicsWindow(GraphicsPipe* pipe);
wglGraphicsWindow(GraphicsPipe* pipe,
const GraphicsWindow::Properties& props);
virtual ~wglGraphicsWindow();
virtual void end_frame();
virtual void swap();
virtual int get_depth_bitwidth();
virtual TypeHandle get_gsg_type() const;
static GraphicsWindow* make_wglGraphicsWindow(const FactoryParams &params);
public:
virtual void make_current();
virtual void unmake_current();
void handle_mouse_motion(int x, int y);
void handle_mouse_exit(void);
INLINE void track_mouse_leaving(HWND hwnd);
void handle_keypress(ButtonHandle key, int x, int y);
void handle_keyrelease(ButtonHandle key);
protected:
int choose_visual(void);
int find_pixfmtnum(bool bLookforHW);
virtual void config();
void setup_colormap(void);
void handle_reshape();
void process_events();
public:
HWND _mwindow;
private:
HGLRC _context;
HDC _hdc;
PIXELFORMATDESCRIPTOR _pixelformat;
HPALETTE _colormap;
HCURSOR _hMouseCursor;
HWND _hOldForegroundWindow;
UINT_PTR _PandaPausedTimer;
DEVMODE *_pCurrent_display_settings;
bool _bIsLowVidMemCard;
bool _bLoadedCustomCursor;
bool _active_minimized_fullscreen;
bool _return_control_to_app;
bool _exiting_window;
bool _cursor_in_windowclientarea;
bool _tracking_mouse_leaving;
bool _ime_open;
bool _ime_active;
bool _ime_composition_w;
// vars for frames/sec meter
DWORD _start_time;
DWORD _start_frame_count;
DWORD _cur_frame_count;
float _current_fps;
string _extensions_str;
typedef BOOL (WINAPI* PFN_TRACKMOUSEEVENT)(LPTRACKMOUSEEVENT);
PFN_TRACKMOUSEEVENT _pfnTrackMouseEvent;
public:
static TypeHandle get_class_type();
static void init_type();
virtual TypeHandle get_type() const;
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
LONG WINAPI window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam);
ButtonHandle lookup_key(WPARAM wparam) const;
void DestroyMe(bool bAtExitFnCalled);
virtual void deactivate_window();
virtual void reactivate_window();
virtual bool resize(unsigned int xsize,unsigned int ysize);
virtual unsigned int verify_window_sizes(unsigned int numsizes,unsigned int *dimen);
protected:
virtual void do_close_window();
void check_for_color_cursor_support();
private:
static TypeHandle _type_handle;
};
extern void set_global_parameters();
extern void restore_global_parameters();
#endif