UNPKG

rl-loadout-lib

Version:

Load Rocket League assets into three.js

28 lines (26 loc) 1.04 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const rim_material_1 = require("../../webgl/rim-material"); const tire_material_1 = require("../../webgl/tire-material"); const UNIFORMS = ` uniform vec3 paintColor; uniform int painted; `; const DIFFUSE_SHADER = ` vec4 normalColor = texture2D(normalMap, vUv); vec4 texelColor = vec4(0.078431, 0.078431, 0.078431, 1.0); if (painted == 1) { texelColor.rgb = blendNormal(texelColor.rgb, paintColor.rgb, normalColor.r); } texelColor = mapTexelToLinear(texelColor); diffuseColor *= texelColor; `; class ChewyTireMaterial extends tire_material_1.TireMaterial { constructor(invertMask = false) { super('r', invertMask); const diffuseShader = invertMask ? DIFFUSE_SHADER.replace('normalColor.r', '1.0-normalColor.r') : DIFFUSE_SHADER; this.fragmentShader = rim_material_1.RimMaterial.createFragmentShader(UNIFORMS, diffuseShader); } } exports.ChewyTireMaterial = ChewyTireMaterial; //# sourceMappingURL=chewy-model.js.map