vertex.vsd
资源名称:Direct3D.rar [点击查看]
上传用户:junlon
上传日期:2022-01-05
资源大小:39075k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual C++
- // vertex shader file: vertex.vsd
- vs_2_0
- // c0,c1,c2,c3 hold the worldviewproj matrix
- // c8,c9,c10,c11 hold the world matrix
- // c4 hold the ambient light color
- // c5 hold the ambient material color, it's assumed that the material reflects all components eqally,
- // like dot product with a (1,1,1,1) vector, so this register may not be used
- dcl_position v0 //input position
- dcl_texcoord v2 //input texcoordinate
- m4x4 r0, v0, c0 //transformation with the worldViewProj matrix
- // r0.x = v0.x*c0.x + v0.y*c0.y + v0.z*c0.z + v0.w*c0.w
- // r0.y = v0.x*c1.x + v0.y*c1.y + v0.z*c1.z + v0.w*c1.w
- // r0.z = v0.x*c2.x + v0.y*c2.y + v0.z*c2.z + v0.w*c2.w
- // r0.w = v0.x*c3.x + v0.y*c3.y + v0.z*c3.z + v0.w*c4.w
- m4x4 r1, v0, c8 //transformation with the world matrix
- mov oPos, r0 //output the position ,which is transformed by the WORLD_VIEW_PROJ matrix
- mov oD0, c4 //output the diffuse color
- mov oT0, v2 //output the coodinate
- mov oT1, r1 //output the position, which is transformed by the WORLD matrix