mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
9f89b0ef24
* Temp * temp * move ui core * Arrange ui and terrain * Fix import path for all modules except core * Move primitives into core * Fix debug.getError * Move audio-downloader to audio module * export game from game.ts * Migrate load-pipeline to ts * Fix core modules and cleanup * Move animation into core * Fix module exports * Fix director issue * Remove most cc.director usage * Fix ts issues * Fix issues for unit test and editor running * Revert removing deprecated import * tweaks * tweaks * Fix ci * Fix ci * Add modules in module division * Upgrade coordinates-converts-utils
39 lines
1014 B
TypeScript
39 lines
1014 B
TypeScript
/**
|
|
* @hidden
|
|
*/
|
|
|
|
import { Quat, Vec3 } from '../core/math';
|
|
|
|
export function stringfyVec3 (value: {x: number; y: number; z: number}): string {
|
|
if (Vec3.strictEquals(value, new Vec3())) {
|
|
return `<origin>`;
|
|
} else {
|
|
return `(x: ${value.x}, y: ${value.y}, z: ${value.z})`;
|
|
}
|
|
}
|
|
|
|
export function stringfyQuat (value: {x: number; y: number; z: number; w: number}): string {
|
|
value = new Quat(value.x, value.y, value.z, value.w);
|
|
if (Quat.strictEquals(value, new Quat())) {
|
|
return `<Identity>`;
|
|
} else {
|
|
return `(x: ${value.x}, y: ${value.y}, z: ${value.z}, w: ${value.w})`;
|
|
}
|
|
}
|
|
|
|
interface IWrapped<T> {
|
|
__cc_wrapper__: T;
|
|
}
|
|
|
|
export function setWrap<Wrapper> (object: any, wrapper: Wrapper) {
|
|
(object as IWrapped<Wrapper>).__cc_wrapper__ = wrapper;
|
|
}
|
|
|
|
export function getWrap<Wrapper> (object: any) {
|
|
return (object as IWrapped<Wrapper>).__cc_wrapper__;
|
|
}
|
|
|
|
export function maxComponent (v: Vec3) {
|
|
return Math.max(v.x, Math.max(v.y, v.z));
|
|
}
|