Exemple #1
0
        internal void Draw(IEnumerable <ITile> tiles)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.LoadIdentity();
            GL.Scale(2f, 2f, 1f);
            GL.Translate(-.5f, -.5f, 0f);

            texTileSet.Activate();
            foreach (var tile in tiles)
            {
                DrawTools.DrawTexturedRect(tile.Bounds, tile.TexCoords);
            }
            texTileSet.Deactivate();
        }
Exemple #2
0
        internal void Render(IEnumerable <IReadOnlyBox2D> shapes)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.LoadIdentity();                 // start with identity transformation
            GL.Scale(invWindowAspect, 1f, 1f); //then multiply by a scale matrix that scales all renderings with 1 / <window aspect>

            //visualize (-1, -1) to (1, 1) range
            GL.Color3(0.2f, 0.5f, 0.2f);
            DrawTools.DrawTexturedRect(new Box2D(-1, -1, 2, 2), Box2D.BOX01);

            GL.Color3(1f, 1f, 1f);
            foreach (var box in shapes)
            {
                DrawTools.DrawTexturedRect(box, Box2D.BOX01);
            }
        }
Exemple #3
0
        public void Render(IReadOnlyList <Vector2> points, int selectedPoint, float truckPos)
        {
            GL.Clear(ClearBufferMask.ColorBufferBit);
            GL.LoadIdentity();
            GL.Ortho(-windowAspect, windowAspect, -1, 1, 0, 1);

            shaderRoad.Activate();
            texSand.Activate();

            DrawLineStrip(points);

            texSand.Deactivate();
            shaderRoad.Deactivate();

            GL.Color3(Color.Red);
            GL.PointSize(15.0f);
            DrawPoints(points);

            if (-1 != selectedPoint)
            {
                GL.Color3(Color.Blue);
                GL.PointSize(25.0f);
                DrawPoint(points[selectedPoint]);
            }
            var pos = CubicHermiteSpline.CatmullRomSpline(points, truckPos);

            GL.Color3(Color.White);
            //GL.Color3(Color.Green);
            //GL.PointSize(25.0f);
            shaderTruck.Activate();
            texTruck.Activate();
            DrawTools.DrawTexturedRect(Box2DExtensions.CreateFromCenterSize(pos.X, pos.Y, 0.1f, 0.1f), Box2D.BOX01);
            texTruck.Deactivate();
            shaderTruck.Deactivate();
            //DrawPoint(pos);
        }