Triangle.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Drawing;
  7. using OpenTK;
  8. using OpenTK.Graphics.OpenGL;
  9. using MathNet.Numerics.LinearAlgebra.Single;
  10. namespace bbiwarg.Test
  11. {
  12. class Triangle
  13. {
  14. public Pixel3D a;
  15. public Pixel3D b;
  16. public Pixel3D c;
  17. public Color color = Color.Red;
  18. public Triangle(Pixel3D a, Pixel3D b, Pixel3D c)
  19. {
  20. this.a = a;
  21. this.b = b;
  22. this.c = c;
  23. }
  24. public void draw()
  25. {
  26. a.draw();
  27. b.draw();
  28. c.draw();
  29. GL.Color3(color);
  30. GL.Begin(BeginMode.Triangles);
  31. GL.Vertex3(a.x, a.y, a.depth);
  32. GL.Vertex3(b.x, b.y, b.depth);
  33. GL.Vertex3(c.x, c.y, c.depth);
  34. GL.End();
  35. }
  36. public void setPixel(Pixel3D a, Pixel3D b, Pixel3D c)
  37. {
  38. this.a = a;
  39. this.b = b;
  40. this.c = c;
  41. }
  42. }
  43. }