public SocketCommand ProcessCommand(SocketCommand commandToProcess) { _currentCommand = commandToProcess; _returnCommandObject = new SocketCommand(); // extract command from command object switch (commandToProcess.Command) { case CommandType.Initialize: { VX_DISPLAY_TYPES displayType = VX_DISPLAY_TYPES.VX_DISPLAY_VGA; VX_FORMAT_TYPES formatType = VX_FORMAT_TYPES.VX_FORMAT_720P; if (commandToProcess.Parameters.Count != 0) { CommandParameter displayTypeParameter = commandToProcess.Parameters.Find(delegate(CommandParameter foundList) { return(foundList.Name == "DisplayType"); }); if (displayTypeParameter != null) { displayType = (VX_DISPLAY_TYPES)displayTypeParameter.Value; } CommandParameter formatTypeParameter = commandToProcess.Parameters.Find(delegate(CommandParameter foundList) { return(foundList.Name == "FormatType"); }); if (formatTypeParameter != null) { formatType = (VX_FORMAT_TYPES)formatTypeParameter.Value; } } CommandParameter workingDirectory = commandToProcess.Parameters.Find(delegate(CommandParameter foundList) { return(foundList.Name == "WorkingDirectory"); }); _previewScene.WorkingDirectory = workingDirectory.Value.ToString(); _outputScene.WorkingDirectory = workingDirectory.Value.ToString(); _previewScene.InitializeScene(VX_DISPLAY_TYPES.VX_DISPLAY_VGA, formatType); _outputScene.InitializeScene(displayType, formatType); _returnCommandObject = null; break; } //#region "LoadTemplate" //// //// LoadTemplate //// //case CommandType.LoadTemplate: // { // if (commandToProcess.Parameters.Count != 0) // { // //string templateName = GetParameter("TemplateName", commandToProcess); // string templateDirectory = GetParameter("TemplateDirectory", commandToProcess); // //if ((!string.IsNullOrEmpty(templateDirectory)) && (templateDirectory != _workingDirectory)) // //{ // // templateName = templateDirectory + "\\" + templateName; // //} // string templateName = GetTemplateName(commandToProcess); // if (!string.IsNullOrEmpty(templateName)) // { // _returnCommandObject = GraphicsPlayer.gfxPlayer.LoadTemplate(templateName); // } // else // { // _returnCommandObject = CreateCommandFailedObject("TemplateName cannot be nothing", // commandToProcess.CommandID); // } // //CommandParameter outputFormatParameter = CommandToProcess.Parameters.Find(delegate(CommandParameter foundList) { return foundList.Name == "TemplateName"; }); // //if (outputFormatParameter != null) { outputFormat = outputFormatParameter.Value; } // } // break; // } //#endregion // didn't really see a difference between ShowPage and UpdatePage commands; combining for now case CommandType.ShowPage: case CommandType.UpdatePage: { _returnCommandObject = ShowUpdatePage(commandToProcess); break; } case CommandType.HidePage: { if (commandToProcess.Parameters.Count != 0) { string templateName = GetParameter("TemplateName", commandToProcess).ToString(); string queueCommandString = GetParameter("QueueCommand", commandToProcess).ToString(); string destSceneString = GetParameter("DestScene", commandToProcess).ToString(); bool queueCommand = false; Output destScene = _previewScene; if (!string.IsNullOrEmpty(queueCommandString)) { queueCommand = (queueCommandString == "TRUE"); } if (!string.IsNullOrEmpty(destSceneString)) { if (destSceneString.ToUpper() == "AIR") { destScene = _outputScene; } else { destScene = _previewScene; } } if (!string.IsNullOrEmpty(queueCommandString)) { queueCommand = (queueCommandString == "TRUE"); } if (templateName != null) { try { destScene.PageEngine.HidePage(templateName, queueCommand); } catch { //for some reason HidePage was throwing an exception when a page wasn't visible...eventually figure out what the deal is } } else { _returnCommandObject = CreateCommandFailedObject("TemplateName cannot be nothing", commandToProcess.CommandID); } } break; } case CommandType.SetCalibrationFile: { _outputScene.CalibrationFile = GetParameter("CalibrationFile", commandToProcess).ToString(); _previewScene.CalibrationFile = GetParameter("CalibrationFile", commandToProcess).ToString(); break; } case CommandType.SetTelemetryFile: { _outputScene.TelemetryFile = GetParameter("TelemetryFile", commandToProcess).ToString(); _previewScene.TelemetryFile = GetParameter("TelemetryFile", commandToProcess).ToString(); break; } default: { _currentCommand = null; return(null); } } if (_returnCommandObject != null) { _returnCommandObject.CommandID = commandToProcess.CommandID; _currentCommand = null; if (_returnCommandObject.Command == CommandType.CommandFailed) { //LogAccess.WriteLog("Command Failed. Reason = " + GetParameter("exception", _returnCommandObject), "CommandProcessor"); } } //LogAccess.WriteLog("> Done Processing " + commandToProcess.Command, "CommandProcessor"); return(_returnCommandObject); }
public void InitializeScene(VX_DISPLAY_TYPES displayType, VX_FORMAT_TYPES formatType) { //init, with aa turned on since we have 3d elements Scene.EnableFullScreenAA = true; Scene.Initialize(displayType, formatType); //Scene.CanvasScaleToFit = 1; Scene.EnableInputVideo = true; // get the scene cast in its different forms IVxScene sceneInterface = (IVxScene)Scene.GetOcx(); object sceneObject = (object)sceneInterface; if (displayType == VX_DISPLAY_TYPES.VX_DISPLAY_XMIO) { VtxXmioLib.VX_FORMAT_TYPES xmioFormatType = VtxXmioLib.VX_FORMAT_TYPES.VX_FORMAT_720P; switch (formatType) { case VX_FORMAT_TYPES.VX_FORMAT_1080P_5000: xmioFormatType = VtxXmioLib.VX_FORMAT_TYPES.VX_FORMAT_1080P_5000; break; } _videoMixer = new VtxXmioLib.VxMixerClass(); _videoInput = new VtxXmioLib.VxVideoInput(); _videoMixer.Initialize2(1, 0, 1, 0, xmioFormatType, true); _videoMixer.ConnectVideoInput(_videoInput); _videoMixer.EnableOnboardCompositor = true; _videoInput.EnableVideo = true; sceneInterface.SetAdjust((int)DSUITE_CP_TYPES.DSUITE_GENLOCK, 1, 0); } sceneInterface.SetCommandQueueID(0); // instance and init pageengine PageEngine = new VxPageEngine(); PageEngine.Initialize(sceneInterface); PageEngine.SetWorkingDirectory(WorkingDirectory); // load virtual camera template PageEngine.LoadTemplate("VirtualCamera"); PageEngine.ShowPage("VirtualCamera", true); PageEngine.DeactivateTimeline("VirtualCamera", "HOME", false); //PageEngine.LoadTemplate("Field"); //PageEngine.ShowPage("Field", true); //PageEngine.FlushQueuedCommands(); // setup scenebrowser _sceneBrowser.SetScene(ref sceneObject); _sceneBrowser.Refresh(); // bind members to template //_templateFrame = Scene.Frames.Item("Field"); //_rotateFrame = _templateFrame.Frames.Item("RotateFrame"); //BallFrame = (IVxMesh3D)_templateFrame.Frames.Item("SoccerBall"); //FieldFrame = (IVxMesh3D)_rotateFrame.Frames.Item("FieldScan"); // turn off hit testing on example trees //foreach (IVxFrame it in FieldFrame.Frames) //{ // it.EnableHitTest = false; //} Camera = (IVxCamera)Scene.Frames.DescendantItem("Virtual Camera"); Camera.NearPlane = 10; //0.00001f; // 10 Camera.FarPlane = 100000; //1000;//100000; Camera.Highlight = 1; Camera.LookThrough = true; IVxPropertySet propertySet = null; Camera.GetPropertySet(ref propertySet, true); propertySet.Set("AimMethod", (int)VX_AIM_METHOD.VX_AIM_METHOD_CAM_FRAME); Scene.InternalComposite = VX_INTERNAL_COMPOSITE_TYPES.VX_ICOMP_LIVE_INPUT | VX_INTERNAL_COMPOSITE_TYPES.VX_ICOMP_SHAPED; // push updated hit test parameters to the template Scene.Update(); // ready! _initialized = true; }