XR和Steam VR项目合并问题

news2024/10/7 0:54:40

最近有一个项目是用Steam VR开发的,里面部分场景是用VRTK框架做的,还有一部分是用SteamVR SDK自带的Player预制直接开发的。

这样本身没有问题,因为最终都是通过SteamVR SDK处理的,VRTK也管理好了SteamVR的逻辑,并且支持动态切换,比如切换成Oculus的。

然后现在遇到一个问题,还有一个项目是用Unity自带的XR开发的,Package Manager导入XR相关的插件实现的。

 

需要将XR开发的项目移植到Steam VR项目来,然后事情就开始了。

SteamVR的场景可以运行,通过Pico以及Quest串流还有htc头盔都能正常识别,手柄也能控制。

但是XR场景就出现问题了,头盔无法识别。

经过一步步排查,发现是XR Plug-in Management这里需要设置不同的XRLoader。

而SteamVR是OpenVR Loader,而XR是OpenXR,因为OpenVR Loader在前,所以激活的是OpenVR Loader,这也是为什么SteamVR场景可以运行而XR场景不行。

我们看看unity的源代码是怎么写的,发现这里面是有activeLoader的概念,也就是一次只能一个Loader运行。

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;

using UnityEditor;

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.UIElements;
using UnityEngine.Serialization;
using UnityEngine.XR.Management;

[assembly: InternalsVisibleTo("Unity.XR.Management.Tests")]
[assembly: InternalsVisibleTo("Unity.XR.Management.EditorTests")]
namespace UnityEngine.XR.Management
{
    /// <summary>
    /// Class to handle active loader and subsystem management for XR. This class is to be added as a
    /// ScriptableObject asset in your project and should only be referenced by the <see cref="XRGeneralSettings"/>
    /// instance for its use.
    ///
    /// Given a list of loaders, it will attempt to load each loader in the given order. The first
    /// loader that is successful wins and all remaining loaders are ignored. The loader
    /// that succeeds is accessible through the <see cref="activeLoader"/> property on the manager.
    ///
    /// Depending on configuration the <see cref="XRManagerSettings"/> instance will automatically manage the active loader
    /// at correct points in the application lifecycle. The user can override certain points in the active loader lifecycle
    /// and manually manage them by toggling the <see cref="automaticLoading"/> and <see cref="automaticRunning"/>
    /// properties. Disabling <see cref="automaticLoading"/> implies the the user is responsible for the full lifecycle
    /// of the XR session normally handled by the <see cref="XRManagerSettings"/> instance. Toggling this to false also toggles
    /// <see cref="automaticRunning"/> false.
    ///
    /// Disabling <see cref="automaticRunning"/> only implies that the user is responsible for starting and stopping
    /// the <see cref="activeLoader"/> through the <see cref="StartSubsystems"/> and <see cref="StopSubsystems"/> APIs.
    ///
    /// Automatic lifecycle management is executed as follows
    ///
    /// * Runtime Initialize -> <see cref="InitializeLoader"/>. The loader list will be iterated over and the first successful loader will be set as the active loader.
    /// * Start -> <see cref="StartSubsystems"/>. Ask the active loader to start all subsystems.
    /// * OnDisable -> <see cref="StopSubsystems"/>. Ask the active loader to stop all subsystems.
    /// * OnDestroy -> <see cref="DeinitializeLoader"/>. Deinitialize and remove the active loader.
    /// </summary>
    public sealed class XRManagerSettings : ScriptableObject
    {
        [HideInInspector]
        bool m_InitializationComplete = false;

#pragma warning disable 414
        // This property is only used by the scriptable object editing part of the system and as such no one
        // directly references it. Have to manually disable the console warning here so that we can
        // get a clean console report.
        [HideInInspector]
        [SerializeField]
        bool m_RequiresSettingsUpdate = false;
#pragma warning restore 414

        [SerializeField]
        [Tooltip("Determines if the XR Manager instance is responsible for creating and destroying the appropriate loader instance.")]
        [FormerlySerializedAs("AutomaticLoading")]
        bool m_AutomaticLoading = false;

        /// <summary>
        /// Get and set Automatic Loading state for this manager. When this is true, the manager will automatically call
        /// <see cref="InitializeLoader"/> and <see cref="DeinitializeLoader"/> for you. When false <see cref="automaticRunning"/>
        /// is also set to false and remains that way. This means that disabling automatic loading disables all automatic behavior
        /// for the manager.
        /// </summary>
        public bool automaticLoading
        {
            get { return m_AutomaticLoading; }
            set { m_AutomaticLoading = value; }
        }

        [SerializeField]
        [Tooltip("Determines if the XR Manager instance is responsible for starting and stopping subsystems for the active loader instance.")]
        [FormerlySerializedAs("AutomaticRunning")]
        bool m_AutomaticRunning = false;

        /// <summary>
        /// Get and set automatic running state for this manager. When set to true the manager will call <see cref="StartSubsystems"/>
        /// and <see cref="StopSubsystems"/> APIs at appropriate times. When set to false, or when <see cref="automaticLoading"/> is false
        /// then it is up to the user of the manager to handle that same functionality.
        /// </summary>
        public bool automaticRunning
        {
            get { return m_AutomaticRunning; }
            set { m_AutomaticRunning = value; }
        }


        [SerializeField]
        [Tooltip("List of XR Loader instances arranged in desired load order.")]
        [FormerlySerializedAs("Loaders")]
        List<XRLoader> m_Loaders = new List<XRLoader>();

        // Maintains a list of registered loaders that is immutable at runtime.
        [SerializeField]
        [HideInInspector]
        HashSet<XRLoader> m_RegisteredLoaders = new HashSet<XRLoader>();

        /// <summary>
        /// List of loaders currently managed by this XR Manager instance.
        /// </summary>
        /// <remarks>
        /// Modifying the list of loaders at runtime is undefined behavior and could result in a crash or memory leak.
        /// Use <see cref="activeLoaders"/> to retrieve the currently ordered list of loaders. If you need to mutate
        /// the list at runtime, use <see cref="TryAddLoader"/>, <see cref="TryRemoveLoader"/>, and
        /// <see cref="TrySetLoaders"/>.
        /// </remarks>
        [Obsolete("'XRManagerSettings.loaders' property is obsolete. Use 'XRManagerSettings.activeLoaders' instead to get a list of the current loaders.")]
        public List<XRLoader> loaders
        {
            get { return m_Loaders; }
#if UNITY_EDITOR
            set { m_Loaders = value; }
#endif
        }

        /// <summary>
        /// A shallow copy of the list of loaders currently managed by this XR Manager instance.
        /// </summary>
        /// <remarks>
        /// This property returns a read only list. Any changes made to the list itself will not affect the list
        /// used by this XR Manager instance. To mutate the list of loaders currently managed by this instance,
        /// use <see cref="TryAddLoader"/>, <see cref="TryRemoveLoader"/>, and/or <see cref="TrySetLoaders"/>.
        /// </remarks>
        public IReadOnlyList<XRLoader> activeLoaders => m_Loaders;

        /// <summary>
        /// Read only boolean letting us know if initialization is completed. Because initialization is
        /// handled as a Coroutine, people taking advantage of the auto-lifecycle management of XRManager
        /// will need to wait for init to complete before checking for an ActiveLoader and calling StartSubsystems.
        /// </summary>
        public bool isInitializationComplete
        {
            get { return m_InitializationComplete; }
        }

        ///<summary>
        /// Return the current singleton active loader instance.
        ///</summary>
        [HideInInspector]
        public XRLoader activeLoader { get; private set; }

        /// <summary>
        /// Return the current active loader, cast to the requested type. Useful shortcut when you need
        /// to get the active loader as something less generic than XRLoader.
        /// </summary>
        ///
        /// <typeparam name="T">Requested type of the loader</typeparam>
        ///
        /// <returns>The active loader as requested type, or null.</returns>
        public T ActiveLoaderAs<T>() where T : XRLoader
        {
            return activeLoader as T;
        }

        /// <summary>
        /// Iterate over the configured list of loaders and attempt to initialize each one. The first one
        /// that succeeds is set as the active loader and initialization immediately terminates.
        ///
        /// When complete <see cref="isInitializationComplete"/> will be set to true. This will mark that it is safe to
        /// call other parts of the API. This does not guarantee that init successfully created a loader. For that
        /// you need to check that ActiveLoader is not null.
        ///
        /// Note that there can only be one active loader. Any attempt to initialize a new active loader with one
        /// already set will cause a warning to be logged and immediate exit of this function.
        ///
        /// This method is synchronous and on return all state should be immediately checkable.
        ///
        /// <b>If manual initialization of XR is being done, this method can not be called before Start completes
        /// as it depends on graphics initialization within Unity completing.</b>
        /// </summary>
        public void InitializeLoaderSync()
        {
            if (activeLoader != null)
            {
                Debug.LogWarning(
                    "XR Management has already initialized an active loader in this scene." +
                    " Please make sure to stop all subsystems and deinitialize the active loader before initializing a new one.");
                return;
            }

            foreach (var loader in currentLoaders)
            {
                if (loader != null)
                {
                    if (CheckGraphicsAPICompatibility(loader) && loader.Initialize())
                    {
                        activeLoader = loader;
                        m_InitializationComplete = true;
                        return;
                    }
                }
            }

            activeLoader = null;
        }

        /// <summary>
        /// Iterate over the configured list of loaders and attempt to initialize each one. The first one
        /// that succeeds is set as the active loader and initialization immediately terminates.
        ///
        /// When complete <see cref="isInitializationComplete"/> will be set to true. This will mark that it is safe to
        /// call other parts of the API. This does not guarantee that init successfully created a loader. For that
        /// you need to check that ActiveLoader is not null.
        ///
        /// Note that there can only be one active loader. Any attempt to initialize a new active loader with one
        /// already set will cause a warning to be logged and immediate exit of this function.
        ///
        /// Iteration is done asynchronously and this method must be called within the context of a Coroutine.
        ///
        /// <b>If manual initialization of XR is being done, this method can not be called before Start completes
        /// as it depends on graphics initialization within Unity completing.</b>
        /// </summary>
        ///
        /// <returns>Enumerator marking the next spot to continue execution at.</returns>
        public IEnumerator InitializeLoader()
        {
            if (activeLoader != null)
            {
                Debug.LogWarning(
                    "XR Management has already initialized an active loader in this scene." +
                    " Please make sure to stop all subsystems and deinitialize the active loader before initializing a new one.");
                yield break;
            }

            foreach (var loader in currentLoaders)
            {
                if (loader != null)
                {
                    if (CheckGraphicsAPICompatibility(loader) && loader.Initialize())
                    {
                        activeLoader = loader;
                        m_InitializationComplete = true;
                        yield break;
                    }
                }

                yield return null;
            }

            activeLoader = null;
        }

        /// <summary>
        /// Attempts to append the given loader to the list of loaders at the given index.
        /// </summary>
        /// <param name="loader">
        /// The <see cref="XRLoader"/> to be added to this manager's instance of loaders.
        /// </param>
        /// <param name="index">
        /// The index at which the given <see cref="XRLoader"/> should be added. If you set a negative or otherwise
        /// invalid index, the loader will be appended to the end of the list.
        /// </param>
        /// <returns>
        /// <c>true</c> if the loader is not a duplicate and was added to the list successfully, <c>false</c>
        /// otherwise.
        /// </returns>
        /// <remarks>
        /// This method behaves differently in the Editor and during runtime/Play mode. While your app runs in the Editor and not in
        /// Play mode, attempting to add an <see cref="XRLoader"/> will always succeed and register that loader's type
        /// internally. Attempting to add a loader during runtime/Play mode will trigger a check to see whether a loader of
        /// that type was registered. If the check is successful, the loader is added. If not, the loader is not added and the method
        /// returns <c>false</c>.
        /// </remarks>
        public bool TryAddLoader(XRLoader loader, int index = -1)
        {
            if (loader == null || currentLoaders.Contains(loader))
                return false;

#if UNITY_EDITOR
            if (!EditorApplication.isPlaying && !m_RegisteredLoaders.Contains(loader))
                m_RegisteredLoaders.Add(loader);
#endif
            if (!m_RegisteredLoaders.Contains(loader))
                return false;

            if (index < 0 || index >= currentLoaders.Count)
                currentLoaders.Add(loader);
            else
                currentLoaders.Insert(index, loader);

            return true;
        }

        /// <summary>
        /// Attempts to remove the first instance of a given loader from the list of loaders.
        /// </summary>
        /// <param name="loader">
        /// The <see cref="XRLoader"/> to be removed from this manager's instance of loaders.
        /// </param>
        /// <returns>
        /// <c>true</c> if the loader was successfully removed from the list, <c>false</c> otherwise.
        /// </returns>
        /// <remarks>
        /// This method behaves differently in the Editor and during runtime/Play mode. During runtime/Play mode, the loader
        /// will be removed with no additional side effects if it is in the list managed by this instance. While in the
        /// Editor and not in Play mode, the loader will be removed if it exists and
        /// it will be unregistered from this instance and any attempts to add it during
        /// runtime/Play mode will fail. You can re-add the loader in the Editor while not in Play mode.
        /// </remarks>
        public bool TryRemoveLoader(XRLoader loader)
        {
            var removedLoader = true;
            if (currentLoaders.Contains(loader))
                removedLoader = currentLoaders.Remove(loader);

#if UNITY_EDITOR
            if (!EditorApplication.isPlaying && !currentLoaders.Contains(loader))
                m_RegisteredLoaders.Remove(loader);
#endif

            return removedLoader;
        }

        /// <summary>
        /// Attempts to set the given loader list as the list of loaders managed by this instance.
        /// </summary>
        /// <param name="reorderedLoaders">
        /// The list of <see cref="XRLoader"/>s to be managed by this manager instance.
        /// </param>
        /// <returns>
        /// <c>true</c> if the loader list was set successfully, <c>false</c> otherwise.
        /// </returns>
        /// <remarks>
        /// This method behaves differently in the Editor and during runtime/Play mode. While in the Editor and not in
        /// Play mode, any attempts to set the list of loaders will succeed without any additional checks. During
        /// runtime/Play mode, the new loader list will be validated against the registered <see cref="XRLoader"/> types.
        /// If any loaders exist in the list that were not registered at startup, the attempt will fail.
        /// </remarks>
        public bool TrySetLoaders(List<XRLoader> reorderedLoaders)
        {
            var originalLoaders = new List<XRLoader>(activeLoaders);
#if UNITY_EDITOR
            if (!EditorApplication.isPlaying)
            {
                registeredLoaders.Clear();
                currentLoaders.Clear();
                foreach (var loader in reorderedLoaders)
                {
                    if (!TryAddLoader(loader))
                    {
                        TrySetLoaders(originalLoaders);
                        return false;
                    }
                }

                return true;
            }
#endif
            currentLoaders.Clear();
            foreach (var loader in reorderedLoaders)
            {
                if (!TryAddLoader(loader))
                {
                    currentLoaders = originalLoaders;
                    return false;
                }
            }

            return true;
        }

        private bool CheckGraphicsAPICompatibility(XRLoader loader)
        {
            GraphicsDeviceType deviceType = SystemInfo.graphicsDeviceType;
            List<GraphicsDeviceType> supportedDeviceTypes = loader.GetSupportedGraphicsDeviceTypes(false);

            // To help with backward compatibility, if the compatibility list is empty we assume that it does not implement the GetSupportedGraphicsDeviceTypes method
            // Therefore we revert to the previous behavior of building or starting the loader regardless of gfx api settings.
            if (supportedDeviceTypes.Count > 0 && !supportedDeviceTypes.Contains(deviceType))
            {
                Debug.LogWarning(String.Format("The {0} does not support the initialized graphics device, {1}. Please change the preffered Graphics API in PlayerSettings. Attempting to start the next XR loader.", loader.name, deviceType.ToString()));
                return false;
            }

            return true;
        }

        /// <summary>
        /// If there is an active loader, this will request the loader to start all the subsystems that it
        /// is managing.
        ///
        /// You must wait for <see cref="isInitializationComplete"/> to be set to true prior to calling this API.
        /// </summary>
        public void StartSubsystems()
        {
            if (!m_InitializationComplete)
            {
                Debug.LogWarning(
                    "Call to StartSubsystems without an initialized manager." +
                    "Please make sure wait for initialization to complete before calling this API.");
                return;
            }

            if (activeLoader != null)
            {
                activeLoader.Start();
            }
        }

        /// <summary>
        /// If there is an active loader, this will request the loader to stop all the subsystems that it
        /// is managing.
        ///
        /// You must wait for <see cref="isInitializationComplete"/> to be set to tru prior to calling this API.
        /// </summary>
        public void StopSubsystems()
        {
            if (!m_InitializationComplete)
            {
                Debug.LogWarning(
                    "Call to StopSubsystems without an initialized manager." +
                    "Please make sure wait for initialization to complete before calling this API.");
                return;
            }

            if (activeLoader != null)
            {
                activeLoader.Stop();
            }
        }

        /// <summary>
        /// If there is an active loader, this function will deinitialize it and remove the active loader instance from
        /// management. We will automatically call <see cref="StopSubsystems"/> prior to deinitialization to make sure
        /// that things are cleaned up appropriately.
        ///
        /// You must wait for <see cref="isInitializationComplete"/> to be set to tru prior to calling this API.
        ///
        /// Upon return <see cref="isInitializationComplete"/> will be rest to false;
        /// </summary>
        public void DeinitializeLoader()
        {
            if (!m_InitializationComplete)
            {
                Debug.LogWarning(
                    "Call to DeinitializeLoader without an initialized manager." +
                    "Please make sure wait for initialization to complete before calling this API.");
                return;
            }

            StopSubsystems();
            if (activeLoader != null)
            {
                activeLoader.Deinitialize();
                activeLoader = null;
            }

            m_InitializationComplete = false;
        }

        // Use this for initialization
        void Start()
        {
            if (automaticLoading && automaticRunning)
            {
                StartSubsystems();
            }
        }

        void OnDisable()
        {
            if (automaticLoading && automaticRunning)
            {
                StopSubsystems();
            }
        }

        void OnDestroy()
        {
            if (automaticLoading)
            {
                DeinitializeLoader();
            }
        }

        // To modify the list of loaders internally use `currentLoaders` as it will return a list reference rather
        // than a shallow copy.
        // TODO @davidmo 10/12/2020: remove this in next major version bump and make 'loaders' internal.
        internal List<XRLoader> currentLoaders
        {
            get { return m_Loaders; }
            set { m_Loaders = value; }
        }

        // To modify the set of registered loaders use `registeredLoaders` as it will return a reference to the
        // hashset of loaders.
        internal HashSet<XRLoader> registeredLoaders
        {
            get { return m_RegisteredLoaders; }
        }
    }
}

事情变的有趣起来,我们知道了这样的原理之后,那鱼蛋我就想着尝试下,在Runtime里动态切换行吧,SteamVR场景切换到OpenVR Loader,而XR场景切换到OpenXR,代码如下。

using System.Collections.Generic;
using Unity.XR.OpenVR;
using UnityEngine;
using UnityEngine.XR.Management;
using UnityEngine.XR.OpenXR;

namespace EgoGame
{
    /// <summary>
    /// 该类有问题,废弃了
    /// </summary>
    public class AutoXRLoader:MonoBehaviour
    {
        public List<XRLoader> xrLoaders;
        public List<XRLoader> vrLoaders;
        public bool isXR;
        
        private void Awake()
        {
            SetLoader(isXR);
        }

        private void OnDestroy()
        {
            SetLoader(!isXR);
        }
        
        void SetLoader(bool xr)
        {
            //不这样,会频繁的退出loader,VR会没画面
            if (xr && XRGeneralSettings.Instance.Manager.activeLoader is OpenXRLoader)
            {
                return;
            }
            if (!xr && XRGeneralSettings.Instance.Manager.activeLoader is OpenVRLoader)
            {
                return;
            }
            var loaders = xr ? xrLoaders : vrLoaders;

            Debug.Log("切换Loader:" + xr+"=="+XRGeneralSettings.Instance.Manager.activeLoader);
            XRGeneralSettings.Instance.Manager.DeinitializeLoader();
            XRGeneralSettings.Instance.Manager.TrySetLoaders(loaders);
            XRGeneralSettings.Instance.Manager.InitializeLoaderSync();
            XRGeneralSettings.Instance.Manager.StartSubsystems();
        }
    }
}

果然奏效了,XR场景能在头盔里识别并运行了,手柄也能控制。但是,切到SteamVR场景就出现了问题,Steam VR SDK报错了,报错提示有另一个应用在使用SteamVR。

最后的结果就是,没法实现动态切换XR或VR,如果看到此处的人,有办法请告诉我,我尝试了两天用了各种办法,都没法做到。

最后推荐大家开发VR应用不要直接用SteamVR SDK或XR SDK或Oculus SDK开发,而是用那些集成的插件,如VR Interaction Framework、VRTK等,这样在多个VR设备也能快速部署。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1797512.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

java:一个简单的WebFlux的例子

【pom.xml】 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-webflux</artifactId><version>2.3.12.RELEASE</version> </dependency> <dependency><groupId>org.spr…

从传统工厂到数字化工厂,从这几方面着手

信息技术与制造技术的结合&#xff0c;产生了新的生产实现模式&#xff0c;是制造业迈向智能化的重要标志。实践应用表明&#xff0c;数字化工厂可以缩短制造周期&#xff0c;优化生产流程&#xff0c;提高协同工作能力&#xff0c;降低成本。 从传统工厂到数字化工厂的转型是一…

.NET集成DeveloperSharp操作Redis缓存

&#x1f3c6;作者&#xff1a;科技、互联网行业优质创作者 &#x1f3c6;专注领域&#xff1a;.Net技术、软件架构、人工智能、数字化转型、DeveloperSharp、微服务、工业互联网、智能制造 &#x1f3c6;欢迎关注我&#xff08;Net数字智慧化基地&#xff09;&#xff0c;里面…

优思学院|一文看懂新版FMEA与FMEA的七大步骤

FMEA的起源 FMEA最早起源于20世纪40年代的美国军工行业。当时&#xff0c;美国军方为了提高武器系统的可靠性和安全性&#xff0c;开始使用FMEA来识别和评估潜在的故障模式及其影响。1949年&#xff0c;美国军方发布了《军用程序手册》&#xff08;Military Procedures Handbo…

【TS】进阶

一、类型别名 类型别名用来给一个类型起个新名字。 type s string; let str: s "123";type NameResolver () > string;: // 定义了一个类型别名NameResolver&#xff0c;它是一个函数类型。这个函数没有参数&#xff0c;返回值类型为string。这意味着任何被…

抱抱脸上第一的开原模型Qwen2-72B;腾讯开源人像照片生成视频的模型;Facebook开源翻译模型;智谱 AI 推出的最新一代预训练模型

✨ 1: Qwen2 Qwen2 是一种多语言预训练和指令调优的语言模型&#xff0c;支持128K上下文长度并在多项基准测试中表现优异。 Qwen2&#xff08;全称“Qwen Qwen”&#xff0c;简称Qwen&#xff09;是一个先进的大语言模型家族&#xff0c;在其前身Qwen1.5的基础上进行了重大提…

硬件I2C读写MPU6050

硬件I2C读写MPU6050 SCL接PB10&#xff0c;SDA接PB11,但是硬件I2C引脚不可以任意指定。 查询引脚定义表&#xff0c;来规划引脚。但由于PB6,7,8,9被OLEDz占用&#xff0c;不方便接线了。 可以使用I2C2引脚&#xff0c;但必须是SCL对应PB10&#xff0c;SDA对应PB11&#xff0c;…

Angular17版本集成Quill富文本编辑器

Angular17版本集成Quill富文本编辑器 前言:网上找了好多富文本资源,对应Angular17版本的且兼容的太少了,且找到不到对应的版本 自己就去网上找个兼容的免费的富文本组件 1.兼容Angular17版本的quill包 "types/quill": "^1.3.10","ngx-quill": …

[Bug]使用Transformers 微调 Whisper出现版本不兼容的bug

错误的现象 ImportError Traceback (most recent call last) <ipython-input-20-6958d7eed552> in () from transformers import Seq2SegTrainingArguments training_args Seq2SeqTrainingArguments( output_dir"./whisper-small-…

解决跨域的几种方法

解决跨域的方法主要有以下几种&#xff1a; 1.CORS&#xff08;跨域资源共享&#xff09; CORS是一种W3C规范&#xff0c;它定义了一种浏览器和服务器交互的方式来确定是否允许跨源请求。 服务器通过设置响应头Access-Control-Allow-Origin来允许或拒绝跨域请求。例如&#xf…

Mintegral解析休闲游戏如何靠创意素材吸引玩家

核心玩法简单清晰、容易让人无限上头的休闲游戏&#xff0c;玩法机制一般比较明确、简单&#xff0c;如果要在短时间内吸引玩家注意&#xff0c;除了完整展示游戏流程以外&#xff0c;开发者需要在素材中设置更多亮点性的内容&#xff0c;如吸睛的剧情、爆炸性的视听效果等元素…

【操作与配置】MySQL安装及启动

【操作与配置】MySQL安装及启动 下载MySQL 进入官网&#xff0c;选择社区版下载 在windows安装 选择不登陆下载 安装MySQL 双击官方安装包 选择“Developer Default”&#xff08;默认&#xff09;即可 Execute&#xff0c;安装完成后next TCP/IP端口等&#xff0c;默认即可…

什么是专业的倾斜摄影轻量化?

眸瑞科技是一家专业从事自研3D可视化技术底层、提供三维模型轻量化服务的高新技术公司&#xff0c;从事该行业近10年&#xff0c;有着丰富的三维模型处理及开发经验。目前已向许多企事业单位提供过工厂厂区、城市地貌、铁路桥梁、高速公路、旅游景区等倾斜摄影模型轻量化处理、…

Alibbaba RocketMQ笔记

作用场景 异步解耦: 将比较耗时且不需要即时(同步)返回结果 的操作放入消息队列; 流量削峰: 历史简介 基本使用 深入了解\原理

【递归、搜索与回溯】搜索

搜索 1.计算布尔二叉树的值2.求根节点到叶节点数字之和3. 二叉树剪枝4.验证二叉搜索树5.二叉搜索树中第K小的元素6.二叉树的所有路径 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&#xff0c;我们一…

【算法】深入浅出爬山算法:原理、实现与应用

人不走空 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌赋&#xff1a;斯是陋室&#xff0c;惟吾德馨 目录 &#x1f308;个人主页&#xff1a;人不走空 &#x1f496;系列专栏&#xff1a;算法专题 ⏰诗词歌…

python-小游戏-弹球对决

python-小游戏-弹球对决 需要安装pygame 代码—game-Pong.py import pygame import random# Initialize pygame pygame.init()# Set up the screen WIDTH 600 HEIGHT 400 BALL_RADIUS 20 PAD_WIDTH 10 PAD_HEIGHT 80 WHITE (255, 255, 255) PURPLE (128, 0, 128) RED…

Springboot注意点

1.Usermapper里加param注解 2.RequestParam 和 RequestBody的区别&#xff1a; RequestParam 和 RequestBody的区别&#xff1a; RequestParam 和 RequestBody 是Spring框架中用于处理HTTP请求的两个不同的注 get请求一般用url传参数&#xff0c;所以参数名和参数的值就在ur…

Office(Microsoft 365) 体验

Office 现已更名为 Microsoft 365。 Microsoft 365 是订阅服务&#xff0c;订阅期间可享受定期的功能与安全更新&#xff0c;始终使用的是的最新版本。 Microsoft 365 包含 Word、Excel、PowerPoint 等办公常用套件&#xff0c;还包括了 OneDrive、Exchange 等协作和通信工具…

视觉SLAM十四讲:从理论到实践(Chapter11:回环检测)

前言 学习笔记&#xff0c;仅供学习&#xff0c;不做商用&#xff0c;如有侵权&#xff0c;联系我删除即可 一、主要目标 1.理解回环检测的必要性。 2.掌握基于词袋的外观式回环检测。 3.通过DBoW3的实验&#xff0c;学习词袋模型的实际用途。 二、概述 VO存在误差累积&…