rl-loadout-lib
Version:
Load Rocket League assets into three.js
36 lines (32 loc) • 1.22 kB
JavaScript
;
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);
// black base
if (rgbaMapColor.r > 0.16470588235) {
texelColor.rgb = blendNormal(texelColor.rgb, vec3(0.04943346, 0.04943346, 0.04943346), rgbaMapColor.r);
}
// primary color
texelColor.rgb = blendNormal(texelColor.rgb, primaryColor.rgb, 1.0 - rgbaMapColor.a);
// back light
texelColor.rgb = blendNormal(texelColor.rgb, vec3(0.5, 0.0, 0.0), rgbaMapColor.g);
texelColor = mapTexelToLinear(texelColor);
diffuseColor *= texelColor;
`;
/**
* Class for the 3D model of K.I.T.T. Needed because of custom coloring.
*/
class FelineMaterial extends static_decal_material_1.StaticDecalMaterial {
constructor() {
super();
this.fragmentShader = static_decal_material_1.StaticDecalMaterial.createFragmentShader(UNIFORMS, DIFFUSE_SHADER);
}
}
exports.FelineMaterial = FelineMaterial;
//# sourceMappingURL=feline-material.js.map