diff options
| author | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-21 18:32:04 -0500 |
|---|---|---|
| committer | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-21 18:32:04 -0500 |
| commit | ece2b67aa689aee0b881bac17a62c16e0469bc56 (patch) | |
| tree | d99ac1bc32eea8687c06b28b90f15e08ba05d390 /frontend/_rigidbody/circle.js | |
| parent | aee81cdf445c02032745f10a1904439e7eecaef7 (diff) | |
Proper support for favicons, rigid body intersections are no longer broken, palinko game
Diffstat (limited to 'frontend/_rigidbody/circle.js')
| -rw-r--r-- | frontend/_rigidbody/circle.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/frontend/_rigidbody/circle.js b/frontend/_rigidbody/circle.js index 35044e3..1cec7ce 100644 --- a/frontend/_rigidbody/circle.js +++ b/frontend/_rigidbody/circle.js @@ -1,3 +1,6 @@ +/// <reference path="mat4.js" /> +/// <reference path="vec2.js" /> + const BYTES_PER_FLOAT = 4; /** @@ -42,13 +45,14 @@ function circle(pGl, pRadius, pSegments, pColorList, pInitialPosition, pMass) { vertexCount: vertexCount, prevPos: vec2(), position: pInitialPosition || vec2(), + prevVelocity: vec2(), velocity: vec2(), force: vec2(), torque: 0, - mass: pMass || 1, + mass: pMass === undefined ? 1 : pMass, rotationVelocity: 0, rotationRadians: 0, - model: mat4(), + model: translateMatrix(mat4(), pInitialPosition ? pInitialPosition.x : 0, pInitialPosition ? pInitialPosition.y : 0, 0), radius: pRadius }; } @@ -106,4 +110,8 @@ function getIntersectionDataForCircles(pFirst, pSecond) { firstPointOfApplication: subVec2(lMedianIntersectingPoint, pFirst.position), secondPointOfApplication: subVec2(lMedianIntersectingPoint, pSecond.position) } +} + +function freeCircle(pGl, pCircle) { + pGl.deleteBuffer(pCircle.buffer); }
\ No newline at end of file |
