improve: update external to support xr development

1.update xr static library
2.add xr pico library
This commit is contained in:
fqamic 2022-09-02 14:36:06 +08:00
parent b5d18a759c
commit 476a109d9a
12 changed files with 3 additions and 182 deletions

View File

@ -65,14 +65,16 @@ target_include_directories(android_platform PUBLIC
if(USE_XR)
if(BUILD_XR_NATIVE)
list(APPEND XR_EXTERNAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr/Xr.h)
list(APPEND XR_EXTERNAL_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/platform/interfaces/modules/XRCommon.h)
list(APPEND XR_EXTERNAL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr)
list(APPEND XR_EXTERNAL_INCLUDES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/platform/interfaces/modules)
include(${CMAKE_CURRENT_LIST_DIR}/../../../../CCOpenXR/internal/CMakeLists.txt)
else()
add_library(xr STATIC IMPORTED GLOBAL)
set_target_properties(xr PROPERTIES
IMPORTED_LOCATION ${platform_spec_path}/xr/${XR_FOLDER}/libxr.a
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/../sources/xr
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/../../cocos/xr
)
set_property(TARGET xr APPEND PROPERTY

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -75,10 +75,6 @@ set(XR_EXTERNAL_LIBS)
set(XR_EXTERNAL_INCLUDES)
set(XR_EXTERNAL_SOURCES)
list(APPEND XR_EXTERNAL_SOURCES
${CMAKE_CURRENT_LIST_DIR}/Xr.h
)
list(APPEND XR_EXTERNAL_INCLUDES
${CMAKE_CURRENT_LIST_DIR}
)

View File

@ -1,157 +0,0 @@
/****************************************************************************
Copyright (c) 2022 Xiamen Yaji Software Co., Ltd.
http://www.cocos.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated engine source code (the "Software"), a limited,
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
to use Cocos Creator solely to develop games on your target platforms. You shall
not use Cocos Creator software for developing other software or tools that's
used for developing games. You are not granted to publish, distribute,
sublicense, and/or sell copies of Cocos Creator.
The software or tools in this License Agreement are licensed, not sold.
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef H_XR_H
#define H_XR_H
#include <functional>
#include <vector>
#include "XRCommon.h"
#ifdef XR_USE_GRAPHICS_API_VULKAN
#include "vulkan/vulkan_core.h"
#endif
namespace cc {
namespace xr {
class XrEntry {
public:
static XrEntry *getInstance();
static void destroyInstance();
virtual void initPlatformData(void *javaVM, void *activity) = 0;
virtual void createXrInstance(const char *graphicsName) = 0;
virtual void pauseXrInstance() = 0;
virtual void resumeXrInstance() = 0;
virtual void destroyXrInstance() = 0;
virtual int getXrViewCount() = 0;
virtual void initXrSwapchains() = 0;
virtual bool isCreatedXrInstance() = 0;
#ifdef XR_USE_GRAPHICS_API_VULKAN
virtual uint32_t getXrVkApiVersion(uint32_t defaultApiVersion) = 0;
virtual void initXrSession(VkInstance vkInstance, VkPhysicalDevice vkPhyDevice, VkDevice vkDevice, uint32_t familyIndex) = 0;
virtual void getSwapchainImages(std::vector<VkImage> &vkImages, uint32_t eye) = 0;
virtual VkInstance xrVkCreateInstance(const VkInstanceCreateInfo &instInfo, const PFN_vkGetInstanceProcAddr &addr) = 0;
virtual VkPhysicalDevice getXrVkGraphicsDevice(const VkInstance &vkInstance) = 0;
virtual VkResult xrVkCreateDevice(const VkDeviceCreateInfo *deviceInfo, const PFN_vkGetInstanceProcAddr &addr, const VkPhysicalDevice &vkPhysicalDevice, VkDevice *vkDevice) = 0;
#endif
#ifdef XR_USE_GRAPHICS_API_OPENGL_ES
virtual void initXrSession(PFNGLES3WLOADPROC gles3wLoadFuncProc, void *eglDisplay, void *eglConfig, void *eglDefaultContext) = 0;
virtual unsigned int getXrFrameBuffer() = 0;
virtual void attachXrFramebufferTexture2D() = 0;
#endif
virtual std::vector<XRSwapchain> &getCocosXrSwapchains() = 0;
virtual const XRSwapchain getCurrentXrSwapchain() = 0;
virtual const xr::XRSwapchain &acquireXrSwapchain(uint32_t gfxApi) = 0;
virtual bool isSessionRunning() = 0;
virtual bool frameStart() = 0;
virtual void renderLoopStart(int eye) = 0;
virtual void renderLoopEnd(int eye) = 0;
virtual void frameEnd() = 0;
virtual bool isRenderAllowable() = 0;
virtual void setGamepadCallback(const cc::xr::XRControllerCallback &xrControllerCallback) = 0;
virtual void setHandleCallback(const cc::xr::XRControllerCallback &xrControllerCallback) = 0;
virtual void setHMDCallback(const cc::xr::XRControllerCallback &xrControllerCallback) = 0;
virtual void setXRConfigCallback(const cc::xr::XRConfigChangeCallback &xrConfigChangeCallback) = 0;
virtual std::vector<float> computeViewProjection(uint32_t index, float nearZ, float farZ, float scaleF) = 0;
virtual uint32_t getSwapchainImageIndex() = 0;
virtual void setMultisamplesRTT(int num) = 0;
virtual void setRenderingScale(float scale) = 0;
virtual void setIPDOffset(float offset) = 0;
virtual void setBaseSpaceType(int type) = 0;
virtual std::vector<float> getHMDViewPosition(uint32_t index, int trackingType) = 0;
virtual bool platformLoopStart() = 0;
virtual bool platformLoopEnd() = 0;
virtual XRConfigValue getXRConfig(XRConfigKey key) = 0;
virtual void setXRConfig(XRConfigKey key, XRConfigValue value) = 0;
virtual void waitFrame() = 0;
virtual void setXRIntConfig(int key, int value) = 0;
virtual void setXRBoolConfig(int key, bool value) = 0;
virtual void setXRFloatConfig(int key, float value) = 0;
virtual void setXRStringConfig(int key, std::string value) = 0;
virtual void setXRPointerConfig(int key, void *value) = 0;
virtual int getXRIntConfig(int key) = 0;
virtual bool getXRBoolConfig(int key) = 0;
virtual float getXRFloatConfig(int key) = 0;
virtual std::string getXRStringConfig(int key) = 0;
virtual void *getXRPointerConfig(int key) = 0;
};
} // namespace xr
} // namespace cc
#endif // H_XR_H

View File

@ -1,20 +0,0 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
-keep class com.huawei.hvr.LibUpdateClient {*;}