Update to latest gl framework
This commit is contained in:
parent
54c4bac8bc
commit
cae1d75173
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -574,8 +574,8 @@ namespace FirstPlugin
|
||||
gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1.0);
|
||||
}");
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
|
||||
}
|
||||
|
||||
@ -614,8 +614,8 @@ namespace FirstPlugin
|
||||
gl_Position = mvpMatrix * vec4(vPosition.xyz, 1.0);
|
||||
}");
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
}
|
||||
|
||||
private void CheckBuffers()
|
||||
|
@ -249,7 +249,7 @@ namespace FirstPlugin
|
||||
var defaultFrag = new FragmentShader(File.ReadAllText(pathFrag));
|
||||
var defaultVert = new VertexShader(File.ReadAllText(pathVert));
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -113,7 +113,7 @@ namespace FirstPlugin
|
||||
var defaultFrag = new FragmentShader(File.ReadAllText(pathFrag));
|
||||
var defaultVert = new VertexShader(File.ReadAllText(pathVert));
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
@ -124,7 +124,7 @@ namespace FirstPlugin
|
||||
var defaultFrag = new FragmentShader(File.ReadAllText(pathFrag));
|
||||
var defaultVert = new VertexShader(File.ReadAllText(pathVert));
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
|
||||
public override void Draw(GL_ControlLegacy control, Pass pass)
|
||||
@ -170,7 +170,7 @@ namespace FirstPlugin
|
||||
GL.Enable(EnableCap.CullFace);
|
||||
}
|
||||
|
||||
private static void SetBoneUniforms(ShaderProgram shader, CMDLWrapper fmdl, SOBJWrapper fshp)
|
||||
private static void SetBoneUniforms(GLControl control, ShaderProgram shader, CMDLWrapper fmdl, SOBJWrapper fshp)
|
||||
{
|
||||
foreach (var FaceGroup in fshp.Shape.FaceGroups)
|
||||
{
|
||||
@ -179,10 +179,10 @@ namespace FirstPlugin
|
||||
|
||||
for (int i = 0; i < FaceGroup.BoneIndexList.Length; i++)
|
||||
{
|
||||
GL.Uniform1(GL.GetUniformLocation(shader.program, String.Format("boneIds[{0}]", i)), FaceGroup.BoneIndexList[i]);
|
||||
GL.Uniform1(GL.GetUniformLocation(shader.programs[control], String.Format("boneIds[{0}]", i)), FaceGroup.BoneIndexList[i]);
|
||||
|
||||
Matrix4 transform = fmdl.Skeleton.Renderable.bones[(int)FaceGroup.BoneIndexList[i]].invert * fmdl.Skeleton.Renderable.bones[(int)FaceGroup.BoneIndexList[i]].Transform;
|
||||
GL.UniformMatrix4(GL.GetUniformLocation(shader.program, String.Format("bones[{0}]", i)), false, ref transform);
|
||||
GL.UniformMatrix4(GL.GetUniformLocation(shader.programs[control], String.Format("bones[{0}]", i)), false, ref transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -306,7 +306,7 @@ namespace FirstPlugin
|
||||
{
|
||||
foreach (SOBJWrapper shp in mdl.Shapes)
|
||||
{
|
||||
DrawModel(shp, mdl, shader, mdl.IsSelected);
|
||||
DrawModel(control, shp, mdl, shader, mdl.IsSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -328,14 +328,14 @@ namespace FirstPlugin
|
||||
GL.BindBuffer(BufferTarget.ElementArrayBuffer, ibo_elements);
|
||||
}
|
||||
|
||||
private void DrawModel(SOBJWrapper m, CMDLWrapper mdl, ShaderProgram shader, bool drawSelection)
|
||||
private void DrawModel(GLControl control, SOBJWrapper m, CMDLWrapper mdl, ShaderProgram shader, bool drawSelection)
|
||||
{
|
||||
if (m.lodMeshes[m.DisplayLODIndex].faces.Count <= 3)
|
||||
return;
|
||||
|
||||
SetUniforms(m.MaterialWrapper, shader, m, m.DisplayId);
|
||||
SetUniformBlocks(m.MaterialWrapper, shader, m, m.DisplayId);
|
||||
SetBoneUniforms(shader, mdl, m);
|
||||
SetBoneUniforms(control,shader, mdl, m);
|
||||
SetVertexAttributes(m, shader);
|
||||
SetTextureUniforms(m.MaterialWrapper, m, shader);
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
Renderer.CenterCamera(viewport.GL_ControlModern);
|
||||
viewport.UpdateViewport();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadEditor(UserControl Control)
|
||||
|
@ -53,7 +53,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
|
||||
gl_Position = mtxCam * mtxMdl * vec4(position.xyz, 1);
|
||||
}");
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
|
||||
public override void Draw(GL_ControlLegacy control, Pass pass)
|
||||
|
@ -1,5 +1,4 @@
|
||||
using Gl_EditorFramework;
|
||||
using GL_EditorFramework.GL_Core;
|
||||
using GL_EditorFramework.GL_Core;
|
||||
using GL_EditorFramework.Interfaces;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
@ -158,7 +157,7 @@ namespace GL_EditorFramework.EditorDrawables
|
||||
|
||||
public override void Prepare(GL_ControlModern control)
|
||||
{
|
||||
Renderers.ColorBlockRenderer.Initialize();
|
||||
Renderers.ColorBlockRenderer.Initialize(control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
@ -214,12 +213,6 @@ namespace GL_EditorFramework.EditorDrawables
|
||||
return REDRAW;
|
||||
}
|
||||
|
||||
public override void ApplyTransformActionToSelection(AbstractTransformAction transformAction)
|
||||
{
|
||||
position = transformAction.NewPos(position);
|
||||
UpdateNodePosition();
|
||||
}
|
||||
|
||||
public override LocalOrientation GetLocalOrientation(int partIndex)
|
||||
{
|
||||
return new LocalOrientation(position);
|
||||
|
@ -60,7 +60,7 @@ namespace FirstPlugin.Turbo.CourseMuuntStructs
|
||||
gl_Position = mtxCam * mtxMdl * vec4(position.xyz, 1);
|
||||
}");
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
|
||||
public override void Draw(GL_ControlLegacy control, Pass pass)
|
||||
|
Binary file not shown.
Binary file not shown.
@ -24,6 +24,8 @@ namespace Switch_Toolbox.Library.Forms
|
||||
public void BeginUpdate() { treeViewCustom1.BeginUpdate(); }
|
||||
public void EndUpdate() { treeViewCustom1.EndUpdate(); }
|
||||
|
||||
public readonly int MAX_TREENODE_VALUE = 1;
|
||||
|
||||
public void AddIArchiveFile(IFileFormat FileFormat)
|
||||
{
|
||||
TreeNode FileRoot = new ArchiveRootNodeWrapper(FileFormat.FileName, (IArchiveFile)FileFormat);
|
||||
@ -40,6 +42,9 @@ namespace Switch_Toolbox.Library.Forms
|
||||
int I = 0;
|
||||
foreach (var node in nodeFiles)
|
||||
{
|
||||
if (I++ == MAX_TREENODE_VALUE)
|
||||
break;
|
||||
|
||||
string nodeString = node.FileName;
|
||||
|
||||
var roots = nodeString.Split(new char[] { '/' },
|
||||
|
@ -375,10 +375,10 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
bool IsOrtho = orthographicToolStripMenuItem.Checked;
|
||||
|
||||
if (GL_ControlModern != null)
|
||||
GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
else
|
||||
GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
// if (GL_ControlModern != null)
|
||||
// GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
// else
|
||||
// GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
|
||||
UpdateViewport();
|
||||
}
|
||||
@ -398,10 +398,10 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
bool IsOrtho = orthographicToolStripMenuItem.Checked;
|
||||
|
||||
if (GL_ControlModern != null)
|
||||
GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
else
|
||||
GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
// if (GL_ControlModern != null)
|
||||
// GL_ControlModern.UseOrthographicView = IsOrtho;
|
||||
// else
|
||||
// GL_ControlLegacy.UseOrthographicView = IsOrtho;
|
||||
|
||||
UpdateViewport();
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
gl_Position = vec4(position, 1);
|
||||
}");
|
||||
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -198,7 +198,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
gl_Position = mvpMatrix * vec4(vPosition.xyz, 1.0);
|
||||
}");
|
||||
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -171,7 +171,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1);
|
||||
}");
|
||||
|
||||
gridShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
gridShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -24,7 +24,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
var defaultFrag = new FragmentShader(File.ReadAllText(pathFrag));
|
||||
var defaultVert = new VertexShader(File.ReadAllText(pathVert));
|
||||
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert);
|
||||
defaultShaderProgram = new ShaderProgram(defaultFrag, defaultVert, control);
|
||||
}
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
{
|
||||
|
@ -189,7 +189,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
gl_Position = mtxCam * mtxMdl * vec4(vPosition.xyz, 1);
|
||||
}");
|
||||
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert);
|
||||
solidColorShaderProgram = new ShaderProgram(solidColorFrag, solidColorVert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -40,12 +40,12 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
GenerateFrameBuffer();
|
||||
}
|
||||
|
||||
public void GenerateBrdfMap()
|
||||
public void GenerateBrdfMap(GLControl control)
|
||||
{
|
||||
if (!IsBufferCreated())
|
||||
GenerateFrameBuffer();
|
||||
|
||||
GL.UseProgram(BrdfShader.program);
|
||||
BrdfShader.Use(control);
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
|
||||
RenderQuad();
|
||||
|
||||
|
@ -308,7 +308,7 @@ namespace Switch_Toolbox.Library.Rendering
|
||||
gl_Position = mtxMdl * mtxCam * vec4(vPosition.xyz, 1);
|
||||
}");
|
||||
|
||||
ProbeSHShaderProgram = new ShaderProgram(Frag, Vert);
|
||||
ProbeSHShaderProgram = new ShaderProgram(Frag, Vert, control);
|
||||
}
|
||||
|
||||
public override void Prepare(GL_ControlLegacy control)
|
||||
|
@ -199,49 +199,6 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
}
|
||||
|
||||
public static void DrawScreenQuad()
|
||||
{
|
||||
var vert = new VertexShader(
|
||||
@"#version 330
|
||||
|
||||
in vec3 position;
|
||||
out vec2 texCoord;
|
||||
|
||||
void main()
|
||||
{
|
||||
texCoord.x = (position.x + 1.0) * 0.5;
|
||||
texCoord.y = (position.y + 1.0) * 0.5;
|
||||
gl_Position = vec4(position, 1);
|
||||
}
|
||||
");
|
||||
var frag = new FragmentShader(
|
||||
@"#version 330 in vec2 texCoord;
|
||||
|
||||
uniform vec3 topColor;
|
||||
uniform vec3 bottomColor;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
FragColor = vec4(1);
|
||||
FragColor.rgb = mix(bottomColor, topColor, texCoord.y);
|
||||
}");
|
||||
|
||||
ShaderProgram shader = new ShaderProgram(frag, vert);
|
||||
|
||||
GL.MatrixMode(MatrixMode.Modelview);
|
||||
GL.LoadIdentity();
|
||||
GL.MatrixMode(MatrixMode.Projection);
|
||||
GL.LoadIdentity();
|
||||
|
||||
|
||||
shader.SetVector3("topColor", new Vector3(0, 1, 0));
|
||||
shader.SetVector3("bottomColor", new Vector3(0, 1, 0));
|
||||
|
||||
DrawScreenTriangle(shader);
|
||||
}
|
||||
|
||||
private static void DrawScreenTriangle(ShaderProgram shader)
|
||||
{
|
||||
float[] vertices =
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user