[D3D 64] Light improvements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changelog:
 - light improvements
 - misc. fixes

-- 
		 Lionel Ulmer - http://www.bbrox.org/
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3ddevice/mesa.c	2002-12-29 09:28:51.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3ddevice/mesa.c	2002-12-29 14:11:25.000000000 +0100
@@ -890,6 +890,8 @@
 	FE(D3DFVF_DIFFUSE),
 	FE(D3DFVF_SPECULAR)
     };
+    int i;
+    
     if (d3dvtVertexType & D3DFVF_RESERVED0) DPRINTF("D3DFVF_RESERVED0 ");
     switch (d3dvtVertexType & D3DFVF_POSITION_MASK) {
 #define GEN_CASE(a) case a: DPRINTF(#a " "); break
@@ -914,6 +916,9 @@
 	GEN_CASE(D3DFVF_TEX8);
     }
 #undef GEN_CASE
+    for (i = 0; i < ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); i++) {
+        DPRINTF(" T%d-s%ld", i + 1, (((d3dvtVertexType >> (16 + (2 * i))) + 1) & 0x03) + 1);
+    }
     DPRINTF("\n");
 }
 
@@ -1544,21 +1549,69 @@
     This->light_parameters[dwLightIndex] = *lpLight;
 
     switch (lpLight->dltType) {
-	case D3DLIGHT_DIRECTIONAL: {  /* 3 */
+	case D3DLIGHT_DIRECTIONAL: {
 	    float direction[4];
-
+	    float cut_off = 180.0;
+	    
 	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_AMBIENT,  (float *) &(lpLight->dcvAmbient));
 	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_DIFFUSE,  (float *) &(lpLight->dcvDiffuse));
 	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPECULAR, (float *) &(lpLight->dcvSpecular));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPOT_CUTOFF, &cut_off);
 
 	    direction[0] = lpLight->dvDirection.u1.x;
 	    direction[1] = lpLight->dvDirection.u2.y;
 	    direction[2] = lpLight->dvDirection.u3.z;
-	    direction[3] = 0.0; /* This is a directional light */
-
+	    direction[3] = 0.0;
 	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_POSITION, (float *) direction);
 	} break;
 
+        case D3DLIGHT_POINT: {
+	    float position[4];
+	    float cut_off = 180.0;
+
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_AMBIENT,  (float *) &(lpLight->dcvAmbient));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_DIFFUSE,  (float *) &(lpLight->dcvDiffuse));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPECULAR, (float *) &(lpLight->dcvSpecular));
+	    position[0] = lpLight->dvPosition.u1.x;
+	    position[1] = lpLight->dvPosition.u2.y;
+	    position[2] = lpLight->dvPosition.u3.z;
+	    position[3] = 1.0;
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_POSITION, (float *) position);
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_CONSTANT_ATTENUATION, &(lpLight->dvAttenuation0));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_LINEAR_ATTENUATION, &(lpLight->dvAttenuation1));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_QUADRATIC_ATTENUATION, &(lpLight->dvAttenuation2));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPOT_CUTOFF, &cut_off);
+	} break;
+
+        case D3DLIGHT_SPOT: {
+	    float direction[4];
+	    float position[4];
+	    float cut_off = 90.0 * (lpLight->dvPhi / M_PI);
+
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_AMBIENT,  (float *) &(lpLight->dcvAmbient));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_DIFFUSE,  (float *) &(lpLight->dcvDiffuse));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPECULAR, (float *) &(lpLight->dcvSpecular));
+
+	    direction[0] = lpLight->dvDirection.u1.x;
+	    direction[1] = lpLight->dvDirection.u2.y;
+	    direction[2] = lpLight->dvDirection.u3.z;
+	    direction[3] = 0.0;
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPOT_DIRECTION, (float *) direction);
+	    position[0] = lpLight->dvPosition.u1.x;
+	    position[1] = lpLight->dvPosition.u2.y;
+	    position[2] = lpLight->dvPosition.u3.z;
+	    position[3] = 1.0;
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_POSITION, (float *) position);
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_CONSTANT_ATTENUATION, &(lpLight->dvAttenuation0));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_LINEAR_ATTENUATION, &(lpLight->dvAttenuation1));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_QUADRATIC_ATTENUATION, &(lpLight->dvAttenuation2));
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPOT_CUTOFF, &cut_off);
+	    glLightfv(GL_LIGHT0 + dwLightIndex, GL_SPOT_EXPONENT, &(lpLight->dvFalloff));
+	    if ((lpLight->dvTheta != 0.0) || (lpLight->dvTheta != lpLight->dvPhi)) {
+	        WARN("dvTheta not fully supported yet !\n");
+	    }
+	} break;
+
         default: WARN(" light type not handled yet...\n");
     }
 
--- /home/ulmer/Wine/wine_base//dlls/ddraw/d3dcommon.c	2002-12-29 09:28:51.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/d3dcommon.c	2002-12-29 09:29:31.000000000 +0100
@@ -208,13 +208,13 @@
 void
 dump_DPFLAGS(DWORD dwFlags)
 {
-        static const flag_info flags[] =
-	{
-	    FE(D3DDP_WAIT),
-	    FE(D3DDP_OUTOFORDER),
-	    FE(D3DDP_DONOTCLIP),
-	    FE(D3DDP_DONOTUPDATEEXTENTS),
-	    FE(D3DDP_DONOTLIGHT)
+    static const flag_info flags[] =
+    {
+        FE(D3DDP_WAIT),
+	FE(D3DDP_OUTOFORDER),
+	FE(D3DDP_DONOTCLIP),
+	FE(D3DDP_DONOTUPDATEEXTENTS),
+	FE(D3DDP_DONOTLIGHT)
     };
 
     DDRAW_dump_flags(dwFlags, flags, sizeof(flags)/sizeof(flags[0]));
--- /home/ulmer/Wine/wine_base//dlls/ddraw/mesa.c	2002-12-29 09:28:51.000000000 +0100
+++ /home/ulmer/Wine/wine_work//dlls/ddraw/mesa.c	2002-12-29 13:22:54.000000000 +0100
@@ -495,6 +495,22 @@
 		}
 		break;
 
+	    case D3DRENDERSTATE_DIFFUSEMATERIALSOURCE:     /* 145 */
+	        rs->color_diffuse = dwRenderState;
+		break;
+
+	    case D3DRENDERSTATE_SPECULARMATERIALSOURCE:   /* 146 */
+	        rs->color_specular = dwRenderState;
+		break;
+
+	    case D3DRENDERSTATE_AMBIENTMATERIALSOURCE:    /* 147 */
+	        rs->color_ambient = dwRenderState;
+		break;
+
+	    case D3DRENDERSTATE_EMISSIVEMATERIALSOURCE:   /* 148 */
+	        rs->color_emissive = dwRenderState;
+		break;
+
 	    default:
 	        ERR("Unhandled dwRenderStateType %s (%08x) !\n", _get_renderstate(dwRenderStateType), dwRenderStateType);
 	}

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux