//################################################################################################################### /// <summary> /// The start method of an UrhoSharp StereoApplication class. Configure the sockets an launch the connections. /// This must not be overrided, use <see cref="Init"/> instead. /// </summary> protected override async void Start() { base.Start(); // call the inherited method Init(); // display initialisation // create and start the camera socket _fRCamera = new UdpFRCamera(); await _fRCamera.Start(); // create the ray collision socket and bind callback methods for ray hit test _rcSocket = new RayCollisionUdpSocket(); _rcSocket.DepthTestFunction += this.DepthTestFunction; // the socket will call this.DepthTestFunction for a request of ray hit test this.RayHitPositionReceived += _rcSocket.RayHitPositionReceived; // the app will call Socket.RayHitPositionReceived for submit 3D coordinate found // create the display socket and bind the method _socket = new DisplayUdpSocket(); _socket.OnReceivedDisplayCommand += this.OnReceivedDisplayCommand; // the socket will call this.OnReceivedDisplayCommand when it receive a command // connection for all the sockets await _fRCamera.Connect(_ip, _cameraSocketPort); await _rcSocket.Connect(_ip, _rayCollisionSocketPort); await _socket.Connect(_ip, _displaySocketPort); }
//################################################################################################################### protected override async void Start() { base.Start(); sphere = this.Scene.CreateChild().CreateComponent <Sphere>(); sphere.Node.SetScale(0.1f); sphere.ViewMask = 0x80000000; // hide from raycasts socket = new RayCollisionUdpSocket(); socket.DepthTestFunction += this.DepthTestFunction; // the socket will call DepthTestFunction for each 2D coordinate this.RayHitPositionReceived += socket.RayHitPositionReceived; // the app will call socket.RayHitPositionReceived for each 3D coordinate found await socket.Connect("192.168.137.1", "9999"); }