[D3D 95] Small 'hack' to improve Nascar2002*

Lionel Ulmer lionel.ulmer at free.fr
Sun Feb 9 16:57:48 CST 2003


Hi all,

Our 'algorithm' to detect lighted / unlighted vertices was plainly wrong (ie
games can perfectly use unlighted geometry without normals as Nascar was
doing). 

The 'problem' is with the legacy interfaces (as it's pretty easy I think for
D3D7 as we can 'trust' the LIGHTING render state). So I wonder how one can
differentiate (if one can) in D3D6 between an untransformed vertex with no
normal that is lighted and one that is not...

On the other hand, I know NO game using D3D6 and untransformed vertices so
we can mostly code for the D3D7 cases :-)

Anyway, now we can see the race track in Nascar2002 (we still have serious
geometry problems though) so I submit this as is but a better fix will be
forecoming (do not know when though, I have to think through this a little
more :-) ).

Changelog:
  Change algorithm to detect lighted / unlighted vertices

-- 
		 Lionel Ulmer - http://www.bbrox.org/
-------------- next part --------------
--- ../wine_base/dlls/ddraw/d3ddevice/mesa.c	Sun Feb  9 21:33:29 2003
+++ dlls/ddraw/d3ddevice/mesa.c	Sun Feb  9 23:43:46 2003
@@ -1029,7 +1029,7 @@
 				   DWORD dwIndexCount,
 				   DWORD dwFlags)
 {
-    BOOLEAN vertex_lighted = (d3dvtVertexType & D3DFVF_NORMAL) == 0;
+    BOOLEAN vertex_lighted = FALSE;
     IDirect3DDeviceGLImpl* glThis = (IDirect3DDeviceGLImpl*) This;
 
     if (TRACE_ON(ddraw)) {
@@ -1037,6 +1037,14 @@
     }
 
     ENTER_GL();
+    
+    /* Just a hack for now.. Will have to find better algorithm :-/ */
+    if ((d3dvtVertexType & D3DFVF_POSITION_MASK) != D3DFVF_XYZ) {
+        vertex_lighted = TRUE;
+    } else {
+        if ((d3dvtVertexType & D3DFVF_NORMAL) == 0) glNormal3f(0.0, 0.0, 0.0);
+    }
+    
     draw_primitive_handle_GL_state(This,
 				   (d3dvtVertexType & D3DFVF_POSITION_MASK) != D3DFVF_XYZ,
 				   vertex_lighted);


More information about the wine-patches mailing list