@dimforge/rapier3d
Version:
3-dimensional physics engine in Rust - official JS bindings.
38 lines • 1.3 kB
JavaScript
import { RawDebugRenderPipeline } from "../raw";
/**
* The vertex and color buffers for debug-redering the physics scene.
*/
export class DebugRenderBuffers {
constructor(vertices, colors) {
this.vertices = vertices;
this.colors = colors;
}
}
/**
* A pipeline for rendering the physics scene.
*
* To avoid leaking WASM resources, this MUST be freed manually with `debugRenderPipeline.free()`
* once you are done using it (and all the rigid-bodies it created).
*/
export class DebugRenderPipeline {
/**
* Release the WASM memory occupied by this serialization pipeline.
*/
free() {
if (!!this.raw) {
this.raw.free();
}
this.raw = undefined;
this.vertices = undefined;
this.colors = undefined;
}
constructor(raw) {
this.raw = raw || new RawDebugRenderPipeline();
}
render(bodies, colliders, impulse_joints, multibody_joints, narrow_phase, filterFlags, filterPredicate) {
this.raw.render(bodies.raw, colliders.raw, impulse_joints.raw, multibody_joints.raw, narrow_phase.raw, filterFlags, colliders.castClosure(filterPredicate));
this.vertices = this.raw.vertices();
this.colors = this.raw.colors();
}
}
//# sourceMappingURL=debug_render_pipeline.js.map