Esempio n. 1
0
        public void Draw()
        {
            foreach (var sensor in space.Sensors)
            {
                if (sensor.IsCompound)
                {
                    ((MultiSensor)sensor).Attachments.ForEach(a => Draw(a.Shape));
                }
                else
                {
                    Draw(sensor.Shape);
                }
            }

            primitives.Flush();
        }
Esempio n. 2
0
        public void Draw(Camera3D camera)
        {
            if (!IsEnabled)
            {
                return;
            }

            foreach (RigidBody body in world.RigidBodies)
            {
                // TODO: Incorporate soft bodies into this visualizer.
                if (body is SoftBody.MassPoint)
                {
                    continue;
                }

                var shape = body.Shape;
                var color = GetColor(body);

                switch (shape.GetType().Name)
                {
                case "BoxShape": Draw((BoxShape)shape, body, color);
                    break;

                case "CapsuleShape": Draw((CapsuleShape)shape, body, color);
                    break;

                case "CylinderShape": Draw((CylinderShape)shape, body, color);
                    break;

                case "SphereShape": Draw((SphereShape)shape, body, color);
                    break;

                case "TriangleMeshShape": Draw((TriangleMeshShape)shape, color);
                    break;
                }
            }

            primitives.Flush();
        }