[v3.8.6] Optimize code size for physx backend (#18169)

This commit is contained in:
James Chen
2025-01-13 10:50:51 +08:00
committed by GitHub
parent 26bc752e5d
commit fd2f3840df
20 changed files with 24 additions and 0 deletions
@@ -34,6 +34,8 @@ import { degreesToRadians } from '../../../core/utils/misc';
const v3_0 = new Vec3(0, 0, 0);
const upDir = new Vec3(0, 1, 0);
/** @mangle */
export class PhysXBoxCharacterController extends PhysXCharacterController implements IBoxCharacterController {
get component (): BoxCharacterController {
return this._comp as BoxCharacterController;
@@ -34,6 +34,8 @@ import { degreesToRadians } from '../../../core/utils/misc';
const v3_0 = new Vec3(0, 0, 0);
const upDir = new Vec3(0, 1, 0);//temp
/** @mangle */
export class PhysXCapsuleCharacterController extends PhysXCharacterController implements ICapsuleCharacterController {
get component (): CapsuleCharacterController {
return this._comp as CapsuleCharacterController;
@@ -34,6 +34,8 @@ import { TransformBit } from '../../../scene-graph';
const v3_0 = new Vec3(0, 0, 0);
const v3_1 = new Vec3(0, 0, 0);
/** @mangle */
export class PhysXCharacterController implements IBaseCharacterController {
private _isEnabled = false;
protected _impl: any = null;
@@ -46,6 +46,7 @@ function getConstraintFlag (v: EConstraintMode): any {
}
}
/** @mangle */
export class PhysXConfigurableJoint extends PhysXJoint implements IConfigurableConstraint {
protected _setLinearLimit (): void {
const linearLimit = this.constraint.linearLimitSettings;
@@ -33,6 +33,7 @@ const v3_0 = new Vec3();
const quat_0 = new Quat();
const mat_0 = new Mat4();
/** @mangle */
export class PhysXFixedJoint extends PhysXJoint implements IFixedConstraint {
setBreakForce (v: number): void {
this._breakForce = this.constraint.breakForce;
@@ -29,6 +29,7 @@ import { PX, setJointActors, _pxtrans } from '../physx-adapter';
import { PhysXRigidBody } from '../physx-rigid-body';
import { PhysXInstance } from '../physx-instance';
/** @mangle */
export class PhysXJoint implements IBaseConstraint {
private static _tempActor: any;
@@ -35,6 +35,7 @@ const v3_2 = new Vec3();
const quat_0 = new Quat();
const mat_0 = new Mat4();
/** @mangle */
export class PhysXRevoluteJoint extends PhysXJoint implements IHingeConstraint {
private _limitPair = new PX.PxJointAngularLimitPair(0, 0);
@@ -28,6 +28,7 @@ import { IPointToPointConstraint } from '../../spec/i-physics-constraint';
import { PX, _trans, getTempTransform, _pxtrans } from '../physx-adapter';
import { PhysXJoint } from './physx-joint';
/** @mangle */
export class PhysXSphericalJoint extends PhysXJoint implements IPointToPointConstraint {
setPivotA (v: IVec3Like): void {
const cs = this.constraint;
@@ -27,6 +27,8 @@ import { IContactEquation, ICollisionEvent, Collider } from '../framework';
import { getContactNormal, getContactPosition } from './physx-adapter';
const quat = new Quat();
/** @mangle */
export class PhysXContactEquation implements IContactEquation {
get isBodyA (): boolean {
return this.colliderA.uuid === this.event.selfCollider.uuid;
+1
View File
@@ -32,6 +32,7 @@ import { PhysXWorld } from './physx-world';
const v3_0 = new Vec3();
/** @mangle */
export class PhysXRigidBody implements IRigidBody {
get impl (): any { return this._sharedBody.impl; }
+1
View File
@@ -38,6 +38,7 @@ import { PhysXJoint } from './joints/physx-joint';
import { PhysicsGroup } from '../framework/physics-enum';
import { Node } from '../../scene-graph';
/** @mangle */
export class PhysXSharedBody {
private static idCounter = 0;
private static readonly sharedBodesMap = new Map<string, PhysXSharedBody>();
@@ -29,6 +29,7 @@ import { PX } from '../physx-adapter';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
import { PhysXInstance } from '../physx-instance';
/** @mangle */
export class PhysXBoxShape extends PhysXShape implements IBoxShape {
static BOX_GEOMETRY: any;
@@ -29,6 +29,7 @@ import { PX } from '../physx-adapter';
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXCapsuleShape extends PhysXShape implements ICapsuleShape {
static CAPSULE_GEOMETRY: any;
@@ -30,6 +30,7 @@ import { createConvexMesh, createMeshGeometryFlags, PX, _trans } from '../physx-
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXConeShape extends PhysXShape implements IConeShape {
static CONVEX_MESH: any;
geometry: any;
@@ -30,6 +30,7 @@ import { createConvexMesh, createMeshGeometryFlags, PX, _trans } from '../physx-
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXCylinderShape extends PhysXShape implements ICylinderShape {
static CONVEX_MESH: any;
geometry: any;
@@ -29,6 +29,7 @@ import { getTempTransform, PX, _trans } from '../physx-adapter';
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXPlaneShape extends PhysXShape implements IPlaneShape {
static PLANE_GEOMETRY: any;
@@ -46,6 +46,7 @@ export enum EPhysXShapeType {
MESH,
}
/** @mangle */
export class PhysXShape implements IBaseShape {
private static _MESH_SCALE: any;
static get MESH_SCALE (): any {
@@ -29,6 +29,7 @@ import { PX } from '../physx-adapter';
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXSphereShape extends PhysXShape implements ISphereShape {
static SPHERE_GEOMETRY: any;
@@ -30,6 +30,7 @@ import { createHeightField, createHeightFieldGeometry, getTempTransform, PX } fr
import { PhysXInstance } from '../physx-instance';
import { EPhysXShapeType, PhysXShape } from './physx-shape';
/** @mangle */
export class PhysXTerrainShape extends PhysXShape implements ITerrainShape {
static heightScale = 1 / 512;
@@ -31,6 +31,7 @@ import { addReference, createConvexMesh, createMeshGeometryFlags, createTriangle
import { EPhysXShapeType, PhysXShape } from './physx-shape';
import { PhysXInstance } from '../physx-instance';
/** @mangle */
export class PhysXTrimeshShape extends PhysXShape implements ITrimeshShape {
geometry: any;