mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-06-06 19:35:55 +00:00
SkinRenderer - Add focal point debug rendering
This commit is contained in:
@@ -73,8 +73,8 @@ namespace PckStudio.Rendering
|
||||
if (value == _outlineColor)
|
||||
return;
|
||||
_outlineColor = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float MouseSensetivity { get; set; } = 0.01f;
|
||||
|
||||
@@ -243,6 +243,10 @@ namespace PckStudio.Rendering
|
||||
};
|
||||
private bool initialized = false;
|
||||
|
||||
#if DEBUG
|
||||
private DrawContext debugDrawContext;
|
||||
#endif
|
||||
|
||||
public SkinRenderer() : base()
|
||||
{
|
||||
InitializeSkinData();
|
||||
@@ -564,6 +568,24 @@ namespace PckStudio.Rendering
|
||||
|
||||
GLErrorCheck();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
// Debug render
|
||||
{
|
||||
LineVertex[] vertices = [
|
||||
new LineVertex(Vector3.Zero, Color.White)
|
||||
];
|
||||
VertexArray vao = new VertexArray();
|
||||
var debugVBO = new VertexBuffer();
|
||||
debugVBO.SetData(vertices);
|
||||
VertexBufferLayout layout = new VertexBufferLayout();
|
||||
layout.Add<float>(3);
|
||||
layout.Add<float>(4);
|
||||
vao.AddBuffer(debugVBO, layout);
|
||||
debugDrawContext = new DrawContext(vao, debugVBO.GenIndexBuffer(), PrimitiveType.Points);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
private DrawContext GetGuidelineDrawContext()
|
||||
@@ -941,6 +963,28 @@ namespace PckStudio.Rendering
|
||||
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
// Debug
|
||||
{
|
||||
GL.BlendFunc(BlendingFactor.DstAlpha, BlendingFactor.OneMinusSrcAlpha);
|
||||
GL.DepthFunc(DepthFunction.Always);
|
||||
GL.DepthMask(false);
|
||||
GL.Enable(EnableCap.PointSmooth);
|
||||
lineShader.Bind();
|
||||
var transform = Matrix4.CreateTranslation(Camera.FocalPoint).Inverted();
|
||||
lineShader.SetUniformMat4("Transform", ref transform);
|
||||
lineShader.SetUniformMat4("ViewProjection", ref viewProjection);
|
||||
lineShader.SetUniform1("intensity", 0.75f);
|
||||
lineShader.SetUniform4("baseColor", Color.DeepPink);
|
||||
GL.PointSize(5f);
|
||||
Renderer.Draw(lineShader, debugDrawContext);
|
||||
GL.PointSize(1f);
|
||||
GL.DepthMask(true);
|
||||
GL.DepthFunc(DepthFunction.Less);
|
||||
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if USE_FRAMEBUFFER
|
||||
framebuffer.Unbind();
|
||||
GL.Disable(EnableCap.DepthTest);
|
||||
|
||||
Reference in New Issue
Block a user