You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 rivejä
1.0 KiB

  1. program example;
  2. uses
  3. sysutils, variants,
  4. ulibShaderFile;
  5. var
  6. i: Integer;
  7. s: String;
  8. ShaderFile: TlsfShaderFile;
  9. Generator: TlsfGenerator;
  10. begin
  11. lsf_init(ExtractFilePath(ParamStr(0)) + '..\..\..\libShaderFile-x86_64-win64.dll');
  12. try
  13. if (ParamCount < 2) then begin
  14. WriteLn('error: expected input file and generator/class name as parameter');
  15. ExitCode := 1;
  16. exit;
  17. end;
  18. ShaderFile := TlsfShaderFile.Create;
  19. try
  20. ShaderFile.LoadFromFile(ParamStr(1));
  21. Generator := TlsfGenerator.Create(ShaderFile, ParamStr(2));
  22. try
  23. i := 3;
  24. while (i < ParamCount) do begin
  25. s := ParamStr(i+1);
  26. Generator.SetProperty(ParamStr(i), s);
  27. inc(i, 2);
  28. end;
  29. WriteLn(Generator.GenerateCode);
  30. finally
  31. FreeAndNil(Generator);
  32. end;
  33. finally
  34. FreeAndNil(ShaderFile);
  35. end;
  36. except
  37. on e: Exception do begin
  38. WriteLn('error: ' + e.Message);
  39. ExitCode := 2;
  40. end;
  41. end;
  42. lsf_finish;
  43. end.