mirror of
https://github.com/4sval/FModel.git
synced 2026-06-23 16:30:35 -05:00
no fuck you
This commit is contained in:
parent
569558640a
commit
24e3d549f5
|
|
@ -8,11 +8,8 @@ layout (location = 5) in ivec4 vBoneIds;
|
|||
layout (location = 6) in vec4 vWeights;
|
||||
layout (location = 7) in mat4 vInstanceMatrix;
|
||||
|
||||
layout (location = 11) in vec3 vPosTarget;
|
||||
|
||||
uniform mat4 uView;
|
||||
uniform mat4 uProjection;
|
||||
uniform float morph_time;
|
||||
|
||||
out vec3 fPos;
|
||||
out vec3 fNormal;
|
||||
|
|
@ -21,10 +18,9 @@ out vec4 fColor;
|
|||
|
||||
void main()
|
||||
{
|
||||
vec3 pos = mix(vPos, vPosTarget, morph_time);
|
||||
gl_Position = uProjection * uView * vInstanceMatrix * vec4(pos, 1.0);
|
||||
gl_Position = uProjection * uView * vInstanceMatrix * vec4(vPos, 1.0);
|
||||
|
||||
fPos = vec3(vInstanceMatrix * vec4(pos, 1.0));
|
||||
fPos = vec3(vInstanceMatrix * vec4(vPos, 1.0));
|
||||
fNormal = mat3(transpose(inverse(vInstanceMatrix))) * vNormal;
|
||||
fTexCoords = vTexCoords;
|
||||
fColor = vColor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
|
|
@ -34,7 +34,7 @@ public class Model : IDisposable
|
|||
public uint[] Indices;
|
||||
public float[] Vertices;
|
||||
public Section[] Sections;
|
||||
public Morph[] Morphs;
|
||||
public readonly Morph[] Morphs;
|
||||
public readonly List<CSkelMeshBone> Skeleton;
|
||||
|
||||
public int TransformsCount;
|
||||
|
|
@ -171,11 +171,10 @@ public class Model : IDisposable
|
|||
_matrixVbo = new BufferObject<Matrix4x4>(_gl, instanceMatrix, BufferTargetARB.ArrayBuffer);
|
||||
_vao.BindInstancing();
|
||||
|
||||
Morphs[0].Setup(gl);
|
||||
_vao.Bind();
|
||||
_vao.VertexAttributePointer(11, 3, VertexAttribPointerType.Float, _vertexSize, 1); // target position
|
||||
_vao.Unbind();
|
||||
|
||||
for (uint morph = 0; morph < Morphs.Length; morph++)
|
||||
{
|
||||
Morphs[morph].Setup(gl);
|
||||
}
|
||||
for (int section = 0; section < Sections.Length; section++)
|
||||
{
|
||||
Sections[section].Setup(_gl);
|
||||
|
|
@ -192,7 +191,6 @@ public class Model : IDisposable
|
|||
|
||||
_vao.Bind();
|
||||
shader.SetUniform("display_vertex_colors", DisplayVertexColors);
|
||||
Morphs[0].Bind(shader);
|
||||
for (int section = 0; section < Sections.Length; section++)
|
||||
{
|
||||
Sections[section].Bind(shader, (uint) TransformsCount);
|
||||
|
|
@ -232,6 +230,10 @@ public class Model : IDisposable
|
|||
_vbo.Dispose();
|
||||
_matrixVbo.Dispose();
|
||||
_vao.Dispose();
|
||||
for (var morph = 0; morph < Morphs.Length; morph++)
|
||||
{
|
||||
Morphs[morph].Dispose();
|
||||
}
|
||||
for (int section = 0; section < Sections.Length; section++)
|
||||
{
|
||||
Sections[section].Dispose();
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class Morph : IDisposable
|
|||
private BufferObject<float> _vbo;
|
||||
|
||||
public readonly string Name;
|
||||
public float[] Vertices;
|
||||
public readonly float[] Vertices;
|
||||
|
||||
public float Value;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ public class Morph : IDisposable
|
|||
|
||||
public void Bind(Shader shader)
|
||||
{
|
||||
shader.SetUniform("morph_time", Value);
|
||||
shader.SetUniform("uMorphTime", Value);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
|||
|
|
@ -319,8 +319,7 @@ public class SnimGui : IDisposable
|
|||
for (int i = 0; i < model.Morphs.Length; i++)
|
||||
{
|
||||
ImGui.PushID(i);
|
||||
ImGui.Text(model.Morphs[i].Name);
|
||||
ImGui.DragFloat("Value", ref model.Morphs[i].Value, 0.01f, 0.0f, 1.0f, "%.2f", ImGuiSliderFlags.AlwaysClamp);
|
||||
ImGui.DragFloat(model.Morphs[i].Name, ref model.Morphs[i].Value, 0.001f, 0.0f, 1.0f, "%.2f", ImGuiSliderFlags.AlwaysClamp);
|
||||
ImGui.PopID();
|
||||
}
|
||||
ImGui.EndTabItem();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user