|
|
HLSL著色器的???(3D??虺淌皆O?入? 第16章)
ID3DXConstantTable的SetDefualts的疑??
?????:
SetDefault直接常?翟O?樗??的??值.??值是?些常?敌?娴某跏贾??方法再??贸淌皆O定?r??艚幸淮
所?的"常?敌?娴某跏贾?quot;是指在"ShaderFile的初始值"或是"程式的初始值"?
Sets the constants to their default values. The default values are declared in the variable declarations in the shader.
HRESULT SetDefaults(
LPDIRECT3DDEVICE9 pDevice
);
Source Code:
TransformViewProjHandle = TransformConstantTable->GetConstantByName(0, "ViewProjMatrix");
TransformConstantTable->SetDefaults(Device);
Shader FIle Content:
matrix ViewProjMatrix;
vector Blue = {0.0f, 0.0f, 1.0f, 1.0f};
struct VS_INPUT
{
vector position : POSITION;
};
struct VS_OUTPUT
{
vector position : POSITION;
vector diffuse : COLOR;
};
VS_OUTPUT Main(VS_INPUT input)
{
// zero out members of output
VS_OUTPUT output = (VS_OUTPUT)0;
// transform to view space and project
output.position = mul(input.position, ViewProjMatrix);
// set vertex diffuse color to blue
output.diffuse = Blue;
return output;
} |
|