Tools.php

From SoundDB
Revision as of 09:33, 31 December 2012 by Admin (talk | contribs)
Jump to: navigation, search
<?php

function wavToCaf($input) {
	$output = str_replace(".wav", ".caf", $input);
	$cmd = "afconvert -f caff -d ima4@22050 -c 1 " . $input . " " . $output;
	echo "Processing: ". $cmd . "\n";
	exec($cmd);
}

$filelist = scandir(getcwd());

foreach ($filelist as $key => $filename) {
	if (strpos($filename, ".wav") !== false) {
	    wavToCaf($filename);
	}
}

?>
  Shader "Example/ScreenPos" {
    Properties {
      _MainTex ("Texture", 2D) = "white" {}
      _Detail ("Detail", 2D) = "gray" {}
      _Range ("Range", Range (0.00,1.00)) = 0.07
    }
    SubShader {
      Tags { "RenderType" = "Opaque" }
      CGPROGRAM
      #pragma surface surf Lambert
      struct Input {
          float2 uv_MainTex;
          float4 screenPos;
      };
      
      sampler2D _MainTex;
      sampler2D _Detail;
      float _Range;
      
      
      void surf (Input IN, inout SurfaceOutput o)
      {
          o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
          float2 screenUV = IN.screenPos.xy / IN.screenPos.w;
          screenUV.x += _Range;
//          screenUV *= float2(8,6);
          o.Albedo *= tex2D (_Detail, screenUV).rgb * 2;
      }
      ENDCG
    } 
    Fallback "Diffuse"
  }