From 0895c600cf6fd93c34b8a8710b6be66426b6f3f4 Mon Sep 17 00:00:00 2001 From: Michel Fedde Date: Sat, 12 Dec 2020 11:00:59 +0100 Subject: [PATCH] Merged SM2D.DrawColor/DrawComplex/DrawPolygon/DrawShader/DrawTexture into DrawObject2D --- .../SMRenderer/SM2D/NuGetUpgradeLog.html | 162 ++++++++++++++++++ .../d4ed0f1f/SMRenderer/SM2D/SM2D.csproj | 82 +++++++++ .../d4ed0f1f/SMRenderer}/SM2D/packages.config | 0 SMCode/SM.Base/Drawing/DrawingBasis.cs | 2 +- SMCode/SM.OGL/GLSystem.cs | 2 +- SMCode/SM2D/Drawing/DrawBackgroundShader.cs | 20 --- SMCode/SM2D/Drawing/DrawColor.cs | 38 ---- SMCode/SM2D/Drawing/DrawComplex.cs | 37 ---- SMCode/SM2D/Drawing/DrawObject2D.cs | 68 ++++++++ SMCode/SM2D/Drawing/DrawPolygon.cs | 46 ----- SMCode/SM2D/Drawing/DrawShader.cs | 24 --- SMCode/SM2D/Drawing/DrawTexture.cs | 56 ------ SMCode/SM2D/OpenTK.dll.config | 25 --- SMCode/SM2D/SM2D.csproj | 14 +- 14 files changed, 320 insertions(+), 256 deletions(-) create mode 100644 MigrationBackup/d4ed0f1f/SMRenderer/SM2D/NuGetUpgradeLog.html create mode 100644 MigrationBackup/d4ed0f1f/SMRenderer/SM2D/SM2D.csproj rename {SMCode => MigrationBackup/d4ed0f1f/SMRenderer}/SM2D/packages.config (100%) delete mode 100644 SMCode/SM2D/Drawing/DrawBackgroundShader.cs delete mode 100644 SMCode/SM2D/Drawing/DrawColor.cs delete mode 100644 SMCode/SM2D/Drawing/DrawComplex.cs create mode 100644 SMCode/SM2D/Drawing/DrawObject2D.cs delete mode 100644 SMCode/SM2D/Drawing/DrawPolygon.cs delete mode 100644 SMCode/SM2D/Drawing/DrawShader.cs delete mode 100644 SMCode/SM2D/Drawing/DrawTexture.cs delete mode 100644 SMCode/SM2D/OpenTK.dll.config diff --git a/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/NuGetUpgradeLog.html b/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/NuGetUpgradeLog.html new file mode 100644 index 0000000..20325c2 --- /dev/null +++ b/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/NuGetUpgradeLog.html @@ -0,0 +1,162 @@ + + + + + NuGetMigrationLog +

+ NuGet Migration Report - SMRenderer\SM2D

Overview

Migration to PackageReference was completed successfully. Please build and run your solution to verify that all packages are available.
+ If you run into any problems, have feedback, questions, or concerns, please + file an issue on the NuGet GitHub repository.

Packages processed

Top-level dependencies:

Package IdVersion
OpenTK + v3.2.1

Transitive dependencies:

Package IdVersion
+ No transitive dependencies found. +

Package compatibility issues

Description
+ No issues were found. +
\ No newline at end of file diff --git a/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/SM2D.csproj b/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/SM2D.csproj new file mode 100644 index 0000000..b87112a --- /dev/null +++ b/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/SM2D.csproj @@ -0,0 +1,82 @@ + + + + + Debug + AnyCPU + {A4565538-625A-42C6-A330-DD4F1ABB3986} + Library + Properties + SM2D + SM2D + v4.5.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\packages\OpenTK.3.2.1\lib\net20\OpenTK.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {8e733844-4204-43e7-b3dc-3913cddabb0d} + SM.Base + + + {f604d684-bc1d-4819-88b5-8b5d03a17be0} + SM.OGL + + + + + + + + + \ No newline at end of file diff --git a/SMCode/SM2D/packages.config b/MigrationBackup/d4ed0f1f/SMRenderer/SM2D/packages.config similarity index 100% rename from SMCode/SM2D/packages.config rename to MigrationBackup/d4ed0f1f/SMRenderer/SM2D/packages.config diff --git a/SMCode/SM.Base/Drawing/DrawingBasis.cs b/SMCode/SM.Base/Drawing/DrawingBasis.cs index ea53bc8..fe1fa39 100644 --- a/SMCode/SM.Base/Drawing/DrawingBasis.cs +++ b/SMCode/SM.Base/Drawing/DrawingBasis.cs @@ -76,7 +76,7 @@ namespace SM.Base.Drawing /// protected override void DrawContext(ref DrawContext context) { - context.ModelMaster = Transform.GetMatrix(); + context.ModelMaster *= Transform.GetMatrix(); } } } \ No newline at end of file diff --git a/SMCode/SM.OGL/GLSystem.cs b/SMCode/SM.OGL/GLSystem.cs index 2abebd3..a2f36c3 100644 --- a/SMCode/SM.OGL/GLSystem.cs +++ b/SMCode/SM.OGL/GLSystem.cs @@ -49,7 +49,7 @@ namespace SM.OGL ShadingVersion = Version.CreateGLVersion(GL.GetString(StringName.ShadingLanguageVersion)); Extensions = GL.GetString(StringName.Extensions).Split(' '); - Debugging = Extensions.Contains("khr_debug"); + Debugging = Extensions.Contains("GL_KHR_debug"); if (Debugging) GLDebugging.EnableDebugging(); _init = true; diff --git a/SMCode/SM2D/Drawing/DrawBackgroundShader.cs b/SMCode/SM2D/Drawing/DrawBackgroundShader.cs deleted file mode 100644 index 0480f1c..0000000 --- a/SMCode/SM2D/Drawing/DrawBackgroundShader.cs +++ /dev/null @@ -1,20 +0,0 @@ -using SM.Base.Contexts; -using SM.Base.Drawing; -using SM.Base.Scene; -using SM2D.Scene; - -namespace SM2D.Drawing -{ - public class DrawBackgroundShader : DrawShader, IBackgroundItem - { - public DrawBackgroundShader(MaterialShader shader) : base(shader) - { } - - protected override void DrawContext(ref DrawContext context) - { - Transform.Size.Set(context.WorldScale); - - base.DrawContext(ref context); - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawColor.cs b/SMCode/SM2D/Drawing/DrawColor.cs deleted file mode 100644 index 04826fa..0000000 --- a/SMCode/SM2D/Drawing/DrawColor.cs +++ /dev/null @@ -1,38 +0,0 @@ -#region usings - -using OpenTK.Graphics; -using SM.Base.Contexts; -using SM.Base.Drawing; -using SM.Base.Scene; -using SM2D.Scene; -using SM2D.Types; - -#endregion - -namespace SM2D.Drawing -{ - public class DrawColor : DrawingBasis, I2DShowItem - { - public DrawColor() - { - } - - public DrawColor(Color4 color) - { - _material.Tint = color; - } - - public Color4 Color - { - get => _material.Tint; - set => _material.Tint = value; - } - - public int ZIndex { get; set; } - - protected override void DrawContext(ref DrawContext context) - { - context.Shader.Draw(context); - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawComplex.cs b/SMCode/SM2D/Drawing/DrawComplex.cs deleted file mode 100644 index b2df861..0000000 --- a/SMCode/SM2D/Drawing/DrawComplex.cs +++ /dev/null @@ -1,37 +0,0 @@ -#region usings - -using SM.Base.Contexts; -using SM.Base.Drawing; -using SM.Base.Scene; -using SM.OGL.Mesh; -using SM2D.Scene; -using SM2D.Types; - -#endregion - -namespace SM2D.Drawing -{ - public class DrawComplex : DrawingBasis, I2DShowItem - { - public Material Material - { - get => _material; - set => _material = value; - } - - public GenericMesh Mesh - { - get => _mesh; - set => _mesh = value; - } - - public int ZIndex { get; set; } - - protected override void DrawContext(ref DrawContext context) - { - base.DrawContext(ref context); - - context.Shader.Draw(context); - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawObject2D.cs b/SMCode/SM2D/Drawing/DrawObject2D.cs new file mode 100644 index 0000000..436a173 --- /dev/null +++ b/SMCode/SM2D/Drawing/DrawObject2D.cs @@ -0,0 +1,68 @@ +using System.Collections.Generic; +using System.Drawing; +using OpenTK; +using OpenTK.Graphics; +using SM.Base.Contexts; +using SM.Base.Drawing; +using SM.Base.Objects; +using SM.Base.Textures; +using SM2D.Object; +using SM2D.Scene; +using SM2D.Types; + +namespace SM2D.Drawing +{ + public class DrawObject2D : DrawingBasis, I2DShowItem + { + public int ZIndex { get; set; } + + public Texture Texture + { + get => (Texture) _material.Texture; + set => _material.Texture = value; + } + + public Color4 Color + { + get => _material.Tint; + set => _material.Tint = value; + } + + protected override void DrawContext(ref DrawContext context) + { + base.DrawContext(ref context); + context.Shader.Draw(context); + } + + public Material GetMaterialReference() => _material; + public void SetMaterialReference(Material material) => _material = material; + + public void SetShader(MaterialShader shader) => _material.CustomShader = shader; + + public Polygon ApplyPolygon(ICollection vertices) + { + Polygon polygon = new Polygon(vertices); + _mesh = polygon; + return polygon; + } + public Polygon ApplyPolygon(ICollection vertices) + { + Polygon polygon = new Polygon(vertices); + _mesh = polygon; + return polygon; + } + public void ApplyPolygon(Polygon polygon) + { + _mesh = polygon; + } + + public void ApplyMesh(Mesh mesh) => _mesh = mesh; + + public Polygon ApplyCircle(int segments = 32) + { + Polygon pol = Polygon.GenerateCircle(segments); + _mesh = pol; + return pol; + } + } +} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawPolygon.cs b/SMCode/SM2D/Drawing/DrawPolygon.cs deleted file mode 100644 index 8de1438..0000000 --- a/SMCode/SM2D/Drawing/DrawPolygon.cs +++ /dev/null @@ -1,46 +0,0 @@ -#region usings - -using System.Drawing; -using OpenTK.Graphics; -using SM.Base.Textures; -using SM2D.Object; - -#endregion - -namespace SM2D.Drawing -{ - public class DrawPolygon : DrawColor - { - public DrawPolygon(Polygon polygon) : this(polygon, Color4.White) - { - } - - public DrawPolygon(Polygon polygon, Bitmap map) : this(polygon, map, Color4.White) - { - } - - public DrawPolygon(Polygon polygon, Color4 color) : base(color) - { - _mesh = polygon; - } - - public DrawPolygon(Polygon polygon, Bitmap map, Color4 tint) : base(tint) - { - _mesh = polygon; - - _material.Texture = new Texture(map); - } - - public Polygon Polygon - { - get => (Polygon) _mesh; - set => _mesh = value; - } - - public Texture Texture - { - get => (Texture) _material.Texture; - set => _material.Texture = value; - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawShader.cs b/SMCode/SM2D/Drawing/DrawShader.cs deleted file mode 100644 index d57d563..0000000 --- a/SMCode/SM2D/Drawing/DrawShader.cs +++ /dev/null @@ -1,24 +0,0 @@ -using SM.Base.Contexts; -using SM.Base.Drawing; -using SM.Base.Scene; -using SM2D.Scene; -using SM2D.Types; - -namespace SM2D.Drawing -{ - public class DrawShader : DrawingBasis, I2DShowItem - { - public int ZIndex { get; set; } - - public DrawShader(MaterialShader shader) - { - _material.CustomShader = shader; - } - - protected override void DrawContext(ref DrawContext context) - { - base.DrawContext(ref context); - _material.CustomShader.Draw(context); - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/Drawing/DrawTexture.cs b/SMCode/SM2D/Drawing/DrawTexture.cs deleted file mode 100644 index 440fef1..0000000 --- a/SMCode/SM2D/Drawing/DrawTexture.cs +++ /dev/null @@ -1,56 +0,0 @@ -#region usings - -using System.Drawing; -using OpenTK.Graphics; -using SM.Base.Contexts; -using SM.Base.Textures; -using SM.Base.Types; - -#endregion - -namespace SM2D.Drawing -{ - public class DrawTexture : DrawColor - { - public static float MasterScale = .25f; - public bool ManualSize = false; - - public float Scale = 1; - - public DrawTexture() - { - } - - protected DrawTexture(Color4 color) : base(color) - { - } - - public DrawTexture(Bitmap map) : this(map, Color4.White) - { - } - - public DrawTexture(Bitmap map, Color4 color) : this((Texture) map, color) - { - } - - public DrawTexture(Texture texture, Color4 color) - { - _material.Texture = texture; - _material.Tint = color; - } - - public Texture Texture - { - get => (Texture) _material.Texture; - set => _material.Texture = value; - } - - protected override void DrawContext(ref DrawContext context) - { - if (!ManualSize) - Transform.Size = new CVector2(Texture.Map.Width * MasterScale * Scale, - Texture.Map.Height * MasterScale * Scale); - base.DrawContext(ref context); - } - } -} \ No newline at end of file diff --git a/SMCode/SM2D/OpenTK.dll.config b/SMCode/SM2D/OpenTK.dll.config deleted file mode 100644 index 7098d39..0000000 --- a/SMCode/SM2D/OpenTK.dll.config +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/SMCode/SM2D/SM2D.csproj b/SMCode/SM2D/SM2D.csproj index a809619..7ebd7c1 100644 --- a/SMCode/SM2D/SM2D.csproj +++ b/SMCode/SM2D/SM2D.csproj @@ -41,14 +41,9 @@ - - - + - - - @@ -73,9 +68,12 @@ - - + + + 3.2.1 + + \ No newline at end of file