/// <summary> /// PrintDoc /// </summary> public void PrintDoc() { if (XR == null) { DialogBox.Msg("报表内容为空。"); } else { XR.PrintDialog(); } }
/// <summary> /// needed for "Equals" /// </summary> /// <returns></returns> public override int GetHashCode() { int hash = 13; hash = (hash * 7) + X.GetHashCode(); hash = (hash * 7) + Y.GetHashCode(); hash = (hash * 7) + Z.GetHashCode(); hash = (hash * 7) + XR.GetHashCode(); hash = (hash * 7) + YR.GetHashCode(); hash = (hash * 7) + LT.GetHashCode(); hash = (hash * 7) + RT.GetHashCode(); hash = (hash * 7) + DpadDirection.GetHashCode(); hash = (hash * 7) + buttons.GetHashCode(); return(hash); }
static unsafe XrExtensionProperties[] GetExtensionProperties() { uint extensionCount; Check(XR.EnumerateInstanceExtensionProperties(null, 0, &extensionCount, null)); var properties = new XrExtensionProperties[checked ((int)extensionCount)]; for (int extension = 0; extension < extensionCount; extension++) { properties[extension] = new XrExtensionProperties { type = XrStructureType.XR_TYPE_EXTENSION_PROPERTIES, } } ; fixed(XrExtensionProperties *ptr = properties) Check(XR.EnumerateInstanceExtensionProperties(null, extensionCount, &extensionCount, ptr)); return(properties); }
private unsafe void Prepare() { // Create our API object for OpenXR. Xr = XR.GetApi(); Extensions.Clear(); //Extensions.Add("XR_KHR_vulkan_enable2"); Extensions.Add("XR_KHR_vulkan_enable"); Extensions.Add("XR_EXT_hp_mixed_reality_controller"); Extensions.Add("XR_HTC_vive_cosmos_controller_interaction"); Extensions.Add("XR_MSFT_hand_interaction"); Extensions.Add("XR_EXT_samsung_odyssey_controller"); uint propCount = 0; Xr.EnumerateInstanceExtensionProperties((byte *)null, 0, &propCount, null); ExtensionProperties[] props = new ExtensionProperties[propCount]; for (int i = 0; i < props.Length; i++) { props[i].Type = StructureType.TypeExtensionProperties; fixed(ExtensionProperties *pptr = &props[0]) Xr.EnumerateInstanceExtensionProperties((byte *)null, propCount, ref propCount, pptr); List <string> AvailableExtensions = new List <string>(); for (int i = 0; i < props.Length; i++) { fixed(void *nptr = props[i].ExtensionName) AvailableExtensions.Add(Marshal.PtrToStringAnsi(new System.IntPtr(nptr))); } for (int i = 0; i < Extensions.Count; i++) { if (AvailableExtensions.Contains(Extensions[i]) == false) { Extensions.RemoveAt(i); i--; } } InstanceCreateInfo instanceCreateInfo; var appInfo = new ApplicationInfo() { ApiVersion = new Version64(1, 0, 9) }; // We've got to marshal our strings and put them into global, immovable memory. To do that, we use // SilkMarshal. Span <byte> appName = new Span <byte>(appInfo.ApplicationName, 128); Span <byte> engName = new Span <byte>(appInfo.EngineName, 128); SilkMarshal.StringIntoSpan(System.AppDomain.CurrentDomain.FriendlyName, appName); SilkMarshal.StringIntoSpan("FocusEngine", engName); var requestedExtensions = SilkMarshal.StringArrayToPtr(Extensions); instanceCreateInfo = new InstanceCreateInfo ( applicationInfo: appInfo, enabledExtensionCount: (uint)Extensions.Count, enabledExtensionNames: (byte **)requestedExtensions ); // Now we're ready to make our instance! CheckResult(Xr.CreateInstance(in instanceCreateInfo, ref Instance), "CreateInstance"); // For our benefit, let's log some information about the instance we've just created. // skip this, as it crashes on Oculus runtime and is not needed /*InstanceProperties properties = new(); * CheckResult(Xr.GetInstanceProperties(Instance, ref properties), "GetInstanceProperties"); * * var runtimeName = SilkMarshal.PtrToString((nint)properties.RuntimeName); * var runtimeVersion = ((Version)(Version64)properties.RuntimeVersion).ToString(3); * * Console.WriteLine($"[INFO] Application: Using OpenXR Runtime \"{runtimeName}\" v{runtimeVersion}");*/ // We're creating a head-mounted-display (HMD, i.e. a VR headset) example, so we ask for a runtime which // supports that form factor. The response we get is a ulong that is the System ID. var getInfo = new SystemGetInfo(formFactor: FormFactor.HeadMountedDisplay); CheckResult(Xr.GetSystem(Instance, in getInfo, ref system_id), "GetSystem"); }