| 1 | /* $Id: OS2D3D.CPP,v 1.10 2000-08-31 17:57:09 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * DX clipper class routines | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1998 Sander van Leeuwen | 
|---|
| 7 | * | 
|---|
| 8 | * Note: MUST use DDraw3D_GetThisPtr macro to access DirectDraw object! | 
|---|
| 9 | * | 
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 11 | * | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | #include <memory.h> | 
|---|
| 15 |  | 
|---|
| 16 | #define INITGUID | 
|---|
| 17 | #include "os2ddraw.h" | 
|---|
| 18 | #include "os2clipper.h" | 
|---|
| 19 | #include "os2palette.h" | 
|---|
| 20 | #include "os2surface.h" | 
|---|
| 21 | #define _OS2WIN_H | 
|---|
| 22 | #define FAR | 
|---|
| 23 | #include <misc.h> | 
|---|
| 24 | #include <winerror.h> | 
|---|
| 25 | #include <builtin.h> | 
|---|
| 26 | #undef THIS | 
|---|
| 27 | #define THIS VOID* | 
|---|
| 28 |  | 
|---|
| 29 | //****************************************************************************** | 
|---|
| 30 | //****************************************************************************** | 
|---|
| 31 | HRESULT __stdcall D3DQueryInterface(THIS This, REFIID riid, LPVOID FAR * ppvObj) | 
|---|
| 32 | { | 
|---|
| 33 | dprintf(("DDRAW: D3DQueryInterface\n")); | 
|---|
| 34 | *ppvObj = NULL; | 
|---|
| 35 |  | 
|---|
| 36 | if(IID_IDirect3D != (GUID &)&riid) | 
|---|
| 37 | return E_NOINTERFACE; | 
|---|
| 38 |  | 
|---|
| 39 | *ppvObj = This; | 
|---|
| 40 |  | 
|---|
| 41 | D3DAddRef(This); | 
|---|
| 42 | return(D3D_OK); | 
|---|
| 43 | } | 
|---|
| 44 | //****************************************************************************** | 
|---|
| 45 | //****************************************************************************** | 
|---|
| 46 | ULONG __stdcall D3DAddRef(THIS This) | 
|---|
| 47 | { | 
|---|
| 48 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 49 |  | 
|---|
| 50 | dprintf(("DDRAW: OS2IDirectDraw::AddRef %d\n", me->Referenced+1)); | 
|---|
| 51 | return ++me->Referenced; | 
|---|
| 52 | } | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | //****************************************************************************** | 
|---|
| 55 | ULONG __stdcall D3DRelease(THIS This) | 
|---|
| 56 | { | 
|---|
| 57 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 58 |  | 
|---|
| 59 | dprintf(("DDRAW: OS2IDirectDraw::Release %d\n", me->Referenced-1)); | 
|---|
| 60 | dprintf(("DDRAW: OS2IDirectDraw::%X \n", me)); | 
|---|
| 61 | if(me->Referenced) | 
|---|
| 62 | { | 
|---|
| 63 | me->Referenced--; | 
|---|
| 64 | if(me->Referenced == 0) | 
|---|
| 65 | { | 
|---|
| 66 | delete(me); | 
|---|
| 67 | return(0); | 
|---|
| 68 | } | 
|---|
| 69 | else | 
|---|
| 70 | return me->Referenced; | 
|---|
| 71 | } | 
|---|
| 72 | else | 
|---|
| 73 | return(0); | 
|---|
| 74 | } | 
|---|
| 75 | //****************************************************************************** | 
|---|
| 76 | //****************************************************************************** | 
|---|
| 77 | HRESULT __stdcall D3DInitialize(THIS This, REFIID) | 
|---|
| 78 | { | 
|---|
| 79 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 80 |  | 
|---|
| 81 | dprintf(("DDRAW: D3DInitialize\n")); | 
|---|
| 82 | return(D3D_OK); | 
|---|
| 83 | } | 
|---|
| 84 | //****************************************************************************** | 
|---|
| 85 | //****************************************************************************** | 
|---|
| 86 | HRESULT __stdcall D3DEnumDevices(THIS This, LPD3DENUMDEVICESCALLBACK, LPVOID) | 
|---|
| 87 | { | 
|---|
| 88 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 89 |  | 
|---|
| 90 | dprintf(("DDRAW: D3DEnumDevices\n")); | 
|---|
| 91 | return(D3D_OK); | 
|---|
| 92 | } | 
|---|
| 93 | //****************************************************************************** | 
|---|
| 94 | //****************************************************************************** | 
|---|
| 95 | HRESULT __stdcall D3DCreateLight(THIS This, LPDIRECT3DLIGHT*, IUnknown*) | 
|---|
| 96 | { | 
|---|
| 97 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 98 |  | 
|---|
| 99 | dprintf(("DDRAW: D3DCreateLight\n")); | 
|---|
| 100 | return(D3D_OK); | 
|---|
| 101 | } | 
|---|
| 102 | //****************************************************************************** | 
|---|
| 103 | //****************************************************************************** | 
|---|
| 104 | HRESULT __stdcall D3DCreateMaterial(THIS This, LPDIRECT3DMATERIAL*, IUnknown*) | 
|---|
| 105 | { | 
|---|
| 106 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 107 |  | 
|---|
| 108 | dprintf(("DDRAW: D3DCreateMaterial\n")); | 
|---|
| 109 | return(D3D_OK); | 
|---|
| 110 | } | 
|---|
| 111 | //****************************************************************************** | 
|---|
| 112 | //****************************************************************************** | 
|---|
| 113 | HRESULT __stdcall D3DCreateViewport(THIS This, LPDIRECT3DVIEWPORT*, IUnknown*) | 
|---|
| 114 | { | 
|---|
| 115 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 116 |  | 
|---|
| 117 | dprintf(("DDRAW: D3DCreateViewport\n")); | 
|---|
| 118 | return(D3D_OK); | 
|---|
| 119 | } | 
|---|
| 120 | //****************************************************************************** | 
|---|
| 121 | //****************************************************************************** | 
|---|
| 122 | HRESULT __stdcall D3DFindDevice(THIS This, LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) | 
|---|
| 123 | { | 
|---|
| 124 | OS2IDirectDraw *me = DDraw3D_GetThisPtr(This); | 
|---|
| 125 |  | 
|---|
| 126 | dprintf(("DDRAW: D3DCreateFindDevice\n")); | 
|---|
| 127 | return(D3D_OK); | 
|---|
| 128 | } | 
|---|
| 129 | //****************************************************************************** | 
|---|
| 130 | //****************************************************************************** | 
|---|