UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

75 lines (69 loc) 1.73 kB
import { b2MakeArray } from "../common/b2_settings.js"; import { b2Vec2 } from "../common/b2_math.js"; export class b2Profile { constructor() { this.step = 0; this.collide = 0; this.solve = 0; this.solveInit = 0; this.solveVelocity = 0; this.solvePosition = 0; this.broadphase = 0; this.solveTOI = 0; } Reset() { this.step = 0; this.collide = 0; this.solve = 0; this.solveInit = 0; this.solveVelocity = 0; this.solvePosition = 0; this.broadphase = 0; this.solveTOI = 0; return this; } } export class b2TimeStep { constructor() { this.dt = 0; this.inv_dt = 0; this.dtRatio = 0; this.velocityIterations = 0; this.positionIterations = 0; this.particleIterations = 0; this.warmStarting = false; } Copy(t) { this.dt = t.dt; this.inv_dt = t.inv_dt; this.dtRatio = t.dtRatio; this.positionIterations = t.positionIterations; this.velocityIterations = t.velocityIterations; this.particleIterations = t.particleIterations; this.warmStarting = t.warmStarting; return this; } } export class b2Position { constructor() { this.c = new b2Vec2; this.a = 0; } static MakeArray(t) { return b2MakeArray(t, (t => new b2Position)); } } export class b2Velocity { constructor() { this.v = new b2Vec2; this.w = 0; } static MakeArray(t) { return b2MakeArray(t, (t => new b2Velocity)); } } export class b2SolverData { constructor() { this.step = new b2TimeStep; } }