Index: ThirdParty.txt |
— | — | @@ -0,0 +1,76 @@ |
| 2 | +Contains headers from OpenGL.org, released under the following license:
|
| 3 | +Copyright (c) 2013-2014 The Khronos Group Inc.
|
| 4 | +
|
| 5 | +Permission is hereby granted, free of charge, to any person obtaining a
|
| 6 | +copy of this software and/or associated documentation files (the
|
| 7 | +"Materials"), to deal in the Materials without restriction, including
|
| 8 | +without limitation the rights to use, copy, modify, merge, publish,
|
| 9 | +distribute, sublicense, and/or sell copies of the Materials, and to
|
| 10 | +permit persons to whom the Materials are furnished to do so, subject to
|
| 11 | +the following conditions:
|
| 12 | +
|
| 13 | +The above copyright notice and this permission notice shall be included
|
| 14 | +in all copies or substantial portions of the Materials.
|
| 15 | +
|
| 16 | +THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 17 | +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 | +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
| 19 | +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
| 20 | +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
| 21 | +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
| 22 | +MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
| 23 | +
|
| 24 | +Contains headers and some code from the Wine project, released under the
|
| 25 | +following license:
|
| 26 | +Copyright (c) 1993-2014 the Wine project authors (see the file AUTHORS
|
| 27 | +in the Wine source code distribution for a complete list)
|
| 28 | +
|
| 29 | +Wine is free software; you can redistribute it and/or modify it under
|
| 30 | +the terms of the GNU Lesser General Public License as published by the
|
| 31 | +Free Software Foundation; either version 2.1 of the License, or (at
|
| 32 | +your option) any later version.
|
| 33 | +
|
| 34 | +This program is distributed in the hope that it will be useful, but
|
| 35 | +WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 36 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 37 | +Lesser General Public License for more details.
|
| 38 | +
|
| 39 | +A copy of the GNU Lesser General Public License is included in the
|
| 40 | +Wine distribution in the file COPYING.LIB. If you did not receive this
|
| 41 | +copy, write to the Free Software Foundation, Inc., 51 Franklin St,
|
| 42 | +Fifth Floor, Boston, MA 02110-1301, USA.
|
| 43 | +
|
| 44 | +Contains CRC-32 version 2.0.0 by Craig Bruce, 2006-04-29, under the following
|
| 45 | +declaration:
|
| 46 | +THIS PROGRAM IS PUBLIC-DOMAIN SOFTWARE.
|
| 47 | +Based on the byte-oriented implementation "File Verification Using CRC"
|
| 48 | +by Mark R. Nelson in Dr. Dobb's Journal, May 1992, pp. 64-67.
|
| 49 | +
|
| 50 | +Contains portions of the Mesa project.c file, under the following license:
|
| 51 | +SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
|
| 52 | +Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
|
| 53 | +
|
| 54 | +Permission is hereby granted, free of charge, to any person obtaining a
|
| 55 | +copy of this software and associated documentation files (the "Software"),
|
| 56 | +to deal in the Software without restriction, including without limitation
|
| 57 | +the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
| 58 | +and/or sell copies of the Software, and to permit persons to whom the
|
| 59 | +Software is furnished to do so, subject to the following conditions:
|
| 60 | +
|
| 61 | +The above copyright notice including the dates of first publication and
|
| 62 | +either this permission notice or a reference to
|
| 63 | +http://oss.sgi.com/projects/FreeB/
|
| 64 | +shall be included in all copies or substantial portions of the Software.
|
| 65 | +
|
| 66 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 67 | +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 68 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
| 69 | +SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
| 70 | +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
| 71 | +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 72 | +SOFTWARE.
|
| 73 | +
|
| 74 | +Except as contained in this notice, the name of Silicon Graphics, Inc.
|
| 75 | +shall not be used in advertising or otherwise to promote the sale, use or
|
| 76 | +other dealings in this Software without prior written authorization from
|
| 77 | +Silicon Graphics, Inc. |
\ No newline at end of file |
Index: ddraw/glDirect3D.cpp |
— | — | @@ -175,11 +175,6 @@ |
176 | 176 | d3ddesc_default.wMaxSimultaneousTextures
|
177 | 177 | };
|
178 | 178 |
|
179 | | -struct D3DDevice
|
180 | | -{
|
181 | | - char *name;
|
182 | | - char *devname;
|
183 | | -};
|
184 | 179 | const D3DDevice devices[3] =
|
185 | 180 | {
|
186 | 181 | {
|
— | — | @@ -205,7 +200,8 @@ |
206 | 201 | glD3D2 = NULL;
|
207 | 202 | glD3D1 = NULL;
|
208 | 203 | glDD7 = gl_DD7;
|
209 | | - TRACE_EXIT(-1,0);
|
| 204 | + memcpy(stored_devices, devices, 3 * sizeof(D3DDevice));
|
| 205 | + TRACE_EXIT(-1, 0);
|
210 | 206 | }
|
211 | 207 |
|
212 | 208 | glDirect3D7::~glDirect3D7()
|
— | — | @@ -401,7 +397,7 @@ |
402 | 398 | desc.dwDevCaps |= D3DDEVCAPS_HWRASTERIZATION | D3DDEVCAPS_HWTRANSFORMANDLIGHT;
|
403 | 399 | break;
|
404 | 400 | }
|
405 | | - result = lpEnumDevicesCallback(devices[i].name,devices[i].devname,&desc,lpUserArg);
|
| 401 | + result = lpEnumDevicesCallback(stored_devices[i].name,stored_devices[i].devname,&desc,lpUserArg);
|
406 | 402 | if(result != D3DENUMRET_OK) break;
|
407 | 403 | }
|
408 | 404 | TRACE_EXIT(23,D3D_OK);
|
— | — | @@ -416,10 +412,10 @@ |
417 | 413 | HRESULT result;
|
418 | 414 | D3DDEVICEDESC desc = d3ddesc3;
|
419 | 415 | GUID guid = IID_IDirect3DRGBDevice;
|
420 | | - result = lpEnumDevicesCallback(&guid,devices[0].name,devices[0].devname,&desc,&desc,lpUserArg);
|
| 416 | + result = lpEnumDevicesCallback(&guid,stored_devices[0].name,stored_devices[0].devname,&desc,&desc,lpUserArg);
|
421 | 417 | if(result != D3DENUMRET_OK) TRACE_RET(HRESULT,23,D3D_OK);
|
422 | 418 | guid = IID_IDirect3DHALDevice;
|
423 | | - result = lpEnumDevicesCallback(&guid,devices[1].name,devices[1].devname,&desc,&desc,lpUserArg);
|
| 419 | + result = lpEnumDevicesCallback(&guid,stored_devices[1].name,stored_devices[1].devname,&desc,&desc,lpUserArg);
|
424 | 420 | TRACE_EXIT(23,D3D_OK);
|
425 | 421 | return D3D_OK;
|
426 | 422 | }
|
Index: ddraw/glDirect3D.h |
— | — | @@ -26,6 +26,13 @@ |
27 | 27 | class glDirect3D3;
|
28 | 28 | class glDirect3D2;
|
29 | 29 | class glDirect3D1;
|
| 30 | +
|
| 31 | +struct D3DDevice
|
| 32 | +{
|
| 33 | + char name[64];
|
| 34 | + char devname[64];
|
| 35 | +};
|
| 36 | +
|
30 | 37 | class glDirect3D7 : public IDirect3D7
|
31 | 38 | {
|
32 | 39 | public:
|
— | — | @@ -49,6 +56,7 @@ |
50 | 57 | glDirect3D1 *glD3D1;
|
51 | 58 | glDirectDraw7 *glDD7;
|
52 | 59 | private:
|
| 60 | + D3DDevice stored_devices[3];
|
53 | 61 | ULONG refcount;
|
54 | 62 | D3DDEVICEDESC7 d3ddesc;
|
55 | 63 | D3DDEVICEDESC d3ddesc3;
|
Index: ddraw/glDirect3DDevice.cpp |
— | — | @@ -418,7 +418,7 @@ |
419 | 419 | if(!tmp) return 0;
|
420 | 420 | *lights = tmp;
|
421 | 421 | for(DWORD i = *maxlights; i < newmax; i++)
|
422 | | - lights[i] = NULL;
|
| 422 | + (*lights)[i] = NULL;
|
423 | 423 | *maxlights = newmax;
|
424 | 424 | return 1;
|
425 | 425 | }
|
— | — | @@ -576,14 +576,107 @@ |
577 | 577 | if(dwCount && !lpRects) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
578 | 578 | TRACE_RET(HRESULT,23,glRenderer_Clear(renderer,glDDS7,dwCount,lpRects,dwFlags,dwColor,dvZ,dwStencil));
|
579 | 579 | }
|
| 580 | +
|
| 581 | +// ComputeSphereVisibility based on modified code from the Wine project, subject
|
| 582 | +// to the following license terms:
|
| 583 | +/*
|
| 584 | +* Copyright (c) 1998-2004 Lionel Ulmer
|
| 585 | +* Copyright (c) 2002-2005 Christian Costa
|
| 586 | +* Copyright (c) 2006-2009, 2011-2013 Stefan Dösinger
|
| 587 | +* Copyright (c) 2008 Alexander Dorofeyev
|
| 588 | +*
|
| 589 | +* This library is free software; you can redistribute it and/or
|
| 590 | +* modify it under the terms of the GNU Lesser General Public
|
| 591 | +* License as published by the Free Software Foundation; either
|
| 592 | +* version 2.1 of the License, or (at your option) any later version.
|
| 593 | +*
|
| 594 | +* This library is distributed in the hope that it will be useful,
|
| 595 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 596 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 597 | +* Lesser General Public License for more details.
|
| 598 | +*
|
| 599 | +* You should have received a copy of the GNU Lesser General Public
|
| 600 | +* License along with this library; if not, write to the Free Software
|
| 601 | +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
| 602 | +*/
|
| 603 | +static DWORD in_plane(UINT plane, D3DVECTOR normal, D3DVALUE origin_plane, D3DVECTOR center, D3DVALUE radius)
|
| 604 | +{
|
| 605 | + float distance, norm;
|
| 606 | +
|
| 607 | + norm = sqrtf(normal.x * normal.x + normal.y * normal.y + normal.z * normal.z);
|
| 608 | + distance = (origin_plane + normal.x * center.x + normal.y * center.y + normal.z * center.z) / norm;
|
| 609 | +
|
| 610 | + if (fabs(distance) < radius) return D3DSTATUS_CLIPUNIONLEFT << plane;
|
| 611 | + if (distance < -radius) return (D3DSTATUS_CLIPUNIONLEFT | D3DSTATUS_CLIPINTERSECTIONLEFT) << plane;
|
| 612 | + return 0;
|
| 613 | +}
|
| 614 | +
|
| 615 | +
|
580 | 616 | HRESULT WINAPI glDirect3DDevice7::ComputeSphereVisibility(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres,
|
581 | 617 | DWORD dwFlags, LPDWORD lpdwReturnValues)
|
582 | 618 | {
|
| 619 | + D3DMATRIX m, temp;
|
| 620 | + D3DVALUE origin_plane[6];
|
| 621 | + D3DVECTOR vec[6];
|
| 622 | + HRESULT hr;
|
| 623 | + UINT i, j;
|
| 624 | +
|
583 | 625 | TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
|
584 | 626 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
585 | | - FIXME("glDirect3DDevice7::ComputeSphereVisibility: stub");
|
586 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
587 | | - ERR(DDERR_GENERIC);
|
| 627 | + hr = GetTransform(D3DTRANSFORMSTATE_WORLD, &m);
|
| 628 | + if (hr != DD_OK) return DDERR_INVALIDPARAMS;
|
| 629 | + hr = GetTransform(D3DTRANSFORMSTATE_VIEW, &temp);
|
| 630 | + if (hr != DD_OK) return DDERR_INVALIDPARAMS;
|
| 631 | + multiply_matrix((wined3d_matrix*)&m, (wined3d_matrix*)&temp, (wined3d_matrix*)&m);
|
| 632 | +
|
| 633 | + hr = GetTransform(D3DTRANSFORMSTATE_PROJECTION, &temp);
|
| 634 | + if (hr != DD_OK) return DDERR_INVALIDPARAMS;
|
| 635 | + multiply_matrix((wined3d_matrix*)&m, (wined3d_matrix*)&temp, (wined3d_matrix*)&m);
|
| 636 | +
|
| 637 | + /* Left plane */
|
| 638 | + vec[0].x = m._14 + m._11;
|
| 639 | + vec[0].y = m._24 + m._21;
|
| 640 | + vec[0].z = m._34 + m._31;
|
| 641 | + origin_plane[0] = m._44 + m._41;
|
| 642 | +
|
| 643 | + /* Right plane */
|
| 644 | + vec[1].z = m._14 - m._11;
|
| 645 | + vec[1].y = m._24 - m._21;
|
| 646 | + vec[1].z = m._34 - m._31;
|
| 647 | + origin_plane[1] = m._44 - m._41;
|
| 648 | +
|
| 649 | + /* Top plane */
|
| 650 | + vec[2].x = m._14 - m._12;
|
| 651 | + vec[2].y = m._24 - m._22;
|
| 652 | + vec[2].z = m._34 - m._32;
|
| 653 | + origin_plane[2] = m._44 - m._42;
|
| 654 | +
|
| 655 | + /* Bottom plane */
|
| 656 | + vec[3].x = m._14 + m._12;
|
| 657 | + vec[3].y = m._24 + m._22;
|
| 658 | + vec[3].z = m._34 + m._32;
|
| 659 | + origin_plane[3] = m._44 + m._42;
|
| 660 | +
|
| 661 | + /* Front plane */
|
| 662 | + vec[4].x = m._13;
|
| 663 | + vec[4].y = m._23;
|
| 664 | + vec[4].z = m._33;
|
| 665 | + origin_plane[4] = m._43;
|
| 666 | +
|
| 667 | + /* Back plane*/
|
| 668 | + vec[5].x = m._14 - m._13;
|
| 669 | + vec[5].y = m._24 - m._23;
|
| 670 | + vec[5].z = m._34 - m._33;
|
| 671 | + origin_plane[5] = m._44 - m._43;
|
| 672 | +
|
| 673 | + for (i = 0; i < dwNumSpheres; ++i)
|
| 674 | + {
|
| 675 | + lpdwReturnValues[i] = 0;
|
| 676 | + for (j = 0; j < 6; ++j)
|
| 677 | + lpdwReturnValues[i] |= in_plane(j, vec[j], origin_plane[j], lpCenters[i], lpRadii[i]);
|
| 678 | + }
|
| 679 | + TRACE_EXIT(23, D3D_OK);
|
| 680 | + return D3D_OK;
|
588 | 681 | }
|
589 | 682 | HRESULT WINAPI glDirect3DDevice7::DeleteStateBlock(DWORD dwBlockHandle)
|
590 | 683 | {
|
— | — | @@ -935,8 +1028,8 @@ |
936 | 1029 | TRACE_ENTER(3,14,this,8,dwLightIndex,14,lpLight);
|
937 | 1030 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
938 | 1031 | if(!lpLight) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
939 | | - if(dwLightIndex >= lightsmax) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
940 | | - if(!lights[dwLightIndex]) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 1032 | + if(dwLightIndex >= lightsmax) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 1033 | + if(!lights[dwLightIndex]) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
941 | 1034 | lights[dwLightIndex]->GetLight7(lpLight);
|
942 | 1035 | TRACE_EXIT(23,D3D_OK);
|
943 | 1036 | return D3D_OK;
|
— | — | @@ -945,8 +1038,8 @@ |
946 | 1039 | {
|
947 | 1040 | TRACE_ENTER(3,14,this,8,dwLightIndex,14,pbEnable);
|
948 | 1041 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
949 | | - if(dwLightIndex >= lightsmax) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
950 | | - if(!lights[dwLightIndex]) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 1042 | + if(dwLightIndex >= lightsmax) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
| 1043 | + if(!lights[dwLightIndex]) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
951 | 1044 | if(!pbEnable) TRACE_RET(HRESULT,23,DDERR_INVALIDPARAMS);
|
952 | 1045 | *pbEnable = FALSE;
|
953 | 1046 | for(int i = 0; i < 8; i++)
|
— | — | @@ -1130,7 +1223,7 @@ |
1131 | 1224 | bool foundlight = false;
|
1132 | 1225 | if(dwLightIndex >= lightsmax)
|
1133 | 1226 | {
|
1134 | | - if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
| 1227 | + if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex+1)) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
1135 | 1228 | }
|
1136 | 1229 | if(!lights[dwLightIndex]) lights[dwLightIndex] = new glDirect3DLight;
|
1137 | 1230 | if(bEnable)
|
— | — | @@ -1208,10 +1301,13 @@ |
1209 | 1302 | {
|
1210 | 1303 | TRACE_ENTER(3,14,this,8,dwLightIndex,14,lpLight);
|
1211 | 1304 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
| 1305 | + if (!lpLight) TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
| 1306 | + if ((lpLight->dltType < D3DLIGHT_POINT) || (lpLight->dltType > D3DLIGHT_GLSPOT))
|
| 1307 | + TRACE_RET(HRESULT, 23, DDERR_INVALIDPARAMS);
|
1212 | 1308 | bool foundlight = false;
|
1213 | 1309 | if(dwLightIndex >= lightsmax)
|
1214 | 1310 | {
|
1215 | | - if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex-1)) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
| 1311 | + if(!ExpandLightBuffer(&lights,&lightsmax,dwLightIndex+1)) TRACE_RET(HRESULT,23,DDERR_OUTOFMEMORY);
|
1216 | 1312 | }
|
1217 | 1313 | if(!lights[dwLightIndex]) lights[dwLightIndex] = new glDirect3DLight;
|
1218 | 1314 | lights[dwLightIndex]->SetLight7(lpLight);
|
— | — | @@ -1951,15 +2047,6 @@ |
1952 | 2048 | return DDERR_GENERIC;
|
1953 | 2049 | }
|
1954 | 2050 |
|
1955 | | -HRESULT glDirect3DDevice7::ComputeSphereVisibility3(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues)
|
1956 | | -{
|
1957 | | - TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
|
1958 | | - if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
1959 | | - FIXME("glDirect3DDevice3::ComputeSphereVisibility: stub");
|
1960 | | - TRACE_EXIT(23,DDERR_GENERIC);
|
1961 | | - return DDERR_GENERIC;
|
1962 | | -}
|
1963 | | -
|
1964 | 2051 | HRESULT glDirect3DDevice7::GetCaps3(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc)
|
1965 | 2052 | {
|
1966 | 2053 | TRACE_ENTER(3,14,this,14,lpD3DHWDevDesc,14,lpD3DHELDevDesc);
|
— | — | @@ -2909,7 +2996,7 @@ |
2910 | 2997 | {
|
2911 | 2998 | TRACE_ENTER(6,14,this,14,lpCenters,14,lpRadii,8,dwNumSpheres,9,dwFlags,14,lpdwReturnValues);
|
2912 | 2999 | if(!this) TRACE_RET(HRESULT,23,DDERR_INVALIDOBJECT);
|
2913 | | - TRACE_RET(HRESULT,23,glD3DDev7->ComputeSphereVisibility3(lpCenters,lpRadii,dwNumSpheres,dwFlags,lpdwReturnValues));
|
| 3000 | + TRACE_RET(HRESULT,23,glD3DDev7->ComputeSphereVisibility(lpCenters,lpRadii,dwNumSpheres,dwFlags,lpdwReturnValues));
|
2914 | 3001 | }
|
2915 | 3002 |
|
2916 | 3003 | HRESULT WINAPI glDirect3DDevice3::DeleteViewport(LPDIRECT3DVIEWPORT3 lpDirect3DViewport)
|
Index: ddraw/glDirect3DDevice.h |
— | — | @@ -146,7 +146,6 @@ |
147 | 147 | HRESULT Index(WORD wVertexIndex);
|
148 | 148 | HRESULT Vertex(LPVOID lpVertex);
|
149 | 149 | HRESULT End(DWORD dwFlags);
|
150 | | - HRESULT ComputeSphereVisibility3(LPD3DVECTOR lpCenters, LPD3DVALUE lpRadii, DWORD dwNumSpheres, DWORD dwFlags, LPDWORD lpdwReturnValues);
|
151 | 150 | HRESULT GetCaps3(LPD3DDEVICEDESC lpD3DHWDevDesc, LPD3DDEVICEDESC lpD3DHELDevDesc);
|
152 | 151 | HRESULT GetLightState(D3DLIGHTSTATETYPE dwLightStateType, LPDWORD lpdwLightState);
|
153 | 152 | HRESULT SetLightState(D3DLIGHTSTATETYPE dwLightStateType, DWORD dwLightState);
|
Index: ddraw/glDirect3DLight.cpp |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | device = NULL;
|
38 | 38 | ZeroMemory(&light,sizeof(D3DLIGHT7));
|
39 | 39 | light.dltType = D3DLIGHT_DIRECTIONAL;
|
40 | | - light.dcvAmbient.r = light.dcvAmbient.g = light.dcvAmbient.b = 1.0f;
|
| 40 | + light.dcvDiffuse.r = light.dcvDiffuse.g = light.dcvDiffuse.b = 1.0f;
|
41 | 41 | light.dvDirection = D3DVECTOR(0,0,1.0);
|
42 | 42 | TRACE_EXIT(-1,0);
|
43 | 43 | }
|
Index: ddraw/matrix.cpp |
— | — | @@ -109,10 +109,11 @@ |
110 | 110 | GLfloat r[16])
|
111 | 111 | {
|
112 | 112 | int i, j;
|
| 113 | + GLfloat out[16];
|
113 | 114 |
|
114 | 115 | for (i = 0; i < 4; i++) {
|
115 | 116 | for (j = 0; j < 4; j++) {
|
116 | | - r[i*4+j] =
|
| 117 | + out[i*4+j] =
|
117 | 118 | a[i*4+0]*b[0*4+j] +
|
118 | 119 | a[i*4+1]*b[1*4+j] +
|
119 | 120 | a[i*4+2]*b[2*4+j] +
|
— | — | @@ -119,6 +120,7 @@ |
120 | 121 | a[i*4+3]*b[3*4+j];
|
121 | 122 | }
|
122 | 123 | }
|
| 124 | + memcpy(r, out, 16 * sizeof(GLfloat));
|
123 | 125 | }
|
124 | 126 |
|
125 | 127 | void __gluMakeIdentityf(GLfloat m[16])
|
— | — | @@ -141,3 +143,58 @@ |
142 | 144 | in[3] * matrix[3*4+i];
|
143 | 145 | }
|
144 | 146 | }
|
| 147 | +
|
| 148 | +
|
| 149 | +// Portions of this file are from the Wine project, distributed under the
|
| 150 | +// following license:
|
| 151 | +/*
|
| 152 | +* Copyright (c) 1998-2004 Lionel Ulmer
|
| 153 | +* Copyright (c) 2002-2005 Christian Costa
|
| 154 | +* Copyright (c) 2006-2009, 2011-2013 Stefan Dösinger
|
| 155 | +* Copyright (c) 2008 Alexander Dorofeyev
|
| 156 | +*
|
| 157 | +* This library is free software; you can redistribute it and/or
|
| 158 | +* modify it under the terms of the GNU Lesser General Public
|
| 159 | +* License as published by the Free Software Foundation; either
|
| 160 | +* version 2.1 of the License, or (at your option) any later version.
|
| 161 | +*
|
| 162 | +* This library is distributed in the hope that it will be useful,
|
| 163 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 164 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 165 | +* Lesser General Public License for more details.
|
| 166 | +*
|
| 167 | +* You should have received a copy of the GNU Lesser General Public
|
| 168 | +* License along with this library; if not, write to the Free Software
|
| 169 | +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
| 170 | +*/
|
| 171 | +
|
| 172 | +void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *src1,
|
| 173 | + const struct wined3d_matrix *src2)
|
| 174 | +{
|
| 175 | + struct wined3d_matrix temp;
|
| 176 | +
|
| 177 | + /* Now do the multiplication 'by hand'.
|
| 178 | + I know that all this could be optimised, but this will be done later :-) */
|
| 179 | + temp._11 = (src1->_11 * src2->_11) + (src1->_21 * src2->_12) + (src1->_31 * src2->_13) + (src1->_41 * src2->_14);
|
| 180 | + temp._21 = (src1->_11 * src2->_21) + (src1->_21 * src2->_22) + (src1->_31 * src2->_23) + (src1->_41 * src2->_24);
|
| 181 | + temp._31 = (src1->_11 * src2->_31) + (src1->_21 * src2->_32) + (src1->_31 * src2->_33) + (src1->_41 * src2->_34);
|
| 182 | + temp._41 = (src1->_11 * src2->_41) + (src1->_21 * src2->_42) + (src1->_31 * src2->_43) + (src1->_41 * src2->_44);
|
| 183 | +
|
| 184 | + temp._12 = (src1->_12 * src2->_11) + (src1->_22 * src2->_12) + (src1->_32 * src2->_13) + (src1->_42 * src2->_14);
|
| 185 | + temp._22 = (src1->_12 * src2->_21) + (src1->_22 * src2->_22) + (src1->_32 * src2->_23) + (src1->_42 * src2->_24);
|
| 186 | + temp._32 = (src1->_12 * src2->_31) + (src1->_22 * src2->_32) + (src1->_32 * src2->_33) + (src1->_42 * src2->_34);
|
| 187 | + temp._42 = (src1->_12 * src2->_41) + (src1->_22 * src2->_42) + (src1->_32 * src2->_43) + (src1->_42 * src2->_44);
|
| 188 | +
|
| 189 | + temp._13 = (src1->_13 * src2->_11) + (src1->_23 * src2->_12) + (src1->_33 * src2->_13) + (src1->_43 * src2->_14);
|
| 190 | + temp._23 = (src1->_13 * src2->_21) + (src1->_23 * src2->_22) + (src1->_33 * src2->_23) + (src1->_43 * src2->_24);
|
| 191 | + temp._33 = (src1->_13 * src2->_31) + (src1->_23 * src2->_32) + (src1->_33 * src2->_33) + (src1->_43 * src2->_34);
|
| 192 | + temp._43 = (src1->_13 * src2->_41) + (src1->_23 * src2->_42) + (src1->_33 * src2->_43) + (src1->_43 * src2->_44);
|
| 193 | +
|
| 194 | + temp._14 = (src1->_14 * src2->_11) + (src1->_24 * src2->_12) + (src1->_34 * src2->_13) + (src1->_44 * src2->_14);
|
| 195 | + temp._24 = (src1->_14 * src2->_21) + (src1->_24 * src2->_22) + (src1->_34 * src2->_23) + (src1->_44 * src2->_24);
|
| 196 | + temp._34 = (src1->_14 * src2->_31) + (src1->_24 * src2->_32) + (src1->_34 * src2->_33) + (src1->_44 * src2->_34);
|
| 197 | + temp._44 = (src1->_14 * src2->_41) + (src1->_24 * src2->_42) + (src1->_34 * src2->_43) + (src1->_44 * src2->_44);
|
| 198 | +
|
| 199 | + /* And copy the new matrix in the good storage.. */
|
| 200 | + memcpy(dest, &temp, 16 * sizeof(float));
|
| 201 | +}
|
Index: ddraw/matrix.h |
— | — | @@ -56,4 +56,45 @@ |
57 | 57 | void __gluMakeIdentityf(GLfloat m[16]);
|
58 | 58 | void __gluMultMatrixVecf(const GLfloat matrix[16], const GLfloat in[4], GLfloat out[4]);
|
59 | 59 |
|
| 60 | +// Portions of this file are from the Wine project, distributed under the
|
| 61 | +// following license:
|
| 62 | +/*
|
| 63 | +* Copyright (c) 1998-2004 Lionel Ulmer
|
| 64 | +* Copyright (c) 2002-2005 Christian Costa
|
| 65 | +* Copyright (c) 2006-2009, 2011-2013 Stefan Dösinger
|
| 66 | +* Copyright (c) 2008 Alexander Dorofeyev
|
| 67 | +*
|
| 68 | +* This library is free software; you can redistribute it and/or
|
| 69 | +* modify it under the terms of the GNU Lesser General Public
|
| 70 | +* License as published by the Free Software Foundation; either
|
| 71 | +* version 2.1 of the License, or (at your option) any later version.
|
| 72 | +*
|
| 73 | +* This library is distributed in the hope that it will be useful,
|
| 74 | +* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 75 | +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 76 | +* Lesser General Public License for more details.
|
| 77 | +*
|
| 78 | +* You should have received a copy of the GNU Lesser General Public
|
| 79 | +* License along with this library; if not, write to the Free Software
|
| 80 | +* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
| 81 | +*/
|
| 82 | +
|
| 83 | +struct wined3d_matrix
|
| 84 | +{
|
| 85 | + union
|
| 86 | + {
|
| 87 | + struct
|
| 88 | + {
|
| 89 | + float _11, _12, _13, _14;
|
| 90 | + float _21, _22, _23, _24;
|
| 91 | + float _31, _32, _33, _34;
|
| 92 | + float _41, _42, _43, _44;
|
| 93 | + } DUMMYSTRUCTNAME;
|
| 94 | + float m[4][4];
|
| 95 | + } DUMMYUNIONNAME;
|
| 96 | +};
|
| 97 | +
|
| 98 | +void multiply_matrix(struct wined3d_matrix *dest, const struct wined3d_matrix *src1,
|
| 99 | + const struct wined3d_matrix *src2);
|
| 100 | +
|
60 | 101 | #endif //_MATRIX_H |
\ No newline at end of file |