macro compression
This commit is contained in:
parent
7e6fc1ffbe
commit
23afa7b266
|
@ -477,7 +477,7 @@ component.edge2d = Object.copy(collider2d, {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.hollow) {
|
if (this.hollow) {
|
||||||
var hpoints = inflate_cpv(spoints, spoints.length, this.hollowt);
|
var hpoints = vector.inflate(spoints, this.hollowt);
|
||||||
if (hpoints.length === spoints.length) return spoints;
|
if (hpoints.length === spoints.length) return spoints;
|
||||||
var arr1 = hpoints.filter(function(x,i) { return i % 2 === 0; });
|
var arr1 = hpoints.filter(function(x,i) { return i % 2 === 0; });
|
||||||
var arr2 = hpoints.filter(function(x,i) { return i % 2 !== 0; });
|
var arr2 = hpoints.filter(function(x,i) { return i % 2 !== 0; });
|
||||||
|
|
|
@ -70,7 +70,7 @@ function use(file)
|
||||||
var c = io.slurp(file);
|
var c = io.slurp(file);
|
||||||
|
|
||||||
var script = `(function() { ${c} })();`;
|
var script = `(function() { ${c} })();`;
|
||||||
use.files[file] = os.eval_env(file,global,script);
|
use.files[file] = os.eval_env(file,script,global);
|
||||||
|
|
||||||
return use.files[file];
|
return use.files[file];
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ function eval_env(script, env, file)
|
||||||
file ??= "SCRIPT";
|
file ??= "SCRIPT";
|
||||||
console.spam(`eval ${file}`);
|
console.spam(`eval ${file}`);
|
||||||
script = `(function() { ${script}; }).call(this);\n`;
|
script = `(function() { ${script}; }).call(this);\n`;
|
||||||
return os.eval_env(file,env,script);
|
return os.eval_env(file,script,env);
|
||||||
}
|
}
|
||||||
|
|
||||||
global.check_registers = function(obj)
|
global.check_registers = function(obj)
|
||||||
|
@ -147,8 +147,7 @@ global.mixin("scripts/render.js");
|
||||||
global.mixin("scripts/debug.js");
|
global.mixin("scripts/debug.js");
|
||||||
|
|
||||||
var frame_t = profile.secs(profile.now());
|
var frame_t = profile.secs(profile.now());
|
||||||
var updateMS = 1/60;
|
var phys_step = 1/60;
|
||||||
var physMS = 1/60;
|
|
||||||
|
|
||||||
var sim = {
|
var sim = {
|
||||||
mode: "play",
|
mode: "play",
|
||||||
|
@ -185,10 +184,10 @@ function process()
|
||||||
|
|
||||||
physlag += dt;
|
physlag += dt;
|
||||||
|
|
||||||
while (physlag > physMS) {
|
while (physlag > phys_step) {
|
||||||
physlag -= physMS;
|
physlag -= phys_step;
|
||||||
prosperon.phys2d_step(physMS*timescale);
|
prosperon.phys2d_step(phys_step*timescale);
|
||||||
prosperon.physupdate(physMS*timescale);
|
prosperon.physupdate(phys_step*timescale);
|
||||||
}
|
}
|
||||||
|
|
||||||
prosperon.window_render();
|
prosperon.window_render();
|
||||||
|
|
|
@ -287,9 +287,8 @@ float phys2d_circle_moi(struct phys2d_circle *c) {
|
||||||
return cpMomentForCircle(m, 0, cpCircleShapeGetRadius(c->shape.shape), cpCircleShapeGetOffset(c->shape.shape));
|
return cpMomentForCircle(m, 0, cpCircleShapeGetRadius(c->shape.shape), cpCircleShapeGetOffset(c->shape.shape));
|
||||||
}
|
}
|
||||||
|
|
||||||
void phys2d_circledel(struct phys2d_circle *c) {
|
void phys2d_circledel(struct phys2d_circle *c) { phys2d_shape_del(&c->shape); }
|
||||||
phys2d_shape_del(&c->shape);
|
void circle2d_free(circle2d *c) { phys2d_circledel(c); }
|
||||||
}
|
|
||||||
|
|
||||||
void phys2d_dbgdrawcpcirc(cpShape *c) {
|
void phys2d_dbgdrawcpcirc(cpShape *c) {
|
||||||
HMM_Vec2 pos = mat_t_pos(t_go2world(shape2go(c)), (HMM_Vec2)cpCircleShapeGetOffset(c));
|
HMM_Vec2 pos = mat_t_pos(t_go2world(shape2go(c)), (HMM_Vec2)cpCircleShapeGetOffset(c));
|
||||||
|
|
|
@ -47,6 +47,8 @@ struct phys2d_circle {
|
||||||
struct phys2d_shape shape;
|
struct phys2d_shape shape;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct phys2d_circle circle2d;
|
||||||
|
|
||||||
/* A convex polygon; defined as the convex hull around the given set of points */
|
/* A convex polygon; defined as the convex hull around the given set of points */
|
||||||
struct phys2d_poly {
|
struct phys2d_poly {
|
||||||
HMM_Vec2 *points;
|
HMM_Vec2 *points;
|
||||||
|
@ -66,6 +68,7 @@ struct phys2d_edge {
|
||||||
|
|
||||||
struct phys2d_circle *Make2DCircle(gameobject *go);
|
struct phys2d_circle *Make2DCircle(gameobject *go);
|
||||||
void phys2d_circledel(struct phys2d_circle *c);
|
void phys2d_circledel(struct phys2d_circle *c);
|
||||||
|
void circle2d_free(circle2d *c);
|
||||||
void phys2d_applycircle(struct phys2d_circle *circle);
|
void phys2d_applycircle(struct phys2d_circle *circle);
|
||||||
void phys2d_dbgdrawcircle(struct phys2d_circle *circle);
|
void phys2d_dbgdrawcircle(struct phys2d_circle *circle);
|
||||||
float phys2d_circle_moi(struct phys2d_circle *c);
|
float phys2d_circle_moi(struct phys2d_circle *c);
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue