Final DirectX
This commit is contained in:
95
project/resources/Fire.fx
Normal file
95
project/resources/Fire.fx
Normal file
@@ -0,0 +1,95 @@
|
||||
float4x4 gWorldViewProj : WorldViewProjection;
|
||||
float4x4 gWorldMatrix : WorldMatrix;
|
||||
|
||||
texture2D gDiffuseMap : DiffuseMap;
|
||||
|
||||
//Input output
|
||||
struct VS_INPUT {
|
||||
float3 Position : POSITION;
|
||||
float2 TexCoord : TEXCOORD;
|
||||
float3 Normal : NORMAL;
|
||||
float3 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct VS_OUTPUT {
|
||||
float4 Position : SV_POSITION;
|
||||
float4 WorldPosition : WORLDPOSITION;
|
||||
float2 TexCoord : TEXCOORD;
|
||||
float3 Normal : NORMAL;
|
||||
float3 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
|
||||
//----------------------
|
||||
// Rasterizer state
|
||||
//----------------------
|
||||
RasterizerState gRasterizerState
|
||||
{
|
||||
CullMode = none;
|
||||
FrontCounterClockwise = false; //default
|
||||
};
|
||||
|
||||
//----------------------
|
||||
// Blend state
|
||||
//----------------------
|
||||
BlendState gBlendState
|
||||
{
|
||||
BlendEnable[0] = true;
|
||||
SrcBlend = SRC_ALPHA;
|
||||
DestBlend = INV_SRC_ALPHA;
|
||||
BlendOp = ADD;
|
||||
SrcBlendAlpha = ZERO;
|
||||
DestBlendAlpha = ZERO;
|
||||
BlendOpAlpha = ADD;
|
||||
RenderTargetWriteMask[0] = 0x0F;
|
||||
};
|
||||
|
||||
//----------------------
|
||||
// SamplerState
|
||||
//----------------------
|
||||
SamplerState samPoint
|
||||
{
|
||||
Filter = MIN_MAG_MIP_POINT;
|
||||
Addressu = Wrap; //or Mirror, Clamp, Border
|
||||
AddressV = Wrap; //or Mirror, Clamp, Border
|
||||
};
|
||||
|
||||
DepthStencilState gDepthStencilState
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = ZERO;
|
||||
DepthFunc = LESS;
|
||||
StencilEnable = false;
|
||||
};
|
||||
|
||||
|
||||
//Vertex shader
|
||||
VS_OUTPUT VS(VS_INPUT input){
|
||||
VS_OUTPUT output = (VS_OUTPUT)0;
|
||||
|
||||
output.Position = mul(float4(input.Position, 1.f), gWorldViewProj);
|
||||
output.WorldPosition = mul(float4(input.Position, 1.f), gWorldMatrix);
|
||||
output.TexCoord = input.TexCoord;
|
||||
output.Normal = mul(input.Normal, (float3x3) gWorldMatrix);
|
||||
output.Tangent = mul(input.Tangent, (float3x3) gWorldMatrix);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 PS(VS_OUTPUT input) : SV_TARGET{
|
||||
return gDiffuseMap.Sample(samPoint, input.TexCoord);
|
||||
}
|
||||
|
||||
|
||||
technique11 DefaultTechnique{
|
||||
pass P0 {
|
||||
SetRasterizerState(gRasterizerState);
|
||||
SetDepthStencilState(gDepthStencilState, 0);
|
||||
SetBlendState(gBlendState, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
|
||||
SetVertexShader( CompileShader( vs_5_0, VS() ) );
|
||||
SetGeometryShader( NULL );
|
||||
SetPixelShader( CompileShader( ps_5_0, PS() ) );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user