public void render(Graphics g) { int cx = g.getClipX(); int cy = g.getClipY(); int cw = g.getClipWidth(); int ch = g.getClipHeight(); g.setClip(Camera.WindowX, Camera.WindowY, Camera.getWidth(), Camera.getHeight()); Camera.render(g); for (int i = 0; i < Sprs.length; i++) { if (Sprs[i].Visible && CCD.cdRect( Sprs[i].X + Sprs[i].animates.w_left, Sprs[i].Y + Sprs[i].animates.w_top, Sprs[i].animates.w_right - Sprs[i].animates.w_left, Sprs[i].animates.w_botton - Sprs[i].animates.w_top, Camera.X, Camera.Y, Camera.getWidth(), Camera.getHeight())) { Sprs[i].OnScreen = true; Sprs[i].render(g, Sprs[i].X - Camera.X + Camera.WindowX, Sprs[i].Y - Camera.Y + Camera.WindowY); } else { Sprs[i].OnScreen = false; } } g.setClip(cx, cy, cw, ch); }
private void InitializeRuntimeDeviceAdapterNameToAdapterIdMapping() { mCurrentRuntimeDeviceAdapterNamesToAdapterIds = new Dictionary <string, CCD.LUID>(); // Initialize the mapping of device names to adapter IDs. // Start with querying all display paths. int numPathArrayElements; int numModeInfoArrayElements; Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.GetDisplayConfigBufferSizes( CCD.QueryDisplayFlags.AllPaths, out numPathArrayElements, out numModeInfoArrayElements)); CCD.DisplayConfigPathInfo[] pathInfoArray = new CCD.DisplayConfigPathInfo[numPathArrayElements]; CCD.DisplayConfigModeInfo[] modeInfoArray = new CCD.DisplayConfigModeInfo[numModeInfoArrayElements]; Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.QueryDisplayConfig( CCD.QueryDisplayFlags.AllPaths, ref numPathArrayElements, pathInfoArray, ref numModeInfoArrayElements, modeInfoArray, IntPtr.Zero)); Dictionary <CCD.LUID, string> adapterIdToAdapterName = new Dictionary <CCD.LUID, string>(); // Find the mapping for each unique LUID -> device adapter name. // Don't use a foreach here because there are some cases where QueryDisplayConfig changes // the length of pathInfoArray to have more elements than numPathArrayElements would indicate, // with the extra elements invalidly initialized to 0s in all of its members. for (int i = 0; i < numPathArrayElements; i++) { CCD.DisplayConfigPathInfo pathInfo = pathInfoArray[i]; if (!adapterIdToAdapterName.ContainsKey(pathInfo.sourceInfo.adapterId)) { CCD.DisplayConfigAdapterName adapterName = new CCD.DisplayConfigAdapterName(); adapterName.header.type = CCD.DisplayConfigDeviceInfoType.GetAdapterName; adapterName.header.adapterId = pathInfo.sourceInfo.adapterId; adapterName.header.size = (uint)Marshal.SizeOf(adapterName); Win32Utilities.ThrowIfResultCodeNotSuccess(CCD.DisplayConfigGetDeviceInfo(ref adapterName)); adapterIdToAdapterName.Add( adapterName.header.adapterId, adapterName.adapterDevicePath); } } // Flip the mapping to adapter name to LUID for usage by DisplayPresets. foreach (KeyValuePair <CCD.LUID, string> luidStringPair in adapterIdToAdapterName) { mCurrentRuntimeDeviceAdapterNamesToAdapterIds.Add( luidStringPair.Value, luidStringPair.Key); } }
/// <summary> /// Gets the display target name. /// </summary> /// <param name="targetAdapterId"></param> /// <param name="targetId"></param> /// <returns></returns> static private CCD.DisplayConfigTargetDeviceName GetTargetDeviceName(CCD.LUID targetAdapterId, uint targetId) { CCD.DisplayConfigTargetDeviceName targetDeviceName = new CCD.DisplayConfigTargetDeviceName(); targetDeviceName.header.type = CCD.DisplayConfigDeviceInfoType.GetTargetName; targetDeviceName.header.size = (uint)System.Runtime.InteropServices.Marshal.SizeOf(targetDeviceName); targetDeviceName.header.adapterId = targetAdapterId; targetDeviceName.header.id = targetId; Win32Utilities.ThrowIfResultCodeNotSuccess(CCD.DisplayConfigGetDeviceInfo(ref targetDeviceName)); return(targetDeviceName); }
void Update() { if (Root == null || Tip == null || Target == null) { Debug.Log("Some inspector variable has not been assigned and is still null."); return; } if (SeedZeroPose) { Actor.SetBoneTransformations(ZeroPose); } CCD.Solve(Root, Tip, Target.position, Target.rotation, Chest, Chest4); }
public CWorld(CMap map, CCamera camera, CSprite[] sprs) { Map = map; Camera = camera; Sprs = sprs; Map.world = this; Camera.world = this; for (int i = 0; i < Sprs.length; i++) { Sprs[i].world = this; if (Sprs[i].mapcd == null) { Sprs[i].mapcd = CCD.createCDRect(0, -4, -4, 8, 8); } } // ZBuffer = new Vector(sprs.length); }
/// <summary> /// Applies the supplied display preset to the system, and dynamically changes it. /// Throws if the settings failed to be applied. /// </summary> /// <param name="displayPreset">The display preset to apply.</param> static public void ApplyPreset(DisplayPreset displayPreset) { AdapterIdMapper.DisplayPresetAdapterIdValidation validationResult = AdapterIdMapper.GetAdapterIdMapper().ValidateDisplayPresetAdapterIds(displayPreset); // Copy to working arrays so that if we need to remap we don't affect the original // display preset data. CCD.DisplayConfigPathInfo[] pathInfoArrayToApply = new CCD.DisplayConfigPathInfo[displayPreset.PathInfoArray.Length]; displayPreset.PathInfoArray.CopyTo(pathInfoArrayToApply, 0); CCD.DisplayConfigModeInfo[] modeInfoArrayToApply = new CCD.DisplayConfigModeInfo[displayPreset.ModeInfoArray.Length]; displayPreset.ModeInfoArray.CopyTo(modeInfoArrayToApply, 0); if (validationResult == AdapterIdMapper.DisplayPresetAdapterIdValidation.NeedAdapterIdRemap) { // TODO: The remap methods return a boolean, though it sorta doesn't matter for us since // we've already done validation. It's the right design that those methods return a // boolean, so maybe we should put an assert here? AdapterIdMapper.GetAdapterIdMapper().RemapDisplayConfigPathInfoAdapterIds(displayPreset, ref pathInfoArrayToApply); AdapterIdMapper.GetAdapterIdMapper().RemapDisplayConfigModeInfoAdapterIds(displayPreset, ref modeInfoArrayToApply); } else if (validationResult == AdapterIdMapper.DisplayPresetAdapterIdValidation.MissingAdapter) { // TODO: Have better interface for handling this case, cuz it's a real case where someone // upgrades a video card for example. throw new Exception("Missing adapter! Can't apply preset."); } else if (validationResult == AdapterIdMapper.DisplayPresetAdapterIdValidation.DisplayPresetMissingAdapterInformation) { // TODO: Handle this better, basically case where schema change throw new Exception("Display Preset is missing adapter name information."); } // Third validation result case is that all the adapter IDs are still valid and map correctly, so no action required. Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.SetDisplayConfig( (uint)pathInfoArrayToApply.Length, pathInfoArrayToApply, (uint)modeInfoArrayToApply.Length, modeInfoArrayToApply, CCD.SdcFlags.Apply | CCD.SdcFlags.UseSuppliedDisplayConfig | CCD.SdcFlags.AllowChanges | CCD.SdcFlags.SaveToDatabase)); }
/// <summary> /// WebApi Json Schema input field information /// </summary> /// <param name="parsedXMLToJsonString"></param> /// <returns></returns> private static string GetCCDDetailsInString(string parsedXMLToJsonString) { var d = new CCD(); d.AffiliationID = "Test"; d.ChartType = "Test"; d.DocumentData = new Int32[1]; d.DocumentData[0] = 0; d.DocumentName = "Test"; d.FileType = "string"; d.FormatReceivedFromVendor = "ccda-pdf"; d.MedicalCodes = new Medicalcodes() { CodeType = "ICD10Dx", DateOfService = "12152019", Value = "E785" }; d.MemberDOB = "10102010"; d.MemberFirstName = "charlotteFN3"; d.MemberKey = "123"; d.MemberKeyType = "Medicare"; d.MemberLastName = "charlotteLN3"; d.NPI = ""; d.OriginalFileName = "Test"; d.ProviderFirstName = "Test"; d.ProviderKey = "Test"; d.ProviderLastName = "Test"; d.ProviderMiddleName = "Test"; d.TIN = "Test"; d.TemporaryFileName = "Test"; d.UUID = "Test"; d.VendorKey = "123"; d.VendorName = "charlotteVendor"; return(JsonConvert.SerializeObject(d)); }
void Update() { if (Root == null || Tip == null) { Debug.Log("Some inspector variable has not been assigned and is still null."); return; } Transform[] chain = CCD.GetChain(Root, Tip); if (chain.Length == 0) { Debug.Log("Given root and tip are not valid."); return; } GameObject rightShoulder = GameObject.Find("RightShoulder"); GameObject rightElbow = GameObject.Find("RightElbow"); GameObject rightWrist = GameObject.Find("RightWrist"); // Moving hand to initial position if (step == 0) { rightShoulder.transform.localRotation = Quaternion.RotateTowards(rightShoulder.transform.localRotation, Quaternion.Euler(0f, 45f, 0f), 20f * Time.deltaTime); rightElbow.transform.localRotation = Quaternion.RotateTowards(rightElbow.transform.localRotation, Quaternion.Euler(0f, 30f, 0f), 15f * Time.deltaTime); rightWrist.transform.localRotation = Quaternion.RotateTowards(rightWrist.transform.localRotation, Quaternion.Euler(0f, 0f, -60f), 20f * Time.deltaTime); // Checking if target rotation has been reached in order to switch to the next step. if (rightElbow.transform.localRotation == Quaternion.Euler(0f, 30f, 0f) && rightShoulder.transform.localRotation == Quaternion.Euler(0f, 45f, 0f) && rightWrist.transform.localRotation == Quaternion.Euler(0f, 0f, -60f)) { step = 1; } } // First quarter of the circle else if (step == 1) { rightShoulder.transform.localRotation = Quaternion.RotateTowards(rightShoulder.transform.localRotation, Quaternion.Euler(0f, 90f, -45f), 20f * Time.deltaTime); rightElbow.transform.localRotation = Quaternion.RotateTowards(rightElbow.transform.localRotation, Quaternion.Euler(0f, 0f, 30f), 15f * Time.deltaTime); rightWrist.transform.localRotation = Quaternion.RotateTowards(rightWrist.transform.localRotation, Quaternion.Euler(0f, 0f, -60f), 20f * Time.deltaTime); if (rightElbow.transform.localRotation == Quaternion.Euler(0f, 0f, 30f) && rightShoulder.transform.localRotation == Quaternion.Euler(0f, 90f, -45f) && rightWrist.transform.localRotation == Quaternion.Euler(0f, 0f, -60f)) { step = 2; } } // Second quarter of the circle else if (step == 2) { rightShoulder.transform.localRotation = Quaternion.RotateTowards(rightShoulder.transform.localRotation, Quaternion.Euler(0f, 135f, 0f), 20f * Time.deltaTime); rightElbow.transform.localRotation = Quaternion.RotateTowards(rightElbow.transform.localRotation, Quaternion.Euler(0f, 0f, 10f), 15f * Time.deltaTime); rightWrist.transform.localRotation = Quaternion.RotateTowards(rightWrist.transform.localRotation, Quaternion.Euler(0f, 0f, -50f), 20f * Time.deltaTime); if (rightElbow.transform.localRotation == Quaternion.Euler(0f, 0f, 10f) && rightShoulder.transform.localRotation == Quaternion.Euler(0f, 135f, 0f) && rightWrist.transform.localRotation == Quaternion.Euler(0f, 0f, -50f)) { step = 3; } } // Third qaurter of the circle else if (step == 3) { rightShoulder.transform.localRotation = Quaternion.RotateTowards(rightShoulder.transform.localRotation, Quaternion.Euler(0f, 90f, 45f), 20f * Time.deltaTime); rightElbow.transform.localRotation = Quaternion.RotateTowards(rightElbow.transform.localRotation, Quaternion.Euler(0f, 0f, -10f), 15f * Time.deltaTime); rightWrist.transform.localRotation = Quaternion.RotateTowards(rightWrist.transform.localRotation, Quaternion.Euler(0f, 0f, -60f), 20f * Time.deltaTime); if (rightElbow.transform.localRotation == Quaternion.Euler(0f, 0f, -10f) && rightShoulder.transform.localRotation == Quaternion.Euler(0f, 90f, 45f) && rightWrist.transform.localRotation == Quaternion.Euler(0f, 0f, -60f)) { step = 4; } } // Fourth quater of the circle else if (step == 4) { rightShoulder.transform.localRotation = Quaternion.RotateTowards(rightShoulder.transform.localRotation, Quaternion.Euler(0f, 45f, 0f), 20f * Time.deltaTime); rightElbow.transform.localRotation = Quaternion.RotateTowards(rightElbow.transform.localRotation, Quaternion.Euler(0f, 30f, 0f), 15f * Time.deltaTime); rightWrist.transform.localRotation = Quaternion.RotateTowards(rightWrist.transform.localRotation, Quaternion.Euler(0f, 0f, -60f), 20f * Time.deltaTime); if (rightElbow.transform.localRotation == Quaternion.Euler(0f, 30f, 0f) && rightShoulder.transform.localRotation == Quaternion.Euler(0f, 45f, 0f) && rightWrist.transform.localRotation == Quaternion.Euler(0f, 0f, -60f)) { step = 1; } } }
public static void TestCCDExampleCode(CCD.QueryDisplayFlags queryDisplayFlags) { int resultCode; int numPathArrayElements; int numModeInfoArrayElements; // Get buffer size required to enumerate all valid paths. resultCode = CCD.GetDisplayConfigBufferSizes(queryDisplayFlags, out numPathArrayElements, out numModeInfoArrayElements); Win32Utilities.ThrowIfResultCodeNotSuccess(resultCode); CCD.DisplayConfigPathInfo[] pathInfoArray = new CCD.DisplayConfigPathInfo[numPathArrayElements]; CCD.DisplayConfigModeInfo[] modeInfoArray = new CCD.DisplayConfigModeInfo[numModeInfoArrayElements]; resultCode = CCD.QueryDisplayConfig( queryDisplayFlags, ref numPathArrayElements, pathInfoArray, ref numModeInfoArrayElements, modeInfoArray, IntPtr.Zero); Win32Utilities.ThrowIfResultCodeNotSuccess(resultCode); foreach (CCD.DisplayConfigPathInfo configPathInfo in pathInfoArray) { ConsoleOutputUtilities.WriteDisplayConfigPathInfoToConsole(configPathInfo); Console.WriteLine(); } foreach (CCD.DisplayConfigModeInfo configModeInfo in modeInfoArray) { ConsoleOutputUtilities.WriteDisplayConfigModeInfoToConsole(configModeInfo); Console.WriteLine(); } // Find and store the primary path based by looking for an active path that is located at desktop position // 0,0 CCD.DisplayConfigPathInfo primaryPath = new CCD.DisplayConfigPathInfo(); bool primaryPathFound = false; foreach (CCD.DisplayConfigPathInfo configPathInfo in pathInfoArray) { if ((configPathInfo.flags & (uint)CCD.DisplayConfigFlags.PathActive) > 0) { if (configPathInfo.sourceInfo.modeInfoIdx > modeInfoArray.Length - 1) { throw new Exception("Config Path Info Source Mode Info Index is out of range."); } CCD.DisplayConfigModeInfo modeInfo = modeInfoArray[configPathInfo.sourceInfo.modeInfoIdx]; if (modeInfo.infoType == CCD.DisplayConfigModeInfoType.Source && modeInfo.sourceMode.position.x == 0 && modeInfo.sourceMode.position.y == 0) { // Bingo primaryPath = configPathInfo; primaryPathFound = true; break; } } } if (!primaryPathFound) { throw new Exception("Failed to find primary display path!"); } CCD.DisplayConfigTargetDeviceName dcTargetDeviceName = new CCD.DisplayConfigTargetDeviceName(); dcTargetDeviceName.header.type = CCD.DisplayConfigDeviceInfoType.GetTargetName; dcTargetDeviceName.header.size = (uint)Marshal.SizeOf(dcTargetDeviceName); dcTargetDeviceName.header.adapterId = primaryPath.targetInfo.adapterId; dcTargetDeviceName.header.id = primaryPath.targetInfo.id; resultCode = CCD.DisplayConfigGetDeviceInfo(ref dcTargetDeviceName); Win32Utilities.ThrowIfResultCodeNotSuccess(resultCode); ConsoleOutputUtilities.WriteDisplayConfigTargetDeviceNameToConsole(dcTargetDeviceName); Console.WriteLine(); CCD.DisplayConfigSourceDeviceName dcSourceDeviceName = new CCD.DisplayConfigSourceDeviceName(); dcSourceDeviceName.header.type = CCD.DisplayConfigDeviceInfoType.GetSourceName; dcSourceDeviceName.header.size = (uint)Marshal.SizeOf(dcSourceDeviceName); dcSourceDeviceName.header.adapterId = primaryPath.sourceInfo.adapterId; dcSourceDeviceName.header.id = primaryPath.sourceInfo.id; resultCode = CCD.DisplayConfigGetDeviceInfo(ref dcSourceDeviceName); Win32Utilities.ThrowIfResultCodeNotSuccess(resultCode); ConsoleOutputUtilities.WriteDisplayConfigSourceDeviceNameToConsole(dcSourceDeviceName); CCD.DisplayConfigAdapterName dcAdapterName = new CCD.DisplayConfigAdapterName(); dcAdapterName.header.type = CCD.DisplayConfigDeviceInfoType.GetAdapterName; dcAdapterName.header.size = (uint)Marshal.SizeOf(dcAdapterName); dcAdapterName.header.adapterId = primaryPath.sourceInfo.adapterId; Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.DisplayConfigGetDeviceInfo(ref dcAdapterName)); ConsoleOutputUtilities.WriteDisplayConfigAdapterNameToConsole(dcAdapterName); CCD.DisplayConfigTargetPreferredMode dcTargetPreferredMode = new CCD.DisplayConfigTargetPreferredMode(); dcTargetPreferredMode.header.type = CCD.DisplayConfigDeviceInfoType.GetTargetPreferredMode; dcTargetPreferredMode.header.size = (uint)Marshal.SizeOf(dcTargetPreferredMode); dcTargetPreferredMode.header.adapterId = primaryPath.targetInfo.adapterId; dcTargetPreferredMode.header.id = primaryPath.targetInfo.id; Win32Utilities.ThrowIfResultCodeNotSuccess(CCD.DisplayConfigGetDeviceInfo(ref dcTargetPreferredMode)); }
public EndExposureParams(CCD ccd) { this.ccd = ccd; }
/// <summary> /// Records the current display configuration as a display preset. /// </summary> /// <param name="presetName">Name of the preset to create</param> /// <returns>A DisplayPreset with the current configuration and supplied name. /// Throws exception if failed to get display configuration paths and modes.</returns> static public DisplayPreset RecordCurrentConfiguration(string presetName) { DisplayPreset displayPreset = null; const CCD.QueryDisplayFlags OnlyActivePathsFlag = CCD.QueryDisplayFlags.OnlyActivePaths; int numPathArrayElements; int numModeInfoArrayElements; // Get the buffer sizes needed to hold the active paths and the source/target mode table. Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.GetDisplayConfigBufferSizes( OnlyActivePathsFlag, out numPathArrayElements, out numModeInfoArrayElements)); CCD.DisplayConfigPathInfo[] pathInfoArray = new CCD.DisplayConfigPathInfo[numPathArrayElements]; CCD.DisplayConfigModeInfo[] modeInfoArray = new CCD.DisplayConfigModeInfo[numModeInfoArrayElements]; // Get the active paths and their associated source/target modes. Win32Utilities.ThrowIfResultCodeNotSuccess( CCD.QueryDisplayConfig( OnlyActivePathsFlag, ref numPathArrayElements, pathInfoArray, ref numModeInfoArrayElements, modeInfoArray, IntPtr.Zero)); displayPreset = new DisplayPreset(presetName); displayPreset.PathInfoArray = pathInfoArray; displayPreset.ModeInfoArray = modeInfoArray; // Save the Target Device Name structs to log the monitor output devices. This isn't // actually used for anything but makes the XML output more readable. CCD.DisplayConfigTargetDeviceName[] targetDeviceNameArray = new CCD.DisplayConfigTargetDeviceName[pathInfoArray.Length]; for (int i = 0; i < pathInfoArray.Length; i++) { targetDeviceNameArray[i] = GetTargetDeviceName(pathInfoArray[i].targetInfo.adapterId, pathInfoArray[i].targetInfo.id); } displayPreset.TargetDeviceNames = targetDeviceNameArray; // Save the Adapter Name structs. The adapter ID values may change on reboot, as they // appear to simply be a logical, run-time value rather than a persistent identifier. // So we save the Adapter Name structs to log a device name that the adapter ID maps to. // We can use this to update the adapter IDs we save in our presets such that the presets // will still be usable after a reboot. Otherwise, when the machine is rebooted and the // user tries to apply a saved preset, the API call will fail because the adapter ID has // changed. Dictionary <CCD.LUID, CCD.DisplayConfigAdapterName> adapterIdToAdapterName = new Dictionary <CCD.LUID, CCD.DisplayConfigAdapterName>(); // Find all the unique adapter IDs used in the active paths and capture the display adapter // device names that those IDs map to. foreach (CCD.DisplayConfigPathInfo pathInfo in pathInfoArray) { if (!adapterIdToAdapterName.ContainsKey(pathInfo.sourceInfo.adapterId)) { CCD.DisplayConfigAdapterName adapterName = new CCD.DisplayConfigAdapterName(); adapterName.header.adapterId = pathInfo.sourceInfo.adapterId; adapterName.header.size = (uint)System.Runtime.InteropServices.Marshal.SizeOf(adapterName); adapterName.header.type = CCD.DisplayConfigDeviceInfoType.GetAdapterName; Win32Utilities.ThrowIfResultCodeNotSuccess(CCD.DisplayConfigGetDeviceInfo(ref adapterName)); adapterIdToAdapterName.Add(adapterName.header.adapterId, adapterName); } } displayPreset.AdapterNames = adapterIdToAdapterName.Values.ToArray(); return(displayPreset); }