Exemplo n.º 1
0
 public override void Draw(Camera canvas = null)
 {
     if (DrawGUI)
     {
         UltiDraw.Begin(canvas);
         UltiDraw.PlotFunctions(Rect.GetCenter(), Rect.GetSize(), Values, UltiDraw.Dimension.Y, yMin: 0f, yMax: 1f, thickness: 0.0025f);
         // UltiDraw.GUIRectangle(new Vector2(0.875f, 0.685f), new Vector2(0.005f, 0.1f), UltiDraw.White.Opacity(0.5f));
         UltiDraw.End();
     }
 }
Exemplo n.º 2
0
    void OnDrawGizmos() // visualise the joint location
    {
        if (Visualise)
        {
            UltiDraw.Begin();
            UltiDraw.DrawSphere(transform.position, Quaternion.identity, 0.25f, UltiDraw.Purple.Transparent(0.5f));

            UltiDraw.DrawArrow(transform.position, transform.position + 0.25f * (transform.rotation * Axis), 0.8f, 0.02f, 0.1f, UltiDraw.Cyan.Transparent(0.5f));
            UltiDraw.End();
        }
    }
Exemplo n.º 3
0
 void OnGUI()
 {
     if (Draw)
     {
         UltiDraw.Begin();
         UltiDraw.OnGUILabel(new Vector2(1f / 3f, YPos + 0.075f), new Vector2(0.5f, 0.25f), 0.02f, "Seed: " + NoiseSeed, Color.Lerp(UltiDraw.DarkGrey, Color.white, SeedTimer));
         UltiDraw.OnGUILabel(new Vector2(2f / 3f, YPos + 0.075f), new Vector2(0.5f, 0.25f), 0.02f, "Scale: " + Utility.Round(NoiseScale, 1), Color.Lerp(UltiDraw.DarkGrey, Color.white, NoiseTimer));
         UltiDraw.OnGUILabel(new Vector2(0.5f, YPos + 0.075f), new Vector2(0.5f, 0.2f), 0.02f, "Generative Control", Color.black);
         UltiDraw.End();
     }
 }
Exemplo n.º 4
0
 public void Draw()
 {
     UltiDraw.Begin();
     UltiDraw.DrawTranslateGizmo(Pivot.GetPosition(), Pivot.GetRotation(), 0.1f);
     for (int i = 0; i < Points.Length; i++)
     {
         UltiDraw.DrawLine(Pivot.GetPosition(), Points[i], UltiDraw.DarkGreen.Transparent(0.1f));
         UltiDraw.DrawCircle(Points[i], 0.025f, UltiDraw.Orange.Transparent(0.5f));
     }
     UltiDraw.End();
 }
Exemplo n.º 5
0
 public void Draw()
 {
     float[] values = new float[TimeSeries.KeyCount];
     for (int i = 0; i < TimeSeries.KeyCount; i++)
     {
         values[i] = Values[TimeSeries.GetKey(i).Index];
     }
     UltiDraw.Begin();
     UltiDraw.DrawGUIBars(new Vector2(0.875f, 0.510f), new Vector2(0.2f, 0.1f), values, 01f, 1f, 0.01f, UltiDraw.DarkGrey, UltiDraw.White);
     UltiDraw.End();
 }
Exemplo n.º 6
0
    public void Draw(int step = 1)
    {
        UltiDraw.Begin();
        //Connections
        for (int i = 0; i < Points.Length - step; i += step)
        {
            UltiDraw.DrawLine(Points[i].GetPosition(), Points[i + step].GetPosition(), 0.01f, UltiDraw.Black);
        }

        //Projections
        for (int i = 0; i < Points.Length; i += step)
        {
            //	Vector3 right = Points[i].GetRightSample();
            //	Vector3 left = Points[i].GetLeftSample();
            //	UltiDraw.DrawCircle(right, 0.01f, Utility.Yellow);
            //	UltiDraw.DrawCircle(left, 0.01f, Utility.Yellow);
        }

        //Velocities
        Color transparentVelocity = UltiDraw.DarkGreen.Transparent(0.25f);

        for (int i = 0; i < Points.Length; i += step)
        {
            Vector3 start = Points[i].GetPosition();
            Vector3 end   = Points[i].GetPosition() + Points[i].GetVelocity() * Points[i].GetDirection();
            end = Utility.ProjectGround(end, LayerMask.GetMask("Ground"));
            UltiDraw.DrawLine(start, end, 0.025f, 0f, transparentVelocity);
        }

        //Directions
        Color transparentDirection = UltiDraw.Orange.Transparent(0.75f);

        for (int i = 0; i < Points.Length; i += step)
        {
            Vector3 start = Points[i].GetPosition();
            Vector3 end   = Points[i].GetPosition() + 0.25f * Points[i].GetDirection();
            end = Utility.ProjectGround(end, LayerMask.GetMask("Ground"));
            UltiDraw.DrawLine(start, end, 0.025f, 0f, transparentDirection);
        }

        //Slopes
        //Color transparentSlope = Utility.Blue.Transparent(0.75f);
        for (int i = 0; i < Points.Length; i += step)
        {
            //	UltiDraw.DrawLine(Points[i].GetPosition(), Points[i].GetPosition() + 1f * Points[i].GetSlope() * Vector3.up, 0.025f, 0f, transparentSlope);
        }

        //Positions
        for (int i = 0; i < Points.Length; i += step)
        {
            UltiDraw.DrawCircle(Points[i].GetPosition(), 0.025f, UltiDraw.Black);
        }
        UltiDraw.End();
    }
    void OnDrawGizmos()
    {
        if (Visualise)
        {
            UltiDraw.Begin();
            UltiDraw.DrawSphere(transform.position, Quaternion.identity, 0.25f, UltiDraw.Cyan.Transparent(0.5f));

            UltiDraw.DrawArrow(GetPivotPosition(), GetPivotPosition() + 0.25f * (transform.rotation), 0.8f, 0.02f, 0.1f, UltiDraw.Cyan.Transparent(0.5f));
            UltiDraw.End();
        }
    }
    void OnDrawGizmos() // visualise the joint location
    {
        if (Visualise)
        {
            UltiDraw.Begin();
            UltiDraw.DrawSphere(transform.position, Quaternion.identity, 0.25f, UltiDraw.Purple.Transparent(0.5f));

            UltiDraw.DrawArrow(transform.position, transform.position + (directionToCheck.normalized * distanceToCheck), 0.8f, 0.02f, 0.1f, UltiDraw.Cyan.Transparent(0.5f));
            UltiDraw.End();
        }
    }
    //Optional scene drawing function
    protected override void DerivedDraw(MotionEditor editor)
    {
        UltiDraw.Begin();

        Transform leftAnkle  = editor.GetActor().FindTransform(Data.Source.Bones[LeftAnkle].Name);
        Transform rightAnkle = editor.GetActor().FindTransform(Data.Source.Bones[RightAnkle].Name);

        UltiDraw.DrawWireCircle(leftAnkle.position, 0.08f, Color.red);
        UltiDraw.DrawWireCircle(rightAnkle.position, 0.08f, Color.red);

        UltiDraw.End();
    }
Exemplo n.º 10
0
        void OnRenderObject()
        {
            if (Root == null)
            {
                Root = transform;
            }

            UltiDraw.Begin();
            UltiDraw.DrawGUICircle(new Vector2(0.5f, 0.85f), 0.075f, UltiDraw.Black.Transparent(0.5f));
            Quaternion rotation = Quaternion.AngleAxis(-360f * ((PFNN)NN.Model).GetPhase() / (2f * Mathf.PI), Vector3.forward);
            Vector2    a        = rotation * new Vector2(-0.005f, 0f);
            Vector2    b        = rotation * new Vector3(0.005f, 0f);
            Vector3    c        = rotation * new Vector3(0f, 0.075f);

            UltiDraw.DrawGUITriangle(new Vector2(0.5f + b.x / Screen.width * Screen.height, 0.85f + b.y), new Vector2(0.5f + a.x / Screen.width * Screen.height, 0.85f + a.y), new Vector2(0.5f + c.x / Screen.width * Screen.height, 0.85f + c.y), UltiDraw.Cyan);
            UltiDraw.End();

            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
                UltiDraw.End();
                Trajectory.Draw(10);
            }

            if (!Application.isPlaying)
            {
                Character.FetchTransformations(Root);
            }
            Character.Draw();

            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                for (int i = 0; i < Joints.Length; i++)
                {
                    Character.Segment segment = Character.FindSegment(Joints[i].name);
                    if (segment != null)
                    {
                        UltiDraw.DrawArrow(
                            Joints[i].position,
                            Joints[i].position + Velocities[i] * 60f,
                            0.75f,
                            0.0075f,
                            0.05f,
                            UltiDraw.Purple.Transparent(0.5f)
                            );
                    }
                }
                UltiDraw.End();
            }
        }
Exemplo n.º 11
0
 public void GUI()
 {
     UltiDraw.Begin();
     UltiDraw.DrawGUILabel(0.83f, 0.03f, 0.0175f, "Goal Action", UltiDraw.Black);
     Color[] colors = UltiDraw.GetRainbowColors(Actions.Length);
     for (int i = 0; i < Actions.Length; i++)
     {
         float value = Values[TimeSeries.Pivot][i];
         UltiDraw.DrawGUILabel(0.9f, 1f - (0.875f - 0.05f + value * 0.1f), value * 0.025f, Actions[i], colors[i]);
     }
     UltiDraw.End();
 }
Exemplo n.º 12
0
 void OnDrawGizmos()
 {
     if (Ankle == null || Normal == Vector3.zero)
     {
         return;
     }
     UltiDraw.Begin();
     UltiDraw.DrawSphere(GetPivotPosition(), Quaternion.identity, 0.025f, UltiDraw.Cyan.Transparent(0.5f));
     UltiDraw.DrawArrow(GetPivotPosition(), GetPivotPosition() + 0.25f * (GetPivotRotation() * Normal), 0.75f, 0.025f, 0.1f, UltiDraw.Cyan.Transparent(0.5f));
     UltiDraw.DrawSphere(GetPivotPosition(), Quaternion.identity, Radius, UltiDraw.Red.Transparent(0.5f));
     UltiDraw.End();
 }
Exemplo n.º 13
0
    void Draw()
    {
        UltiDraw.Begin();

        Action <Transform, Transform> recursion = null;

        recursion = new Action <Transform, Transform>((segment, parent) => {
            if (segment == null)
            {
                return;
            }
            if (parent != null)
            {
                UltiDraw.DrawSphere(
                    parent.position,
                    parent.rotation,
                    5f / 8f * BoneSize,
                    JointColor
                    );
                float distance = Vector3.Distance(parent.position, segment.position);
                if (distance > 0.05f)
                {
                    UltiDraw.DrawBone(
                        parent.position,
                        Quaternion.FromToRotation(parent.forward, segment.position - parent.position) * parent.rotation,
                        4f * BoneSize, distance,
                        BoneColor
                        );
                }
            }
            parent = segment;
            for (int i = 0; i < segment.childCount; i++)
            {
                recursion(segment.GetChild(i), parent);
            }
        });
        recursion(transform, null);

        if (DrawTransforms)
        {
            Action <Transform> f = null;
            f = new Action <Transform>((segment) => {
                UltiDraw.DrawTranslateGizmo(segment.position, segment.rotation, 0.075f);
                for (int i = 0; i < segment.childCount; i++)
                {
                    f(segment.GetChild(i));
                }
            });
            f(transform);
        }

        UltiDraw.End();
    }
Exemplo n.º 14
0
 public override void GUI(Camera canvas = null)
 {
     if (DrawGUI)
     {
         UltiDraw.Begin(canvas);
         UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(0f, 1.25f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.02f, "Ball Control", UltiDraw.Black);
         UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(-1.175f, 1f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.015f, "Height", UltiDraw.Black);
         UltiDraw.OnGUILabel(rect.GetCenter() + rect.ToScreen(new Vector2(1.175f, 1f)), rect.ToScreen(new Vector2(1f, 0.25f)), 0.015f, "Speed", UltiDraw.Black);
         UltiDraw.OnGUILabel(opponent.GetCenter() + new Vector2(0f, opponent.H + 0.02f), rect.ToScreen(new Vector2(1f, 0.25f)), 0.0175f, "Opponent", UltiDraw.Black);
         UltiDraw.End();
     }
 }
Exemplo n.º 15
0
 void OnDrawGizmos()
 {
     UltiDraw.Begin();
     //
     UltiDraw.DrawBone(
         transform.position,
         Quaternion.FromToRotation(-transform.parent.forward, transform.position - transform.parent.position) * transform.parent.rotation,
         0.5f,
         (transform.position - transform.parent.position).magnitude, UltiDraw.IndianRed);
     //
     UltiDraw.End();
 }
Exemplo n.º 16
0
    private void DrawFunction()
    {
        UltiDraw.Begin();
        Color[]        colors    = UltiDraw.GetRainbowColors(Values.Length);
        List <float[]> functions = new List <float[]>();

        for (int i = 0; i < Values.Length; i++)
        {
            functions.Add(Values[i].ToArray());
        }
        UltiDraw.PlotFunctions(Rect.GetCenter(), Rect.GetSize(), functions.ToArray(), UltiDraw.Dimension.Y, yMin: 0f, yMax: 1f, thickness: 0.001f);
        UltiDraw.End();
    }
Exemplo n.º 17
0
    void Draw()
    {
        UltiDraw.Begin();

        float[] values = new float[1000];
        for (int i = 0; i < values.Length; i++)
        {
            values[i] = Random.Range(NoiseMin, NoiseMax);
        }
        UltiDraw.PlotFunction(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), values, yMin: YMin, yMax: YMax, backgroundColor: UltiDraw.DarkGrey, lineColor: UltiDraw.Cyan);

        UltiDraw.End();
    }
    void Draw()
    {
        UltiDraw.Begin();

        float[] values = new float[1000];
        for (int i = 0; i < values.Length; i++)
        {
            values[i] = Random.Range(NoiseMin, NoiseMax);
        }
        UltiDraw.DrawFunction(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), values, YMin, YMax, UltiDraw.DarkGrey, UltiDraw.Cyan);

        UltiDraw.End();
    }
Exemplo n.º 19
0
    public void Draw(Color boneColor, Color jointColor, float alpha)
    {
        UltiDraw.Begin();
        if (DrawRoot)
        {
            UltiDraw.DrawWiredSphere(GetRoot().position, GetRoot().rotation, 0.1f, UltiDraw.DarkRed, UltiDraw.Black);
            UltiDraw.DrawTranslateGizmo(GetRoot().position, GetRoot().rotation, 0.1f);
        }

        if (DrawSkeleton)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                if (bone.GetParent() != null)
                {
                    UltiDraw.DrawBone(
                        bone.GetParent().Transform.position,
                        Quaternion.FromToRotation(bone.GetParent().Transform.forward, bone.Transform.position - bone.GetParent().Transform.position) * bone.GetParent().Transform.rotation,
                        12.5f * BoneSize * bone.GetLength(), bone.GetLength(), boneColor
                        );
                }
                UltiDraw.DrawSphere(bone.Transform.position, Quaternion.identity, 5f / 8f * BoneSize, jointColor);
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }

        if (DrawTransforms)
        {
            Action <Bone> recursion = null;
            recursion = new Action <Bone>((bone) => {
                UltiDraw.DrawTranslateGizmo(bone.Transform.position, bone.Transform.rotation, 0.05f);
                for (int i = 0; i < bone.Childs.Length; i++)
                {
                    recursion(bone.GetChild(i));
                }
            });
            if (Bones.Length > 0)
            {
                recursion(Bones[0]);
            }
        }
        UltiDraw.End();
    }
Exemplo n.º 20
0
    public void DrawDistribution(Color color, UltiDraw.GUIRect rect)
    {
        float max = Distances.Max();

        float[] distances = new float[Distances.Length];
        for (int i = 0; i < distances.Length; i++)
        {
            distances[i] = Utility.Normalise(Distances[i], 0f, max, 1f, 0f);
        }

        UltiDraw.Begin();
        UltiDraw.DrawGUIFunction(rect.GetPosition(), rect.GetSize(), distances, 0f, 1f, UltiDraw.White, color);
        UltiDraw.End();
    }
Exemplo n.º 21
0
    public void DrawDistribution(Color color, UltiDraw.GUIRect rect)
    {
        float max = Distances.Max();

        float[] distances = new float[Distances.Length];
        for (int i = 0; i < distances.Length; i++)
        {
            distances[i] = Distances[i].Normalize(0f, max, 1f, 0f);
        }

        UltiDraw.Begin();
        UltiDraw.PlotFunction(rect.GetCenter(), rect.GetSize(), distances, yMin: 0f, yMax: 1f, backgroundColor: UltiDraw.White, lineColor: color);
        UltiDraw.End();
    }
Exemplo n.º 22
0
 public void Draw()
 {
     UltiDraw.Begin();
     for (int i = 0; i < Keypoints.Count; i++)
     {
         UltiDraw.DrawSphere(Keypoints[i], Quaternion.identity, 0.025f, UltiDraw.Red);
     }
     for (int i = 0; i < Actor.Bones.Length; i++)
     {
         UltiDraw.DrawWireSphere(Actor.Bones[i].Transform.position, Actor.Bones[i].Transform.rotation, 2f * GetRadius(i), UltiDraw.Black.Transparent(0.05f));
         UltiDraw.DrawArrow(Positions[i], Positions[i] + Gradients[i], 0.8f, 0.005f, 0.015f, UltiDraw.Cyan.Transparent(0.5f));
     }
     UltiDraw.End();
 }
Exemplo n.º 23
0
 public void Draw()
 {
     UltiDraw.Begin();
     UltiDraw.DrawTranslateGizmo(Pivot.GetPosition(), Pivot.GetRotation(), 0.1f);
     for (int i = 0; i < Points.Length; i++)
     {
         Vector3 bottom = new Vector3(Points[i].x, Pivot.GetPosition().y, Points[i].z);
         Vector3 top    = Points[i];
         UltiDraw.DrawLine(bottom, top, UltiDraw.Green.Transparent(0.25f));
         UltiDraw.DrawCircle(bottom, 0.015f, UltiDraw.DarkGrey.Transparent(0.5f));
         UltiDraw.DrawCircle(top, 0.025f, UltiDraw.Mustard.Transparent(0.5f));
     }
     UltiDraw.End();
 }
Exemplo n.º 24
0
    public void Draw()
    {
        UltiDraw.Begin();
        UltiDraw.DrawTranslateGizmo(Pivot.GetPosition(), Pivot.GetRotation(), 0.1f);
        float      size     = 0.5f * Size / Resolution;
        Quaternion rotation = Pivot.GetRotation();

        for (int i = 0; i < Points.Length; i++)
        {
            UltiDraw.DrawLine(Pivot.GetPosition(), Points[i], UltiDraw.DarkGreen.Opacity(0.05f));
            UltiDraw.DrawQuad(Points[i], rotation, size, size, UltiDraw.Orange.Opacity(0.5f));
        }
        UltiDraw.End();
    }
Exemplo n.º 25
0
    void OnRenderObject()
    {
        if (Application.isPlaying)
        {
            if (NN.Parameters == null)
            {
                return;
            }

            if (ShowTrajectory)
            {
                UltiDraw.Begin();
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
                UltiDraw.End();
                Trajectory.Draw(10);
            }

            if (ShowVelocities)
            {
                UltiDraw.Begin();
                for (int i = 0; i < Actor.Bones.Length; i++)
                {
                    UltiDraw.DrawArrow(
                        Actor.Bones[i].Transform.position,
                        Actor.Bones[i].Transform.position + Velocities[i],
                        0.75f,
                        0.0075f,
                        0.05f,
                        UltiDraw.Purple.Transparent(0.5f)
                        );
                }
                UltiDraw.End();
            }

            UltiDraw.Begin();
            Color[] colors = UltiDraw.GetRainbowColors(Controller.Styles.Length);
            float   phase  = GetPhase();
            for (int i = 0; i < Controller.Styles.Length; i++)
            {
                float x = (float)i / (float)(Controller.Styles.Length - 1);
                x = Utility.Normalise(x, 0f, 1f, 0.3f, 0.7f);
                float y = 0.85f;
                UltiDraw.DrawGUICircularPivot(new Vector2(x, y), 0.04f, UltiDraw.DarkGrey, phase * 360f, GetSample(6).Styles[i], colors[i]);
            }
            UltiDraw.End();

            //HeightMap.Draw();
        }
    }
Exemplo n.º 26
0
    void OnRenderObject()
    {
        if (Elements <= Feet.Length)
        {
            return;
        }

        UltiDraw.Begin();

        Color[] colors = UltiDraw.GetRainbowColors(Feet.Length);
        for (int i = 0; i < colors.Length; i++)
        {
            colors[i] = colors[i].Darken(0.25f);
        }
        for (int i = 0; i < Feet.Length; i++)
        {
            UltiDraw.DrawSphere(Feet[i].transform.position, Quaternion.identity, 0.075f, colors[i]);
        }

        float border = 0.01f;
        float width  = Rect.W;
        float height = Feet.Length * Rect.H + (Feet.Length - 1) * border / 2f;

        UltiDraw.DrawGUIRectangle(Rect.GetPosition(), new Vector2(width, height), UltiDraw.DarkGrey.Transparent(0.75f), 0.5f * border, UltiDraw.BlackGrey);
        float pivot = 0.5f * height;

        for (int i = 1; i <= Feet.Length; i++)
        {
            pivot -= Rect.H / 2f;
            UltiDraw.DrawGUIRectangle(Rect.GetPosition() + new Vector2(0f, pivot), new Vector2(Rect.W, Rect.H), UltiDraw.White.Transparent(0.5f));
            for (int j = 0; j < Positions[i - 1].Count; j++)
            {
                float p = (float)j / (float)(Positions[i - 1].Count - 1);
                p = Utility.Normalise(p, 0f, 1f, 0.5f * Thickness / Rect.W, (Rect.W - 0.5f * Thickness) / Rect.W);
                float x    = Rect.X - 0.5f * Rect.W + p * Rect.W;
                float yTop = pivot + Rect.H / 2f;
                float yBot = pivot - Rect.H / 2f;
                float h    = Positions[i - 1][j].y - Utility.GetHeight(Positions[i - 1][j], LayerMask.GetMask("Ground"));
                if (h < Thresholds[i - 1])
                {
                    UltiDraw.DrawGUILine(new Vector2(x, Rect.Y + yTop), new Vector2(x, Rect.Y + yBot), Thickness, colors[i - 1]);
                }
            }
            pivot -= border / 2f;
            pivot -= Rect.H / 2f;
        }

        UltiDraw.End();
    }
Exemplo n.º 27
0
    void OnRenderObject()
    {
        UpdateData();

        if (!Show)
        {
            return;
        }

        if (DrawCW)
        {
            UltiDraw.Begin();
            Vector2 center = new Vector2(0.5f, 0.1f);
            float   width  = 0.95f;
            float   height = 0.1f;
            float   border = 0.0025f;
            UltiDraw.DrawGUIRectangle(
                center,
                new Vector2(width + 2f * border / Screen.width * Screen.height, height + 2f * border),
                UltiDraw.Black);
            UltiDraw.DrawGUIRectangle(
                center,
                new Vector2(width, height),
                UltiDraw.White);

            Color[] colors = UltiDraw.GetRainbowColors(Animation.APFNN.ControlWeights);
            for (int i = 0; i < colors.Length; i++)
            {
                DrawControlPoint(center.x - width / 2f, center.y + height / 2f, width, height, CW[i], colors[i]);
            }

            /*
             * DrawControlPoint(x, y, width, height, CW[0], Utility.Red);
             * DrawControlPoint(x, y, width, height, CW[1], Utility.DarkGreen);
             * DrawControlPoint(x, y, width, height, CW[2], Utility.Purple);
             * DrawControlPoint(x, y, width, height, CW[3], Utility.Orange);
             */
            UltiDraw.End();
        }

        for (int i = 0; i < Trails.Length; i++)
        {
            Trails[i].Update(Frames);
            if (DrawTrails)
            {
                Trails[i].Draw(0.01f, new Color(0f, 1f, 2f / 3f, 1f));
            }
        }
    }
Exemplo n.º 28
0
    void OnRenderObject()
    {
        if (Root == null)
        {
            Root = transform;
        }

        if (ShowTrajectory)
        {
            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetDirection, 0.05f, 0f, UltiDraw.Red.Transparent(0.75f));
                UltiDraw.DrawLine(Trajectory.Points[RootPointIndex].GetPosition(), Trajectory.Points[RootPointIndex].GetPosition() + TargetVelocity, 0.05f, 0f, UltiDraw.Green.Transparent(0.75f));
                UltiDraw.End();
                Trajectory.Draw(10);
            }
        }

        if (!Application.isPlaying)
        {
            Character.FetchTransformations(Root);
        }
        Character.Draw();

        if (ShowVelocities)
        {
            if (Application.isPlaying)
            {
                UltiDraw.Begin();
                for (int i = 0; i < Joints.Length; i++)
                {
                    Character.Segment segment = Character.FindSegment(Joints[i].name);
                    if (segment != null)
                    {
                        UltiDraw.DrawArrow(
                            Joints[i].position,
                            Joints[i].position + Velocities[i] * 60f,
                            0.75f,
                            0.0075f,
                            0.05f,
                            UltiDraw.Purple.Transparent(0.5f)
                            );
                    }
                }
                UltiDraw.End();
            }
        }
    }
    public void Draw()
    {
        if (Data == null)
        {
            return;
        }

        MotionData.Frame frame = GetCurrentFrame();

        if (ShowMotion)
        {
            for (int i = 0; i < 6; i++)
            {
                MotionData.Frame previous = Data.GetFrame(Mathf.Clamp(frame.Timestamp - 1f + (float)i / 6f, 0f, Data.GetTotalTime()));
                Actor.DrawSimple(Color.Lerp(UltiDraw.Blue, UltiDraw.Cyan, 1f - (float)(i + 1) / 6f).Transparent(0.75f), previous.GetBoneTransformations(ShowMirrored));
            }
            for (int i = 1; i <= 5; i++)
            {
                MotionData.Frame future = Data.GetFrame(Mathf.Clamp(frame.Timestamp + (float)i / 5f, 0f, Data.GetTotalTime()));
                Actor.DrawSimple(Color.Lerp(UltiDraw.Red, UltiDraw.Orange, (float)(i + 1) / 5f).Transparent(0.75f), future.GetBoneTransformations(ShowMirrored));
            }
        }

        if (ShowVelocities)
        {
            UltiDraw.Begin();
            for (int i = 0; i < Actor.Bones.Length; i++)
            {
                UltiDraw.DrawArrow(
                    Actor.Bones[i].Transform.position,
                    Actor.Bones[i].Transform.position + frame.GetBoneVelocity(i, ShowMirrored),
                    0.75f,
                    0.0075f,
                    0.05f,
                    UltiDraw.Purple.Transparent(0.5f)
                    );
            }
            UltiDraw.End();
        }

        if (ShowTrajectory)
        {
            frame.GetTrajectory(ShowMirrored).Draw();
        }

        frame.GetHeightMap(ShowMirrored).Draw();

        frame.GetDepthMap(ShowMirrored).Draw();
    }
Exemplo n.º 30
0
 public void Draw()
 {
     UltiDraw.Begin();
     float[] function = new float[TimeSeries.Pivot + 1];
     Color[] colors   = UltiDraw.GetRainbowColors(Bones.Length);
     for (int i = 0; i < Bones.Length; i++)
     {
         for (int j = 0; j < function.Length; j++)
         {
             function[j] = Values[j][i];
         }
         UltiDraw.DrawGUIBars(new Vector2(0.875f, (i + 1) * 0.06f), new Vector2(0.2f, 0.05f), function, 0f, 1f, 0.1f / function.Length, UltiDraw.White, colors[i], 0.0025f, UltiDraw.Black);
     }
     UltiDraw.End();
 }