Пример #1
0
 public void ImportFile(string srcFile, string targetName, string targetDir)
 {
     string ext = Path.GetExtension(srcFile).ToLower();
     string[] output = this.GetOutputFiles(srcFile, targetName, targetDir);
     if (ext == ".vert")
     {
         VertexShader res = new VertexShader();
         res.LoadSource(srcFile);
         res.Compile();
         res.Save(output[0]);
     }
     else if(ext == ".frag")
     {
         FragmentShader res = new FragmentShader();
         res.LoadSource(srcFile);
         res.Compile();
         res.Save(output[0]);
     }
     else
     {
         GeometryShader res = new GeometryShader();
         res.LoadSource(srcFile);
         res.Compile();
         res.Save(output[0]);
     }
 }
		internal static void InitDefaultContent()
		{
			VertexShader tmp;

			tmp = new VertexShader();
			tmp.SetSource(DefaultRes.MinimalVert);
			ContentProvider.RegisterContent(ContentPath_Minimal, tmp);

			tmp = new VertexShader();
			tmp.SetSource(DefaultRes.SmoothAnimVert);
			ContentProvider.RegisterContent(ContentPath_SmoothAnim, tmp);

			Minimal		= ContentProvider.RequestContent<VertexShader>(ContentPath_Minimal);
			SmoothAnim	= ContentProvider.RequestContent<VertexShader>(ContentPath_SmoothAnim);
		}
Пример #3
0
 public void ImportFile(string srcFile, string targetName, string targetDir)
 {
     string ext = Path.GetExtension(srcFile);
     string[] output = this.GetOutputFiles(srcFile, targetName, targetDir);
     if (string.Equals(ext, SourceFileExtVertex, StringComparison.InvariantCultureIgnoreCase))
     {
         VertexShader res = new VertexShader();
         res.LoadSource(srcFile);
         res.Compile();
         res.Save(output[0]);
     }
     else
     {
         FragmentShader res = new FragmentShader();
         res.LoadSource(srcFile);
         res.Compile();
         res.Save(output[0]);
     }
 }
		private void ActionShaderCreateProgram_Create(FragmentShader frag, VertexShader vert)
		{
			AbstractShader refShader = (vert != null) ? (AbstractShader)vert : (AbstractShader)frag;

			string nameTemp = refShader.Name;
			string dirTemp = Path.GetDirectoryName(refShader.Path);
			if (nameTemp.Contains("Shader"))
				nameTemp = nameTemp.Replace("Shader", "Program");
			else if (nameTemp.Contains("Shader"))
				nameTemp = nameTemp.Replace("shader", "program");
			else
				nameTemp += "Program";

			string programPath = PathHelper.GetFreePath(Path.Combine(dirTemp, nameTemp), ShaderProgram.FileExt);
			ShaderProgram program = new ShaderProgram(vert, frag);
			program.Save(programPath);
		}