diff --git a/cc.config.json b/cc.config.json index 3c88283128..55852cf3b4 100644 --- a/cc.config.json +++ b/cc.config.json @@ -133,9 +133,6 @@ "video": { "modules": ["video"] }, - "xr": { - "modules": ["xr"] - }, "terrain": { "modules": ["terrain"], "dependentAssets": ["1d08ef62-a503-4ce2-8b9a-46c90873f7d3"] @@ -168,6 +165,13 @@ "MARIONETTE": true } }, + "xr": { + "modules": ["xr"] + }, + "ar": { + "modules": ["ar"], + "dependentModules": ["xr"] + }, "custom-pipeline": { "modules": ["custom-pipeline"] } @@ -520,6 +524,18 @@ "type": "boolean", "value": false, "internal": true + }, + "XR_ENV": { + "comment": "Running in environment where using XR.\n- 0 CLOSE\n- 1 XR\n- 2 WEB_XR", + "type": "number", + "value": 0, + "internal": false + }, + "XR_TYPE": { + "comment": "Different types in the XR environment.\n- 0 OFF\n- 1 VR\n- 2 AR", + "type": "number", + "value": 0, + "internal": false } } } diff --git a/cocos/xr/ar/ar-module-base.ts b/cocos/xr/ar/ar-module-base.ts new file mode 100644 index 0000000000..919904d8f1 --- /dev/null +++ b/cocos/xr/ar/ar-module-base.ts @@ -0,0 +1,26 @@ +/* + Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + + http://www.cocos2d-x.org + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + 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. +*/ + +export abstract class IARModule { +} diff --git a/cocos/xr/ar/index.ts b/cocos/xr/ar/index.ts new file mode 100644 index 0000000000..cd62997937 --- /dev/null +++ b/cocos/xr/ar/index.ts @@ -0,0 +1,26 @@ +/* +Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + +https://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. +*/ + +export * from './ar-module-base'; diff --git a/cocos/xr/event/xr-event-handle.ts b/cocos/xr/event/xr-event-handle.ts index ed1291defb..c14d88fd5c 100644 --- a/cocos/xr/event/xr-event-handle.ts +++ b/cocos/xr/event/xr-event-handle.ts @@ -23,11 +23,6 @@ THE SOFTWARE. */ -/** - * @packageDocumentation - * @module component/xr - */ - import { Vec3 } from '../../core/math'; import { Event } from '../../input/types'; diff --git a/cocos/xr/index.ts b/cocos/xr/index.ts index 57b3f9f0f5..a1926d7d74 100644 --- a/cocos/xr/index.ts +++ b/cocos/xr/index.ts @@ -23,9 +23,4 @@ THE SOFTWARE. */ -/** - * @packageDocumentation - * @hidden - */ - export * from './event/xr-event-handle'; diff --git a/editor/engine-features/render-config.json b/editor/engine-features/render-config.json index 8082af61f5..994a57ce0d 100644 --- a/editor/engine-features/render-config.json +++ b/editor/engine-features/render-config.json @@ -53,12 +53,6 @@ "category": "2d", "wechatPlugin": true }, - "xr": { - "default": ["xr"], - "label": "i18n:ENGINE.features.xr.label", - "description": "i18n:ENGINE.features.xr.description", - "wechatPlugin": false - }, "ui": { "default": ["ui"], "label": "i18n:ENGINE.features.ui.label", @@ -245,6 +239,20 @@ "wechatPlugin": false, "category": "animation" }, + "xr": { + "default": [], + "label": "i18n:ENGINE.features.base_xr.label", + "description": "i18n:ENGINE.features.base_xr.description", + "wechatPlugin": false, + "category": "xr" + }, + "ar": { + "default": [], + "label": "i18n:ENGINE.features.ar.label", + "description": "i18n:ENGINE.features.ar.description", + "wechatPlugin": false, + "category": "xr" + }, "custom-pipeline": { "default": [], "label": "i18n:ENGINE.features.custom_pipeline.label", @@ -268,6 +276,10 @@ "network": { "label": "i18n:ENGINE.features.categories.network.label", "description": "i18n:ENGINE.features.categories.network.description" + }, + "xr": { + "label": "i18n:ENGINE.features.categories.xr.label", + "description": "i18n:ENGINE.features.categories.xr.description" } } } diff --git a/editor/engine-features/schema.json b/editor/engine-features/schema.json index 8f79449fbc..26921665ec 100644 --- a/editor/engine-features/schema.json +++ b/editor/engine-features/schema.json @@ -61,6 +61,9 @@ "animation": { "$ref": "#/definitions/Item" }, + "ar": { + "$ref": "#/definitions/Item" + }, "audio": { "$ref": "#/definitions/Item" }, @@ -147,6 +150,9 @@ }, "webview": { "$ref": "#/definitions/Item" + }, + "xr": { + "$ref": "#/definitions/Item" } }, "type": "object" @@ -205,6 +211,9 @@ "animation": { "$ref": "#/definitions/BaseItem" }, + "ar": { + "$ref": "#/definitions/BaseItem" + }, "audio": { "$ref": "#/definitions/BaseItem" }, @@ -291,6 +300,9 @@ }, "webview": { "$ref": "#/definitions/BaseItem" + }, + "xr": { + "$ref": "#/definitions/BaseItem" } }, "type": "object" diff --git a/editor/engine-features/types.ts b/editor/engine-features/types.ts index 2ff6a5f7cd..41aa9cb916 100644 --- a/editor/engine-features/types.ts +++ b/editor/engine-features/types.ts @@ -8,7 +8,6 @@ export type EngineFeature = | 'graphcis' | '3d' | '2d' - | 'xr' | 'ui' | 'particle' | 'physics' @@ -33,7 +32,9 @@ export type EngineFeature = | 'profiler' | 'marionette' | 'animation' - | 'skeletal-animation'; + | 'skeletal-animation' + | 'xr' + | 'ar'; export interface ModuleRenderConfig { $schema?: string; diff --git a/editor/i18n/en/localization.js b/editor/i18n/en/localization.js index 7f44e5812d..95036c73ff 100755 --- a/editor/i18n/en/localization.js +++ b/editor/i18n/en/localization.js @@ -786,6 +786,10 @@ module.exports = { label: 'Network', description: 'Network Module.', }, + xr: { + label: 'XR', + description: 'XR System.', + }, }, core: { label: "Core", @@ -931,9 +935,13 @@ module.exports = { label: "Marionette Animation System", description: "Enable the Marionette animation system", }, - xr: { - label: "XR", - description: "Enable the XR function system", + base_xr: { + label: "Basic XR", + description: "Basic XR support.", + }, + ar: { + label: "AR", + description: "AR support.", }, custom_pipeline: { label: "Custom Render Pipeline (Experimental)", diff --git a/editor/i18n/zh/localization.js b/editor/i18n/zh/localization.js index 54ddbe026a..7b285a707f 100755 --- a/editor/i18n/zh/localization.js +++ b/editor/i18n/zh/localization.js @@ -767,6 +767,10 @@ module.exports = { label: '网络', description: '网络模块。', }, + xr: { + label: 'XR', + description: 'XR系统。', + }, }, core: { label: "核心功能", @@ -912,9 +916,13 @@ module.exports = { label: "Marionette 动画系统", description: "启用 Marionette 动画系统。", }, - xr: { - label: "XR", - description: "启用 XR 功能系统。", + base_xr: { + label: "基础 XR 功能", + description: "基础 XR 功能支持。", + }, + ar: { + label: "AR 功能", + description: "AR 功能支持。", }, custom_pipeline: { label: "自定义渲染管线(实验)", diff --git a/exports/ar.ts b/exports/ar.ts new file mode 100644 index 0000000000..22d7b886d6 --- /dev/null +++ b/exports/ar.ts @@ -0,0 +1,26 @@ +/* + Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + + https://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. + */ + +export * from '../cocos/xr/ar'; diff --git a/exports/xr.ts b/exports/xr.ts index 5368d95d40..e214512d90 100644 --- a/exports/xr.ts +++ b/exports/xr.ts @@ -23,9 +23,4 @@ THE SOFTWARE. */ -/** - * @packageDocumentation - * @hidden - */ - - export * from '../cocos/xr'; +export * from '../cocos/xr'; diff --git a/scripts/build-engine/src/constant-manager.ts b/scripts/build-engine/src/constant-manager.ts index bdfcf53f21..f113044873 100644 --- a/scripts/build-engine/src/constant-manager.ts +++ b/scripts/build-engine/src/constant-manager.ts @@ -7,7 +7,7 @@ export type PlatformType = 'HTML5' | 'NATIVE' | 'WECHAT' | 'BAIDU' | 'XIAOMI' | 'ALIPAY' | 'BYTEDANCE' | 'OPPO' | 'VIVO' | 'HUAWEI' | 'COCOSPLAY' | 'QTT' | 'LINKSURE'; export type InternalFlagType = 'SERVER_MODE' | 'NOT_PACK_PHYSX_LIBS' | 'WEBGPU'; -export type PublicFlagType = 'DEBUG' | 'NET_MODE'; +export type PublicFlagType = 'DEBUG' | 'NET_MODE' | 'XR_ENV' | 'XR_TYPE'; export type FlagType = InternalFlagType | PublicFlagType; export type ValueType = number | boolean; diff --git a/scripts/build-engine/src/index.ts b/scripts/build-engine/src/index.ts index e03386708e..3de015217a 100644 --- a/scripts/build-engine/src/index.ts +++ b/scripts/build-engine/src/index.ts @@ -276,7 +276,7 @@ async function doBuild ({ // HACK: get platform, mode, flags from build time constants const flags: Record = {}; - ['SERVER_MODE', 'NOT_PACK_PHYSX_LIBS', 'DEBUG', 'NET_MODE', 'WEBGPU'].forEach((key) => { + ['SERVER_MODE', 'NOT_PACK_PHYSX_LIBS', 'DEBUG', 'NET_MODE', 'WEBGPU', 'XR_ENV', 'XR_TYPE'].forEach((key) => { flags[key] = buildTimeConstants[key]; }); // Wether use webgpu