首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网络游戏 >

DirectX的fx文件有关问题

2012-02-17 
DirectX的fx文件问题求助我不知道fx文件是什么意思。。里面写的//

DirectX的fx文件问题
求助我不知道fx文件是什么意思。。
里面写的

//=============================================================================
// transform.fx by Frank Luna (C) 2004 All Rights Reserved.
//
// Basic FX that simply transforms geometry from local space to 
// homogeneous clip space, and draws the geometry in wireframe mode.
//=============================================================================

uniform extern float4x4 gWVP;

// Define a vertex shader output structure; that is, a structure
// that defines the data we output from the vertex shader. Here,
// we only output a 4D vector in homogeneous clip space. The
// semantic ": POSITION0" tells Direct3D that the data returned
// in this data member is a vertex position.
struct OutputVS
{
  float4 posH : POSITION0;
};

// Define the vertex shader program. The parameter posL 
// corresponds to a data member in the vertex structure.
// Specifically, it corresponds to the data member in the 
// vertex structure with usage D3DDECLUSAGE_POSITION and 
// index 0 (as specified by the vertex declaration).
OutputVS TransformVS(float3 posL : POSITION0)
{
  // Zero out our output.
OutputVS outVS = (OutputVS)0;

// Transform to homogeneous clip space.
outVS.posH = mul(float4(posL, 1.0f), gWVP);
 
// Done--return the output.
  return outVS;
}

// Define the pixel shader program. Just return a 4D color
// vector (i.e., first component red, second component green,
// third component blue, fourth component alpha). Here we
// specify black to color the lines black. 
float4 TransformPS() : COLOR
{
  return float4(0.0f, 0.0f, 0.0f, 1.0f);
}

technique TransformTech
{
  pass P0
  {
  // Specify the vertex and pixel shader associated with this pass.
  vertexShader = compile vs_2_0 TransformVS();
  pixelShader = compile ps_2_0 TransformPS();

// Specify the render/device states associated with this pass.
FillMode = Wireframe;
  }
}
请高手帮忙解释一下。。这个文件是做什么用的。。。

[解决办法]
这是一个效果文件,包含顶点着色器和像素着色器,从上面的文件看,这个效果文件很简单,仅仅是做个一个顶点转换,和色彩输出。
还有一楼说fx-composer是个着色器代码检验工具,和ati的RenderMonkey差不多。

热点排行