/// <summary> /// Generate distortion mesh per eye. /// Distortion capabilities will depend on 'distortionCaps' flags. Users should /// render using the appropriate shaders based on their settings. /// Distortion mesh data will be allocated and written into the ovrDistortionMesh data structure, /// which should be explicitly freed with ovrHmd_DestroyDistortionMesh. /// Users should call ovrHmd_GetRenderScaleAndOffset to get uvScale and Offset values for rendering. /// The function shouldn't fail unless theres is a configuration or memory error, in which case /// ovrDistortionMesh values will be set to null. /// This is the only function in the SDK reliant on eye relief, currently imported from profiles, /// or overridden here. /// </summary> public DistortionMesh? CreateDistortionMesh(Eye eye, FovPort fov, uint distortionCaps) { DistortionMesh_Raw rawMesh = new DistortionMesh_Raw(); bool result = ovrHmd_CreateDistortionMesh(HmdPtr, eye, fov, distortionCaps, out rawMesh) != 0; if (!result) { return null; } DistortionMesh mesh = new DistortionMesh(rawMesh); ovrHmd_DestroyDistortionMesh(ref rawMesh); return mesh; }
public DistortionMesh? CreateDistortionMeshDebug(Eye eye, FovPort fov, uint distortionCaps, float debugEyeReliefOverrideInMeters) { DistortionMesh_Raw rawMesh = new DistortionMesh_Raw(); bool result = ovrHmd_CreateDistortionMeshDebug( HmdPtr, eye, fov, distortionCaps, out rawMesh, debugEyeReliefOverrideInMeters) != 0; if (!result) { return null; } DistortionMesh mesh = new DistortionMesh(rawMesh); ovrHmd_DestroyDistortionMesh(ref rawMesh); return mesh; }