feat: feature cropping for xr and ar, add xr environment constant. (#13032)

This commit is contained in:
fqamic
2022-10-14 15:52:41 +08:00
committed by GitHub
parent aa0515103f
commit cca8ff36e3
14 changed files with 155 additions and 35 deletions
+19 -3
View File
@@ -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
}
}
}
+26
View File
@@ -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 {
}
+26
View File
@@ -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';
-5
View File
@@ -23,11 +23,6 @@
THE SOFTWARE.
*/
/**
* @packageDocumentation
* @module component/xr
*/
import { Vec3 } from '../../core/math';
import { Event } from '../../input/types';
-5
View File
@@ -23,9 +23,4 @@
THE SOFTWARE.
*/
/**
* @packageDocumentation
* @hidden
*/
export * from './event/xr-event-handle';
+18 -6
View File
@@ -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"
}
}
}
+12
View File
@@ -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"
+3 -2
View File
@@ -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;
+11 -3
View File
@@ -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)",
+11 -3
View File
@@ -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: "自定义渲染管线(实验)",
+26
View File
@@ -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';
+1 -6
View File
@@ -23,9 +23,4 @@
THE SOFTWARE.
*/
/**
* @packageDocumentation
* @hidden
*/
export * from '../cocos/xr';
export * from '../cocos/xr';
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -276,7 +276,7 @@ async function doBuild ({
// HACK: get platform, mode, flags from build time constants
const flags: Record<string, any> = {};
['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