GLTypes.pas 970 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. unit GLTypes;
  2. interface
  3. uses
  4. WebGL, JS;
  5. // TODO: when advanced record syntax is added move these to records
  6. type
  7. TVec2 = array of GLfloat;
  8. TRGBAb = array of GLubyte;
  9. TRGBAf = array of GLfloat;
  10. function TVec2_Sizeof: integer;
  11. function TRGBAb_Sizeof: integer;
  12. function TRGBAf_Sizeof: integer;
  13. function V2(x, y: GLfloat): TVec2;
  14. function RGBAb(r, g, b, a: GLubyte): TRGBAb;
  15. function RGBAf(r, g, b, a: GLfloat): TRGBAf;
  16. implementation
  17. function V2(x, y: GLfloat): TVec2;
  18. begin
  19. result[0] := x;
  20. result[1] := y;
  21. end;
  22. function RGBAb(r, g, b, a: GLubyte): TRGBAb;
  23. begin
  24. result[0] := r;
  25. result[1] := g;
  26. result[2] := b;
  27. result[3] := a;
  28. end;
  29. function RGBAf(r, g, b, a: GLfloat): TRGBAf;
  30. begin
  31. result[0] := r;
  32. result[1] := g;
  33. result[2] := b;
  34. result[3] := a;
  35. end;
  36. function TVec2_Sizeof: integer;
  37. begin
  38. result := (4 * 2);
  39. end;
  40. function TRGBAb_Sizeof: integer;
  41. begin
  42. result := (1 * 4);
  43. end;
  44. function TRGBAf_Sizeof: integer;
  45. begin
  46. result := (4 * 4);
  47. end;
  48. end.