In HLSL code you can create input parameters of various datatypes. Here’s one of the simplest scalar types, the float.
float – 32-bit floating point value.
There are a number of vector types too.
float2 – two dimensional float vector.
float3 – three dimensional float vector.
float4 – four dimensional float vector.
When you need two float values stored in a type (think WPF Point and Size types) use a float2 in your HLSL. float3 is used for types like 3DPoint and float4 is handy for storing the four color values (Alpha, Red, Green, Blue) together.
Shazzam test controls
In Shazzam 1.0 float2 and other vector values were shown in the test UI with a single textbox.
Figure 1: Shazzam 1.0 UI
Simple but not the most intuitive interface ever to grace an application. Plus the point values were not animatable in V1.0. In Shazzam 1.1 the test UI has been changed to support animation and updated to handle float2, float3 and float4 values in a smarter way.
Figure 2: Shazzam 1.1 UI
There is a better use of color in the UI labeling too, which helps differentiate between labels and data.
Forcing data type
There is a new Meta Tag, the <type> tag, available for decorating your HLSL. This tag tells the compiler which .NET type to use for a given HLSL variable.
float can be Double or Single.
float2 can be a Point, Size or Vector.
float3 can be Point3D (not available for Silverlight).
float4 can be Point4D or Color.
Example HLSL
//-------------------------------------------------------------------------------------- // float4 //-------------------------------------------------------------------------------------- // float4 map to Color or Point4D /// <type>Color</type> float4 SampleColor: register(C4); /// <type>Point4D</type> float4 SamplePoint4D : register(C5);
Figure 3: Shazzam 1.1 Color and Point4D
The result is that the Point4D gets four data entry controls. You still have to enter a color value (Red, Orange, #Ff4455FF) in a textbox however. In a future version of Shazzam this will be replaced with a color picker. In the meantime you can use the Color Picker in the side pane (thanks Robby).
Figure 4: Robby’s Color Picker
Summary
[Shazzam 1.1 was released on October 11, 2009]
See a list of additional help pages here.
Install your own copy of the free Shazzam Pixel Shader Utility here.
[...] Better Edit Controls [...]