这个两个函数的参数一大堆,害我头都大了2,3倍。。今天整理下已经能够大概清晰明白的参数。。
缓存存的是一个屏幕像素的值。。
先来SetTextureStageState:
HRESULT SetTextureStageState(
DWORD Stage,
D3DTEXTURESTAGESTATETYPE Type,
DWORD Value
);
stage这个参数是指第几层纹理,1.2.3...9,, 这个版本的dx最多支持9层纹理。
Type:Defines the type of operation that a texture stage will perform.//定义对该纹理的哪个属进行设置,值很多。。。
Value: 指的是前面所选属性的值
type:
D3DTSS_ALPHAOP = 4, //alpha通道的运算,
D3DTSS_COLOROP = 1, //颜色的运算
//这里的op 是operations,指对前面设置的颜色进行运算
//既后面的2个type:D3DTSS_COLORARG1,D3DTSS_COLORARG2
//或D3DTSS_ALPHAARG1,D3DTSS_ALPHAARG2 = 6
value:
D3DTOP_DISABLE = 1, //该纹理无效,既不显示
D3DTOP_SELECTARG1 = 2, //选择第1个颜色值(既D3DTSS_COLORARG1的值)作为纹理颜色输出
D3DTOP_SELECTARG2 = 3, //选择第2个颜色值(既D3DTSS_COLORARG2的值)作为纹理颜色输出
D3DTOP_MODULATE = 4, //将颜色1和颜色2相乘作为纹理颜色输出
D3DTOP_MODULATE2X = 5, //将颜色1和颜色2相乘后左移1bit(用于增亮)作为纹理颜色输出 ,
D3DTOP_MODULATE4X = 6, //将颜色1和颜色2相乘后左移2bit(用于增亮)作为纹理颜色输出
D3DTOP_ADD = 7, //将颜色1和颜色2相加作为纹理颜色输出
D3DTOP_ADDSIGNED = 8, ///////////后面的参见SDK 都是对2个颜色进行运算
D3DTOP_ADDSIGNED2X = 9,
D3DTOP_SUBTRACT = 10,
D3DTOP_ADDSMOOTH = 11,
D3DTOP_BLENDDIFFUSEALPHA = 12,
D3DTOP_BLENDTEXTUREALPHA = 13,
D3DTOP_BLENDFACTORALPHA = 14,
D3DTOP_BLENDTEXTUREALPHAPM = 15,
D3DTOP_BLENDCURRENTALPHA = 16,
D3DTOP_PREMODULATE = 17,
D3DTOP_MODULATEALPHA_ADDCOLOR = 18,
D3DTOP_MODULATECOLOR_ADDALPHA = 19,
D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,
D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,
D3DTOP_BUMPENVMAP = 22,
D3DTOP_BUMPENVMAPLUMINANCE = 23,
D3DTOP_DOTPRODUCT3 = 24,
D3DTOP_MULTIPLYADD = 25,
D3DTOP_LERP = 26,
D3DTOP_FORCE_DWORD = 0x7fffffff,
type:
D3DTSS_COLORARG1 = 2,
D3DTSS_COLORARG2 = 3,
D3DTSS_ALPHAARG1 = 5,
D3DTSS_ALPHAARG2 = 6,
D3DTSS_COLORARG0 = 26,
D3DTSS_ALPHAARG0 = 27,
D3DTSS_RESULTARG = 28,
value:
这里的TA指的是texture arguments ,
D3DTA_CONSTANT //给当前纹理一个固定的值;
D3DTA_DIFFUSE; //diffuse的值作为参数 diffuse 可能有多个来源。。比如材质,vertex
D3DTA_SELECTMASK //Mask value for all arguments; not used when setting texture arguments 这句话不理解啊,为什么要伪装呢
D3DTA_SPECULAR //取spercular 的值作为参数 来源同diffuse
D3DTA_TEMP //待定。。
D3DTA_TEXTURE //用纹理的颜色值作为参数
D3DTA_TFACTOR //待定。。
////////////////////////////////////////////////////////////////////////////////////
以下还没来得及研究。。貌似叫难懂,还请高人指点啊
D3DTSS_BUMPENVMAT00 = 7,
D3DTSS_BUMPENVMAT01 = 8,
D3DTSS_BUMPENVMAT10 = 9,
D3DTSS_BUMPENVMAT11 = 10,
D3DTSS_TEXCOORDINDEX = 11,
D3DTSS_BUMPENVLSCALE = 22,
D3DTSS_BUMPENVLOFFSET = 23,
D3DTSS_TEXTURETRANSFORMFLAGS = 24,
D3DTSS_CONSTANT = 32,
D3DTSS_FORCE_DWORD = 0x7fffffff,
、
HRESULT SetRenderState(
D3DRENDERSTATETYPE State, //所要设置的状态
DWORD Value //该状态的值
);
State 的取值
posted on 2008-10-08 23:12
AstaTus 阅读(3185)
评论(3) 编辑 收藏 引用 所属分类:
DIRECTX9