mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix tile parsing and decal rotation
• Decals now respond to rotation and offset tools again • Fix tile value parsing • Fix broken normals when projecting on parts with no normal maps
This commit is contained in:
@ -1,9 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Experimental.Rendering;
|
||||
|
||||
namespace ConformalDecals {
|
||||
public static class DecalConfig {
|
||||
private static Texture2D _blankNormal;
|
||||
private static List<string> _shaderBlacklist;
|
||||
|
||||
public static Texture2D BlankNormal => _blankNormal;
|
||||
|
||||
public static bool IsBlacklisted(Shader shader) {
|
||||
return IsBlacklisted(shader.name);
|
||||
@ -21,6 +25,24 @@ namespace ConformalDecals {
|
||||
}
|
||||
}
|
||||
|
||||
private static Texture2D MakeBlankNormal() {
|
||||
Debug.Log("ConformalDecals: Generating neutral normal map texture");
|
||||
var width = 2;
|
||||
var height = 2;
|
||||
var color = new Color32(255, 128, 128, 128);
|
||||
var colors = new Color32[] { color, color, color, color };
|
||||
|
||||
var tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
|
||||
for (var x = 0; x <= width; x++) {
|
||||
for (var y = 0; y < height; y++) {
|
||||
tex.SetPixels32(colors);
|
||||
}
|
||||
}
|
||||
tex.Apply();
|
||||
|
||||
return tex;
|
||||
}
|
||||
|
||||
public static void ModuleManagerPostLoad() {
|
||||
_shaderBlacklist = new List<string>();
|
||||
|
||||
@ -32,6 +54,8 @@ namespace ConformalDecals {
|
||||
ParseConfig(config.config);
|
||||
}
|
||||
}
|
||||
|
||||
_blankNormal = MakeBlankNormal();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user