rl-loadout-lib
Version:
Load Rocket League assets into three.js
68 lines • 2.56 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const body_model_1 = require("./body-model");
const color_1 = require("../../utils/color");
const util_1 = require("../../utils/util");
/**
* Class for the 3D model of Jurassic Jeep® Wrangler. Needed because paints cannot be applied to this body.
*/
class MapleModel extends body_model_1.BodyModel {
constructor(body, decal, bodyAssets, decalAssets, paints) {
super(body, decal, bodyAssets, decalAssets, paints);
this.bodyDataOrange = util_1.htmlImageToTexture(bodyAssets.bodyOrange);
this.bodyDataBlue = util_1.htmlImageToTexture(bodyAssets.bodyBlue);
this.chassisDataOrange = util_1.htmlImageToTexture(bodyAssets.chassisOrange);
this.chassisDataBlue = util_1.htmlImageToTexture(bodyAssets.chassisBlue);
this.bodyMaterial.map = this.bodyDataBlue;
this.chassisMaterial.map = this.chassisDataBlue;
this.applyTextures();
}
applyAssets() {
this.chassisMaterial.normalMap = util_1.htmlImageToTexture(this.bodyAssets.chassisN);
this.chassisMaterial.normalMap.needsUpdate = true;
}
dispose() {
super.dispose();
util_1.disposeIfExists(this.bodyDataOrange);
util_1.disposeIfExists(this.bodyDataBlue);
util_1.disposeIfExists(this.chassisDataOrange);
util_1.disposeIfExists(this.chassisDataBlue);
}
applyTextures() {
this.bodyMaterial.needsUpdate = true;
this.chassisMaterial.needsUpdate = true;
}
setPaintColor(color) {
}
changeDecal(decalAssets, paints) {
}
setPrimaryColor(color) {
if (`#${color.getHexString()}` === color_1.COLOR_MAPLE_ORANGE) {
this.bodyMaterial.map = this.bodyDataOrange;
this.chassisMaterial.map = this.chassisDataOrange;
}
else {
this.bodyMaterial.map = this.bodyDataBlue;
this.chassisMaterial.map = this.chassisDataBlue;
}
this.applyTextures();
}
setAccentColor(color) {
}
setDecalPaintColor(color) {
}
copy(other) {
super.copy(other);
this.bodyDataBlue = other.bodyDataBlue.clone();
this.bodyDataOrange = other.bodyDataOrange.clone();
this.chassisDataOrange = other.chassisDataOrange.clone();
this.chassisDataBlue = other.chassisDataBlue.clone();
}
clone() {
const m = new MapleModel();
m.copy(this);
return m;
}
}
exports.MapleModel = MapleModel;
//# sourceMappingURL=maple-model.js.map