The D3DMATERIAL structure specifies material properties in calls to the IDirect3DMaterial2::GetMaterial and IDirect3DMaterial2::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;
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 of the texture map. This member can be zero to indicate that this material does not use a texture.
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.
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: Use version 4.0 or later.
Windows: Use Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in d3dtypes.h.
See Also
IDirect3DMaterial2::GetMaterial, IDirect3DMaterial2::SetMaterial