Exemple #1
0
        static void RenderBodies()
        {
            foreach (LsmBody body in world.bodies)
            {
                RenderLockedParticlesSelection(body.particles);
                if (LsmBody.drawCollisionPointsAndTraces)
                {
                    RenderCollisionedParticlesSelection(body.particles);
                }

                Color3 colorX      = new Color3(0, 0.5, 1);
                Color3 colorXPrior = new Color3(0, 1, 0.5);
                Color3 colorGoalX  = new Color3(1, 0, 1);
                if (!body.Frozen)
                {
                    if (LsmBody.drawXPriorXConnection)
                    {
                        RenderConnection_xPrior_x(body.particles, colorGoalX);
                    }
                    if (LsmBody.drawBodyLattice_xPrior)
                    {
                        RenderLattice_xPrior(body.particles, 0.7 * colorXPrior);
                    }
                    if (LsmBody.drawBodyParticles_xPrior)
                    {
                        RenderParticleGroup_xPrior(body.particles, colorXPrior);
                    }
                }
                if (LsmBody.drawBodyLattice_x)
                {
                    RenderLattice_x(body.particles, 0.7 * colorX);
                }
                if (LsmBody.drawBodyParticles_x)
                {
                    RenderParticleGroup_x(body.particles, colorX);
                }
                if (LsmBody.drawBodyLattice_goal)
                {
                    RenderLattice_Goal(body.particles, 0.7 * body.Color);
                }
                if (LsmBody.drawBodyParticles_goal)
                {
                    RenderParticleGroup_Goal(body.particles, body.Color);
                }
            }
        }
Exemple #2
0
        public static void RenderKnob(Vector2 knob, Color3 color)
        {
            //   Outline
            Gl.glPointSize(12.0f);
            Gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
            Gl.glBegin(Gl.GL_POINTS);
            {
                Gl.glVertex2d(knob.X, knob.Y);
            }
            Gl.glEnd();

            //   Knob
            Gl.glPointSize(9.0f);
            Gl.glColor4d(color.R, color.G, color.B, 1.0);
            Gl.glBegin(Gl.GL_POINTS);
            {
                Gl.glVertex2d(knob.X, knob.Y);
            }
            Gl.glEnd();
        }
Exemple #3
0
        public static void RenderCircle(Vector2 center, double radius, Color3 color)
        {
            double angle;

            Gl.glLineWidth(1.0f);
            Gl.glColor4d(color.R, color.G, color.B, 1.0);
            Gl.glBegin(Gl.GL_LINES);
            for (angle = 0; angle < Math.PI * 2; angle += 0.1)
            {
                double angle2 = Math.Min(angle + 0.1, Math.PI * 2);
                double x1, y1, x2, y2;
                x1 = center.X + Math.Cos(angle) * radius;
                y1 = center.Y + Math.Sin(angle) * radius;
                x2 = center.X + Math.Cos(angle2) * radius;
                y2 = center.Y + Math.Sin(angle2) * radius;
                Gl.glVertex2d(x1, y1);
                Gl.glVertex2d(x2, y2);
            }
            Gl.glEnd();
        }
Exemple #4
0
 static void RenderLattice_xPrior(List <Particle> particles, Color3 color)
 {
     Gl.glLineWidth(1.0f);
     Gl.glColor3d(color.R, color.G, color.B);
     Gl.glBegin(Gl.GL_LINES);
     {
         foreach (Particle t in particles)
         {
             if (t.xPos != null)
             {
                 Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
                 Gl.glVertex2d(t.xPos.xPrior.X, t.xPos.xPrior.Y);
             }
             if (t.yPos != null)
             {
                 Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
                 Gl.glVertex2d(t.yPos.xPrior.X, t.yPos.xPrior.Y);
             }
         }
     }
     Gl.glEnd();
 }
Exemple #5
0
        static void RenderBodies()
        {
            foreach (LsmBody body in world.bodies)
            {
                RenderLockedParticlesSelection(body.particles);
                if (LsmBody.drawCollisionPointsAndTraces)
                    RenderCollisionedParticlesSelection(body.particles);

                Color3 colorX = new Color3(0, 0.5, 1);
                Color3 colorXPrior = new Color3(0, 1, 0.5);
                Color3 colorGoalX = new Color3(1, 0, 1);
                if (!body.Frozen)
                {
                    if (LsmBody.drawXPriorXConnection) RenderConnection_xPrior_x(body.particles, colorGoalX);
                    if (LsmBody.drawBodyLattice_xPrior) RenderLattice_xPrior(body.particles, 0.7 * colorXPrior);
                    if (LsmBody.drawBodyParticles_xPrior) RenderParticleGroup_xPrior(body.particles, colorXPrior);
                }
                if (LsmBody.drawBodyLattice_x) RenderLattice_x(body.particles, 0.7 * colorX);
                if (LsmBody.drawBodyParticles_x) RenderParticleGroup_x(body.particles, colorX);
                if (LsmBody.drawBodyLattice_goal) RenderLattice_Goal(body.particles, 0.7 * body.Color);
                if (LsmBody.drawBodyParticles_goal) RenderParticleGroup_Goal(body.particles, body.Color);
            }
        }
Exemple #6
0
 public LsmBody(Vector2 offset, Point spacing, Color3 color)
 {
     this.offset = offset;
     this.spacing = spacing;
     this.color = color;
 }
Exemple #7
0
 public LsmBody(Vector2 offset, Point spacing, Color3 color)
 {
     this.offset  = offset;
     this.spacing = spacing;
     this.color   = color;
 }
Exemple #8
0
        public static void RenderKnob(Vector2 knob, Color3 color)
        {
            //   Outline
            Gl.glPointSize(12.0f);
            Gl.glColor4f(0.0f, 0.0f, 0.0f, 1.0f);
            Gl.glBegin(Gl.GL_POINTS);
            {
                Gl.glVertex2d(knob.X, knob.Y);
            }
            Gl.glEnd();

            //   Knob
            Gl.glPointSize(9.0f);
            Gl.glColor4d(color.R, color.G, color.B, 1.0);
            Gl.glBegin(Gl.GL_POINTS);
            {
                Gl.glVertex2d(knob.X, knob.Y);
            }
            Gl.glEnd();
        }
Exemple #9
0
 public static void RenderCircle(Vector2 center, double radius, Color3 color)
 {
     double angle;
     Gl.glLineWidth(1.0f);
     Gl.glColor4d(color.R, color.G, color.B, 1.0);
     Gl.glBegin(Gl.GL_LINES);
     for (angle = 0; angle < Math.PI * 2; angle += 0.1)
     {
         double angle2 = Math.Min(angle + 0.1, Math.PI * 2);
         double x1, y1, x2, y2;
         x1 = center.X + Math.Cos(angle) * radius;
         y1 = center.Y + Math.Sin(angle) * radius;
         x2 = center.X + Math.Cos(angle2) * radius;
         y2 = center.Y + Math.Sin(angle2) * radius;
         Gl.glVertex2d(x1, y1);
         Gl.glVertex2d(x2, y2);
     }
     Gl.glEnd();
 }
Exemple #10
0
 static void RenderParticleGroup_xPrior(List<Particle> particles, Color3 color)
 {
     Gl.glColor3d(color.R, color.G, color.B);
     Gl.glPointSize(4.0f);
     Gl.glBegin(Gl.GL_POINTS);
     foreach (Particle t in particles)
     {
         Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
     }
     Gl.glEnd();
 }
Exemple #11
0
 static void RenderLattice_xPrior(List<Particle> particles, Color3 color)
 {
     Gl.glLineWidth(1.0f);
     Gl.glColor3d(color.R, color.G, color.B);
     Gl.glBegin(Gl.GL_LINES);
     {
         foreach (Particle t in particles)
         {
             if (t.xPos != null)
             {
                 Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
                 Gl.glVertex2d(t.xPos.xPrior.X, t.xPos.xPrior.Y);
             }
             if (t.yPos != null)
             {
                 Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
                 Gl.glVertex2d(t.yPos.xPrior.X, t.yPos.xPrior.Y);
             }
         }
     }
     Gl.glEnd();
 }
Exemple #12
0
 static void RenderConnection_xPrior_x(List<Particle> particles, Color3 color)
 {
     Gl.glColor4d(color.R, color.G, color.B, 0.5);
     Gl.glLineWidth(1.0f);
     Gl.glBegin(Gl.GL_LINES);
     foreach (Particle t in particles)
     {
         Gl.glVertex2d(t.xPrior.X, t.xPrior.Y);
         Gl.glVertex2d(t.x.X, t.x.Y);
     }
     Gl.glEnd();
 }