feat: release v0.4 with textured Microban visuals
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import * as THREE from "three";
|
||||
import { applyWorldGrid } from "./WorldRenderer.js";
|
||||
import { BodyVisuals } from "./BodyVisuals.js";
|
||||
// Geometry is compiled MuJoCo geometry, not raw STL: compiler-applied mesh
|
||||
// scale/centering is already represented by vertices + geom transforms.
|
||||
export class RigRenderer {
|
||||
@@ -91,7 +92,21 @@ export class RigRenderer {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
async loadBodyVisuals(mujoco, pkg) {
|
||||
if (!pkg.config.render.body_visuals?.length) return;
|
||||
this.bodyVisuals = await BodyVisuals.load(
|
||||
mujoco,
|
||||
this.model,
|
||||
this.data,
|
||||
pkg,
|
||||
);
|
||||
const replaced = new Set(this.bodyVisuals.items.map(({ id }) => id));
|
||||
for (const { id, mesh } of this.items)
|
||||
if (replaced.has(this.model.geom_bodyid[id])) mesh.visible = false;
|
||||
this.root.add(this.bodyVisuals.root);
|
||||
}
|
||||
sync() {
|
||||
this.bodyVisuals?.sync();
|
||||
const p = this.data.geom_xpos,
|
||||
r = this.data.geom_xmat,
|
||||
m = this.matrix;
|
||||
@@ -120,6 +135,7 @@ export class RigRenderer {
|
||||
}
|
||||
}
|
||||
dispose() {
|
||||
this.bodyVisuals?.dispose();
|
||||
for (const g of this.geometries.values()) g.dispose();
|
||||
for (const m of this.materials) m.dispose();
|
||||
this.geometries.clear();
|
||||
|
||||
Reference in New Issue
Block a user