void Start() { _main = GetComponent <Main>(); _properties = GetComponent <Properties>(); _filteredHandPosition = new AdaptiveDoubleExponentialFilterVector3(); _bodiesManager = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); }
void Awake() { Application.runInBackground = true; properties = GetComponent <Properties>(); try { properties.load(location); } catch (NegativeRuntimeException e) { Debug.LogException(e); strategicExit(); } _negativeSpace = GetComponent <NegativeSpace>(); _projection = Camera.main.GetComponent <PerspectiveProjection>(); _surfaceRequestListener = GetComponent <SurfaceRequestListener>(); _surfaceRequestListener.StartReceive(); GetComponent <SurfaceRequest>().request(); _udpBodiesListener = GameObject.Find("BodiesManager").GetComponent <UdpBodiesListener>(); _bodies = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); _udpBodiesListener.startListening(int.Parse(properties.localSetupInfo.trackerBroadcastPort)); }
void Start() { _main = GetComponent <Main>(); _properties = GetComponent <Properties>(); _log = GetComponent <VisualLog>(); _bodiesManager = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); _rpc = GetComponent <RPCWorkspace>(); }
void Awake() { Application.runInBackground = true; _surfaceRequestListener = GetComponent <SurfaceRequestListener>(); _properties = GetComponent <Properties>(); _log = GetComponent <VisualLog>(); _negativeSpace = GetComponent <NegativeSpace>(); _bodiesListener = GameObject.Find("BodiesManager").GetComponent <UdpBodiesListener>(); _bodies = GameObject.Find("BodiesManager").GetComponent <BodiesManager>(); _prespectiveProjection = Camera.main.GetComponent <PerspectiveProjection>(); _tracker = GameObject.Find("RavatarManager").GetComponent <Tracker>(); _tcpKinectListener = GameObject.Find("RavatarManager").GetComponent <TcpKinectListener>(); _workspace = GetComponent <RPCWorkspace>(); _properties.load(); ConfigLoaded = _properties.ConfigLoaded; if (!ConfigLoaded) { _log.Show = true; } else { _log.WriteLine(this, "Config Loaded"); _surfaceRequestListener.StartReceive(); } if (location == Location.A) { _workspace.InitServer(); } else { _workspace.InitClient(); } }
void Update() { if (_perspectiveProjection.SurfaceCalibrated) { if (!_spaceCreated) { _createNegativeSpace(); origin = GameObject.Find("ScreenCenter").transform; _bodiesManager = GameObject.Find("BodiesManagerGO").GetComponent <BodiesManager>(); _surface = new NegativespaceSurface(); //Debug.Log("waiting"); } //_syncNSObjects(); //_updateCursors(); //_NSNetwork.lockObject(o.name); //_NSNetwork.unlockObject(o.name); //_DEBUG_NEGATIVESPACECONNECTIONS(); } }
private void SetupCurrentDisplay(DisplayFrameType newDisplayFrameType) { currentDisplayFrameType = newDisplayFrameType; // Frames used by more than one type are declared outside the switch statement FrameDescription colorFrameDescription = null; //reset the display methods if (BodyJointsGrid != null) { BodyJointsGrid.Visibility = Visibility.Collapsed; } if (FrameDisplayImage != null) { FrameDisplayImage.Source = null; } switch (currentDisplayFrameType) { case DisplayFrameType.Infrared: FrameDescription infraredFrameDescription = kinectSensor.InfraredFrameSource.FrameDescription; CurrentFrameDescription = infraredFrameDescription; // allocate space to put the pixels being received and converted infraredFrameData = new ushort[infraredFrameDescription.Width * infraredFrameDescription.Height]; infraredPixels = new byte[infraredFrameDescription.Width * infraredFrameDescription.Height * BYTES_PER_PIXEL]; bitmap = new WriteableBitmap(infraredFrameDescription.Width, infraredFrameDescription.Height); break; case DisplayFrameType.Color: colorFrameDescription = kinectSensor.ColorFrameSource.FrameDescription; CurrentFrameDescription = colorFrameDescription; // create the bitmap bitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height); break; case DisplayFrameType.Depth: FrameDescription depthFrameDescription = kinectSensor.DepthFrameSource.FrameDescription; CurrentFrameDescription = depthFrameDescription; depthFrameData = new ushort[depthFrameDescription.Width * depthFrameDescription.Height]; depthPixels = new byte[depthFrameDescription.Width * depthFrameDescription.Height * BYTES_PER_PIXEL]; bitmap = new WriteableBitmap(depthFrameDescription.Width, depthFrameDescription.Height); break; case DisplayFrameType.BodyMask: colorFrameDescription = kinectSensor.ColorFrameSource.FrameDescription; CurrentFrameDescription = colorFrameDescription; colorMappedToDepthPoints = new DepthSpacePoint[colorFrameDescription.Width * colorFrameDescription.Height]; bitmap = new WriteableBitmap(colorFrameDescription.Width, colorFrameDescription.Height); break; case DisplayFrameType.BodyJoints: // instantiate a new Canvas drawingCanvas = new Canvas(); drawingCanvas.Clip = new RectangleGeometry(); drawingCanvas.Clip.Rect = new Rect(0.0, 0.0, BodyJointsGrid.Width, BodyJointsGrid.Height); // reset the body joints grid BodyJointsGrid.Visibility = Visibility.Visible; BodyJointsGrid.Children.Clear(); // add canvas to DisplayGrid BodyJointsGrid.Children.Add(drawingCanvas); bodiesManager = new BodiesManager(coordinateMapper, drawingCanvas, kinectSensor.BodyFrameSource.BodyCount); break; default: break; } }
public void setPointsUncompressed(byte[] colorBytes, byte[] depthBytes) { _depthTex.LoadRawTextureData(depthBytes); _colorTex.LoadRawTextureData(colorBytes); _colorTex.Apply(); _depthTex.Apply(); //BodiesManager b = GameObject.Find( _local ? "LocalBodiesManager" : "RemoteBodiesManager").GetComponent<BodiesManager>(); //IKWarpInfo wi = b.armsWarpInfo; try { //Body b = GameObject.Find("BodiesManager").GetComponent<BodiesManager>().human.body; BodiesManager bm = GameObject.Find("BodiesManagerCat").GetComponent <BodiesManager>(); MeshRenderer[] renderers = GetComponentsInChildren <MeshRenderer>(); for (int i = 0; i < renderers.Length; i++) { MeshRenderer mr = renderers[i]; mr.material.SetInt("_TexScale", _texScale); mr.material.SetTexture("_ColorTex", _colorTex); mr.material.SetTexture("_DepthTex", _depthTex); mr.material.SetFloat("_sigmaS", sigmaS); mr.material.SetFloat("_sigmaS", sigmaS); mr.material.SetInt("_SizeFilter", medianFilterSize); mr.material.SetInt("_calculateNormals", calculateNormals ? 1 : 0); mr.material.SetInt("_RemoveHead", bm.removeHead ? 1 : 0); mr.material.SetVector("_VRHead", bm.head.position); mr.material.SetFloat("_HeadSize", bm.headSize); mr.material.SetFloat("_Y_HeadOffset", bm.Y_HeadOffset); //mr.material.SetInt("_Warping", 0); //mr.material.SetInt("_RemoveHead", wi.removeHead ? 1 : 0); //mr.material.SetVector("_VRHead", wi.VRHead); //mr.material.SetFloat("_HeadSize", wi.headSize); //mr.material.SetFloat("_Y_HeadOffset", wi.Y_HeadOffset); //if (!_local) //{ // //mr.material.SetInt("_LeftWarping", wi.leftWarping ? 1 : 0); // //mr.material.SetInt("_RightWarping", wi.rightWarping ? 1 : 0); // mr.material.SetInt("_LeftWarping", 1); // mr.material.SetInt("_RightWarping", 1); // mr.material.SetInt("_Debug", wi.debug ? 1 : 0); // mr.material.SetFloat("_tabley", b.table.position.y); // mr.material.SetVector("_LEFT_OriginalShoulder", wi.LEFT_OriginalShoulder); // mr.material.SetVector("_LEFT_OriginalElbow", wi.LEFT_OriginalElbow); // mr.material.SetVector("_LEFT_OriginalWrist", wi.LEFT_OriginalWrist); // mr.material.SetVector("_LEFT_OriginalHandTip", wi.LEFT_OriginalHandTip); // mr.material.SetVector("_RIGHT_OriginalShoulder", wi.RIGHT_OriginalShoulder); // mr.material.SetVector("_RIGHT_OriginalElbow", wi.RIGHT_OriginalElbow); // mr.material.SetVector("_RIGHT_OriginalWrist", wi.RIGHT_OriginalWrist); // mr.material.SetVector("_RIGHT_OriginalHandTip", wi.RIGHT_OriginalHandTip); // mr.material.SetMatrix("_LEFT_UpperArmMatrix", wi.LEFT_UpperArmMatrix); // mr.material.SetMatrix("_LEFT_ForearmMatrix", wi.LEFT_ForearmMatrix); // mr.material.SetMatrix("_LEFT_HandMatrix", wi.LEFT_HandMatrix); // mr.material.SetMatrix("_RIGHT_UpperArmMatrix", wi.RIGHT_UpperArmMatrix); // mr.material.SetMatrix("_RIGHT_ForearmMatrix", wi.RIGHT_ForearmMatrix); // mr.material.SetMatrix("_RIGHT_HandMatrix", wi.RIGHT_HandMatrix); // //////// BODY // mr.material.SetVector("head", b.head.position); // mr.material.SetVector("neck", b.head.position); // mr.material.SetVector("spineShoulder", b.spineShoulder.position); // mr.material.SetVector("spineMid", b.spineMid.position); // mr.material.SetVector("spineBase", b.spineBase.position); // mr.material.SetVector("leftShoulder", wi.LEFT_OriginalShoulder); // mr.material.SetVector("leftElbow", wi.LEFT_OriginalElbow); // mr.material.SetVector("leftWrist", wi.LEFT_OriginalWrist); // mr.material.SetVector("leftHand", b.leftHand.position); // mr.material.SetVector("leftThumb", b.leftThumb.position); // mr.material.SetVector("leftHandTip", wi.LEFT_OriginalHandTip); // mr.material.SetVector("leftHip", b.leftHip.position); // mr.material.SetVector("leftKnee", b.leftKnee.position); // mr.material.SetVector("leftAnkle", b.leftAnkle.position); // mr.material.SetVector("leftFoot", b.leftFoot.position); // mr.material.SetVector("rightShoulder", wi.RIGHT_OriginalShoulder); // mr.material.SetVector("rightElbow", wi.RIGHT_OriginalElbow); // mr.material.SetVector("rightWrist", wi.RIGHT_OriginalWrist); // mr.material.SetVector("rightHand", b.rightHand.position); // mr.material.SetVector("rightThumb", b.rightThumb.position); // mr.material.SetVector("rightHandTip", wi.RIGHT_OriginalHandTip); // mr.material.SetVector("rightHip", b.rightHip.position); // mr.material.SetVector("rightKnee", b.rightKnee.position); // mr.material.SetVector("rightAnkle", b.rightAnkle.position); // mr.material.SetVector("rightFoot", b.rightFoot.position); // mr.material.SetVector("LEGBONE", b.LEGBONE.position); //} } } catch { print("no body"); } }