Exemplo n.º 1
0
        public void update(FaceAlignment face)
        {
            currentOrientation = face.FaceOrientation.toEngineQuat().inverse();

            if (JawTracking)
            {
                float openInterpolate = Math.Min(face.AnimationUnits[FaceShapeAnimations.JawOpen] / openMaxValue, 1.0f);
                float protrusion      = neutralProtrusion.interpolate(fullyOpenProtrusion, openInterpolate);

                float leftAdditiontalSlide  = 0f;
                float rightAdditiontalSlide = 0f;

                //Uncomment to try left/right sliding
                //float slide = face.AnimationUnits[FaceShapeAnimations.JawSlideRight];
                //if(slide > 0)
                //{
                //    rightAdditiontalSlide = 0f.interpolate(additionalOneSideProtrusion, Math.Min(slide / protrusionMaxValue, 1.0f));
                //}
                //else
                //{
                //    leftAdditiontalSlide = 0f.interpolate(additionalOneSideProtrusion, Math.Min(-slide / protrusionMaxValue, 1.0f));
                //}

                leftCP.setLocation(Math.Min(protrusion + leftAdditiontalSlide, 1.0f));
                rightCP.setLocation(Math.Min(protrusion + rightAdditiontalSlide, 1.0f));
                movingMuscleTarget.Offset = new Vector3(0, 0f.interpolate(fullyOpenHinge, openInterpolate), 0.0f);
                movingMuscle.changeForce(70);

                //Logging.Log.Debug("Jaw pos {0} slide {1}", face.AnimationUnits[FaceShapeAnimations.JawOpen], face.AnimationUnits[FaceShapeAnimations.JawSlideRight]);
            }
        }
 void synchronizeForce(object sender, float force)
 {
     if (allowSyncronization)
     {
         allowSyncronization = false;
         if (sender != forceSlider)
         {
             forceSlider.Value = force;
         }
         if (sender != movingMuscle)
         {
             movingMuscle.changeForce(force);
         }
         allowSyncronization = true;
     }
 }
        void adaptButton_CheckedChanged(Widget sender, EventArgs e)
        {
            if (adaptButton.Checked)
            {
                ControlPointBehavior leftCP             = ControlPointController.getControlPoint("LeftCP");
                ControlPointBehavior rightCP            = ControlPointController.getControlPoint("RightCP");
                MuscleBehavior       movingMuscle       = MuscleController.getMuscle("MovingMuscleDynamic");
                MovingMuscleTarget   movingMuscleTarget = MuscleController.MovingTarget;

                leftCP.setLocation(leftCP.NeutralLocation);
                rightCP.setLocation(rightCP.NeutralLocation);
                movingMuscle.changeForce(TeethController.AdaptForce);
                movingMuscleTarget.Offset = Vector3.Zero;
            }

            TeethController.adaptAllTeeth(adaptButton.Checked);
        }
Exemplo n.º 4
0
        public override void opening()
        {
            ControlPointBehavior leftCP             = ControlPointController.getControlPoint("LeftCP");
            ControlPointBehavior rightCP            = ControlPointController.getControlPoint("RightCP");
            MuscleBehavior       movingMuscle       = MuscleController.getMuscle("MovingMuscleDynamic");
            MovingMuscleTarget   movingMuscleTarget = MuscleController.MovingTarget;

            leftCP.setLocation(leftCP.NeutralLocation);
            rightCP.setLocation(rightCP.NeutralLocation);
            movingMuscle.changeForce(TeethController.AdaptForce);
            movingMuscleTarget.Offset = Vector3.Zero;

            gridPropertiesControl.Origin = TeethController.getToothCenter();
            gridPropertiesControl.updateGrid();
            teethMovementPanel.setDefaultTools();

            teethMovementPanel.opening();

            base.opening();
        }