Guest User

Untitled

a guest
May 6th, 2015
258
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="iso-8859-1" ?>
  2. <ZApplication Name="App" Caption="ZGameEditor application" ClearColor="0.4902 0.8745 1 1" FrameRateStyle="2" FixedFrameRate="60" Camera="ProjectionFrontal" MouseVisible="255">
  3. <OnLoaded>
  4. <ZLibrary Comment="HSV Library">
  5. <Source>
  6. <![CDATA[//
  7.  
  8. vec3 hsv(float h, float s, float v)
  9. {
  10. s = clamp(s/100, 0, 1);
  11. v = clamp(v/100, 0, 1);
  12.  
  13. if(!s)return vector3(v, v, v);
  14.  
  15. h = h < 0 ? frac(1-abs(frac(h/360)))*6 : frac(h/360)*6;
  16.  
  17. float c, f, p, q, t;
  18.  
  19. c = floor(h);
  20. f = h-c;
  21.  
  22. p = v*(1-s);
  23. q = v*(1-s*f);
  24. t = v*(1-s*(1-f));
  25.  
  26. switch(c)
  27. {
  28. case 0: return vector3(v, t, p);
  29. case 1: return vector3(q, v, p);
  30. case 2: return vector3(p, v, t);
  31. case 3: return vector3(p, q, v);
  32. case 4: return vector3(t, p, v);
  33. case 5: return vector3(v, p, q);
  34. }
  35. }]]>
  36. </Source>
  37. </ZLibrary>
  38. <ZExpression>
  39. <Expression>
  40. <![CDATA[Stretch.Scale.X = 2f*App.ViewportWidth/App.ViewportHeight;
  41. Stretch.Scale.Y = 2;
  42.  
  43. RainbowField.XCount = NumberOfBars ;
  44.  
  45. ColumnColor.SizeDim1 = RainbowField.XCount+1;]]>
  46. </Expression>
  47. </ZExpression>
  48. </OnLoaded>
  49. <OnUpdate>
  50. <ZExpression Comment="Which column the cursor is currently in">
  51. <Expression>
  52. <![CDATA[MouseToColumn =
  53. floor
  54. (
  55. (App.MousePosition.X+1)/2f*ColumnColor.SizeDim1
  56. );]]>
  57. </Expression>
  58. </ZExpression>
  59. <ZExpression Comment="Calculate colors">
  60. <Expression>
  61. <![CDATA[ColumnColor[MouseToColumn] =
  62. hsv(MouseToColumn/RainbowField.XCount*360,(App.MousePosition.Y*0.5+0.5)*100,100);]]>
  63. </Expression>
  64. </ZExpression>
  65. <Condition Comment="Should Plink?">
  66. <Expression>
  67. <![CDATA[return
  68. (
  69. MouseToColumnBuffer != MouseToColumn
  70. );]]>
  71. </Expression>
  72. <OnTrue>
  73. <PlaySound Sound="Plink" NoteNr="96"/>
  74. <ZExpression Comment="Calculate colors" Expression="MouseToColumnBuffer = MouseToColumn;"/>
  75. </OnTrue>
  76. </Condition>
  77. </OnUpdate>
  78. <OnRender>
  79. <UseMaterial Material="ColorMono"/>
  80. <RenderTransformGroup Name="Stretch" Scale="7.2566 2 1">
  81. <Children>
  82. <RenderNet Name="RainbowField" XCount="12" VertexColors="255">
  83. <RenderVertexExpression>
  84. <![CDATA[//Update each vertex.
  85. //Vertex : current vertex
  86. //TexCoord : current texture coordinate
  87. //Color : current vertex color
  88.  
  89. float VertexPairInArray;
  90. VertexPairInArray = ceil((Vertex.X+0.5)*NumberOfBars);
  91.  
  92. Color = ColumnColor[VertexPairInArray];]]>
  93. </RenderVertexExpression>
  94. </RenderNet>
  95. </Children>
  96. </RenderTransformGroup>
  97. </OnRender>
  98. <Content>
  99. <Material Name="ColorMono" Shading="1" Color="1 1 1 0.8993" Light="0"/>
  100. <Camera Name="ProjectionFrontal" Comment="No rotation, for interface etc" Kind="1" Position="0 0 10"/>
  101. <Variable Name="MouseToColumn"/>
  102. <Variable Name="MouseToColumnBuffer"/>
  103. <Array Name="ColumnColor" Type="7"/>
  104. <Sound Name="Plink" Length="0.5" Osc1Waveform="3" UseFilter="1" FilterCutoff="0.5095" FilterQ="0.1199" Mod0Active="1" Mod0Destination="11" Mod0Amount="1" Mod1Active="1" Mod1Source="2" Mod1Destination="2" Mod1Amount="0.21" Mod2Source="2" Mod2Amount="0.6" Env0Active="1" Env0DecayTime="0.42" Env0SustainLevel="0.604" Env0ReleaseTime="1.28" Env1DecayTime="1.8" Env1ReleaseTime="0.54" Lfo0Active="1" Lfo0IsBipolar="1" Lfo0Style="1" Lfo0Speed="0.23"/>
  105. <Constant Name="NumberOfBars" Type="1" IntValue="12"/>
  106. </Content>
  107. </ZApplication>
RAW Paste Data