/// <summary> /// Construct a new entity. /// </summary> /// <param name="GraphicsBuffer">The graphics buffer where /// the entity is displayed.</param> /// <param name="GraphicsBufferPosition">The position in /// the buffer where the entity is displayed.</param> public Entity(Vertex[] GraphicsBuffer, ref int GraphicsBufferPosition) { PIDSetting = new PID(); MyGraphic = new Triangle(GraphicsBuffer, GraphicsBufferPosition); MyHue = new Colourization(GraphicsBuffer, GraphicsBufferPosition); GraphicsBufferPosition += Triangle.Model.Length; }
/// <summary> /// Put data in opengl buffer. /// </summary> /// <param name="data">Data</param> public void SetData(Vertex[] data) { if (data == null) throw new ArgumentNullException("data"); this.data = data; GL.BindBuffer(BufferTarget.ArrayBuffer, Id); GL.BufferData(BufferTarget.ArrayBuffer, new IntPtr(data.Length * Vertex.Stride), data, BufferUsageHint.StaticDraw); }
/// <summary> /// Construct a new Colourization /// </summary> /// <param name="GraphicsBuffer">For a tri in this buffer</param> /// <param name="GraphicsBufferPosition">At this position n..n+2</param> public Colourization(Vertex[] GraphicsBuffer, int GraphicsBufferPosition) { this.GraphicsBuffer = GraphicsBuffer; this.GraphicsBufferPosition = GraphicsBufferPosition; }
/// <summary> /// Construct a new Triangle. /// </summary> /// <param name="targetArray">Vertexbuffer wherein this triangle lives</param> /// <param name="offset">Position whereat it lives.</param> public Triangle(Vertex[] targetArray, int offset) { this.targetArray = targetArray; this.offset = offset; }