protected override Material[] GenerateMasks(GraphicRequestRGB req, PatternDef pattern) { Texture2D mainTex = ContentFinder <Texture2D> .Get(req.path); Texture2D maskTex = ContentFinder <Texture2D> .Get(req.path + MaskSuffix, false); masks = Enumerable.Repeat(maskTex, MatCount).ToArray(); var mats = new Material[MatCount]; MaterialRequestRGB mReq = new MaterialRequestRGB() { mainTex = mainTex, shader = req.shader, properties = pattern.properties, color = pattern.properties.colorOne ?? req.color, colorTwo = pattern.properties.colorTwo ?? req.colorTwo, colorThree = pattern.properties.colorThree ?? req.colorThree, tiles = req.tiles, isSkin = pattern is SkinDef, maskTex = maskTex, patternTex = pattern?[Rot8.North], shaderParameters = req.shaderParameters }; mats[0] = MaterialPoolExpanded.MatFrom(mReq); return(mats); }
private void RecacheMaterials() { maskMaterials.Clear(); foreach (PatternDef pattern in availableMasks) { MaterialRequestRGB req = new MaterialRequestRGB() { mainTex = vehicle.VehicleGraphic.TexAt(Rot8.North), shader = RGBShaderTypeDefOf.CutoutComplexPattern.Shader, properties = pattern.properties, color = pattern.properties.colorOne ?? CurrentColorOne.ToColor, colorTwo = pattern.properties.colorTwo ?? CurrentColorTwo.ToColor, colorThree = pattern.properties.colorThree ?? CurrentColorThree.ToColor, tiles = 1, isSkin = pattern is SkinDef, maskTex = vehicle.VehicleGraphic.masks[Rot8.North.AsInt], patternTex = pattern[Rot8.North], shaderParameters = null }; Material patMat = MaterialPoolExpanded.MatFrom(req); maskMaterials.Add(patMat); } }