Ivan Gyurdiev : wined3d: Add D3DFOGMODE to the WINED3D namespace.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Oct 30 05:22:35 CST 2006


Module: wine
Branch: master
Commit: 4eced8ea247df69cef092b894f253df9bae459fb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4eced8ea247df69cef092b894f253df9bae459fb

Author: Ivan Gyurdiev <ivg231 at gmail.com>
Date:   Sun Oct 29 21:41:42 2006 -0500

wined3d: Add D3DFOGMODE to the WINED3D namespace.

---

 dlls/wined3d/device.c        |   24 ++++++++++++++----------
 dlls/wined3d/drawprim.c      |    8 ++++----
 dlls/wined3d/stateblock.c    |    4 ++--
 include/wine/wined3d_types.h |    9 +++++++++
 4 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index dc360db..d11c42b 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3891,14 +3891,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl
     case WINED3DRS_FOGVERTEXMODE             :
         {
           /* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes, the system will apply only pixel(=table) fog effects." */
-          if(This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == D3DFOG_NONE) {
+          if(This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
               glHint(GL_FOG_HINT, GL_FASTEST);
               checkGLcall("glHint(GL_FOG_HINT, GL_FASTEST)");
               switch (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE]) {
                   /* Processed vertices have their fog factor stored in the specular value. Fall too the none case.
                    * If we are drawing untransformed vertices atm, d3ddevice_set_ortho will update the fog
                    */
-                  case D3DFOG_EXP:  {
+                  case WINED3DFOG_EXP:  {
                       if(!This->last_was_rhw) {
                           glFogi(GL_FOG_MODE, GL_EXP);
                           checkGLcall("glFogi(GL_FOG_MODE, GL_EXP");
@@ -3911,7 +3911,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                           break;
                       }
                   }
-                  case D3DFOG_EXP2: {
+                  case WINED3DFOG_EXP2: {
                       if(!This->last_was_rhw) {
                           glFogi(GL_FOG_MODE, GL_EXP2);
                           checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2");
@@ -3924,7 +3924,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                           break;
                       }
                   }
-                  case D3DFOG_LINEAR: {
+                  case WINED3DFOG_LINEAR: {
                       if(!This->last_was_rhw) {
                           glFogi(GL_FOG_MODE, GL_LINEAR);
                           checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR");
@@ -3937,7 +3937,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                           break;
                       }
                   }
-                  case D3DFOG_NONE: {
+                  case WINED3DFOG_NONE: {
                       /* Both are none? According to msdn the alpha channel of the specular
                        * color contains a fog factor. Set it in drawStridedSlow.
                        * Same happens with Vertexfog on transformed vertices
@@ -3964,7 +3964,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
               glHint(GL_FOG_HINT, GL_NICEST);
               checkGLcall("glHint(GL_FOG_HINT, GL_NICEST)");
               switch (This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE]) {
-                  case D3DFOG_EXP:    glFogi(GL_FOG_MODE, GL_EXP);
+                  case WINED3DFOG_EXP:
+                                      glFogi(GL_FOG_MODE, GL_EXP);
                                       checkGLcall("glFogi(GL_FOG_MODE, GL_EXP");
                                       if(GL_SUPPORT(EXT_FOG_COORD)) {
                                           glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
@@ -3973,7 +3974,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                                           IWineD3DDevice_SetRenderState(iface, WINED3DRS_FOGEND, This->stateBlock->renderState[WINED3DRS_FOGEND]);
                                       }
                                       break;
-                  case D3DFOG_EXP2:   glFogi(GL_FOG_MODE, GL_EXP2);
+                  case WINED3DFOG_EXP2:
+                                      glFogi(GL_FOG_MODE, GL_EXP2);
                                       checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2");
                                       if(GL_SUPPORT(EXT_FOG_COORD)) {
                                           glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
@@ -3982,7 +3984,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                                           IWineD3DDevice_SetRenderState(iface, WINED3DRS_FOGEND, This->stateBlock->renderState[WINED3DRS_FOGEND]);
                                       }
                                       break;
-                  case D3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR);
+                  case WINED3DFOG_LINEAR:
+                                      glFogi(GL_FOG_MODE, GL_LINEAR);
                                       checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR");
                                       if(GL_SUPPORT(EXT_FOG_COORD)) {
                                           glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
@@ -3991,8 +3994,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl
                                           IWineD3DDevice_SetRenderState(iface, WINED3DRS_FOGEND, This->stateBlock->renderState[WINED3DRS_FOGEND]);
                                       }
                                       break;
-                  case D3DFOG_NONE:   /* Won't happen */
-                  default:            FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE]);
+                  case WINED3DFOG_NONE:
+                  default:            /* Won't happen */
+                                      FIXME("Unexpected WINED3DRS_FOGTABLEMODE %d\n", This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE]);
               }
           }
           if (GL_SUPPORT(NV_FOG_DISTANCE)) {
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index b632f65..a5bf5eb 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -201,7 +201,7 @@ void d3ddevice_set_ortho(IWineD3DDeviceI
         }
 
         /* Vertex fog on transformed vertices? Use the calculated fog factor stored in the specular color */
-        if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] && This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] != D3DFOG_NONE) {
+        if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] && This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] != WINED3DFOG_NONE) {
             if(GL_SUPPORT(EXT_FOG_COORD)) {
                 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT);
                 checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)");
@@ -326,7 +326,7 @@ static void primitiveInitState(
             glFogf(GL_FOG_END, 0.0f);
 
         } else if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] 
-                  && This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] != D3DFOG_NONE) {
+                  && This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] != WINED3DFOG_NONE) {
             
             if(GL_SUPPORT(EXT_FOG_COORD)) {
                 glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT);
@@ -1508,8 +1508,8 @@ static void drawStridedSlow(IWineD3DDevi
         if (sd->u.s.specular.lpData != NULL) {
             /* special case where the fog density is stored in the diffuse alpha channel */
             if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] &&
-              (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == D3DFOG_NONE || sd->u.s.position.dwType == WINED3DDECLTYPE_FLOAT4 )&&
-              This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == D3DFOG_NONE) {
+              (This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || sd->u.s.position.dwType == WINED3DDECLTYPE_FLOAT4 )&&
+              This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
                 if(GL_SUPPORT(EXT_FOG_COORD)) {
                     GL_EXTCALL(glFogCoordfEXT(specularColor >> 24));
                 } else {
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index e7221a2..e1a3b22 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -863,7 +863,7 @@ static HRESULT  WINAPI IWineD3DStateBloc
     IWineD3DDevice_SetRenderState(device, WINED3DRS_SPECULARENABLE,   FALSE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_ZVISIBLE,         0);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGCOLOR,         0);
-    IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGTABLEMODE,     D3DFOG_NONE);
+    IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGTABLEMODE,     WINED3DFOG_NONE);
     tmpfloat.f = 0.0f;
     IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGSTART,         tmpfloat.d);
     tmpfloat.f = 1.0f;
@@ -900,7 +900,7 @@ static HRESULT  WINAPI IWineD3DStateBloc
     IWineD3DDevice_SetRenderState(device, WINED3DRS_CLIPPING,                 TRUE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_LIGHTING,                 TRUE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_AMBIENT,                  0);
-    IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGVERTEXMODE,            D3DFOG_NONE);
+    IWineD3DDevice_SetRenderState(device, WINED3DRS_FOGVERTEXMODE,            WINED3DFOG_NONE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORVERTEX,              TRUE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_LOCALVIEWER,              TRUE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_NORMALIZENORMALS,         FALSE);
diff --git a/include/wine/wined3d_types.h b/include/wine/wined3d_types.h
index 067188a..5573463 100644
--- a/include/wine/wined3d_types.h
+++ b/include/wine/wined3d_types.h
@@ -478,6 +478,15 @@ typedef enum _WINED3DZBUFFERTYPE {
     WINED3DZB_FORCE_DWORD           = 0x7fffffff
 } WINED3DZBUFFERTYPE;
 
+typedef enum _WINED3DFOGMODE {
+    WINED3DFOG_NONE                 = 0,
+    WINED3DFOG_EXP                  = 1,
+    WINED3DFOG_EXP2                 = 2,
+    WINED3DFOG_LINEAR               = 3,
+
+    WINED3DFOG_FORCE_DWORD          = 0x7fffffff
+} WINED3DFOGMODE;
+
 typedef struct _WINED3DDISPLAYMODE {
     UINT            Width;
     UINT            Height;




More information about the wine-cvs mailing list