Index: ddraw/ddraw.vcxproj |
— | — | @@ -162,6 +162,8 @@ |
163 | 163 | <ClInclude Include="common.h" />
|
164 | 164 | <ClInclude Include="ddraw.h" />
|
165 | 165 | <ClInclude Include="glClassFactory.h" />
|
| 166 | + <ClInclude Include="glDirect3D.h" />
|
| 167 | + <ClInclude Include="glDirect3DDevice.h" />
|
166 | 168 | <ClInclude Include="glDirectDraw.h" />
|
167 | 169 | <ClInclude Include="glDirectDrawClipper.h" />
|
168 | 170 | <ClInclude Include="glDirectDrawPalette.h" />
|
— | — | @@ -199,6 +201,8 @@ |
200 | 202 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release no DXGL|Win32'">NotUsing</PrecompiledHeader>
|
201 | 203 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
202 | 204 | </ClCompile>
|
| 205 | + <ClCompile Include="glDirect3D.cpp" />
|
| 206 | + <ClCompile Include="glDirect3DDevice.cpp" />
|
203 | 207 | <ClCompile Include="glDirectDraw.cpp" />
|
204 | 208 | <ClCompile Include="glDirectDrawClipper.cpp" />
|
205 | 209 | <ClCompile Include="glDirectDrawPalette.cpp" />
|
Index: ddraw/ddraw.vcxproj.filters |
— | — | @@ -74,6 +74,12 @@ |
75 | 75 | <ClInclude Include="glClassFactory.h">
|
76 | 76 | <Filter>Header Files</Filter>
|
77 | 77 | </ClInclude>
|
| 78 | + <ClInclude Include="glDirect3D.h">
|
| 79 | + <Filter>Header Files</Filter>
|
| 80 | + </ClInclude>
|
| 81 | + <ClInclude Include="glDirect3DDevice.h">
|
| 82 | + <Filter>Header Files</Filter>
|
| 83 | + </ClInclude>
|
78 | 84 | </ItemGroup>
|
79 | 85 | <ItemGroup>
|
80 | 86 | <ClCompile Include="ddraw.cpp">
|
— | — | @@ -112,6 +118,12 @@ |
113 | 119 | <ClCompile Include="glClassFactory.cpp">
|
114 | 120 | <Filter>Source Files</Filter>
|
115 | 121 | </ClCompile>
|
| 122 | + <ClCompile Include="glDirect3D.cpp">
|
| 123 | + <Filter>Source Files</Filter>
|
| 124 | + </ClCompile>
|
| 125 | + <ClCompile Include="glDirect3DDevice.cpp">
|
| 126 | + <Filter>Source Files</Filter>
|
| 127 | + </ClCompile>
|
116 | 128 | </ItemGroup>
|
117 | 129 | <ItemGroup>
|
118 | 130 | <ResourceCompile Include="ddraw.rc">
|
Index: ddraw/glDirect3D.cpp |
— | — | @@ -0,0 +1,81 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#include "common.h"
|
| 20 | +#include "glDirect3D.h"
|
| 21 | +#include "glDirect3DDevice.h"
|
| 22 | +#include "glDirectDraw.h"
|
| 23 | +#include "glDirectDrawSurface.h"
|
| 24 | +
|
| 25 | +glDirect3D7::glDirect3D7(glDirectDraw7 *glDD7)
|
| 26 | +{
|
| 27 | + refcount=1;
|
| 28 | + this->glDD7 = glDD7;
|
| 29 | + glDD7->AddRef();
|
| 30 | +}
|
| 31 | +
|
| 32 | +glDirect3D7::~glDirect3D7()
|
| 33 | +{
|
| 34 | + glDD7->Release();
|
| 35 | +}
|
| 36 | +
|
| 37 | +ULONG WINAPI glDirect3D7::AddRef()
|
| 38 | +{
|
| 39 | + refcount++;
|
| 40 | + return refcount;
|
| 41 | +}
|
| 42 | +ULONG WINAPI glDirect3D7::Release()
|
| 43 | +{
|
| 44 | + ULONG ret;
|
| 45 | + refcount--;
|
| 46 | + ret = refcount;
|
| 47 | + if(refcount == 0) delete this;
|
| 48 | + return ret;
|
| 49 | +}
|
| 50 | +
|
| 51 | +HRESULT WINAPI glDirect3D7::QueryInterface(REFIID riid, void** ppvObj)
|
| 52 | +{
|
| 53 | + FIXME("glDirect3D7::QueryInterface: stub");
|
| 54 | + return E_NOINTERFACE;
|
| 55 | +}
|
| 56 | +
|
| 57 | +
|
| 58 | +HRESULT WINAPI glDirect3D7::CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice)
|
| 59 | +{
|
| 60 | + FIXME("glDirect3D7::CreateDevice: stub");
|
| 61 | + return DDERR_GENERIC;
|
| 62 | +}
|
| 63 | +HRESULT WINAPI glDirect3D7::CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertexBuffer, DWORD dwFlags)
|
| 64 | +{
|
| 65 | + FIXME("glDirect3D7::CreateVertexBuffer: stub");
|
| 66 | + return DDERR_GENERIC;
|
| 67 | +}
|
| 68 | +HRESULT WINAPI glDirect3D7::EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg)
|
| 69 | +{
|
| 70 | + FIXME("glDirect3D7::EnumDevices: stub");
|
| 71 | + return DDERR_GENERIC;
|
| 72 | +}
|
| 73 | +HRESULT WINAPI glDirect3D7::EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext)
|
| 74 | +{
|
| 75 | + FIXME("glDirect3D7::EnumZBufferFormats: stub");
|
| 76 | + return DDERR_GENERIC;
|
| 77 | +}
|
| 78 | +HRESULT WINAPI glDirect3D7::EvictManagedTextures()
|
| 79 | +{
|
| 80 | + FIXME("glDirect3D7::EvictManagedTextures: stub");
|
| 81 | + return DDERR_GENERIC;
|
| 82 | +}
|
Index: ddraw/glDirect3D.h |
— | — | @@ -0,0 +1,44 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#pragma once
|
| 20 | +#ifndef __GLDIRECT3D_H
|
| 21 | +#define __GLDIRECT3D_H
|
| 22 | +
|
| 23 | +class glDirectDraw7;
|
| 24 | +
|
| 25 | +class glDirect3D7 : public IDirect3D7
|
| 26 | +{
|
| 27 | +public:
|
| 28 | + glDirect3D7(glDirectDraw7 *glDD7);
|
| 29 | + virtual ~glDirect3D7();
|
| 30 | + HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
|
| 31 | + ULONG WINAPI AddRef();
|
| 32 | + ULONG WINAPI Release();
|
| 33 | + HRESULT WINAPI CreateDevice(REFCLSID rclsid, LPDIRECTDRAWSURFACE7 lpDDS, LPDIRECT3DDEVICE7 *lplpD3DDevice);
|
| 34 | + HRESULT WINAPI CreateVertexBuffer(LPD3DVERTEXBUFFERDESC lpVBDesc, LPDIRECT3DVERTEXBUFFER7* lplpD3DVertexBuffer, DWORD dwFlags);
|
| 35 | + HRESULT WINAPI EnumDevices(LPD3DENUMDEVICESCALLBACK7 lpEnumDevicesCallback, LPVOID lpUserArg);
|
| 36 | + HRESULT WINAPI EnumZBufferFormats(REFCLSID riidDevice, LPD3DENUMPIXELFORMATSCALLBACK lpEnumCallback, LPVOID lpContext);
|
| 37 | + HRESULT WINAPI EvictManagedTextures();
|
| 38 | +private:
|
| 39 | + glDirectDraw7 *glDD7;
|
| 40 | + ULONG refcount;
|
| 41 | +};
|
| 42 | +
|
| 43 | +
|
| 44 | +
|
| 45 | +#endif //__GLDIRECT3D_H |
\ No newline at end of file |
Index: ddraw/glDirect3DDevice.cpp |
— | — | @@ -0,0 +1,122 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#include "common.h"
|
| 20 | +#include "glDirect3D.h"
|
| 21 | +#include "glDirectDrawSurface.h"
|
| 22 | +#include "glDirect3DDevice.h"
|
| 23 | +
|
| 24 | +/*
|
| 25 | +glDirect3DDevice7::glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
|
| 26 | +{
|
| 27 | + refcount = 1;
|
| 28 | + this->glD3D7 = glD3D7;
|
| 29 | + glD3D7->AddRef();
|
| 30 | + this->glDDS7 = glDDS7;
|
| 31 | + glDDS7->AddRef();
|
| 32 | +}
|
| 33 | +glDirect3DDevice7::~glDirect3DDevice7()
|
| 34 | +{
|
| 35 | + glD3D7->Release();
|
| 36 | + glDDS7->Release();
|
| 37 | +}
|
| 38 | +
|
| 39 | +HRESULT WINAPI glDirect3DDevice7::QueryInterface(REFIID riid, void** ppvObj)
|
| 40 | +{
|
| 41 | + ERR(E_NOINTERFACE);
|
| 42 | +}
|
| 43 | +
|
| 44 | +ULONG WINAPI glDirect3DDevice7::AddRef()
|
| 45 | +{
|
| 46 | + refcount++;
|
| 47 | + return refcount;
|
| 48 | +}
|
| 49 | +ULONG WINAPI glDirect3DDevice7::Release()
|
| 50 | +{
|
| 51 | + ULONG ret;
|
| 52 | + refcount--;
|
| 53 | + ret = refcount;
|
| 54 | + if(refcount == 0) delete this;
|
| 55 | + return ret;
|
| 56 | +}
|
| 57 | +
|
| 58 | +HRESULT WINAPI glDirect3DDevice7::ApplyStateBlock(DWORD dwBlockHandle)
|
| 59 | +{
|
| 60 | + FIXME("glDirect3DDevice7::ApplyStateBlock: stub");
|
| 61 | + ERR(DDERR_GENERIC);
|
| 62 | +}
|
| 63 | +HRESULT WINAPI glDirect3DDevice7::BeginScene()
|
| 64 | +{
|
| 65 | + FIXME("glDirect3DDevice7::BeginScene: stub");
|
| 66 | + ERR(DDERR_GENERIC);
|
| 67 | +}
|
| 68 | +HRESULT WINAPI glDirect3DDevice7::BeginStateBlock()
|
| 69 | +{
|
| 70 | + FIXME("glDirect3DDevice7::BeginStateBlock: stub");
|
| 71 | + ERR(DDERR_GENERIC);
|
| 72 | +}
|
| 73 | +HRESULT WINAPI glDirect3DDevice7::CaptureStateBlock(DWORD dwBlockHandle)
|
| 74 | +{
|
| 75 | + FIXME("glDirectDraw::CaptureStateBlock: stub");
|
| 76 | + ERR(DDERR_GENERIC);
|
| 77 | +}*/
|
| 78 | +/*
|
| 79 | +HRESULT WINAPI glDirect3DDevice7::CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle);
|
| 80 | +HRESULT WINAPI glDirect3DDevice7::Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil);
|
| 81 | +HRESULT WINAPI glDirect3DDevice7::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues);
|
| 82 | +HRESULT WINAPI glDirect3DDevice7::DeleteStateBlock(DWORD dwBlockHandle);
|
| 83 | +HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 84 | +HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc, LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 85 | +HRESULT WINAPI glDirect3DDevice7::DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer, DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 86 | +HRESULT WINAPI glDirect3DDevice7::DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices, DWORD dwVertexCount, DWORD dwFlags);
|
| 87 | +HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags);
|
| 88 | +HRESULT WINAPI glDirect3DDevice7::DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer, DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags);
|
| 89 | +HRESULT WINAPI glDirect3DDevice7::EndScene();
|
| 90 | +HRESULT WINAPI glDirect3DDevice7::EndStateBlock(LPDWORD lpdwBlockHandle);
|
| 91 | +HRESULT WINAPI glDirect3DDevice7::EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg);
|
| 92 | +HRESULT WINAPI glDirect3DDevice7::GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc);
|
| 93 | +HRESULT WINAPI glDirect3DDevice7::GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation);
|
| 94 | +HRESULT WINAPI glDirect3DDevice7::GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
|
| 95 | +HRESULT WINAPI glDirect3DDevice7::GetDirect3D(LPDIRECT3D7 *lplpD3D);
|
| 96 | +HRESULT WINAPI glDirect3DDevice7::GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize);
|
| 97 | +HRESULT WINAPI glDirect3DDevice7::GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
|
| 98 | +HRESULT WINAPI glDirect3DDevice7::GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable);
|
| 99 | +HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial);
|
| 100 | +HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState);
|
| 101 | +HRESULT WINAPI glDirect3DDevice7::GetRenderTarget(LPDIRECTDRAWSURFACE7 lplpRenderTarget);
|
| 102 | +HRESULT WINAPI glDirect3DDevice7::GetStateData(DWORD dwState, LPVOID* lplpStateData);
|
| 103 | +HRESULT WINAPI glDirect3DDevice7::GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture);
|
| 104 | +HRESULT WINAPI glDirect3DDevice7::GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue);
|
| 105 | +HRESULT WINAPI glDirect3DDevice7::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 106 | +HRESULT WINAPI glDirect3DDevice7::GetViewport(LPD3DVIEWPORT7 lpViewport);
|
| 107 | +HRESULT WINAPI glDirect3DDevice7::LightEnable(DWORD dwLightIndex, BOOL bEnable);
|
| 108 | +HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex, LPRECT lprcSrcRect, DWORD dwFlags);
|
| 109 | +HRESULT WINAPI glDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 110 | +HRESULT WINAPI glDirect3DDevice7::PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture);
|
| 111 | +HRESULT WINAPI glDirect3DDevice7::SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation);
|
| 112 | +HRESULT WINAPI glDirect3DDevice7::SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
|
| 113 | +HRESULT WINAPI glDirect3DDevice7::SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
|
| 114 | +HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial);
|
| 115 | +HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState);
|
| 116 | +HRESULT WINAPI glDirect3DDevice7::SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags);
|
| 117 | +HRESULT WINAPI glDirect3DDevice7::SetStateData(DWORD dwState, LPVOID lpStateData);
|
| 118 | +HRESULT WINAPI glDirect3DDevice7::SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture);
|
| 119 | +HRESULT WINAPI glDirect3DDevice7::SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue);
|
| 120 | +HRESULT WINAPI glDirect3DDevice7::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 121 | +HRESULT WINAPI glDirect3DDevice7::SetViewport(LPD3DVIEWPORT7 lpViewport);
|
| 122 | +HRESULT WINAPI glDirect3DDevice7::ValidateDevice(LPDWORD lpdwPasses);
|
| 123 | +*/ |
\ No newline at end of file |
Index: ddraw/glDirect3DDevice.h |
— | — | @@ -0,0 +1,95 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#pragma once
|
| 20 | +#ifndef __GLDIRECT3DDEVICE_H
|
| 21 | +#define __GLDIRECT3DDEVICE_H
|
| 22 | +
|
| 23 | +class glDirectDrawSurface7;
|
| 24 | +class glDirect3DDevice7 : public IDirect3DDevice7
|
| 25 | +{
|
| 26 | +public:
|
| 27 | + glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7);
|
| 28 | + virtual ~glDirect3DDevice7();
|
| 29 | + HRESULT WINAPI QueryInterface(REFIID riid, void** ppvObj);
|
| 30 | + ULONG WINAPI AddRef();
|
| 31 | + ULONG WINAPI Release();
|
| 32 | + HRESULT WINAPI ApplyStateBlock(DWORD dwBlockHandle);
|
| 33 | + HRESULT WINAPI BeginScene();
|
| 34 | + HRESULT WINAPI BeginStateBlock();
|
| 35 | + HRESULT WINAPI CaptureStateBlock(DWORD dwBlockHandle);
|
| 36 | + HRESULT WINAPI CreateStateBlock(D3DSTATEBLOCKTYPE d3dsbtype, LPDWORD lpdwBlockHandle);
|
| 37 | + HRESULT WINAPI Clear(DWORD dwCount, LPD3DRECT lpRects, DWORD dwFlags, DWORD dwColor, D3DVALUE dvZ, DWORD dwStencil);
|
| 38 | + HRESULT WINAPI ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres,
|
| 39 | + DWORD dwFlags, LPDWORD lpdwReturnValues);
|
| 40 | + HRESULT WINAPI DeleteStateBlock(DWORD dwBlockHandle);
|
| 41 | + HRESULT WINAPI DrawIndexedPrimitive(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 42 | + LPVOID lpvVertices, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 43 | + HRESULT WINAPI DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE d3dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 44 | + LPD3DDRAWPRIMITIVESTRIDEDDATA lpvVerticexArray, DWORD dwVertexCount, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 45 | + HRESULT WINAPI DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
|
| 46 | + DWORD dwStartVertex, DWORD dwNumVertices, LPWORD lpwIndices, DWORD dwIndexCount, DWORD dwFlags);
|
| 47 | + HRESULT WINAPI DrawPrimitive(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc, LPVOID lpVertices,
|
| 48 | + DWORD dwVertexCount, DWORD dwFlags);
|
| 49 | + HRESULT WINAPI DrawPrimitiveStrided(D3DPRIMITIVETYPE dptPrimitiveType, DWORD dwVertexTypeDesc,
|
| 50 | + LPD3DDRAWPRIMITIVESTRIDEDDATA lpVertexArray, DWORD dwVertexCount, DWORD dwFlags);
|
| 51 | + HRESULT WINAPI DrawPrimitiveVB(D3DPRIMITIVETYPE d3dptPrimitiveType, LPDIRECT3DVERTEXBUFFER7 lpd3dVertexBuffer,
|
| 52 | + DWORD dwStartVertex, DWORD dwNumVertices, DWORD dwFlags);
|
| 53 | + HRESULT WINAPI EndScene();
|
| 54 | + HRESULT WINAPI EndStateBlock(LPDWORD lpdwBlockHandle);
|
| 55 | + HRESULT WINAPI EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK lpd3dEnumPixelProc, LPVOID lpArg);
|
| 56 | + HRESULT WINAPI GetCaps(LPD3DDEVICEDESC7 lpD3DDevDesc);
|
| 57 | + HRESULT WINAPI GetClipPlane(DWORD dwIndex, D3DVALUE *pPlaneEquation);
|
| 58 | + HRESULT WINAPI GetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
|
| 59 | + HRESULT WINAPI GetDirect3D(LPDIRECT3D7 *lplpD3D);
|
| 60 | + HRESULT WINAPI GetInfo(DWORD dwDevInfoID, LPVOID pDevInfoStruct, DWORD dwSize);
|
| 61 | + HRESULT WINAPI GetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
|
| 62 | + HRESULT WINAPI GetLightEnable(DWORD dwLightIndex, BOOL* pbEnable);
|
| 63 | + HRESULT WINAPI GetMaterial(LPD3DMATERIAL7 lpMaterial);
|
| 64 | + HRESULT WINAPI GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState);
|
| 65 | + HRESULT WINAPI GetRenderTarget(LPDIRECTDRAWSURFACE7 lplpRenderTarget);
|
| 66 | + HRESULT WINAPI GetStateData(DWORD dwState, LPVOID* lplpStateData);
|
| 67 | + HRESULT WINAPI GetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 *lplpTexture);
|
| 68 | + HRESULT WINAPI GetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, LPDWORD lpdwValue);
|
| 69 | + HRESULT WINAPI GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 70 | + HRESULT WINAPI GetViewport(LPD3DVIEWPORT7 lpViewport);
|
| 71 | + HRESULT WINAPI LightEnable(DWORD dwLightIndex, BOOL bEnable);
|
| 72 | + HRESULT WINAPI Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
|
| 73 | + LPRECT lprcSrcRect, DWORD dwFlags);
|
| 74 | + HRESULT WINAPI MultiplyTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 75 | + HRESULT WINAPI PreLoad(LPDIRECTDRAWSURFACE7 lpddsTexture);
|
| 76 | + HRESULT WINAPI SetClipPlane(DWORD dwIndex, D3DVALUE* pPlaneEquation);
|
| 77 | + HRESULT WINAPI SetClipStatus(LPD3DCLIPSTATUS lpD3DClipStatus);
|
| 78 | + HRESULT WINAPI SetLight(DWORD dwLightIndex, LPD3DLIGHT7 lpLight);
|
| 79 | + HRESULT WINAPI SetMaterial(LPD3DMATERIAL7 lpMaterial);
|
| 80 | + HRESULT WINAPI SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState);
|
| 81 | + HRESULT WINAPI SetRenderTarget(LPDIRECTDRAWSURFACE7 lpNewRenderTarget, DWORD dwFlags);
|
| 82 | + HRESULT WINAPI SetStateData(DWORD dwState, LPVOID lpStateData);
|
| 83 | + HRESULT WINAPI SetTexture(DWORD dwStage, LPDIRECTDRAWSURFACE7 lpTexture);
|
| 84 | + HRESULT WINAPI SetTextureStageState(DWORD dwStage, D3DTEXTURESTAGESTATETYPE dwState, DWORD dwValue);
|
| 85 | + HRESULT WINAPI SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix);
|
| 86 | + HRESULT WINAPI SetViewport(LPD3DVIEWPORT7 lpViewport);
|
| 87 | + HRESULT WINAPI ValidateDevice(LPDWORD lpdwPasses);
|
| 88 | +
|
| 89 | +private:
|
| 90 | + glDirect3D7 *glD3D7;
|
| 91 | + glDirectDrawSurface7 *glDDS7;
|
| 92 | + ULONG refcount;
|
| 93 | +
|
| 94 | +};
|
| 95 | +
|
| 96 | +#endif //__GLDIRECT3DDEVICE_H |
\ No newline at end of file |
Index: ddraw/glDirectDraw.cpp |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | #include "common.h"
|
20 | 20 | #include "shaders.h"
|
21 | 21 | #include "ddraw.h"
|
| 22 | +#include "glDirect3D.h"
|
22 | 23 | #include "glDirectDraw.h"
|
23 | 24 | #include "glDirectDrawClipper.h"
|
24 | 25 | #include "glDirectDrawSurface.h"
|
— | — | @@ -563,6 +564,7 @@ |
564 | 565 |
|
565 | 566 | glDirectDraw7::~glDirectDraw7()
|
566 | 567 | {
|
| 568 | + if(glD3D7) glD3D7->Release();
|
567 | 569 | RestoreDisplayMode();
|
568 | 570 | if(clippers)
|
569 | 571 | {
|
— | — | @@ -627,8 +629,9 @@ |
628 | 630 | }
|
629 | 631 | if(riid == IID_IDirect3D7)
|
630 | 632 | {
|
631 | | - FIXME("Add IDirect3D Interfaces\n");
|
632 | | - ERR(DDERR_GENERIC);
|
| 633 | + this->AddRef();
|
| 634 | + *ppvObj = new glDirect3D7(this);
|
| 635 | + return DD_OK;
|
633 | 636 | }
|
634 | 637 | if(riid == IID_IDirectDrawGammaControl)
|
635 | 638 | {
|
— | — | @@ -839,6 +842,7 @@ |
840 | 843 | if(initialized) return DDERR_ALREADYINITIALIZED;
|
841 | 844 | hDC = NULL;
|
842 | 845 | hRC = NULL;
|
| 846 | + glD3D7 = NULL;
|
843 | 847 | hRenderWnd = NULL;
|
844 | 848 | primary = NULL;
|
845 | 849 | fullscreen = false;
|
Index: ddraw/glDirectDraw.h |
— | — | @@ -21,6 +21,7 @@ |
22 | 22 |
|
23 | 23 | class glDirectDrawSurface7;
|
24 | 24 | class glDirectDrawClipper;
|
| 25 | +class glDirect3D7;
|
25 | 26 |
|
26 | 27 | LRESULT CALLBACK RenderWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
27 | 28 |
|
— | — | @@ -117,6 +118,7 @@ |
118 | 119 | GLCAPS gl_caps;
|
119 | 120 | DEVMODE oldmode;
|
120 | 121 | bool initialized;
|
| 122 | + glDirect3D7 *glD3D7;
|
121 | 123 | };
|
122 | 124 |
|
123 | 125 | class glDirectDraw1 : public IDirectDraw
|
Index: ddraw/glDirectDrawSurface.h |
— | — | @@ -28,6 +28,7 @@ |
29 | 29 | DDCOLORKEY key;
|
30 | 30 | } CKEY;
|
31 | 31 |
|
| 32 | +class glDirectDrawClipper;
|
32 | 33 | class glDirectDrawPalette;
|
33 | 34 | class glDirectDrawSurface1;
|
34 | 35 | class glDirectDrawSurface2;
|
Index: dxgltest/Tests2D.cpp |
— | — | @@ -20,22 +20,13 @@ |
21 | 21 | #include "surfacegen.h"
|
22 | 22 | #include "MultiDD.h"
|
23 | 23 | #include "timer.h"
|
24 | | -#include <time.h>
|
| 24 | +#include "misc.h"
|
25 | 25 |
|
26 | 26 | void InitTest(int test);
|
27 | 27 | void RunTestTimed(int test);
|
28 | 28 | void RunTestLooped(int test);
|
29 | 29 | void RunTestMouse(int test, UINT Msg, WPARAM wParam, LPARAM lParam);
|
30 | | -inline unsigned int rand32(unsigned int &n)
|
31 | | -{
|
32 | | - return n=(((unsigned int) 1103515245 * n) + (unsigned int) 12345) %
|
33 | | - (unsigned int) 0xFFFFFFFF;
|
34 | | -}
|
35 | 30 |
|
36 | | -inline float randfloat(float multiple)
|
37 | | -{
|
38 | | - return ((float)rand() / (float)RAND_MAX)*multiple;
|
39 | | -}
|
40 | 31 |
|
41 | 32 | MultiDirectDraw *ddinterface;
|
42 | 33 | MultiDirectDrawSurface *ddsurface;
|
Index: dxgltest/Tests3D.cpp |
— | — | @@ -0,0 +1,22 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#include "common.h"
|
| 20 | +#include "tests.h"
|
| 21 | +#include "surfacegen.h"
|
| 22 | +#include "timer.h"
|
| 23 | +#include "misc.h"
|
Index: dxgltest/common.h |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | #include <memory.h>
|
45 | 45 | #include <tchar.h>
|
46 | 46 | #include <math.h>
|
| 47 | +#include <time.h>
|
47 | 48 | #include <string>
|
48 | 49 | #ifdef _DEBUG
|
49 | 50 | #include <crtdbg.h>
|
Index: dxgltest/dxgltest.vcxproj |
— | — | @@ -164,6 +164,7 @@ |
165 | 165 | <ItemGroup>
|
166 | 166 | <ClInclude Include="common.h" />
|
167 | 167 | <ClInclude Include="dxgltest.h" />
|
| 168 | + <ClInclude Include="misc.h" />
|
168 | 169 | <ClInclude Include="MultiDD.h" />
|
169 | 170 | <ClInclude Include="palette.h" />
|
170 | 171 | <ClInclude Include="Resource.h" />
|
— | — | @@ -189,6 +190,7 @@ |
190 | 191 | <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
191 | 192 | </ClCompile>
|
192 | 193 | <ClCompile Include="surfacegen.cpp" />
|
| 194 | + <ClCompile Include="Tests3D.cpp" />
|
193 | 195 | <ClCompile Include="timer.cpp" />
|
194 | 196 | </ItemGroup>
|
195 | 197 | <ItemGroup>
|
Index: dxgltest/dxgltest.vcxproj.filters |
— | — | @@ -42,6 +42,9 @@ |
43 | 43 | <ClInclude Include="timer.h">
|
44 | 44 | <Filter>Header Files</Filter>
|
45 | 45 | </ClInclude>
|
| 46 | + <ClInclude Include="misc.h">
|
| 47 | + <Filter>Header Files</Filter>
|
| 48 | + </ClInclude>
|
46 | 49 | </ItemGroup>
|
47 | 50 | <ItemGroup>
|
48 | 51 | <ClCompile Include="dxgltest.cpp">
|
— | — | @@ -68,6 +71,9 @@ |
69 | 72 | <ClCompile Include="dxguid.cpp">
|
70 | 73 | <Filter>Source Files</Filter>
|
71 | 74 | </ClCompile>
|
| 75 | + <ClCompile Include="Tests3D.cpp">
|
| 76 | + <Filter>Source Files</Filter>
|
| 77 | + </ClCompile>
|
72 | 78 | </ItemGroup>
|
73 | 79 | <ItemGroup>
|
74 | 80 | <ResourceCompile Include="dxgltest.rc">
|
Index: dxgltest/misc.h |
— | — | @@ -0,0 +1,33 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#pragma once
|
| 20 | +#ifndef _MISC_H
|
| 21 | +#define _MISC_H
|
| 22 | +
|
| 23 | +inline unsigned int rand32(unsigned int &n)
|
| 24 | +{
|
| 25 | + return n=(((unsigned int) 1103515245 * n) + (unsigned int) 12345) %
|
| 26 | + (unsigned int) 0xFFFFFFFF;
|
| 27 | +}
|
| 28 | +
|
| 29 | +inline float randfloat(float multiple)
|
| 30 | +{
|
| 31 | + return ((float)rand() / (float)RAND_MAX)*multiple;
|
| 32 | +}
|
| 33 | +
|
| 34 | +#endif //_MISC_H |
\ No newline at end of file |
Index: dxgltest/tests.h |
— | — | @@ -23,4 +23,7 @@ |
24 | 24 | void RunTest2D(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int apiver,
|
25 | 25 | double fps, bool fullscreen, bool resizable);
|
26 | 26 |
|
| 27 | +void RunTest3D(int testnum, int width, int height, int bpp, int refresh, int backbuffers, int filter,
|
| 28 | + int msaa, double fps, bool fullscreen, bool resizable);
|
| 29 | +
|
27 | 30 | #endif //_TESTS_H
|