Code: Select all
<?xml version="1.0" encoding="iso-8859-1" ?>
<ZApplication Name="App" Caption="ZGameEditor application" ClearColor="0.4902 0.8745 1 1" FrameRateStyle="2" FixedFrameRate="60" Camera="ProjectionFrontal" NoSound="1">
<OnLoaded>
<ZLibrary Comment="HSV Library">
<Source>
<![CDATA[//
float angle(float X)
{
if(X >= 0 && X < 360)return X;
if(X > 360)return X-floor(X/360)* 360;
if(X < 0)return X+floor(X/360)*-360;
}
//
void hsv(float H, float S, float V)
{
float R,G,B,I,F,P,Q,T;
H = angle(H);
S = clamp(S,0,100);
V = clamp(V,0,100);
H /= 60;
S /= 100;
V /= 100;
if(S == 0)
{
Color[0] = V;
Color[1] = V;
Color[2] = V;
return;
}
I = floor(H);
F = H-I;
P = V*(1-S);
Q = V*(1-S*F);
T = V*(1-S*(1-F));
if(I == 0){R = V; G = T; B = P;}
if(I == 1){R = Q; G = V; B = P;}
if(I == 2){R = P; G = V; B = T;}
if(I == 3){R = P; G = Q; B = V;}
if(I == 4){R = T; G = P; B = V;}
if(I == 5){R = V; G = P; B = Q;}
Color[0] = R;
Color[1] = G;
Color[2] = B;
}]]>
</Source>
</ZLibrary>
<ZExpression>
<Expression>
<![CDATA[Stretch.Scale.X = 2f*App.ViewportWidth/App.ViewportHeight;
Stretch.Scale.Y = 2;]]>
</Expression>
</ZExpression>
</OnLoaded>
<OnRender>
<UseMaterial Material="ColorRainbow"/>
<RenderTransformGroup Name="Stretch">
<Children>
<RenderNet XCount="8"/>
</Children>
</RenderTransformGroup>
</OnRender>
<Content>
<Material Name="ColorRainbow" Shading="1" Color="1 1 1 0.8993" Light="0">
<Textures>
<MaterialTexture Texture="Rainbow" TextureWrapMode="2" TexCoords="1"/>
</Textures>
</Material>
<Mesh Name="PlaneRectangle">
<Producers>
<MeshBox/>
</Producers>
</Mesh>
<Array Name="Color" SizeDim1="3"/>
<Camera Name="ProjectionFrontal" Comment="No rotation, for interface etc" Kind="1" Position="0 0 10"/>
<Bitmap Name="Rainbow" Comment="ff" Width="0" Height="0" Filter="1">
<Producers>
<BitmapExpression>
<Expression>
<![CDATA[//X,Y : current coordinate (0..1)
//Pixel : current color (rgb)
//Sample expression: Pixel.R=abs(sin(X*16));
hsv((X+0.5)*360f,100,100);
Pixel.R = Color[0];
Pixel.G = Color[1];
Pixel.B = Color[2];]]>
</Expression>
</BitmapExpression>
</Producers>
</Bitmap>
</Content>
</ZApplication>