mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
fix texture misalignment + negative far plane
This commit is contained in:
parent
cc89becb4c
commit
2f3b076aa4
|
|
@ -1 +1 @@
|
|||
Subproject commit 00bc31fa4cc570efd3f9d54694feb16a8d21251c
|
||||
Subproject commit 97174265894eddcb0d94ef570d36ddc559a8573a
|
||||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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++)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user