D3DMATERIAL

The D3DMATERIAL structure specifies material properties in calls to the IDirect3DMaterial3::GetMaterial and IDirect3DMaterial3::SetMaterial methods.

typedef struct _D3DMATERIAL { 
    DWORD             dwSize; 
    union { 
        D3DCOLORVALUE diffuse; 
        D3DCOLORVALUE dcvDiffuse; 
    }; 
    union { 
        D3DCOLORVALUE ambient; 
        D3DCOLORVALUE dcvAmbient; 
    }; 
    union { 
        D3DCOLORVALUE specular; 
        D3DCOLORVALUE dcvSpecular; 
    }; 
    union { 
        D3DCOLORVALUE emissive; 
        D3DCOLORVALUE dcvEmissive; 
    }; 
    union { 
        D3DVALUE      power; 
        D3DVALUE      dvPower; 
    }; 
    D3DTEXTUREHANDLE  hTexture;     // Used only by Ramp devices.
    DWORD             dwRampSize; 
} D3DMATERIAL, *LPD3DMATERIAL; 
 

Members

dwSize
Size, in bytes, of this structure. This member must be initialized before the structure is used.
dcvDiffuse, dcvAmbient, dcvSpecular, and dcvEmissive
Values specifying the diffuse color, ambient color, specular color, and emissive color of the material, respectively. These values are D3DCOLORVALUE structures.
dvPower
Value of the D3DVALUE type specifying the sharpness of specular highlights.
hTexture
Handle to the texture map for use by a ramp device. This member can be zero to indicate that the material does not use a texture or when the material is being used with a device other than the ramp device.
dwRampSize
Size of the color ramp. For the monochromatic (ramp) driver, this value should be 1 for materials assigned to the background.

Remarks

The texture handle specified by the hTexture member is acquired from Direct3D by loading a texture into the device. The texture handle may be used only when it has been loaded into the device. This texture handle is only used by the legacy ramp device, which is not supported by interfaces introduced in DirectX 6.0, such as the new IDirect3DDevice3 interface. For more information, see Ramp Device.

To turn off specular highlights for a material, you must set the dvPower member to 0—simply setting the specular color components to 0 is not enough.

QuickInfo

  Windows NT/2000: Requires Windows NT 4.0 SP3 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in d3dtypes.h.

See Also

IDirect3DMaterial3::GetMaterial, IDirect3DMaterial3::SetMaterial