Exemplo n.º 1
0
        public static Texture GetMap(MAP_DATA_TYPE type)
        {
            switch (type)
            {
            case MAP_DATA_TYPE.ColorMap:
                return(CVInterface.GetColorMap());

            case MAP_DATA_TYPE.DepthMap:
                /*if( Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer )
                 *      return CVInterface.GetUsersMap();
                 * else
                 */
                return(CVInterface.GetDepthMap());

            case MAP_DATA_TYPE.UserMap:
                return(CVInterface.GetUsersMap());

            case MAP_DATA_TYPE.ColorPointCloud:
                return(CVInterface.GetColorPointCloud());

            case MAP_DATA_TYPE.VertexPointCloud:
                return(CVInterface.GetVertexPointCloud());

            default:
                return(null);
            }
        }
Exemplo n.º 2
0
        public static float GetFloat(FLOAT_DATA_TYPE type, int userIndex = 0)
        {
            switch (type)
            {
            case FLOAT_DATA_TYPE.AudioBeat:
                return(AudioProcessor.GetBeat());

            case FLOAT_DATA_TYPE.AudioLevel:
                return(AudioProcessor.GetLevel());

            case FLOAT_DATA_TYPE.HandsHorizontalSeparation:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.HandsHorizontalSeparation, userIndex));

            case FLOAT_DATA_TYPE.HandsVerticalSeparation:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.HandsVerticalSeparation));

            case FLOAT_DATA_TYPE.HandsToPelvisFactor:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.HandsToPelvisFactor));

            case FLOAT_DATA_TYPE.UserHorizontalPosition:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.UserHorizontalPosition));

            case FLOAT_DATA_TYPE.PelvisToLeftHand:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.PelvisToLeftHand, userIndex));

            case FLOAT_DATA_TYPE.PelvisToRightHand:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.PelvisToRightHand, userIndex));

            case FLOAT_DATA_TYPE.AmplitudeSetting:
                return(CVInterface.GetFloat(FLOAT_DATA_TYPE.AmplitudeSetting));

            default:
                return(0.0f);
            }
        }
 // Update is called once per frame
 void Update()
 {
     if (CVInterface._Instance && refTransform != null)
     {
         float sep = CVInterface.GetFloat(FXDataProvider.FLOAT_DATA_TYPE.HandsVerticalSeparation);
         refTransform.Rotate(0.0f, sep * multiplier, 0.0f);
     }
 }
Exemplo n.º 4
0
        public static Vector2 GetMapScale(MAP_DATA_TYPE type)
        {
            Vector2 scale = CVInterface.GetTextureScale(type);

            if (Application.platform == RuntimePlatform.IPhonePlayer)
            {
                scale.x *= -1f;
            }

            return(scale);
        }
Exemplo n.º 5
0
        // Update is called once per frame
        void Update()
        {
            if (CVInterface.AreDatasAvailable())
            {
                Vector3 pos = CVInterface.GetJointPos3D(joint);

                pos   = projCam.WorldToViewportPoint(pos);
                pos.z = planeToProjectOnto.position.z;
                pos   = projCam.ViewportToWorldPoint(pos);
                transform.position = pos;
            }
        }
Exemplo n.º 6
0
        public void Awake()
        {
            if (_Instance != null)
            {
                Destroy(gameObject);
                return;
            }
            else
            {
                _Instance = this;
            }

            Init();
        }
Exemplo n.º 7
0
        public static Vector2 GetMapSize(MAP_DATA_TYPE type)
        {
            Vector2 output = new Vector2();
            Texture map    = null;

            switch (type)
            {
            case MAP_DATA_TYPE.ColorMap:
                map = CVInterface.GetColorMap();
                break;

            case MAP_DATA_TYPE.DepthMap:
                if (Application.platform == RuntimePlatform.WindowsEditor || Application.platform == RuntimePlatform.WindowsPlayer)
                {
                    //map = CVInterface.GetUsersMap();
                    map = CVInterface.GetDepthMap();
                }
                else
                {
                    map = CVInterface.GetDepthMap();
                }
                break;

            case MAP_DATA_TYPE.UserMap:
                map = CVInterface.GetUsersMap();
                break;

            case MAP_DATA_TYPE.ColorPointCloud:
                map = CVInterface.GetColorPointCloud();
                break;

            case MAP_DATA_TYPE.VertexPointCloud:
                map = CVInterface.GetVertexPointCloud();
                break;

            default:
                break;
            }
            if (map == null)
            {
                return(output);
            }
            output.x = map.width;
            output.y = map.height;

            return(output);
        }
Exemplo n.º 8
0
        // Update is called once per frame
        void Update()
        {
            if (!CVInterface.AreDatasAvailable())
            {
                return;
            }

            foreach (KeyValuePair <IRISJoints.Joints, Transform> couples in JointsToTransforms)
            {
                if (CVInterface.IsJointTracked(couples.Key))
                {
                    Vector3 p = CVInterface.GetJointPos3D(couples.Key);

                    couples.Value.position = Vector3.Lerp(couples.Value.position, p, .5f);
                }
            }

            Vector3 ol = LeftShoulderT.position;
            Vector3 or = RightShoulderT.position;

            // shoulders positions hack to straighten the middle mesh x-->  <--x
            LeftShoulderT.position  = Vector3.Lerp(ol, or, .15f);
            RightShoulderT.position = Vector3.Lerp(ol, or, .85f);

            foreach (Link l in links)
            {
                Vector3 delta = l.j2.position - l.j1.position;
                if (delta == Vector3.zero)
                {
                    continue;
                }

                if (l.tr == null)
                {
                    continue;
                }

                l.tr.position = l.j1.position + (delta) / 2f;
                l.tr.rotation = Quaternion.LookRotation(delta) * Quaternion.LookRotation(Vector3.up);
                Vector3 s = l.tr.localScale;
                l.tr.localScale = new Vector3(s.x, (l.j2.position - l.j1.position).magnitude / 2f, s.z);
            }

            DrawMiddle();
        }
Exemplo n.º 9
0
        public static int GetInt(INT_DATA_TYPE type, int userIndex = 0)
        {
            switch (type)
            {
            case INT_DATA_TYPE.BoneCount:
                return(CVInterface.GetBoneCount());

            case INT_DATA_TYPE.UserCount:
                return(CVInterface.GetUserCount());

            case INT_DATA_TYPE.ScreenWidth:
                return(Screen.width);

            case INT_DATA_TYPE.ScreenHeight:
                return(Screen.height);

            default:
                return(0);
            }
        }
Exemplo n.º 10
0
 public void Update()
 {
     CVInterface.SetAmplitudeLevel(AmplitudeValue);
 }
        public void Update()
        {
            if (CVInterface.AreDatasAvailable())
            {
                Vector3 pos = CVInterface.GetJointPos3D(Joint, userIndex);
                if (pos == Vector3.zero)
                {
                    pos = previousValue;
                    if (ProjectionCamera != null && ProjectToPlane && ProjectionPlane != null)
                    {
                        pos.z = ProjectionPlane.transform.position.z;
                    }
                    transform.position = Vector3.Lerp(transform.position, targetPos, .5f);
                    previousValue      = transform.position;

                    return;
                }

                if (ProjectionCamera != null && ProjectToPlane && ProjectionPlane != null)
                {
                    pos   = ProjectionCamera.WorldToViewportPoint(pos);
                    pos.z = ProjectionPlane.position.z;
                    pos   = ProjectionCamera.ViewportToWorldPoint(pos);
                }

                if (bindX)
                {
                    targetPos.x = pos.x;
                }
                else
                {
                    targetPos.x = transform.position.x;
                }

                if (bindY)
                {
                    targetPos.y = pos.y;
                }
                else
                {
                    targetPos.y = transform.position.y;
                }

                if (bindZ)
                {
                    targetPos.z = pos.z;
                }
                else
                {
                    targetPos.z = transform.position.z;
                }

                transform.position = Vector3.Lerp(transform.position, targetPos, .5f);

                previousValue = transform.position;
            }
            else
            {
                Vector3 pos = Vector3.zero;
                if (ProjectionCamera != null && ProjectToPlane && ProjectionPlane != null)
                {
                    pos.z = ProjectionPlane.transform.position.z;
                }

                transform.position = Vector3.Lerp(transform.position, targetPos, .5f);
                previousValue      = transform.position;
            }
        }
Exemplo n.º 12
0
 public static Vector3 GetJointRotation(IRISJoints.Joints joint, int userIndex = 0)
 {
     return(CVInterface.GetJointRot3D(joint, userIndex));
 }
Exemplo n.º 13
0
 public static Texture GetAllBonesTexture()
 {
     return(CVInterface.GetAllBonesTexture());
 }