UNPKG

rl-loadout-lib

Version:

Load Rocket League assets into three.js

63 lines 2.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const three_1 = require("three"); const color_1 = require("../utils/color"); /** * Color configuration of a loadout. */ class PaintConfig { constructor() { /** * Primary color. */ this.primary = new three_1.Color(color_1.DEFAULT_BLUE_TEAM); /** * Accent color. */ this.accent = new three_1.Color(color_1.DEFAULT_ACCENT); } } exports.PaintConfig = PaintConfig; /** * Create a color configuration object based on in-game color IDs, converting the IDs to THREE Color objects with RGB values. * @param isOrange Whether the loadout is orange or not * @param primaryColorId in-game ID of the primary color * @param accentColorId in-game ID of the accent color * @param bodyPaintId in-game ID of the body paint * @param decalPaintId in-game ID of the decal paint * @param wheelPaintId in-game ID of the wheel paint * @param topperPaintId in-game ID of the topper paint * @param antennaPaintId in-game ID of the antenna paint * @return color configuration with RGB values */ function createPaintConfig(isOrange, primaryColorId, accentColorId, bodyPaintId, decalPaintId, wheelPaintId, topperPaintId, antennaPaintId) { if (isOrange == undefined) { isOrange = false; } const config = new PaintConfig(); if (isOrange) { config.primary = new three_1.Color(primaryColorId == undefined ? color_1.DEFAULT_ORANGE_TEAM : color_1.ORANGE_PRIMARY_COLORS[primaryColorId]); } else { config.primary = new three_1.Color(primaryColorId == undefined ? color_1.DEFAULT_BLUE_TEAM : color_1.BLUE_PRIMARY_COLORS[primaryColorId]); } config.accent = new three_1.Color(accentColorId != undefined ? color_1.ACCENT_COLORS[accentColorId] : color_1.ACCENT_COLORS[0]); if (bodyPaintId != undefined && bodyPaintId > 0) { config.body = new three_1.Color(color_1.PAINT_COLORS[bodyPaintId]); } if (decalPaintId != undefined && decalPaintId > 0) { config.decal = new three_1.Color(color_1.PAINT_COLORS[decalPaintId]); } if (wheelPaintId != undefined && wheelPaintId > 0) { config.wheel = new three_1.Color(color_1.PAINT_COLORS[wheelPaintId]); } if (topperPaintId != undefined && topperPaintId > 0) { config.topper = new three_1.Color(color_1.PAINT_COLORS[topperPaintId]); } if (antennaPaintId != undefined && antennaPaintId > 0) { config.antenna = new three_1.Color(color_1.PAINT_COLORS[antennaPaintId]); } return config; } exports.createPaintConfig = createPaintConfig; //# sourceMappingURL=paint-config.js.map