PANEL* panTarget = { bmap = "#256x256x24"; flags = SHOW; } // target bmap
BMAP* bmSrc = "image.tga"; // source bmap
MATERIAL* mtlSepia = { // sepia coloring pixel shader
effect = "
Texture TargetMap; // source bitmap
sampler2D smpSrc = sampler_state { texture = <TargetMap>; };
float4 SepiaColor1 = {0.2, 0.05, 0.0, 1.0};
float4 SepiaColor2 = {1.0, 0.9, 0.5, 1.0};
float4 process_sepia(float2 Tex: TEXCOORD0): COLOR
{
float4 Color = tex2D( smpSrc, Tex.xy);
float sepiaLerp = dot( float3(0.3, 0.59, 0.11), Color);
return lerp(SepiaColor1,SepiaColor2,sepiaLerp);
}
technique Sepia {
pass p1 {
AlphaBlendEnable = false;
PixelShader = compile ps_2_0 process_sepia();
}
}
";
}
function main()
{
wait(1); // until DirectX device is opened
level_load ("Level_1.wmb");
bmap_process(panTarget.bmap,bmSrc,mtlSepia);
}