CLEO Shader API - Part 1

I hope you understand HLSL language..
I'm not going to explain anything related to that topic, search in google for it.
now to use this shaders you need;
  1. CLEO 4
  2. Shader API plugin installed properly
  3. knowledge about HLSL
  4. knowledge about CLEO
(you can find shader API in the previous post)


EXAMPLE

this is how it looks the HLSL file;
(you can open the .fx files with notepad or Notepad++)

and the CLEO file looks like this;


in the HLSL file take a look at this part;
shared texture ScreenTexture : SCREEN_TEX;
float RedValue;
float GreenValue;
float BlueValue;
sampler2D TextureSampler = sampler_state
{
    Texture = <ScreenTexture>;
};
the text in red color, must be the same, or this won't work.
the text in green color, is the shared specificator that the Author explained.
the text in purple color, this are variables defined in the HLSL, and we can send values thru CLEO

in the CLEO file take a look at this part;
0DF0: 0@ = load_shader_from_file "CLEO\shaders\colors_screen.fx"
with this opcode you can load the shader file, and store it into a variable (0@).
0DF2: set_shader 0@ float_param "RedValue" to 1.0      ///  recomended < 1.0 - 2.0 >
0DF2: set_shader 0@ float_param "GreenValue" to 1.5   ///  recomended < 1.0 - 2.0 >
0DF2: set_shader 0@ float_param "BlueValue" to 2.0      ///  recomended < 1.0 - 2.0 >
with these opcodes you can assign values to the variables defined in the HLSL file.
you must note that the names; RedValue, GreenValue, BlueValue are the same in both files.
0DF1: draw_shader 0@ technique "rgbacolors" at SCREEN_BASE_X SCREEN_BASE_Y SCREEN_SIZE_X SCREEN_SIZE_Y        
with this opcode you can draw the shader in the screen.
remember to check the last part of the shader file;
technique rgbacolors
{
    pass P0
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}
you only need to set the technique name, in the opcode to draw the shader ;)
and done, same for textures.

easy isn't it?

to test all my examples check the key in each file.

to download my files go to my ARCHIVE  (shader API examples)


;) 

Comentarios