public override RenderData GetRenderData()
        {
            var data = new RenderData
            {
                Position     = GetPosition(),
                Size         = Size,
                RenderLayer  = RenderLayer,
                RenderShape  = RenderShape,
                RenderType   = RenderType,
                FillColor    = FillColor,
                OutlineColor = OutlineColor,
                ZIndex       = ZLevel
            };

            return(data);
        }
Beispiel #2
0
        private void OpenGLDrawBlock(RenderData item)
        {
            //GL.BindBuffer(BufferTarget.ArrayBuffer, item.ObjectIndex);
            Matrix4.CreateTranslation((float)item.Position.X, (float)item.Position.Y, 0.0f, out Matrix4 trans);
            var model = GL.GetUniformLocation(DefaultShader, "model");

            GL.UniformMatrix4(model, false, ref trans);

            var color = GL.GetUniformLocation(DefaultShader, "ourColor");

            if (item.FillColor != Color.Transparent)
            {
                var colorVec = new Vector4(item.FillColor.R / 255.0f, item.FillColor.G / 255.0f, item.FillColor.B / 255.0f, item.FillColor.A / 255.0f);
                GL.Uniform4(color, colorVec);

                GL.Begin(PrimitiveType.Quads);

                GL.Vertex3(item.Size.X, 0.0f, 0.0f);
                GL.Vertex3(item.Size.X, item.Size.Y, 0.0f);
                GL.Vertex3(0.0f, item.Size.Y, 0.0f);
                GL.Vertex3(0.0f, 0.0f, 0.0f);
                GL.End();
            }

            if (item.OutlineColor != Color.Transparent)
            {
                var colorVec = new Vector4(item.OutlineColor.R / 55.0f, item.OutlineColor.G / 255.0f, item.OutlineColor.B / 255.0f, item.OutlineColor.A / 255.0f);
                GL.Uniform4(color, colorVec);
                GL.Begin(PrimitiveType.Lines);

                GL.Vertex3(item.Size.X, 0.0f, 0.0f);
                GL.Vertex3(item.Size.X, item.Size.Y, 0.0f);
                GL.Vertex3(item.Size.X, item.Size.Y, 0.0f);
                GL.Vertex3(0.0f, item.Size.Y, 0.0f);
                GL.Vertex3(0.0f, item.Size.Y, 0.0f);
                GL.Vertex3(0.0f, 0.0f, 0.0f);
                GL.Vertex3(0.0f, 0.0f, 0.0f);
                GL.Vertex3(item.Size.X, 0.0f, 0.0f);
                GL.End();
            }
        }
Beispiel #3
0
        public virtual RenderData GetRenderData()
        {
            var data = new RenderData();

            return(data);
        }