|
|
顶点是这样定义的
Vertex(float _x, float _y, float _z,float _r, float _g, float _b);
fvf是FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE;
vertices[0] = Vertex(-0.8f, 0.8f, 1.0f,1.0f, 1.0f, 0.0f);//这里只有第4个参数的颜色值被画出来
vertices[1] = Vertex( 0.8f, 0.8f, 1.0f, 0.0f, 0.4f, 0.0f);//这里只有第4个参数的颜色值被画出来
vertices[2] = Vertex( 0.0f, -0.8f, 0.0f, 0.0f, 0.0f, 0.4f);//这里只有第4个参数的颜色值被画出来
程序运行的结果是只有第四个参数的值会影响颜色,其他两个值都没影响T_T,我昨天不知道怎么的弄好了,今天改写其他功能的时候不知道怎样又这样的……超郁闷啊……
///////////////////////顶点着色器///////////////////////////////////////////////////////////
struct VS_OUTPUT {
float4 position : POSITION;
float4 diffuse : COLOR;
};
VS_OUTPUT vs( float4 position : POSITION,
float4 color : COLOR)
{
VS_OUTPUT output = (VS_OUTPUT) 0;
output.position = position;
output.diffuse = color;
return output;
}
//////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////像素着色器///////////////////////////////////////////////////////////
struct PS_OUTPUT {
float4 color : COLOR;
};
PS_OUTPUT ps( float4 color : COLOR)
{
PS_OUTPUT OUT = (PS_OUTPUT) 0;
OUT.color = color;//只是简单的接收输入的颜色
return OUT;
}
[em6] |
|