Fix errors
This commit is contained in:
parent
0fef9aac31
commit
5b2f6effc7
@ -26,6 +26,8 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
public Vector3 position = new Vector3(0, 0, 0);
|
public Vector3 position = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
public bool UseOverlay = false;
|
||||||
|
|
||||||
protected bool Selected = false;
|
protected bool Selected = false;
|
||||||
protected bool Hovered = false;
|
protected bool Hovered = false;
|
||||||
|
|
||||||
@ -213,7 +215,7 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
public override void Draw(GL_ControlLegacy control, Pass pass)
|
public override void Draw(GL_ControlLegacy control, Pass pass)
|
||||||
{
|
{
|
||||||
if (!Runtime.OpenTKInitialized || defaultShaderProgram == null)
|
if (!Runtime.OpenTKInitialized || defaultShaderProgram == null || !Visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Matrix4 mvpMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
|
Matrix4 mvpMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
|
||||||
@ -251,11 +253,14 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
public override void Draw(GL_ControlModern control, Pass pass)
|
public override void Draw(GL_ControlModern control, Pass pass)
|
||||||
{
|
{
|
||||||
CheckBuffers();
|
if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT || defaultShaderProgram == null || !Visible)
|
||||||
|
|
||||||
if (!Runtime.OpenTKInitialized || pass == Pass.TRANSPARENT || defaultShaderProgram == null)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (UseOverlay && pass == Pass.PICKING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CheckBuffers();
|
||||||
|
|
||||||
Matrix4 camMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
|
Matrix4 camMat = control.ModelMatrix * control.CameraMatrix * control.ProjectionMatrix;
|
||||||
|
|
||||||
if (DrawGlobalOctrees)
|
if (DrawGlobalOctrees)
|
||||||
@ -263,8 +268,17 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
control.CurrentShader = defaultShaderProgram;
|
control.CurrentShader = defaultShaderProgram;
|
||||||
|
|
||||||
control.UpdateModelMatrix(
|
if (UseOverlay)
|
||||||
Matrix4.CreateScale(Runtime.previewScale));
|
{
|
||||||
|
control.UpdateModelMatrix(
|
||||||
|
Matrix4.CreateScale(1.0002f));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
control.UpdateModelMatrix(
|
||||||
|
Matrix4.CreateScale(Runtime.previewScale));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SetRenderSettings(defaultShaderProgram);
|
SetRenderSettings(defaultShaderProgram);
|
||||||
|
|
||||||
@ -306,7 +320,11 @@ namespace FirstPlugin
|
|||||||
|
|
||||||
if (m.Checked)
|
if (m.Checked)
|
||||||
{
|
{
|
||||||
if ((m.IsSelected))
|
if (UseOverlay)
|
||||||
|
{
|
||||||
|
DrawOverlayWireframe(m, shader);
|
||||||
|
}
|
||||||
|
else if ((m.IsSelected))
|
||||||
{
|
{
|
||||||
DrawModelSelection(m, shader);
|
DrawModelSelection(m, shader);
|
||||||
}
|
}
|
||||||
@ -351,6 +369,24 @@ namespace FirstPlugin
|
|||||||
GL.VertexAttribPointer(shader.GetAttribute("vColor"), 3, VertexAttribPointerType.Float, false, KCL.DisplayVertex.Size, 24);
|
GL.VertexAttribPointer(shader.GetAttribute("vColor"), 3, VertexAttribPointerType.Float, false, KCL.DisplayVertex.Size, 24);
|
||||||
GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements);
|
GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void DrawOverlayWireframe(KCL.KCLModel p, ShaderProgram shader)
|
||||||
|
{
|
||||||
|
GL.Enable(EnableCap.PolygonOffsetFill);
|
||||||
|
GL.PolygonOffset(0, -1);
|
||||||
|
|
||||||
|
// use vertex color for wireframe color
|
||||||
|
GL.Uniform1(shader["colorOverride"], 1);
|
||||||
|
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
|
||||||
|
GL.Enable(EnableCap.LineSmooth);
|
||||||
|
GL.LineWidth(1.2f);
|
||||||
|
GL.DrawElements(PrimitiveType.Triangles, p.displayFaceSize, DrawElementsType.UnsignedInt, p.Offset);
|
||||||
|
GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
|
||||||
|
GL.Uniform1(shader["colorOverride"], 0);
|
||||||
|
|
||||||
|
GL.Disable(EnableCap.PolygonOffsetFill);
|
||||||
|
}
|
||||||
|
|
||||||
private static void DrawModelWireframe(KCL.KCLModel p, ShaderProgram shader)
|
private static void DrawModelWireframe(KCL.KCLModel p, ShaderProgram shader)
|
||||||
{
|
{
|
||||||
// use vertex color for wireframe color
|
// use vertex color for wireframe color
|
||||||
|
Loading…
Reference in New Issue
Block a user