Exemple #1
0
 internal void drawDebug(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     foreach (var bone in bones)
     {
         if ((drawMode & DebugDrawMode.Bones) != 0)
         {
             bone.draw(drawingSurface);
         }
         foreach (var joint in bone.IkBone.Joints)
         {
             ((BEPUikConstraint)joint.UserObject).draw(drawingSurface, drawMode);
         }
     }
     if ((drawMode & DebugDrawMode.Controls) != 0)
     {
         foreach (var control in externalControls)
         {
             control.draw(drawingSurface, drawMode);
         }
         foreach (var control in controls)
         {
             control.draw(drawingSurface, drawMode);
         }
     }
     foreach (var child in childSolvers)
     {
         child.drawDebug(drawingSurface, drawMode);
     }
 }
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.BallSocketJoints) != 0)
     {
         drawingSurface.drawAxes(VisualizationOrigin, Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ, 5.0f);
     }
 }
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     //Vector3 origin = revoluteControl.AngularMotor.TargetBone.Position.toEngineVec3();
     //drawingSurface.drawAxes(offset, Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ, 10, Color.Orange, Color.Orange, Color.Orange);
     //drawingSurface.drawAxes(target, Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ, 10, Color.Yellow, Color.Yellow, Color.Yellow);
     //drawingSurface.Color = Color.Red;
     //drawingSurface.drawLine(offset, target);
 }
 public void DebugDrawBitmap(DebugDrawMode mode, int x, int z, int size, string name)
 {
     if (!Debug)
     {
         return;
     }
     DebugDrawBitmap(mode, GenLayer(x + DebugXCoord, z + DebugZCoord, size, size), size, size, name);
 }
Exemple #5
0
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.RevoluteJoints) != 0)
     {
         Vector3 origin = VisualizationOrigin;
         drawingSurface.Color = Color.Red;
         drawingSurface.drawLine(origin, origin + joint.WorldFreeAxisA.toEngineVec3() * 5.0f);
     }
 }
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.PointOnLineJoints) != 0)
     {
         Vector3 origin = VisualizationOrigin;
         drawingSurface.Color = Color.Red;
         drawingSurface.drawLine(origin, origin + joint.LineDirection.toEngineVec3() * 5.0f);
     }
 }
        internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
        {
            Vector3 offset = dragControl.LinearMotor.TargetBone.Position.toEngineVec3() + dragControl.LinearMotor.Offset.toEngineVec3();
            Vector3 target = dragControl.LinearMotor.TargetPosition.toEngineVec3();

            drawingSurface.drawAxes(offset, Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ, 10, Color.Orange, Color.Orange, Color.Orange);
            drawingSurface.drawAxes(target, Vector3.UnitX, Vector3.UnitY, Vector3.UnitZ, 10, Color.Yellow, Color.Yellow, Color.Yellow);
            drawingSurface.Color = Color.Red;
            drawingSurface.drawLine(offset, target);
        }
Exemple #8
0
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.SwingLimits) != 0)
     {
         Vector3 origin = VisualizationOrigin;
         drawingSurface.Color = Color.Red;
         drawingSurface.drawLine(origin, origin + limit.AxisA.toEngineVec3() * 5.0f);
         drawingSurface.Color = Color.Blue;
         drawingSurface.drawLine(origin, origin + limit.AxisB.toEngineVec3() * 5.0f);
     }
 }
 void DrawMapRegion(DebugDrawMode mode, IServerPlayer player, IntMap map, string prefix, bool lerp, int regionX, int regionZ, int scale)
 {
     if (lerp)
     {
         int[] lerped = GameMath.BiLerpColorMap(map, scale);
         NoiseBase.DebugDrawBitmap(mode, lerped, map.InnerSize * scale, prefix + "-" + regionX + "-" + regionZ + "-l");
         player.SendMessage(groupId, "Lerped " + prefix + " map generated.", EnumChatType.CommandSuccess);
     }
     else
     {
         NoiseBase.DebugDrawBitmap(mode, map.Data, map.Size, prefix + "-" + regionX + "-" + regionZ);
         player.SendMessage(groupId, "Original " + prefix + " map generated.", EnumChatType.CommandSuccess);
     }
 }
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.TwistJoints) != 0)
     {
         Vector3 origin = VisualizationOrigin;
         drawingSurface.Color = Color.Red;
         drawingSurface.drawLine(origin, origin + joint.AxisA.toEngineVec3() * 5.0f);
         drawingSurface.Color = Color.Orange;
         drawingSurface.drawLine(origin, origin + joint.MeasurementAxisA.toEngineVec3() * 5.0f);
         drawingSurface.Color = Color.Blue;
         drawingSurface.drawLine(origin, origin + joint.AxisB.toEngineVec3() * 5.0f);
         drawingSurface.Color = Color.LightBlue;
         drawingSurface.drawLine(origin, origin + joint.MeasurementAxisB.toEngineVec3() * 5.0f);
     }
 }
        public static void DebugDrawBitmap(DebugDrawMode mode, int[] values, int sizeX, int sizeZ, string name)
        {
            if (!Debug)
            {
                return;
            }

            Bitmap bmp = new Bitmap(sizeX, sizeZ);
            int    color;

            for (int x = 0; x < sizeX; x++)
            {
                for (int z = 0; z < sizeZ; z++)
                {
                    color = values[z * sizeX + x];

                    if (mode == DebugDrawMode.FirstByteGrayscale)
                    {
                        int val = color & 0xff;
                        color = (val) | (val << 8) | (val << 16);
                    }

                    if (mode == DebugDrawMode.LandformRGB)
                    {
                        LandformVariant[] landformsByIndex = NoiseLandforms.landforms.LandFormsByIndex;

                        if (landformsByIndex.Length > color)
                        {
                            color = landformsByIndex[color].ColorInt;
                        }
                    }

                    if (mode == DebugDrawMode.ProvinceRGB)
                    {
                        GeologicProvinceVariant[] provincesByIndex = NoiseGeoProvince.provinces.Variants;

                        if (provincesByIndex.Length > color)
                        {
                            color = provincesByIndex[color].ColorInt;
                        }
                    }

                    bmp.SetPixel(x, z, Color.FromArgb((color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff));
                }
            }

            bmp.Save("map-" + name + ".png");
        }
Exemple #12
0
        public void AddDrawDebug(string _name = "none", DebugDrawMode _drawMode = DebugDrawMode.None, Vector2?_distRect = null, Rectangle?_drawRect = null, Point?_drawPoint = null, Line _drawLine = null, string _drawText = null, Color?color = null)
        {
            DebugDraw debugDraw = new DebugDraw
            {
                Name            = _name,
                DrawMode        = _drawMode,
                DistinationRect = _distRect ?? Vector2.Zero,
                DrawRect        = _drawRect ?? Rectangle.Empty,
                DrawPoint       = _drawPoint ?? Point.Zero,
                DrawString      = _drawText,
                Color           = color ?? Color.White
            };

            if (!p_DrawDebugs.ContainsKey(debugDraw.Name))
            {
                p_DrawDebugs.Add(debugDraw.Name, debugDraw);
            }
        }
        internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
        {
            if ((drawMode & DebugDrawMode.DistanceLimits) != 0)
            {
                Vector3 origin = VisualizationOrigin;
                drawingSurface.Color = Color.Blue;
                Vector3 minMaxPoint = origin + Vector3.Up * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Up * (limit.MaximumDistance - limit.MinimumDistance));

                drawingSurface.Color = Color.Blue;
                minMaxPoint          = origin + Vector3.Down * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Down * (limit.MaximumDistance - limit.MinimumDistance));

                drawingSurface.Color = Color.Blue;
                minMaxPoint          = origin + Vector3.Left * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Left * (limit.MaximumDistance - limit.MinimumDistance));

                drawingSurface.Color = Color.Blue;
                minMaxPoint          = origin + Vector3.Right * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Right * (limit.MaximumDistance - limit.MinimumDistance));

                drawingSurface.Color = Color.Blue;
                minMaxPoint          = origin + Vector3.Forward * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Forward * (limit.MaximumDistance - limit.MinimumDistance));

                drawingSurface.Color = Color.Blue;
                minMaxPoint          = origin + Vector3.Backward * limit.MinimumDistance;
                drawingSurface.drawLine(origin, minMaxPoint);
                drawingSurface.Color = Color.Red;
                drawingSurface.drawLine(minMaxPoint, minMaxPoint + Vector3.Backward * (limit.MaximumDistance - limit.MinimumDistance));
            }
        }
Exemple #14
0
 public BEPUikDebugEntry(String text, DebugDrawMode mode, BEPUikDebugInterface debugInterface)
 {
     this.text           = text;
     this.mode           = mode;
     this.debugInterface = debugInterface;
 }
 internal void drawDebug(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     drawingSurface.begin("BepuIkScene", Engine.Renderer.DrawingType.LineList);
     rootSolver.drawDebug(drawingSurface, drawMode);
     drawingSurface.end();
 }
        // C# modulo doesn't work on negative numbers

        /*public static int mod(int a, int n)
         * {
         *  int result = a % n;
         *  if ((a < 0 && n > 0) || (a > 0 && n < 0))
         *      result += n;
         *  return result;
         * }*/



        // mode = 0   normal rgb image
        // mode = 1   use lowest 8 bits to create a grayscale image
        // mode = 2   decode rgb value into landform rgb value
        // mode = 3   decode rgb value into province rgb value

        public static void DebugDrawBitmap(DebugDrawMode mode, int[] values, int size, string name)
        {
            DebugDrawBitmap(mode, values, size, size, name);
        }
 internal override void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     //Not really sure how to visualize this one
 }
 internal abstract void draw(DebugDrawingSurface drawingSurface, DebugDrawMode drawMode);
 internal void enableGlobalDebugMode(DebugDrawMode mode)
 {
     drawMode |= mode;
 }
 internal void disableGlobalDebugMode(DebugDrawMode mode)
 {
     drawMode &= (~mode);
 }
Exemple #21
0
 internal override void draw(Engine.Renderer.DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     //TODO: Implement Constraint Drawing
 }
Exemple #22
0
 internal override void draw(Engine.Renderer.DebugDrawingSurface drawingSurface, DebugDrawMode drawMode)
 {
     if ((drawMode & DebugDrawMode.SwivelHingeJoints) != 0)
     {
         Vector3 origin = VisualizationOrigin;
         drawingSurface.Color = Color.Red;
         drawingSurface.drawLine(origin, origin + joint.WorldHingeAxis.toEngineVec3() * 10.0f);
         drawingSurface.Color = Color.Blue;
         drawingSurface.drawLine(origin, origin + joint.WorldTwistAxis.toEngineVec3() * 10.0f);
     }
 }