| Index: Help/dxglcfg.png |
| Cannot display: file marked as a binary type. |
| svn:mime-type = application/octet-stream |
| Index: ddraw/glDirect3DDevice.cpp |
| — | — | @@ -115,10 +115,18 @@ |
| 116 | 116 | FALSE, //clipplaneenable
|
| 117 | 117 | };
|
| 118 | 118 |
|
| | 119 | +D3DMATRIX identity;
|
| | 120 | +
|
| 119 | 121 | glDirect3DDevice7::glDirect3DDevice7(glDirect3D7 *glD3D7, glDirectDrawSurface7 *glDDS7)
|
| 120 | 122 | {
|
| 121 | 123 | memcpy(renderstate,renderstate_default,153*sizeof(DWORD));
|
| 122 | 124 | GLfloat ambient[] = {0.0,0.0,0.0,0.0};
|
| | 125 | + identity._11 = identity._22 = identity._33 = identity._44 = 1.0;
|
| | 126 | + identity._12 = identity._13 = identity._14 =
|
| | 127 | + identity._21 = identity._23 = identity._24 =
|
| | 128 | + identity._31 = identity._32 = identity._34 =
|
| | 129 | + identity._41 = identity._42 = identity._43 = 0.0;
|
| | 130 | + matWorld = matView = matProjection = identity;
|
| 123 | 131 | refcount = 1;
|
| 124 | 132 | this->glD3D7 = glD3D7;
|
| 125 | 133 | glD3D7->AddRef();
|
| — | — | @@ -339,8 +347,20 @@ |
| 340 | 348 | }
|
| 341 | 349 | HRESULT WINAPI glDirect3DDevice7::GetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
|
| 342 | 350 | {
|
| 343 | | - FIXME("glDirect3DDevice7::GetTransform: stub");
|
| 344 | | - ERR(DDERR_GENERIC);
|
| | 351 | + switch(dtstTransformStateType)
|
| | 352 | + {
|
| | 353 | + case D3DTRANSFORMSTATE_WORLD:
|
| | 354 | + memcpy(lpD3DMatrix,&matWorld,sizeof(D3DMATRIX));
|
| | 355 | + return D3D_OK;
|
| | 356 | + case D3DTRANSFORMSTATE_VIEW:
|
| | 357 | + memcpy(lpD3DMatrix,&matView,sizeof(D3DMATRIX));
|
| | 358 | + return D3D_OK;
|
| | 359 | + case D3DTRANSFORMSTATE_PROJECTION:
|
| | 360 | + memcpy(lpD3DMatrix,&matProjection,sizeof(D3DMATRIX));
|
| | 361 | + return D3D_OK;
|
| | 362 | + default:
|
| | 363 | + ERR(DDERR_INVALIDPARAMS);
|
| | 364 | + }
|
| 345 | 365 | }
|
| 346 | 366 | HRESULT WINAPI glDirect3DDevice7::GetViewport(LPD3DVIEWPORT7 lpViewport)
|
| 347 | 367 | {
|
| — | — | @@ -373,8 +393,7 @@ |
| 374 | 394 | if(!foundlight) return D3DERR_LIGHT_SET_FAILED;
|
| 375 | 395 | lights[dwLightIndex]->SetGLLight(i);
|
| 376 | 396 | }
|
| 377 | | - FIXME("glDirect3DDevice7::LightEnable: stub");
|
| 378 | | - ERR(DDERR_GENERIC);
|
| | 397 | + return D3D_OK;
|
| 379 | 398 | }
|
| 380 | 399 | HRESULT WINAPI glDirect3DDevice7::Load(LPDIRECTDRAWSURFACE7 lpDestTex, LPPOINT lpDestPoint, LPDIRECTDRAWSURFACE7 lpSrcTex,
|
| 381 | 400 | LPRECT lprcSrcRect, DWORD dwFlags)
|
| — | — | @@ -421,7 +440,10 @@ |
| 422 | 441 |
|
| 423 | 442 | inline void dwordto4float(DWORD in, GLfloat *out)
|
| 424 | 443 | {
|
| 425 | | -
|
| | 444 | + out[0] = (GLfloat)((in>>16) & 0xff) / 255.0f;
|
| | 445 | + out[1] = (GLfloat)((in>>8) & 0xff) / 255.0f;
|
| | 446 | + out[2] = (GLfloat)(in& 0xff) / 255.0f;
|
| | 447 | + out[3] = (GLfloat)((in>>24) & 0xff) / 255.0f;
|
| 426 | 448 | }
|
| 427 | 449 |
|
| 428 | 450 | HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
|
| — | — | @@ -458,7 +480,8 @@ |
| 459 | 481 | return D3D_OK;
|
| 460 | 482 | case D3DRENDERSTATE_AMBIENT:
|
| 461 | 483 | dwordto4float(dwRenderState,floats);
|
| 462 | | -
|
| | 484 | + glLightModelfv(GL_LIGHT_MODEL_AMBIENT,floats);
|
| | 485 | + return D3D_OK;
|
| 463 | 486 | default:
|
| 464 | 487 | ERR(DDERR_INVALIDPARAMS);
|
| 465 | 488 | }
|
| — | — | @@ -485,8 +508,20 @@ |
| 486 | 509 | }
|
| 487 | 510 | HRESULT WINAPI glDirect3DDevice7::SetTransform(D3DTRANSFORMSTATETYPE dtstTransformStateType, LPD3DMATRIX lpD3DMatrix)
|
| 488 | 511 | {
|
| 489 | | - FIXME("glDirect3DDevice7::SetTransform: stub");
|
| 490 | | - ERR(DDERR_GENERIC);
|
| | 512 | + switch(dtstTransformStateType)
|
| | 513 | + {
|
| | 514 | + case D3DTRANSFORMSTATE_WORLD:
|
| | 515 | + memcpy(&matWorld,lpD3DMatrix,sizeof(D3DMATRIX));
|
| | 516 | + return D3D_OK;
|
| | 517 | + case D3DTRANSFORMSTATE_VIEW:
|
| | 518 | + memcpy(&matView,lpD3DMatrix,sizeof(D3DMATRIX));
|
| | 519 | + return D3D_OK;
|
| | 520 | + case D3DTRANSFORMSTATE_PROJECTION:
|
| | 521 | + memcpy(&matProjection,lpD3DMatrix,sizeof(D3DMATRIX));
|
| | 522 | + return D3D_OK;
|
| | 523 | + default:
|
| | 524 | + ERR(DDERR_INVALIDPARAMS);
|
| | 525 | + }
|
| 491 | 526 | }
|
| 492 | 527 | HRESULT WINAPI glDirect3DDevice7::SetViewport(LPD3DVIEWPORT7 lpViewport)
|
| 493 | 528 | {
|
| Index: ddraw/glDirect3DDevice.h |
| — | — | @@ -87,6 +87,7 @@ |
| 88 | 88 | HRESULT WINAPI ValidateDevice(LPDWORD lpdwPasses);
|
| 89 | 89 |
|
| 90 | 90 | private:
|
| | 91 | + D3DMATRIX matWorld,matView,matProjection;
|
| 91 | 92 | glDirect3D7 *glD3D7;
|
| 92 | 93 | glDirectDrawSurface7 *glDDS7;
|
| 93 | 94 | ULONG refcount;
|