| 1 | /* $Id: OS2D3D.CPP,v 1.3 1999-06-10 17:10:56 phaller Exp $ */
|
|---|
| 2 |
|
|---|
| 3 | //******************************************************************************
|
|---|
| 4 | //******************************************************************************
|
|---|
| 5 | // Direct3D Main Class
|
|---|
| 6 | //
|
|---|
| 7 | // Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
|---|
| 8 | //******************************************************************************
|
|---|
| 9 | //******************************************************************************
|
|---|
| 10 | // *
|
|---|
| 11 | // * Project Odin Software License can be found in LICENSE.TXT
|
|---|
| 12 | // *
|
|---|
| 13 |
|
|---|
| 14 | /*@Const************************************************************************
|
|---|
| 15 | * Defined Constants *
|
|---|
| 16 | *******************************************************************************/
|
|---|
| 17 | #define WIN32SDK_NOPOSTWRAPPER
|
|---|
| 18 |
|
|---|
| 19 | /*@Header***********************************************************************
|
|---|
| 20 | * Header Files *
|
|---|
| 21 | *******************************************************************************/
|
|---|
| 22 | #include <os2win.h>
|
|---|
| 23 | #include <dive.h>
|
|---|
| 24 |
|
|---|
| 25 | #include <builtin.h>
|
|---|
| 26 | #include <memory.h>
|
|---|
| 27 |
|
|---|
| 28 | #include "no.h"
|
|---|
| 29 | #include <w_windows.h>
|
|---|
| 30 | #include <ddraw.h>
|
|---|
| 31 | #include <d3d.h>
|
|---|
| 32 | #include <Win32SDKPostWrapper.h>
|
|---|
| 33 |
|
|---|
| 34 | #include "os2ddraw.h"
|
|---|
| 35 | #include "os2clipper.h"
|
|---|
| 36 | #include "os2palette.h"
|
|---|
| 37 | #include "os2surface.h"
|
|---|
| 38 | #include "misc.h"
|
|---|
| 39 |
|
|---|
| 40 | /*** IDirect3D methods ***/
|
|---|
| 41 | /* KSO Apr 19 1999: Set correct interface. *
|
|---|
| 42 | * (INTERFACE is used in the THIS and THIS_ macros) */
|
|---|
| 43 | #undef INTERFACE
|
|---|
| 44 | #define INTERFACE IDirect3D
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 | //******************************************************************************
|
|---|
| 48 | //******************************************************************************
|
|---|
| 49 | HRESULT __stdcall D3DQueryInterface(THIS, REFIID riid, LPVOID FAR * ppvObj)
|
|---|
| 50 | {
|
|---|
| 51 | dprintf(("D3DQueryInterface\n"));
|
|---|
| 52 | *ppvObj = NULL;
|
|---|
| 53 |
|
|---|
| 54 | if(IID_IDirect3D != (GUID &)&riid)
|
|---|
| 55 | return E_NOINTERFACE;
|
|---|
| 56 |
|
|---|
| 57 | *ppvObj = This;
|
|---|
| 58 |
|
|---|
| 59 | D3DAddRef(This);
|
|---|
| 60 | return(D3D_OK);
|
|---|
| 61 | }
|
|---|
| 62 | //******************************************************************************
|
|---|
| 63 | //******************************************************************************
|
|---|
| 64 | ULONG __stdcall D3DAddRef(THIS)
|
|---|
| 65 | {
|
|---|
| 66 | OS2IDirectDraw *me = (OS2IDirectDraw *)This;
|
|---|
| 67 |
|
|---|
| 68 | dprintf(("OS2IDirectDraw::AddRef %d\n", me->Referenced+1));
|
|---|
| 69 | return ++me->Referenced;
|
|---|
| 70 | }
|
|---|
| 71 | //******************************************************************************
|
|---|
| 72 | //******************************************************************************
|
|---|
| 73 | ULONG __stdcall D3DRelease(THIS)
|
|---|
| 74 | {
|
|---|
| 75 | OS2IDirectDraw *me = (OS2IDirectDraw *)This;
|
|---|
| 76 |
|
|---|
| 77 | dprintf(("OS2IDirectDraw::Release %d\n", me->Referenced-1));
|
|---|
| 78 | dprintf(("OS2IDirectDraw::%X \n", me));
|
|---|
| 79 | if(me->Referenced) {
|
|---|
| 80 | me->Referenced--;
|
|---|
| 81 | if(me->Referenced == 0) {
|
|---|
| 82 | delete me;
|
|---|
| 83 | return(0);
|
|---|
| 84 | }
|
|---|
| 85 | else return me->Referenced;
|
|---|
| 86 | }
|
|---|
| 87 | else return(0);
|
|---|
| 88 | }
|
|---|
| 89 | //******************************************************************************
|
|---|
| 90 | //******************************************************************************
|
|---|
| 91 | HRESULT __stdcall D3DInitialize(THIS_ REFIID)
|
|---|
| 92 | {
|
|---|
| 93 | dprintf(("D3DInitialize\n"));
|
|---|
| 94 | return(D3D_OK);
|
|---|
| 95 | }
|
|---|
| 96 | //******************************************************************************
|
|---|
| 97 | //******************************************************************************
|
|---|
| 98 | HRESULT __stdcall D3DEnumDevices(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID)
|
|---|
| 99 | {
|
|---|
| 100 | dprintf(("D3DEnumDevices\n"));
|
|---|
| 101 | return(D3D_OK);
|
|---|
| 102 | }
|
|---|
| 103 | //******************************************************************************
|
|---|
| 104 | //******************************************************************************
|
|---|
| 105 | HRESULT __stdcall D3DCreateLight(THIS_ LPDIRECT3DLIGHT*, IUnknown*)
|
|---|
| 106 | {
|
|---|
| 107 | dprintf(("D3DCreateLight\n"));
|
|---|
| 108 | return(D3D_OK);
|
|---|
| 109 | }
|
|---|
| 110 | //******************************************************************************
|
|---|
| 111 | //******************************************************************************
|
|---|
| 112 | HRESULT __stdcall D3DCreateMaterial(THIS_ LPDIRECT3DMATERIAL*, IUnknown*)
|
|---|
| 113 | {
|
|---|
| 114 | dprintf(("D3DCreateMaterial\n"));
|
|---|
| 115 | return(D3D_OK);
|
|---|
| 116 | }
|
|---|
| 117 | //******************************************************************************
|
|---|
| 118 | //******************************************************************************
|
|---|
| 119 | HRESULT __stdcall D3DCreateViewport(THIS_ LPDIRECT3DVIEWPORT*, IUnknown*)
|
|---|
| 120 | {
|
|---|
| 121 | dprintf(("D3DCreateViewport\n"));
|
|---|
| 122 | return(D3D_OK);
|
|---|
| 123 | }
|
|---|
| 124 | //******************************************************************************
|
|---|
| 125 | //******************************************************************************
|
|---|
| 126 | HRESULT __stdcall D3DFindDevice(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT)
|
|---|
| 127 | {
|
|---|
| 128 | dprintf(("D3DCreateFindDevice\n"));
|
|---|
| 129 | return(D3D_OK);
|
|---|
| 130 | }
|
|---|
| 131 | //******************************************************************************
|
|---|
| 132 | //******************************************************************************
|
|---|