DXGL r67 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r66‎ | r67 | r68 >
Date:15:58, 1 January 2012
Author:admin
Status:new
Tags:
Comment:
Add IDirect3DDevice7::GetMaterial and SetMaterial
Modified paths:
  • /ddraw/glDirect3DDevice.cpp (modified) (history)
  • /ddraw/glDirect3DDevice.h (modified) (history)

Diff [purge]

Index: ddraw/glDirect3DDevice.cpp
@@ -131,6 +131,7 @@
132132 glDisable(GL_DITHER);
133133 glEnable(GL_LIGHTING);
134134 glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient);
 135+ ZeroMemory(&material,sizeof(D3DMATERIAL7));
135136
136137 }
137138 glDirect3DDevice7::~glDirect3DDevice7()
@@ -287,8 +288,9 @@
288289 }
289290 HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial)
290291 {
291 - FIXME("glDirect3DDevice7::GetMaterial: stub");
292 - ERR(DDERR_GENERIC);
 292+ if(!lpMaterial) return DDERR_INVALIDPARAMS;
 293+ memcpy(lpMaterial,&material,sizeof(D3DMATERIAL7));
 294+ return D3D_OK;
293295 }
294296 HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
295297 {
@@ -367,8 +369,14 @@
368370 }
369371 HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial)
370372 {
371 - FIXME("glDirect3DDevice7::SetMaterial: stub");
372 - ERR(DDERR_GENERIC);
 373+ if(!lpMaterial) return DDERR_INVALIDPARAMS;
 374+ memcpy(&material,lpMaterial,sizeof(D3DMATERIAL7));
 375+ glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,(GLfloat*)&material.ambient);
 376+ glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,(GLfloat*)&material.diffuse);
 377+ glMaterialfv(GL_FRONT_AND_BACK,GL_SPECULAR,(GLfloat*)&material.specular);
 378+ glMaterialfv(GL_FRONT_AND_BACK,GL_EMISSION,(GLfloat*)&material.emissive);
 379+ glMaterialf(GL_FRONT_AND_BACK,GL_SHININESS,material.power);
 380+ return D3D_OK;
373381 }
374382 HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
375383 {
Index: ddraw/glDirect3DDevice.h
@@ -91,6 +91,7 @@
9292 ULONG refcount;
9393 D3DVIEWPORT7 viewport;
9494 DWORD renderstate[153];
 95+ D3DMATERIAL7 material;
9596 };
9697
9798 #endif //__GLDIRECT3DDEVICE_H
\ No newline at end of file