コード例 #1
0
 internal void RegisterUser(RATUserViewCamera user)
 {
     if (!userViewCameras.Contains(user))
     {
         userViewCameras.Add(user);
     }
 }
コード例 #2
0
        public void Render()
        {
            if (!hasManager)
            {
                return;
            }

            int prevCulling = cam.cullingMask;

            bool maskWasEnabled = false;

            if (dynamicMask != null)
            {
                maskWasEnabled      = dynamicMask.enabled;
                dynamicMask.enabled = false;
            }



            cam.backgroundColor = projectionManager.backgroundColor;
            cam.clearFlags      = CameraClearFlags.SolidColor;
            cam.cullingMask     = projectionManager.textureLayers;
            cam.Render();

            cam.clearFlags = CameraClearFlags.Nothing;
            for (int i = 0; i < userCount; i++)
            {
                RATUserViewCamera userView = projectionManager.userViewCameras[i];
                if (!userView.isActiveAndEnabled)
                {
                    continue;
                }
                userView.RenderProjection(cam);
            }

            if (dynamicMask != null && maskWasEnabled)
            {
                dynamicMask.enabled = maskWasEnabled;
                cam.clearFlags      = CameraClearFlags.Nothing;
                cam.cullingMask     = 0;
                cam.Render();
            }


            //Reset
            cam.cullingMask = prevCulling;
            cam.clearFlags  = CameraClearFlags.SolidColor;
        }
コード例 #3
0
        public void AddUser() //helper method that sets up a simple User with projection passes for both Surface and Depth
        {
            GameObject userGO = new GameObject("User");

            userGO.transform.parent = transform;
            RATUser           user     = userGO.AddComponent <RATUser>();
            RATUserViewCamera userView = userGO.AddComponent <RATUserViewCamera>();
            RATProjectionPass pass1    = userGO.AddComponent <RATProjectionPass>();

            pass1.SetDefaultStaticShaders();
            RATProjectionPass pass2 = userGO.AddComponent <RATProjectionPass>();

            pass2.SetDefaultDynamicShaders();

            user.skeletonProvider = transform.GetComponentInChildren <RATKinectClient>(true);
            RATProjectionPass[] layers = new RATProjectionPass[2];
            layers[0] = pass1;
            layers[1] = pass2;
            userView.projectionLayers = layers;
        }