diff --git a/EpicManifestParser b/EpicManifestParser index 00bc31fa..97174265 160000 --- a/EpicManifestParser +++ b/EpicManifestParser @@ -1 +1 @@ -Subproject commit 00bc31fa4cc570efd3f9d54694feb16a8d21251c +Subproject commit 97174265894eddcb0d94ef570d36ddc559a8573a diff --git a/FModel/Resources/default.frag b/FModel/Resources/default.frag index 8222cc51..d839e904 100644 --- a/FModel/Resources/default.frag +++ b/FModel/Resources/default.frag @@ -34,22 +34,23 @@ uniform Material material; uniform Light light; uniform vec3 viewPos; uniform bool display_vertex_colors; +uniform int numTexCoords; out vec4 FragColor; -int LayerToIndex(int max) +int LayerToIndex() { - return min(int(fTexLayer), max); + return min(int(fTexLayer), numTexCoords - 1); } vec4 SamplerSelector(sampler2D array[8]) { - return texture(array[LayerToIndex(7)], fTexCoords); + return texture(array[LayerToIndex()], fTexCoords); } vec4 VectorSelector(vec4 array[8]) { - return array[LayerToIndex(7)]; + return array[LayerToIndex()]; } vec3 getNormalFromMap() diff --git a/FModel/Views/Snooper/Material.cs b/FModel/Views/Snooper/Material.cs index 02dc5af9..cccfa589 100644 --- a/FModel/Views/Snooper/Material.cs +++ b/FModel/Views/Snooper/Material.cs @@ -110,8 +110,12 @@ public class Material : IDisposable if (top) { for (int i = 0; i < array.Length; i++) + { if (Parameters.TryGetTexture2d(out var o, triggers[i]) && cache.TryGetCachedTexture(o, out var t)) array[i] = t; + else if (i > 0 && array[i - 1] != null) + array[i] = array[i - 1]; + } } else if (Parameters.Textures.TryGetValue(fallback, out var u) && u is UTexture2D o && cache.TryGetCachedTexture(o, out var t)) { diff --git a/FModel/Views/Snooper/Model.cs b/FModel/Views/Snooper/Model.cs index 4a56fd61..2a13dbde 100644 --- a/FModel/Views/Snooper/Model.cs +++ b/FModel/Views/Snooper/Model.cs @@ -250,6 +250,7 @@ public class Model : IDisposable _vao.Bind(); shader.SetUniform("uMorphTime", MorphTime); shader.SetUniform("display_vertex_colors", DisplayVertexColors); + shader.SetUniform("numTexCoords", NumTexCoords); GL.PolygonMode(MaterialFace.FrontAndBack, Wireframe ? PolygonMode.Line : PolygonMode.Fill); for (int section = 0; section < Sections.Length; section++) diff --git a/FModel/Views/Snooper/Renderer.cs b/FModel/Views/Snooper/Renderer.cs index 65fa4fcc..643b31e1 100644 --- a/FModel/Views/Snooper/Renderer.cs +++ b/FModel/Views/Snooper/Renderer.cs @@ -94,7 +94,7 @@ public class Renderer : IDisposable private Camera SetupCamera(FBox box) { - var far = box.Max.Max(); + var far = Math.Abs(box.Max.Max()); var center = box.GetCenter(); return new Camera( new Vector3(0f, center.Z, box.Max.Y * 3),