UNPKG

rl-loadout-lib

Version:

Load Rocket League assets into three.js

53 lines 1.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const object_1 = require("./object"); const util_1 = require("../utils/util"); const topper_material_1 = require("../webgl/topper-material"); /** * Class that handles loading the 3D model of the car topper. */ class TopperModel extends object_1.AbstractObject { /** * Create an topper object. * @param topper the topper * @param topperAssets topper assets * @param paints the paint config to apply the topper paint */ constructor(topper, topperAssets, paints) { super(topperAssets); if (topperAssets != undefined) { this.material = new topper_material_1.TopperMaterial(); this.material.normalMap = util_1.htmlImageToTexture(topperAssets.normalMap); this.material.map = util_1.htmlImageToTexture(topperAssets.diffuse); this.material.rgbaMap = util_1.htmlImageToTexture(topperAssets.rgbaMap); this.material.needsUpdate = true; this.mesh.material = this.material; } } dispose() { super.dispose(); util_1.disposeIfExists(this.material); } handleModel(scene) { scene.traverse(object => { if (object['isMesh']) { this.mesh = object; } }); } setPaintColor(color) { if (this.material != undefined) { this.material.paintColor = color; } } copy(other) { super.copy(other); } clone() { const m = new TopperModel(); m.copy(this); return m; } } exports.TopperModel = TopperModel; //# sourceMappingURL=topper-model.js.map