Skip to content

Commit

Permalink
[v3.8.6] Optimize code size for physx backend (#18169)
Browse files Browse the repository at this point in the history
  • Loading branch information
dumganhar authored Jan 13, 2025
1 parent 26bc752 commit fd2f384
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/joints/physx-configurable-joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/joints/physx-fixed-joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/joints/physx-joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/joints/physx-revolute-joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/joints/physx-spherical-joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions cocos/physics/physx/physx-contact-equation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/physx-rigid-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/physx-shared-body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-box-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-capsule-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-cone-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-cylinder-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-plane-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export enum EPhysXShapeType {
MESH,
}

/** @mangle */
export class PhysXShape implements IBaseShape {
private static _MESH_SCALE: any;
static get MESH_SCALE (): any {
Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-sphere-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-terrain-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions cocos/physics/physx/shapes/physx-trimesh-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit fd2f384

Please sign in to comment.