DXGL r67 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
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 @@
132
132
glDisable(GL_DITHER);
133
133
glEnable(GL_LIGHTING);
134
134
glLightModelfv(GL_LIGHT_MODEL_AMBIENT,ambient);
135
+ ZeroMemory(&material,sizeof(D3DMATERIAL7));
135
136
136
137
}
137
138
glDirect3DDevice7::~glDirect3DDevice7()
—
—
@@ -287,8 +288,9 @@
288
289
}
289
290
HRESULT WINAPI glDirect3DDevice7::GetMaterial(LPD3DMATERIAL7 lpMaterial)
290
291
{
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;
293
295
}
294
296
HRESULT WINAPI glDirect3DDevice7::GetRenderState(D3DRENDERSTATETYPE dwRenderStateType, LPDWORD lpdwRenderState)
295
297
{
—
—
@@ -367,8 +369,14 @@
368
370
}
369
371
HRESULT WINAPI glDirect3DDevice7::SetMaterial(LPD3DMATERIAL7 lpMaterial)
370
372
{
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;
373
381
}
374
382
HRESULT WINAPI glDirect3DDevice7::SetRenderState(D3DRENDERSTATETYPE dwRendStateType, DWORD dwRenderState)
375
383
{
Index: ddraw/glDirect3DDevice.h
—
—
@@ -91,6 +91,7 @@
92
92
ULONG refcount;
93
93
D3DVIEWPORT7 viewport;
94
94
DWORD renderstate[153];
95
+ D3DMATERIAL7 material;
95
96
};
96
97
97
98
#endif //__GLDIRECT3DDEVICE_H
\ No newline at end of file
Navigation menu
Personal tools
Log in
Namespaces
Special page
English
expanded
collapsed
Views
More
expanded
collapsed
Search
Navigation
Home
Main page
Recent changes
Random page
MediaWiki help
Introduction
Progress
Downloads
Source code
Build from source
AppDB
Bug reports
Forums
Tools
Special pages
Printable version