// Use this for initialization void Start() { if (null == target) { target = renderer; } Image = OpenNIContext.OpenNode(NodeType.Image) as ImageGenerator; inputSize = new Vector2(Image.MapOutputMode.XRes, Image.MapOutputMode.YRes); outputSize = (null != target) ? new Vector2(Mathf.NextPowerOfTwo((int)inputSize.x), Mathf.NextPowerOfTwo((int)inputSize.y)) : new Vector2(inputSize.x, inputSize.y); imageMapTexture = new Texture2D((int)outputSize.x, (int)outputSize.y, TextureFormat.RGB24, false); rawImageMap = new byte[Image.GetMetaData().BytesPerPixel *Image.MapOutputMode.XRes *Image.MapOutputMode.YRes]; imageMapPixels = new Color32[(int)(outputSize.x * outputSize.y)]; if (null != target) { float uScale = inputSize.x / outputSize.x; float vScale = inputSize.y / outputSize.y; target.material.SetTextureScale("_MainTex", new Vector2(uScale, -vScale)); target.material.SetTextureOffset("_MainTex", new Vector2(0.0f, vScale - 1.0f)); target.material.mainTexture = imageMapTexture; } openGl = SystemInfo.graphicsDeviceVersion.Contains("OpenGL"); if (openGl) { print("Running in OpenGL mode"); } }
// Use this for initialization void Start() { print("Graphics device: " + SystemInfo.graphicsDeviceVersion); Image = OpenNIContext.OpenNode(NodeType.Image) as ImageGenerator; //new ImageGenerator(OpenNIContext.Instance.context); imageMapTexture = new Texture2D(Image.MapOutputMode.XRes, Image.MapOutputMode.YRes, TextureFormat.RGB24, false); imageMetaData = new ImageMetaData(); }
void Start() { this.hands.HandCreate += new EventHandler <HandCreateEventArgs>(hands_HandCreate); this.hands.HandUpdate += new EventHandler <HandUpdateEventArgs>(hands_HandUpdate); this.hands.HandDestroy += new EventHandler <HandDestroyEventArgs>(hands_HandDestroy); if (DetectWave) { this.gestures.AddGesture("Wave"); } if (DetectPush) { this.gestures.AddGesture("Click"); } if (ExperimentalGestureless) { this.gestures.AddGesture("RaiseHand"); } this.gestures.GestureRecognized += new EventHandler <GestureRecognizedEventArgs> (gestures_GestureRecognized); if (RotateToUser) { if (null == userGenerator) { userGenerator = OpenNIContext.OpenNode(NodeType.User) as UserGenerator; } } }
// Use this for initialization void Start() { DepthGenerator depth = OpenNIContext.OpenNode(NodeType.Depth) as DepthGenerator; ImageGenerator image = OpenNIContext.OpenNode(NodeType.Image) as ImageGenerator; depth.AlternativeViewpointCapability.SetViewpoint(image); }
// Use this for initialization void Start() { // create hand & gesture generators, if we dont have them yet OpenNIContext.OpenNode(NodeType.Hands); OpenNIContext.OpenNode(NodeType.Gesture); // init session manager sessionManager = new SessionManager(OpenNIContext.Context, "Click", "RaiseHand"); sessionManager.QuickRefocusTimeout = 5; sessionManager.SessionStart += new System.EventHandler <PositionEventArgs>(sessionManager_SessionStart); sessionManager.SessionEnd += new System.EventHandler(sessionManager_SessionEnd); sessionManager.AddListener(broadcaster); }
void Start() { calibratedUsers = new List <int>(); calibratingUsers = new List <int>(); allUsers = new List <int>(); this.userGenerator = OpenNIContext.OpenNode(NodeType.User) as UserGenerator; //new UserGenerator(this.Context.context); this.skeletonCapbility = this.userGenerator.SkeletonCapability; this.poseDetectionCapability = this.userGenerator.PoseDetectionCapability; this.calibPose = this.skeletonCapbility.CalibrationPose; this.skeletonCapbility.SetSkeletonProfile(SkeletonProfile.All); this.userGenerator.NewUser += new EventHandler <NewUserEventArgs>(userGenerator_NewUser); this.userGenerator.LostUser += new EventHandler <UserLostEventArgs>(userGenerator_LostUser); this.poseDetectionCapability.PoseDetected += new EventHandler <PoseDetectedEventArgs>(poseDetectionCapability_PoseDetected); this.skeletonCapbility.CalibrationEnd += new EventHandler <CalibrationEndEventArgs>(skeletonCapbility_CalibrationEnd); }