Created
November 27, 2011 10:26
-
-
Save ssube/1397359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
D3DVERTEXELEMENT9 vertDeclElems[] = | |
{ | |
{ 0, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 }, | |
{ 0, 16, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0 }, | |
{ 0, 32, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 }, | |
{ 0, 48, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 }, | |
D3DDECL_END() | |
}; | |
// Shader | |
sampler2D mainTex < string texture = ":thisframe"; >; | |
struct VertexStruct | |
{ | |
float4 pos : POSITION; | |
float4 color : COLOR; | |
float4 uv : TEXCOORD0; | |
float4 data : TEXCOORD1; | |
}; | |
struct ProcessedVertex | |
{ | |
float4 pos : POSITION; | |
float4 color : COLOR; | |
float4 uv : TEXCOORD0; | |
}; | |
void partialInvert(in float4 icolor : COLOR0, in float2 uv : TEXCOORD0, out float4 color : COLOR0) | |
{ | |
color = tex2D(mainTex, uv); | |
color.a = 1.0f; | |
} | |
void copyVert(in VertexStruct vert, out ProcessedVertex overt) | |
{ | |
overt.pos = vert.pos / 500; | |
overt.color = float4(1.0, vert.color.gb, 1.0); | |
overt.uv = vert.uv; | |
} | |
technique main | |
{ | |
pass basicColor | |
{ | |
VertexProgram = compile latest copyVert(); | |
FragmentProgram = compile latest partialInvert(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment