Point2D.cs 975 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using OpenTK.Graphics.OpenGL;
  8. using MathNet.Numerics.LinearAlgebra.Single;
  9. using bbiwarg.Helpers;
  10. namespace bbiwarg.Graphics.GraphicElements2D
  11. {
  12. class Point2D : IGraphicElement2D
  13. {
  14. private Vector position;
  15. private Color color;
  16. public Point2D(Vector position, Color color)
  17. {
  18. this.position = position;
  19. this.color = color;
  20. }
  21. public void draw(short[] textureData, int width)
  22. {
  23. int index = (3 * ((int)position.y() * width + (int)position.x()));
  24. textureData[index + 0] = (short) ((short.MaxValue / byte.MaxValue) * color.R);
  25. textureData[index + 1] = (short) ((short.MaxValue / byte.MaxValue) * color.G);
  26. textureData[index + 2] = (short) ((short.MaxValue / byte.MaxValue) * color.B);
  27. }
  28. }
  29. }