DXGL r310 - Code Review
For
DXGL
(
recent comments
|
status changes
|
tags
|
authors
|
states
|
release notes
|
statistics
)
Jump to navigation
Jump to search
Repository:
DXGL
Revision:
<
r309
|
r310
|
r311
>
Date:
19:17, 13 January 2013
Author:
admin
Status:
new
Tags:
Comment:
Add flat shading.
Modified paths:
/ddraw/glRenderer.cpp
(modified) (
history
)
/ddraw/glutil.cpp
(modified) (
history
)
/ddraw/glutil.h
(modified) (
history
)
Diff
[
purge
]
Index: ddraw/glRenderer.cpp
—
—
@@ -794,6 +794,7 @@
795
795
SetFogEnd(1);
796
796
SetFogDensity(1);
797
797
SetPolyMode(D3DFILL_SOLID);
798
+ SetShadeMode(D3DSHADE_GOURAUD);
798
799
if(hWnd)
799
800
{
800
801
dib.enabled = true;
—
—
@@ -1576,6 +1577,7 @@
1577
1578
SetFogEnd(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGEND]));
1578
1579
SetFogDensity(*(GLfloat*)(&device->renderstate[D3DRENDERSTATE_FOGDENSITY]));
1579
1580
SetPolyMode((D3DFILLMODE)device->renderstate[D3DRENDERSTATE_FILLMODE]);
1581
+ SetShadeMode((D3DSHADEMODE)device->renderstate[D3DRENDERSTATE_SHADEMODE]);
1580
1582
if(indices) glDrawElements(mode,indexcount,GL_UNSIGNED_SHORT,indices);
1581
1583
else glDrawArrays(mode,0,count);
1582
1584
if(device->glDDS7->zbuffer) device->glDDS7->zbuffer->dirty |= 2;
Index: ddraw/glutil.cpp
—
—
@@ -58,6 +58,7 @@
59
59
D3DCULL cullmode = D3DCULL_NONE;
60
60
bool cullenabled = false;
61
61
D3DFILLMODE polymode = D3DFILL_SOLID;
62
+D3DSHADEMODE shademode = D3DSHADE_GOURAUD;
62
63
63
64
void InitFBO()
64
65
{
—
—
@@ -412,4 +413,24 @@
413
414
break;
414
415
}
415
416
}
417
+}
418
+
419
+void SetShadeMode(D3DSHADEMODE mode)
420
+{
421
+ if(shademode != mode)
422
+ {
423
+ shademode = mode;
424
+ switch(mode)
425
+ {
426
+ case D3DSHADE_FLAT:
427
+ case 4:
428
+ glShadeModel(GL_FLAT);
429
+ break;
430
+ case D3DSHADE_GOURAUD:
431
+ case D3DSHADE_PHONG:
432
+ default:
433
+ glShadeModel(GL_SMOOTH);
434
+ break;
435
+ }
436
+ }
416
437
}
\ No newline at end of file
Index: ddraw/glutil.h
—
—
@@ -46,5 +46,6 @@
47
47
void EnableCull(bool enabled);
48
48
void SetCull(D3DCULL mode);
49
49
void SetPolyMode(D3DFILLMODE mode);
50
+void SetShadeMode(D3DSHADEMODE mode);
50
51
51
52
#endif //_GLUTIL_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