simple.fx
来自「这是一个简单的3D游戏源码」· FX 代码 · 共 47 行
FX
47 行
//
// Intro to HLSL
//
// Shader output, position and diffuse color
struct VS_OUTPUT
{
float4 pos : POSITION;
float4 diff : COLOR0;
};
// The world view and projection matrices
float4x4 WorldViewProj : WORLDVIEWPROJECTION;
float Time = 1.0f;
// Transform our coordinates into world space
VS_OUTPUT Transform(
float4 Pos : POSITION)
{
// Declare our return variable
VS_OUTPUT Out = (VS_OUTPUT)0;
// Transform our position
Out.pos = mul(Pos, WorldViewProj);
// Set our color
Out.diff.r = 1 - Time;
Out.diff.b = Time * WorldViewProj[2].yz;
Out.diff.ga = Time * WorldViewProj[0].xy;
// Return
return Out;
}
technique TransformDiffuse
{
pass P0
{
CullMode = None;
// shaders
VertexShader = compile vs_1_1 Transform();
PixelShader = NULL;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?