Skip to content

Commit

Permalink
add style for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
shakiba committed Dec 21, 2023
1 parent dc63010 commit 1bbdadc
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/collision/Shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { RayCastOutput, RayCastInput, AABBValue } from './AABB';
import { DistanceProxy } from './Distance';
import type { Transform, TransformValue } from '../common/Transform';
import type { Vec2Value } from '../common/Vec2';
import { Style } from '../util/Testbed';

// todo make shape an interface

Expand All @@ -44,6 +45,9 @@ export abstract class Shape {
*/
m_radius: number;

/** Styling for dev-tools. */
style: Style = {};

/** @internal */
abstract _reset(): void;

Expand Down
4 changes: 4 additions & 0 deletions src/dynamics/Body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { Shape } from '../collision/Shape';
import { JointEdge } from "./Joint";
import { World } from "./World";
import { ContactEdge } from "./Contact";
import { Style } from '../util/Testbed';


/** @internal */ const _ASSERT = typeof ASSERT === 'undefined' ? false : ASSERT;
Expand Down Expand Up @@ -217,6 +218,9 @@ export class Body {
/** @internal */ m_next: Body | null;
/** @internal */ m_destroyed: boolean;

/** Styling for dev-tools. */
style: Style = {};

/** @internal */
constructor(world: World, def: BodyDef) {
def = options(def, BodyDefDefault);
Expand Down
4 changes: 4 additions & 0 deletions src/dynamics/Fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { Shape, ShapeType } from '../collision/Shape';
import { Body, MassData } from "./Body";
import { BroadPhase } from "../collision/BroadPhase";
import { TransformValue } from "../common/Transform";
import { Style } from '../util/Testbed';


/** @internal */ const _ASSERT = typeof ASSERT === 'undefined' ? false : ASSERT;
Expand Down Expand Up @@ -131,6 +132,9 @@ export class Fixture {
/** @internal */ m_proxyCount: number;
/** @internal */ m_userData: unknown;

/** Styling for dev-tools. */
style: Style = {};

constructor(body: Body, def: FixtureDef);
constructor(body: Body, shape: Shape, def?: FixtureOpt);
constructor(body: Body, shape: Shape, density?: number);
Expand Down
4 changes: 4 additions & 0 deletions src/dynamics/Joint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import type { Vec2, Vec2Value } from '../common/Vec2';
import type { Body } from './Body';
import { TimeStep } from "./Solver";
import { Style } from '../util/Testbed';

/** @internal */ const _ASSERT = typeof ASSERT === 'undefined' ? false : ASSERT;

Expand Down Expand Up @@ -108,6 +109,9 @@ export abstract class Joint {
/** @internal */ m_islandFlag: boolean = false;
/** @internal */ m_userData: unknown;

/** Styling for dev-tools. */
style: Style = {};

constructor(def: JointDef);
constructor(def: JointOpt, bodyA: Body, bodyB: Body);
constructor(def: JointDef | JointOpt, bodyA?: Body, bodyB?: Body) {
Expand Down

0 comments on commit 1bbdadc

Please sign in to comment.