Beispiel #1
0
    protected override void DerivedDraw(MotionEditor editor)
    {
        CuboidMap sensor = GetCuboidMap(editor.GetCurrentFrame(), editor.Mirror);

        sensor.Draw(Color);
        if (DrawReferences)
        {
            sensor.DrawReferences();
        }
        if (DrawDistribution)
        {
            sensor.DrawDistribution(Color, Rect);
        }
    }
    protected override void DerivedDraw(MotionEditor editor)
    {
        if (Target.DrawGeometry || Target.DrawReferences || Target.DrawDistribution)
        {
            //DistanceMap sensor = Target.GetInteractionGeometry(editor.GetCurrentFrame(), editor.Mirror, 1f/editor.TargetFramerate);
            CuboidMap sensor = Target.GetInteractionGeometry(editor.GetCurrentFrame(), editor.Mirror, 1f / editor.TargetFramerate);

            /*
             * Interaction interaction = Target.FindInteraction(editor.GetCurrentFrame());
             * CuboidMap sensor;
             * if(interaction == null) {
             *      RootModule module = Data.GetModule(ID.Root) == null ? null : (RootModule)Data.GetModule(ID.Root);
             *      sensor = new CuboidMap(new Vector3Int(Target.PropResolution, Target.PropResolution, Target.PropResolution));
             *      sensor.Sense(module == null ? Matrix4x4.identity : module.GetRootTransformation(editor.GetCurrentFrame(), editor.Mirror), interaction.gameObject.layer, Vector3.zero);
             * } else {
             *      sensor = new CuboidMap(new Vector3Int(Target.PropResolution, Target.PropResolution, Target.PropResolution));
             *      sensor.Sense(interaction.GetCenter(), LayerMask.GetMask("Interaction"), interaction.GetExtents());
             *      Transformation transformation = interaction.GetComponent<Transformation>();
             *      if(transformation != null) {
             *              sensor.Retransform(interaction.GetCenter(transformation.GetTransformation(Target.GetTargetFrame(editor.GetCurrentFrame(), 1f/editor.TargetFramerate), editor.Mirror)));
             *      }
             * }
             */

            if (Target.DrawGeometry)
            {
                sensor.Draw(UltiDraw.Cyan.Transparent(0.75f));
            }
            if (Target.DrawReferences)
            {
                sensor.DrawReferences();
            }
            if (Target.DrawDistribution)
            {
                sensor.DrawDistribution(UltiDraw.Black, new UltiDraw.GUIRect(0.5f, 0.1f, 0.9f, 0.1f));
            }
        }
    }
    protected override void OnRenderObjectDerived()
    {
        Controller.Draw();

        if (ShowRoot)
        {
            RootSeries.Draw();
        }
        if (ShowGoal)
        {
            GoalSeries.Draw();
        }
        if (ShowCurrent)
        {
            StyleSeries.Draw();
        }
        if (ShowPhase)
        {
            PhaseSeries.Draw();
        }
        if (ShowContacts)
        {
            ContactSeries.Draw();
        }
        if (ShowEnvironment)
        {
            Environment.Draw(UltiDraw.Mustard.Transparent(0.25f));
        }
        if (ShowInteraction)
        {
            Geometry.Draw(UltiDraw.Cyan.Transparent(0.25f));
        }

        if (ShowBiDirectional)
        {
            UltiDraw.Begin();
            for (int i = 0; i < PosePrediction.Length; i++)
            {
                UltiDraw.DrawSphere(PosePrediction[i], Quaternion.identity, 0.05f, UltiDraw.Magenta);
            }
            for (int i = 0; i < RootPrediction.Length; i++)
            {
                UltiDraw.DrawCircle(RootPrediction[i].GetPosition(), 0.05f, UltiDraw.DarkRed.Darken(0.5f));
                UltiDraw.DrawArrow(RootPrediction[i].GetPosition(), RootPrediction[i].GetPosition() + 0.1f * RootPrediction[i].GetForward(), 0f, 0f, 0.025f, UltiDraw.DarkRed);
                if (i < RootPrediction.Length - 1)
                {
                    UltiDraw.DrawLine(RootPrediction[i].GetPosition(), RootPrediction[i + 1].GetPosition(), UltiDraw.Black);
                }
            }
            for (int i = 0; i < GoalPrediction.Length; i++)
            {
                UltiDraw.DrawCircle(GoalPrediction[i].GetPosition(), 0.05f, UltiDraw.DarkGreen.Darken(0.5f));
                UltiDraw.DrawArrow(GoalPrediction[i].GetPosition(), GoalPrediction[i].GetPosition() + 0.1f * GoalPrediction[i].GetForward(), 0f, 0f, 0.025f, UltiDraw.DarkGreen);
                if (i < GoalPrediction.Length - 1)
                {
                    UltiDraw.DrawLine(GoalPrediction[i].GetPosition(), GoalPrediction[i + 1].GetPosition(), UltiDraw.Black);
                }
            }
            UltiDraw.End();
        }
    }