public Main() { InitializeComponent(); receiver = new TelemetryReceiver(dataStream, translator); lastMousePosition = MousePosition; PlaneMeshId = mainViewport.Renderer.Meshes.AddPlane(10, 10, new Vector3(-10.0f, 0.0f, -10.0f), new Vector3(10.0f, 0.0f, 10.0f)); CubeMeshId = mainViewport.Renderer.Meshes.AddCubeMesh(); TetrahedronMeshId = mainViewport.Renderer.Meshes.AddTetrahedron(); mainViewport.Renderer.Camera.CameraPosition = new Vector3(0.0f, 0.0f, 15.0f); RenderInstance instanceToRender = new RenderInstance(Matrix.Translation(0.0f, 0.0f, 0.0f), PlaneMeshId); instanceToRender.Fill = RenderInstance.FillMode.eWireFrame; instanceToRender.Material.ColourTint = new Vector4(0.0f, 0.0f, 0.0f, 1.0f); mainViewport.Renderer.InstanceList.Add(instanceToRender); clock.Start(); updateTimer.Start(); controller.FrameChanged += Controller_FrameChanged; controller.MaxFrameChanged += Controller_MaxFrameChanged; controller.StateChanged += Controller_StateChanged; controller.State = PlayBackState.eStaticFrame; sceneGraphView.SelectionChanged += SceneGraphView_SelectionChanged; BuildAndSetApplicationTitleString(); graphChannelPropertyGrid.SelectedObject = channelCollection; }
private static void recv(object inputPayload) { TelemetryReceiver payload = (TelemetryReceiver)inputPayload; // while we're connected and no request has been made to stop processing while (payload.DataStream.Connected && !payload.StopThreadSwitch) { Telemetry.Network.BasePacketHeader basePacket = payload.DataStream.ReceiveData(); if (basePacket != null) { if (payload.Translator.TranslatePacket(basePacket)) { // todo: error - don't pull out packets that aren't complete foreach (Tuple <bool, FrameSnapshot> snapshot in payload.Translator.ConstructedSnaphots.Values) { lock (payload.LockObject) { payload.ReceivedFrameSnapshots.Enqueue(snapshot.Item2); } } foreach (FrameStats stats in payload.Translator.ConstructedFrameStats.Values) { lock (payload.LockObject) { payload.ReceivedFrameStats.Enqueue(stats); } } foreach (PacketTranslator.CollectedFrameShapes frameShapeList in payload.Translator.AddedShapes.Values) { lock (payload.LockObject) { payload.ReceivedShapes.Enqueue(frameShapeList); } } payload.Translator.ConstructedSnaphots.Clear(); payload.Translator.AddedShapes.Clear(); payload.Translator.ConstructedFrameStats.Clear(); } else { Console.WriteLine($"Error: read unknown packet type: {basePacket.PacketBytes}"); } } else { Console.WriteLine("No data to receive"); // todo - this number should be driven by the frame update time sent over or by a config option Thread.Sleep(5); // we're running faster/as fast as the producer of the data - take a brief break } } }