本文整理汇总了C#中Ovr.FovPort类的典型用法代码示例。如果您正苦于以下问题:C# FovPort类的具体用法?C# FovPort怎么用?C# FovPort使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FovPort类属于Ovr命名空间,在下文中一共展示了FovPort类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ovrHmd_GetRenderScaleAndOffset
private static extern void ovrHmd_GetRenderScaleAndOffset(
FovPort fov,
Sizei textureSize,
Recti renderViewport,
[MarshalAs(UnmanagedType.LPArray, SizeConst = 2)]
[Out] Vector2f[] uvScaleOffsetOut);
示例2: ovrMatrix4f_Projection
private static extern Matrix4f_Raw ovrMatrix4f_Projection(
FovPort fov,
float znear,
float zfar,
bool rightHanded);
示例3: ovrHmd_GetRenderDesc
private static extern EyeRenderDesc ovrHmd_GetRenderDesc(IntPtr hmd, Eye eye, FovPort fov);
示例4: ovrHmd_CreateDistortionMesh
private static extern sbyte ovrHmd_CreateDistortionMesh(
IntPtr hmd,
Eye eye,
FovPort fov,
uint distortionCaps,
[Out] out DistortionMesh_Raw meshData);
示例5: GetRenderScaleAndOffset
/// <summary>
/// Computes updated 'uvScaleOffsetOut' to be used with a distortion if render target size or
/// viewport changes after the fact. This can be used to adjust render size every frame if desired.
/// </summary>
public Vector2f[] GetRenderScaleAndOffset(FovPort fov, Sizei textureSize, Recti renderViewport)
{
Vector2f[] uvScaleOffsetOut = new Vector2f[] { new Vector2f(), new Vector2f() };
ovrHmd_GetRenderScaleAndOffset(fov, textureSize, renderViewport, uvScaleOffsetOut);
return uvScaleOffsetOut;
}
示例6: ovrHmd_GetFovTextureSize
private static extern Sizei ovrHmd_GetFovTextureSize(
IntPtr hmd,
Eye eye,
FovPort fov,
float pixelsPerDisplayPixel);
示例7: GetRenderDesc
//-------------------------------------------------------------------------------------
// ***** Client Distortion Rendering Functions
// These functions provide the distortion data and render timing support necessary to allow
// client rendering of distortion. Client-side rendering involves the following steps:
//
// 1. Setup ovrEyeDesc based on the desired texture size and FOV.
// Call ovrHmd_GetRenderDesc to get the necessary rendering parameters for each eye.
//
// 2. Use ovrHmd_CreateDistortionMesh to generate the distortion mesh.
//
// 3. Use ovrHmd_BeginFrameTiming, ovrHmd_GetEyePoses, and ovrHmd_BeginFrameTiming in
// the rendering loop to obtain timing and predicted head orientation when rendering each eye.
// - When using timewarp, use ovr_WaitTillTime after the rendering and gpu flush, followed
// by ovrHmd_GetEyeTimewarpMatrices to obtain the timewarp matrices used
// by the distortion pixel shader. This will minimize latency.
//
/// <summary>
/// Computes the distortion viewport, view adjust, and other rendering parameters for
/// the specified eye. This can be used instead of ovrHmd_ConfigureRendering to do
/// setup for client rendered distortion.
/// </summary>
public EyeRenderDesc GetRenderDesc(Eye eyeType, FovPort fov)
{
return ovrHmd_GetRenderDesc(HmdPtr, eyeType, fov);
}
示例8: CreateDistortionMesh
/// <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;
}
示例9: GetFovTextureSize
//-------------------------------------------------------------------------------------
// ***** Graphics Setup
/// <summary>
/// Calculates the recommended texture size for rendering a given eye within the HMD
/// with a given FOV cone. Higher FOV will generally require larger textures to
/// maintain quality.
/// - pixelsPerDisplayPixel specifies the ratio of the number of render target pixels
/// to display pixels at the center of distortion. 1.0 is the default value. Lower
/// values can improve performance.
/// </summary>
public Sizei GetFovTextureSize(Eye eye, FovPort fov, float pixelsPerDisplayPixel = 1.0f)
{
return ovrHmd_GetFovTextureSize(HmdPtr, eye, fov, pixelsPerDisplayPixel);
}
示例10: ConfigureRendering
//-------------------------------------------------------------------------------------
// ***** Rendering API Thread Safety
// All of rendering functions including the configure and frame functions
// are *NOT thread safe*. It is ok to use ConfigureRendering on one thread and handle
// frames on another thread, but explicit synchronization must be done since
// functions that depend on configured state are not reentrant.
//
// As an extra requirement, any of the following calls must be done on
// the render thread, which is the same thread that calls ovrHmd_BeginFrame
// or ovrHmd_BeginFrameTiming.
// - ovrHmd_EndFrame
// - ovrHmd_GetEyeTimewarpMatrices
//-------------------------------------------------------------------------------------
// ***** SDK Distortion Rendering Functions
// These functions support rendering of distortion by the SDK through direct
// access to the underlying rendering API, such as D3D or GL.
// This is the recommended approach since it allows better support for future
// Oculus hardware, and enables a range of low-level optimizations.
/// <summary>
/// Configures rendering and fills in computed render parameters.
/// This function can be called multiple times to change rendering settings.
/// eyeRenderDescOut is a pointer to an array of two EyeRenderDesc structs
/// that are used to return complete rendering information for each eye.
/// - apiConfig provides D3D/OpenGL specific parameters. Pass null
/// to shutdown rendering and release all resources.
/// - distortionCaps describe desired distortion settings.
/// </summary>
public EyeRenderDesc[] ConfigureRendering(ref RenderAPIConfig renderAPIConfig, FovPort[] eyeFovIn, uint distortionCaps)
{
EyeRenderDesc[] eyeRenderDesc = new EyeRenderDesc[] { new EyeRenderDesc(), new EyeRenderDesc() };
RenderAPIConfig_Raw rawConfig = renderAPIConfig.ToRaw();
bool result = ovrHmd_ConfigureRendering(HmdPtr, ref rawConfig, distortionCaps, eyeFovIn, eyeRenderDesc) != 0;
if (result)
return eyeRenderDesc;
return null;
}
示例11: GetProjection
/// <summary>
/// Used to generate projection from ovrEyeDesc::Fov.
/// </summary>
public static Matrix4f GetProjection(FovPort fov, float znear, float zfar, bool rightHanded)
{
return new Matrix4f(ovrMatrix4f_Projection(fov, znear, zfar, rightHanded));
}
示例12: ovrMatrix4f_Projection
private static extern Matrix4f_Raw ovrMatrix4f_Projection(
FovPort fov,
float znear,
float zfar,
uint projectionModFlags);
示例13: ovrHmd_CreateDistortionMeshDebug
private static extern sbyte ovrHmd_CreateDistortionMeshDebug(
IntPtr hmd,
Eye eye,
FovPort fov,
uint distortionCaps,
[Out] out DistortionMesh_Raw meshData,
float debugEyeReliefOverrideInMeters);
示例14: CreateDistortionMeshDebug
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;
}
示例15: GetProjection
/// <summary>
/// Used to generate projection from ovrEyeDesc::Fov.
/// </summary>
public static Matrix4f GetProjection(
FovPort fov,
float znear,
float zfar,
uint projectionModFlags)
{
return new Matrix4f(ovrMatrix4f_Projection(
fov,
znear,
zfar,
projectionModFlags));
}