rl-loadout-lib
Version:
Load Rocket League assets into three.js
42 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const body_model_1 = require("./body-model");
const object_1 = require("../object");
const util_1 = require("../../utils/util");
/**
* Class for the 3D model of Maverick G1. Needed because of custom textures.
*/
class RyeTier1Model extends body_model_1.BodyModel {
constructor(body, decal, bodyAssets, decalAssets, paints) {
super(body, decal, bodyAssets, decalAssets, paints);
this.init();
}
init() {
const bodyAssets = this.bodyAssets;
this.lightsMaterial.map = util_1.htmlImageToTexture(bodyAssets.lightsD);
this.lightsMaterial.normalMap = util_1.htmlImageToTexture(bodyAssets.lightsN);
this.grillMaterial.normalMap = util_1.htmlImageToTexture(bodyAssets.grillN);
}
handleModel(scene) {
super.handleModel(scene);
object_1.traverseMaterials(scene, mat => {
if (mat.name === 'MIC_Lights') {
this.lightsMaterial = mat;
}
else if (mat.name === 'Grill') {
this.grillMaterial = mat;
}
});
}
copy(other) {
super.copy(other);
this.init();
}
clone() {
const m = new RyeTier1Model();
m.copy(this);
return m;
}
}
exports.RyeTier1Model = RyeTier1Model;
//# sourceMappingURL=rye-tier1-model.js.map