当前位置: 首页>>代码示例>>C#>>正文


C# VR.HmdQuad_t类代码示例

本文整理汇总了C#中Valve.VR.HmdQuad_t的典型用法代码示例。如果您正苦于以下问题:C# HmdQuad_t类的具体用法?C# HmdQuad_t怎么用?C# HmdQuad_t使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HmdQuad_t类属于Valve.VR命名空间,在下文中一共展示了HmdQuad_t类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetWorkingCollisionBoundsInfo

 public bool GetWorkingCollisionBoundsInfo(out HmdQuad_t[] pQuadsBuffer)
 {
     uint num = 0u;
     bool flag = this.FnTable.GetWorkingCollisionBoundsInfo(null, ref num);
     pQuadsBuffer = new HmdQuad_t[num];
     return this.FnTable.GetWorkingCollisionBoundsInfo(pQuadsBuffer, ref num);
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:CVRChaperoneSetup.cs

示例2: GetLivePhysicalBoundsInfo

 public bool GetLivePhysicalBoundsInfo(out HmdQuad_t[] pQuadsBuffer)
 {
     uint num = 0u;
     bool flag = this.FnTable.GetLivePhysicalBoundsInfo(null, ref num);
     pQuadsBuffer = new HmdQuad_t[num];
     return this.FnTable.GetLivePhysicalBoundsInfo(pQuadsBuffer, ref num);
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:CVRChaperoneSetup.cs

示例3: CreateSpaceGuardWalls

	private void CreateSpaceGuardWalls()
	{
		switch (ConfigurationManager.GetConfiguration())
		{
			case ConfigurationManager.Configuration.HTC_Vive:
				CVRChaperone chaperone = OpenVR.Chaperone;
				HmdQuad_t  area = new HmdQuad_t();
				chaperone.GetPlayAreaRect(ref area);
				CreateWall(area.vCorners0.v0, area.vCorners0.v2, area.vCorners1.v0, area.vCorners1.v2, "Wall1");
				CreateWall(area.vCorners1.v0, area.vCorners1.v2, area.vCorners2.v0, area.vCorners2.v2, "Wall2");
				CreateWall(area.vCorners2.v0, area.vCorners2.v2, area.vCorners3.v0, area.vCorners3.v2, "Wall3");
				CreateWall(area.vCorners3.v0, area.vCorners3.v2, area.vCorners0.v0, area.vCorners0.v2, "Wall4");
				chaperone.ForceBoundsVisible(false);
				break;

			case ConfigurationManager.Configuration.MoCapRoom:
				CreateWall(-2, -2,  2, -2, "Front");
				CreateWall( 2, -2,  2,  2, "Right");
				CreateWall( 2,  2, -2,  2, "Back");
				CreateWall(-2,  2, -2, -2, "Left");
				break;

			default:
				break;
		}
	}
开发者ID:stefanmarks,项目名称:MotionServer_Clients,代码行数:26,代码来源:SpaceGuard.cs

示例4: GetBounds

    public static bool GetBounds( Size size, ref HmdQuad_t pRect )
    {
        if (size == Size.Calibrated)
        {
            var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
            if (initOpenVR)
            {
                var error = EVRInitError.None;
                OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
            }

            var chaperone = OpenVR.Chaperone;
            bool success = (chaperone != null) && chaperone.GetPlayAreaRect(ref pRect);
            if (!success)
                Debug.LogWarning("Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");

            if (initOpenVR)
                OpenVR.Shutdown();

            return success;
        }
        else
        {
            try
            {
                var str = size.ToString().Substring(1);
                var arr = str.Split(new char[] {'x'}, 2);

                // convert to half size in meters (from cm)
                var x = float.Parse(arr[0]) / 200;
                var z = float.Parse(arr[1]) / 200;

                pRect.vCorners0.v0 =  x;
                pRect.vCorners0.v1 =  0;
                pRect.vCorners0.v2 =  z;

                pRect.vCorners1.v0 =  x;
                pRect.vCorners1.v1 =  0;
                pRect.vCorners1.v2 = -z;

                pRect.vCorners2.v0 = -x;
                pRect.vCorners2.v1 =  0;
                pRect.vCorners2.v2 = -z;

                pRect.vCorners3.v0 = -x;
                pRect.vCorners3.v1 =  0;
                pRect.vCorners3.v2 =  z;

                return true;
            }
            catch {}
        }

        return false;
    }
开发者ID:CAOakleyII,项目名称:vive-project,代码行数:55,代码来源:SteamVR_PlayArea.cs

示例5: GetBounds

	public static bool GetBounds( Size size, ref HmdQuad_t pRect )
	{
		if (size == Size.Calibrated)
		{
			var error = EVRInitError.None;
			if (!SteamVR.active)
			{
				OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
				if (error != EVRInitError.None)
					return false;
			}

			var pChaperone = OpenVR.GetGenericInterface(OpenVR.IVRChaperone_Version, ref error);
			if (pChaperone == System.IntPtr.Zero || error != EVRInitError.None)
			{
				if (!SteamVR.active)
					OpenVR.Shutdown();
				return false;
			}

			var chaperone = new CVRChaperone(pChaperone);

			bool success = chaperone.GetPlayAreaRect( ref pRect );
			if (!success)
				Debug.LogWarning("Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");

			if (!SteamVR.active)
				OpenVR.Shutdown();

			return success;
		}
		else
		{
			try
			{
				var str = size.ToString().Substring(1);
				var arr = str.Split(new char[] {'x'}, 2);
				// convert to half size in meters (from cm)
				var x = float.Parse(arr[0]) / 200;
				var z = float.Parse(arr[1]) / 200;
				pRect.vCorners = new HmdVector3_t[ 4 ];
				pRect.vCorners[ 0 ].v = new float[ 3 ] { x, 0, z };
				pRect.vCorners[ 1 ].v = new float[ 3 ] { x, 0, -z };
				pRect.vCorners[ 2 ].v = new float[ 3 ] { -x, 0, -z };
				pRect.vCorners[ 3 ].v = new float[ 3 ] { -x, 0, z };
				return true;
			}
			catch {}
		}

		return false;
	}
开发者ID:Black4Blade,项目名称:NewtonVR,代码行数:52,代码来源:SteamVR_PlayArea.cs

示例6: GetBounds

 public static bool GetBounds(SteamVR_PlayArea.Size size, ref HmdQuad_t pRect)
 {
     if (size == SteamVR_PlayArea.Size.Calibrated)
     {
         bool flag = !SteamVR.active && !SteamVR.usingNativeSupport;
         if (flag)
         {
             EVRInitError eVRInitError = EVRInitError.None;
             OpenVR.Init(ref eVRInitError, EVRApplicationType.VRApplication_Other);
         }
         CVRChaperone chaperone = OpenVR.Chaperone;
         bool flag2 = chaperone != null && chaperone.GetPlayAreaRect(ref pRect);
         if (!flag2)
         {
             UnityEngine.Debug.LogWarning("Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");
         }
         if (flag)
         {
             OpenVR.Shutdown();
         }
         return flag2;
     }
     try
     {
         string text = size.ToString().Substring(1);
         string[] array = text.Split(new char[]
         {
             'x'
         }, 2);
         float num = float.Parse(array[0]) / 200f;
         float num2 = float.Parse(array[1]) / 200f;
         pRect.vCorners0.v0 = num;
         pRect.vCorners0.v1 = 0f;
         pRect.vCorners0.v2 = num2;
         pRect.vCorners1.v0 = num;
         pRect.vCorners1.v1 = 0f;
         pRect.vCorners1.v2 = -num2;
         pRect.vCorners2.v0 = -num;
         pRect.vCorners2.v1 = 0f;
         pRect.vCorners2.v2 = -num2;
         pRect.vCorners3.v0 = -num;
         pRect.vCorners3.v1 = 0f;
         pRect.vCorners3.v2 = num2;
         return true;
     }
     catch
     {
     }
     return false;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:50,代码来源:SteamVR_PlayArea.cs

示例7: BuildMesh

    private void BuildMesh()
    {
        var rect = new HmdQuad_t();
        GetBounds(ref rect);
        var corners = new HmdVector3_t[] { rect.vCorners0, rect.vCorners1, rect.vCorners2, rect.vCorners3 };

        vertices = new Vector3[corners.Length * 2];
        for (int i = 0; i < corners.Length; i++)
        {
            var c = corners[i];
            vertices[i] = new Vector3(c.v0, 0.01f, c.v2);
        }

        for (int i = 0; i < corners.Length; i++)
        {
            vertices[corners.Length + i] = vertices[i];
        }
    }
开发者ID:CreateAppAdmin,项目名称:SteamVR_Unity_Toolkit,代码行数:18,代码来源:VRTK_RoomExtender_PlayAreaGizmo.cs

示例8: GetBounds

 public void GetBounds(ref HmdQuad_t pRect)
 {
     checkAndUpdateBounds();
     if (steamVR_PlayArea.size == SteamVR_PlayArea.Size.Calibrated)
     {
         pRect.vCorners0.v2 = steamVrBounds.vCorners0.v2 + (steamVrBounds.vCorners0.v2 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners0.v2 = pRect.vCorners0.v2 > steamVrBounds.vCorners0.v2 ? steamVrBounds.vCorners0.v2 : pRect.vCorners0.v2;
         pRect.vCorners1.v0 = steamVrBounds.vCorners1.v0 + (steamVrBounds.vCorners1.v0 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners1.v0 = pRect.vCorners1.v0 > steamVrBounds.vCorners1.v0 ? steamVrBounds.vCorners1.v0 : pRect.vCorners1.v0;
         pRect.vCorners2.v2 = steamVrBounds.vCorners2.v2 + (steamVrBounds.vCorners2.v2 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners2.v2 = pRect.vCorners2.v2 < steamVrBounds.vCorners2.v2 ? steamVrBounds.vCorners2.v2 : pRect.vCorners2.v2;
         pRect.vCorners3.v0 = steamVrBounds.vCorners3.v0 + (steamVrBounds.vCorners3.v0 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners3.v0 = pRect.vCorners3.v0 < steamVrBounds.vCorners3.v0 ? steamVrBounds.vCorners3.v0 : pRect.vCorners3.v0;
     }
     else
     {
         pRect.vCorners0.v2 = steamVrBounds.vCorners0.v2 + (steamVrBounds.vCorners0.v2 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners0.v2 = pRect.vCorners0.v2 < steamVrBounds.vCorners0.v2 ? steamVrBounds.vCorners0.v2 : pRect.vCorners0.v2;
         pRect.vCorners1.v0 = steamVrBounds.vCorners1.v0 + (steamVrBounds.vCorners1.v0 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners1.v0 = pRect.vCorners1.v0 < steamVrBounds.vCorners1.v0 ? steamVrBounds.vCorners1.v0 : pRect.vCorners1.v0;
         pRect.vCorners2.v2 = steamVrBounds.vCorners2.v2 + (steamVrBounds.vCorners2.v2 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners2.v2 = pRect.vCorners2.v2 > steamVrBounds.vCorners2.v2 ? steamVrBounds.vCorners2.v2 : pRect.vCorners2.v2;
         pRect.vCorners3.v0 = steamVrBounds.vCorners3.v0 + (steamVrBounds.vCorners3.v0 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
         pRect.vCorners3.v0 = pRect.vCorners3.v0 > steamVrBounds.vCorners3.v0 ? steamVrBounds.vCorners3.v0 : pRect.vCorners3.v0;
     }
     pRect.vCorners0.v1 = 0;
     pRect.vCorners1.v1 = 0;
     pRect.vCorners2.v1 = 0;
     pRect.vCorners3.v1 = 0;
     pRect.vCorners0.v0 = steamVrBounds.vCorners0.v0 + (steamVrBounds.vCorners0.v0 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
     pRect.vCorners0.v0 = pRect.vCorners0.v0 < steamVrBounds.vCorners0.v0 ? steamVrBounds.vCorners0.v0 : pRect.vCorners0.v0;
     pRect.vCorners1.v2 = steamVrBounds.vCorners1.v2 + (steamVrBounds.vCorners1.v2 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
     pRect.vCorners1.v2 = pRect.vCorners1.v2 > steamVrBounds.vCorners1.v2 ? steamVrBounds.vCorners1.v2 : pRect.vCorners1.v2;
     pRect.vCorners2.v0 = steamVrBounds.vCorners2.v0 + (steamVrBounds.vCorners2.v0 + vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
     pRect.vCorners2.v0 = pRect.vCorners2.v0 > steamVrBounds.vCorners2.v0 ? steamVrBounds.vCorners2.v0 : pRect.vCorners2.v0;
     pRect.vCorners3.v2 = steamVrBounds.vCorners3.v2 + (steamVrBounds.vCorners3.v2 - vrtk_RoomExtender.headZoneRadius) * vrtk_RoomExtender.additionalMovementMultiplier;
     pRect.vCorners3.v2 = pRect.vCorners3.v2 < steamVrBounds.vCorners3.v2 ? steamVrBounds.vCorners3.v2 : pRect.vCorners3.v2;
 }
开发者ID:CreateAppAdmin,项目名称:SteamVR_Unity_Toolkit,代码行数:38,代码来源:VRTK_RoomExtender_PlayAreaGizmo.cs

示例9: GetChaperoneBounds

    /// \brief Requests the chaperone boundaries of the SteamVR play area.  This doesn't work if you haven't performed
    ///        Room Setup.
    /// \param p0, p1, p2, p3 Points that make up the chaperone boundaries.
    /// 
    /// \returns If the play area retrieval was successful
    public static bool GetChaperoneBounds(out Vector3 p0, out Vector3 p1, out Vector3 p2, out Vector3 p3)
    {
        var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
        if (initOpenVR)
        {
            var error = EVRInitError.None;
            OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
        }

        var chaperone = OpenVR.Chaperone;
        HmdQuad_t rect = new HmdQuad_t();
        bool success = (chaperone != null) && chaperone.GetPlayAreaRect(ref rect);
        p0 = new Vector3(rect.vCorners0.v0, rect.vCorners0.v1, rect.vCorners0.v2);
        p1 = new Vector3(rect.vCorners1.v0, rect.vCorners1.v1, rect.vCorners1.v2);
        p2 = new Vector3(rect.vCorners2.v0, rect.vCorners2.v1, rect.vCorners2.v2);
        p3 = new Vector3(rect.vCorners3.v0, rect.vCorners3.v1, rect.vCorners3.v2);
        if (!success)
            Debug.LogWarning("Failed to get Calibrated Play Area bounds!  Make sure you have tracking first, and that your space is calibrated.");

        if (initOpenVR)
            OpenVR.Shutdown();

        return success;
    }
开发者ID:sweenr,项目名称:ped-sim,代码行数:29,代码来源:TeleportVive.cs

示例10: SetWorkingCollisionBoundsInfo

	public override void SetWorkingCollisionBoundsInfo(HmdQuad_t [] pQuadsBuffer)
	{
		CheckIfUsable();
		VRNativeEntrypoints.VR_IVRChaperoneSetup_SetWorkingCollisionBoundsInfo(m_pVRChaperoneSetup,pQuadsBuffer,(uint) pQuadsBuffer.Length);
	}
开发者ID:Black4Blade,项目名称:NewtonVR,代码行数:5,代码来源:openvr_api.cs

示例11: GetWorkingPlayAreaRect

	public override bool GetWorkingPlayAreaRect(ref HmdQuad_t rect)
	{
		CheckIfUsable();
		bool result = VRNativeEntrypoints.VR_IVRChaperoneSetup_GetWorkingPlayAreaRect(m_pVRChaperoneSetup,ref rect);
		return result;
	}
开发者ID:Black4Blade,项目名称:NewtonVR,代码行数:6,代码来源:openvr_api.cs

示例12: GetLiveCollisionBoundsInfo

	public override bool GetLiveCollisionBoundsInfo(out HmdQuad_t [] pQuadsBuffer)
	{
		CheckIfUsable();
		uint punQuadsCount = 0;
		bool result = VRNativeEntrypoints.VR_IVRChaperoneSetup_GetLiveCollisionBoundsInfo(m_pVRChaperoneSetup,null,ref punQuadsCount);
		pQuadsBuffer= new HmdQuad_t[punQuadsCount];
		result = VRNativeEntrypoints.VR_IVRChaperoneSetup_GetLiveCollisionBoundsInfo(m_pVRChaperoneSetup,pQuadsBuffer,ref punQuadsCount);
		return result;
	}
开发者ID:Black4Blade,项目名称:NewtonVR,代码行数:9,代码来源:openvr_api.cs

示例13: BuildMesh

    public void BuildMesh()
    {
        var rect = new HmdQuad_t();
        if ( !GetBounds( size, ref rect ) )
            return;

        var corners = new HmdVector3_t[] { rect.vCorners0, rect.vCorners1, rect.vCorners2, rect.vCorners3 };

        vertices = new Vector3[corners.Length * 2];
        for (int i = 0; i < corners.Length; i++)
        {
            var c = corners[i];
            vertices[i] = new Vector3(c.v0, 0.01f, c.v2);
        }

        if (borderThickness == 0.0f)
        {
            GetComponent<MeshFilter>().mesh = null;
            return;
        }

        for (int i = 0; i < corners.Length; i++)
        {
            int next = (i + 1) % corners.Length;
            int prev = (i + corners.Length - 1) % corners.Length;

            var nextSegment = (vertices[next] - vertices[i]).normalized;
            var prevSegment = (vertices[prev] - vertices[i]).normalized;

            var vert = vertices[i];
            vert += Vector3.Cross(nextSegment, Vector3.up) * borderThickness;
            vert += Vector3.Cross(prevSegment, Vector3.down) * borderThickness;

            vertices[corners.Length + i] = vert;
        }

        var triangles = new int[]
        {
            0, 1, 4,
            1, 5, 4,
            1, 2, 5,
            2, 6, 5,
            2, 3, 6,
            3, 7, 6,
            3, 0, 7,
            0, 4, 7
        };

        var uv = new Vector2[]
        {
            new Vector2(0.0f, 0.0f),
            new Vector2(1.0f, 0.0f),
            new Vector2(0.0f, 0.0f),
            new Vector2(1.0f, 0.0f),
            new Vector2(0.0f, 1.0f),
            new Vector2(1.0f, 1.0f),
            new Vector2(0.0f, 1.0f),
            new Vector2(1.0f, 1.0f)
        };

        var colors = new Color[]
        {
            color,
            color,
            color,
            color,
            new Color(color.r, color.g, color.b, 0.0f),
            new Color(color.r, color.g, color.b, 0.0f),
            new Color(color.r, color.g, color.b, 0.0f),
            new Color(color.r, color.g, color.b, 0.0f)
        };

        var mesh = new Mesh();
        GetComponent<MeshFilter>().mesh = mesh;
        mesh.vertices = vertices;
        mesh.uv = uv;
        mesh.colors = colors;
        mesh.triangles = triangles;

        var renderer = GetComponent<MeshRenderer>();
        #if UNITY_EDITOR
        renderer.material = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Material>("Sprites-Default.mat");
        #else
        renderer.material = Resources.GetBuiltinResource<Material>("Sprites-Default.mat");
        #endif
        renderer.reflectionProbeUsage = UnityEngine.Rendering.ReflectionProbeUsage.Off;
        renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
        renderer.receiveShadows = false;
        renderer.lightProbeUsage = LightProbeUsage.Off;
    }
开发者ID:CAOakleyII,项目名称:vive-project,代码行数:90,代码来源:SteamVR_PlayArea.cs

示例14: SetWorkingPhysicalBoundsInfo

 public bool SetWorkingPhysicalBoundsInfo(HmdQuad_t[] pQuadsBuffer)
 {
     return this.FnTable.SetWorkingPhysicalBoundsInfo(pQuadsBuffer, (uint)pQuadsBuffer.Length);
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:4,代码来源:CVRChaperoneSetup.cs

示例15: GetLivePhysicalBoundsInfo

	public bool GetLivePhysicalBoundsInfo(out HmdQuad_t [] pQuadsBuffer)
	{
		uint punQuadsCount = 0;
		bool result = FnTable.GetLivePhysicalBoundsInfo(null,ref punQuadsCount);
		pQuadsBuffer= new HmdQuad_t[punQuadsCount];
		result = FnTable.GetLivePhysicalBoundsInfo(pQuadsBuffer,ref punQuadsCount);
		return result;
	}
开发者ID:apekshadarbari,项目名称:PokerFace,代码行数:8,代码来源:openvr_api.cs


注:本文中的Valve.VR.HmdQuad_t类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。