示例#1
0
        public unsafe void UseFaceData(ref ImageData image, ref FaceData face)
        {
            if (smr == null)
            {
                return;
            }
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }

            ReadWebcam.instance.GetMirrorValue(out int mirrorX, out int mirrorY);
            mirrorX *= ReadWebcam.instance.mirror3D;

            transform.parent.localScale = new Vector3(mirrorX, mirrorY, -1.0f);

            var pose = face.HeadPose;

            pose.position *= 100;
            HeadPose       = pose;

            float *weights = stackalloc float[FaceData.NumAnimationWeights];

            face.GetAnimation(weights);
            SetAnimation(weights);

            SetCustomEyeBlink(ref face);
        }
示例#2
0
        public unsafe void UseFaceData(ref ImageData image, ref FaceData face)
        {
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }

            ReadWebcam.instance.GetMirrorValue(out int mirrorX, out int mirrorY);
            mirrorX = mirrorX * ReadWebcam.instance.mirror3D;

            transform.parent.localScale = new Vector3(mirrorX, mirrorY, -1.0f);


            var pose = face.HeadPose;

            pose.position *= 100;
            HeadPose       = pose;

            for (int i = 0; i < 1220; ++i)
            {
                vertices[i] = face.Vertices[i];
            }

            mesh.vertices = vertices;
            mesh.RecalculateBounds();
            mesh.RecalculateNormals();
        }
示例#3
0
        public void UseFaceData(ref ImageData image, ref FaceData face)
        {
            if (facePoints == null)
            {
                return;
            }
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }

            SetPoints(ref image, ref face);
        }
示例#4
0
        public void UseFaceData(ref ImageData image, ref FaceData face)
        {
            GameObject.Find("World").GetComponent <FaceSceneBehavior>().faceDetected = false;
            if (facePoints == null)
            {
                return;
            }
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }

            SetPoints(ref image, ref face);
        }
        public void UseFaceData(ref ImageData image, ref FaceData face)
        {
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }
            ReadWebcam.instance.GetMirrorValue(out int mirrorX, out int mirrorY);
            mirrorX = mirrorX * ReadWebcam.instance.mirror3D;
            transform.parent.localScale = new Vector3(mirrorX, mirrorY, -1.0f);

            var pose = face.HeadPose;

            pose.position *= 100;
            HeadPose       = pose;
        }
        public void UseHandData(ref ImageData image, ref HandData hand, bool isLeft)
        {
            if (skeleton == null)
            {
                return;
            }
            if (quad == null)
            {
                quad = FindObjectOfType <AutoBackgroundQuad>();
                return;
            }

            SetPoints(ref image, ref hand);
            SetLinks();
            SetBox(ref image, ref hand);
            SetPosture(ref image, ref hand);
        }
            internal unsafe void Init(int _maxCount, bool _need3D, LevelOf3DProcess _levelOf3DProcess)
            {
                context = default(FaceLib.Context);
                context.detectableSize = 128f;
                context.logStateMode   = 0;
                context.maxCount       = (UInt16)_maxCount;
                context.InitPath       = Application.persistentDataPath;

                storage = new FaceData[context.maxCount];
                need3D  = _need3D;

                quad = FindObjectOfType <AutoBackgroundQuad>();

                FaceLib.Init(ref context);

                if (need3D)
                {
                    context3D.levelOf3DProcess = _levelOf3DProcess;
                    Face3DLib.Init(ref context3D);
                }
            }