Pixel3D.cs 1.3 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 Pixel3D
  13. {
  14. public int x;
  15. public int y;
  16. public short depth = 100;
  17. private int width;
  18. private int height;
  19. public Color color = Color.White;
  20. public float size = 0.5f;
  21. public Pixel3D(int x, int y, int width, int height){
  22. this.x = x;
  23. this.y = y;
  24. this.width = width;
  25. this.height = height;
  26. }
  27. public void draw(){
  28. int relX = x - width / 2;
  29. int relY = height/2 - y;
  30. GL.Color4(color);
  31. GL.Begin(BeginMode.Polygon);
  32. GL.Vertex3(relX - size, relY + size, -depth);
  33. GL.Vertex3(relX + size, relY + size, -depth);
  34. GL.Vertex3(relX + size, relY - size, -depth);
  35. GL.Vertex3(relX - size, relY - size, -depth);
  36. GL.End();
  37. }
  38. public string toString()
  39. {
  40. return "x: " + x + "y: " + y + " depth: " + depth;
  41. }
  42. }
  43. }