Get decal switching working mostly

pull/13/head
Andrew Cassidy 4 years ago
parent d6f0a1f9a7
commit 41ea08e571
No known key found for this signature in database
GPG Key ID: 963017B38FD477A1

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:39917c9af2ac9434ced262d911ac6d48ddc982c95d875085b425dbbf48d5b1fd
size 830547

@ -47,22 +47,58 @@ PART
decalFront = Decal-Front
decalBack = Decal-Back
decalShader = ConformalDecals/Feature/Bumped
useBaseNormal = false
TEXTURE
{
name = _Decal
textureURL = ConformalDecals/Assets/Tortilla-diffuse
isMain = true
}
MODULE {
name = ModuleB9PartSwitch
SUBTYPE {
name = tortilla
MODULE {
IDENTIFIER {
name = ModuleConformalDecal
}
DATA {
decalShader = ConformalDecals/Feature/Bumped
TEXTURE {
name = _Decal
textureURL = ConformalDecals/Assets/Tortilla-diffuse
isMain = true
}
TEXTURE
{
name = _BumpMap
textureURL = ConformalDecals/Assets/Tortilla-normal
isNormalMap = true
}
}
}
}
TEXTURE
{
name = _BumpMap
textureURL = ConformalDecals/Assets/Tortilla-normal
isNormalMap = true
SUBTYPE {
name = Danger
MODULE {
IDENTIFIER {
name = ModuleConformalDecal
}
DATA {
decalShader = ConformalDecals/Paint/Diffuse
useBaseNormal = true
TEXTURE {
name = _Decal
textureURL = ConformalDecals/Assets/Sign-HighVoltage-2
isMain = true
}
}
}
}
}
}

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b382a49057472d4ba44cb722cd3a1e6956800b06e085e967e17708721dd11be2
size 28672
oid sha256:7b71c371f4db1ec56730e30d79c3dcfaeca02167a15e25d595e066907f4e5a3a
size 29184

@ -31,6 +31,12 @@ namespace ConformalDecals.MaterialModifiers {
}
public void AddProperty(MaterialProperty property) {
if (property == null) throw new ArgumentNullException("Tried to add a null property");
if (_materialProperties == null || _textureMaterialProperties == null) {
Initialize();
Debug.LogWarning("Tried to add a property to uninitialized property collection! correcting now.");
}
foreach (var p in _materialProperties) {
if (p.PropertyName == property.PropertyName) {
_materialProperties.Remove(property);
@ -53,8 +59,14 @@ namespace ConformalDecals.MaterialModifiers {
}
public void SetShader(string shaderName) {
if (_decalShader == null && string.IsNullOrEmpty(shaderName)) {
throw new FormatException("Shader name not provided");
if (string.IsNullOrEmpty(shaderName)) {
if (_decalShader == null) {
Debug.Log("Using default decal shader");
shaderName = "ConformalDecals/Paint/Diffuse";
}
else {
return;
}
}
var shader = Shabby.Shabby.FindShader(shaderName);

@ -29,7 +29,7 @@ namespace ConformalDecals {
[KSPField] public string decalBack = string.Empty;
[KSPField] public string decalModel = string.Empty;
[KSPField] public string decalProjector = string.Empty;
[KSPField] public string decalShader = string.Empty;
[KSPField] public string decalShader = "ConformalDecals/Paint/Diffuse";
[KSPField] public Transform decalFrontTransform;
[KSPField] public Transform decalBackTransform;
@ -93,6 +93,7 @@ namespace ConformalDecals {
}
else {
// materialProperties already exists, so make a copy
this.Log($"{materialProperties == null}");
materialProperties = ScriptableObject.Instantiate(materialProperties);
}

@ -1,5 +1,3 @@
using System;
using ConformalDecals.MaterialModifiers;
using ConformalDecals.Util;
using UnityEngine;
using UnityEngine.Rendering;

Loading…
Cancel
Save