UNPKG

rl-loadout-lib

Version:

Load Rocket League assets into three.js

33 lines (30 loc) 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const static_decal_material_1 = require("../../webgl/static-decal-material"); const UNIFORMS = ` uniform sampler2D rgbaMap; uniform vec3 primaryColor; `; const DIFFUSE_SHADER = ` vec4 texelColor = texture2D(map, vUv); vec4 rgbaMapColor = texture2D(rgbaMap, vUv); // primary color if (rgbaMapColor.r > 0.16470588235) { texelColor.rgb = blendNormal(texelColor.rgb, primaryColor.rgb, rgbaMapColor.r); } // grey color texelColor.rgb = blendNormal(texelColor.rgb, vec3(0.329729, 0.329729, 0.329729), rgbaMapColor.a); texelColor = mapTexelToLinear(texelColor); diffuseColor *= texelColor; `; /** * Class for the 3D model of K.I.T.T. Needed because of custom coloring. */ class GreyCarMaterial extends static_decal_material_1.StaticDecalMaterial { constructor() { super(); this.fragmentShader = static_decal_material_1.StaticDecalMaterial.createFragmentShader(UNIFORMS, DIFFUSE_SHADER); } } exports.GreyCarMaterial = GreyCarMaterial; //# sourceMappingURL=grey-car-material.js.map