mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-06 03:22:39 +08:00
65b0478c69
* 3d v1.1.1-exp physics expriment (#6787) * activate when not awake (#6781) * activate when not awake * cannon too * off event listener when onDestroy * add clearVelocity & clearForces * add CC_CONFIG to ammo\cannon * add convex mesh & reuse mesh * cache enable false by default * terrain collider * cone collider * fix scale of ammo box & sphere * simple collider * add worldBounds & boundingSphere to collider * add clear*** to rigid body * enhance physics material * enhance event * plane collider * stash * tweaks * update @cocos/ammo to v1.0.7-beta.1 * typing * enchance update shape dynamic * absolute scale cannon-box * expose allowsleep * fix warning of generate declaration * remove physics_builtin * DO NOT MERGE * Better reuse * Correct construct and deconstruct * avoid ammo memory leaks * minor refactor contact data * fix cannon terrain tileSize * stash * optimize auto wakeup * [Ammo] fix update by re add * 400~ * overwrite ArrayCollisionMatrix.prototype.reset * Export enum by namespace * stash * fix remove child shape of btCompound * fix event with CCD * dynamic instantiate * STASH * add group to rigid body * update attachedRigidBody of collider in editor * stash physics config * tweaks of ammo config * stash * stash * collision matrix * stash * rename deltaTime to fixedTimeStep * group mask collider * allow get mask * set default group to Layers.Enum.DEFAULT * add group change fallback * cannon collision matrix * fix * update @cocos/ammo to 1.0.7-beta.2 * more prop * fix * disable on 1.1.1-exp * tweaks * fix circular dependency * tweaks * rename simple to simplex * rename collider -> colliders * stash * ammo p2p * hinge constraint * adapt cannon p2p pivotB * ammo p2p setPivotB * constraint * tweaks * remove macro of physics * refactor physics selector * import ammo from ammo-instantiated * update @cocos/ammo * update @cocos/cannon
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
const _global = typeof window === 'undefined' ? global : window;
|
|
|
|
function defined (name: string) {
|
|
return typeof _global[name] === 'object';
|
|
}
|
|
|
|
function tryDefineGlobal (name: string, value: boolean): boolean {
|
|
if (typeof _global[name] === 'undefined') {
|
|
return (_global[name] = value);
|
|
} else {
|
|
return _global[name];
|
|
}
|
|
}
|
|
|
|
export const BUILD = tryDefineGlobal('CC_BUILD', false);
|
|
export const TEST = tryDefineGlobal('CC_TEST', defined('tap') || defined('QUnit'));
|
|
export const EDITOR = tryDefineGlobal('CC_EDITOR', defined('Editor') && defined('process') && ('electron' in process.versions));
|
|
export const PREVIEW = tryDefineGlobal('CC_PREVIEW', !EDITOR);
|
|
export const DEV = tryDefineGlobal('CC_DEV', true); // (CC_EDITOR && !CC_BUILD) || CC_PREVIEW || CC_TEST
|
|
export const DEBUG = tryDefineGlobal('CC_DEBUG', true); // CC_DEV || Debug Build
|
|
export const JSB = tryDefineGlobal('CC_JSB', defined('jsb'));
|
|
// @ts-ignore
|
|
export const WECHAT = tryDefineGlobal('CC_WECHAT', !!(defined('wx') && (wx.getSystemInfoSync || wx.getSharedCanvas)));
|
|
export const MINIGAME = tryDefineGlobal('CC_MINIGAME', false);
|
|
export const RUNTIME_BASED = tryDefineGlobal('CC_RUNTIME_BASED', false);
|
|
export const ALIPAY = tryDefineGlobal('CC_ALIPAY', false);
|
|
export const XIAOMI = tryDefineGlobal('CC_XIAOMI', false);
|
|
export const BAIDU = tryDefineGlobal('CC_BAIDU', false);
|
|
export const COCOSPLAY = tryDefineGlobal('CC_COCOSPLAY', false);
|
|
export const HUAWEI = tryDefineGlobal('CC_HUAWEI', false);
|
|
export const OPPO = tryDefineGlobal('CC_OPPO', false);
|
|
export const VIVO = tryDefineGlobal('CC_VIVO', false);
|
|
// @ts-ignore
|
|
export const SUPPORT_JIT = tryDefineGlobal('CC_SUPPORT_JIT', ('function' === typeof loadRuntime));
|