+ AxisHelper

~ Transformation can now set to be ignored. (Sending a Identity, when requested)
~ Changed how Meshes store Attributes
This commit is contained in:
Michel Fedde 2020-12-13 13:03:57 +01:00
parent 0895c600cf
commit 2e7051d800
14 changed files with 146 additions and 30 deletions

View file

@ -1,6 +1,9 @@
#region usings
using OpenTK;
using OpenTK.Graphics;
using SM.Base.Contexts;
using SM.Base.Objects.Static;
using SM.Base.Scene;
using SM2D.Drawing;
@ -10,11 +13,30 @@ namespace SM2D.Scene
{
public class Scene : GenericScene<Camera, ItemCollection, I2DShowItem>
{
private static DrawObject2D _axisHelper;
public float AxisHelperSize = 100;
static Scene()
{
_axisHelper = new DrawObject2D();
_axisHelper.ApplyMesh(AxisHelper.Object);
}
public Scene()
{
_Background = new DrawBackground(Color4.Black);
}
public DrawBackground Background => (DrawBackground) _Background;
public override void DrawDebug(DrawContext context)
{
if (ShowAxisHelper)
{
_axisHelper.Transform.Size.Set(AxisHelperSize, AxisHelperSize);
_axisHelper.Draw(context);
}
}
}
}

View file

@ -26,8 +26,8 @@ namespace SM2D.Shader
// Vertex Uniforms
Uniforms["MVP"].SetMatrix4(context.ModelMaster * context.View * context.World);
Uniforms["HasVColor"]
.SetUniform1(context.Mesh.AttribDataIndex.ContainsKey(3) && context.Mesh.AttribDataIndex[3] != null);
.SetUniform1(context.Mesh.Attributes["color"] != null);
/*
Uniforms.GetArray("Instances").Set((i, uniforms) =>
{
if (i >= context.Instances.Count) return false;
@ -38,7 +38,7 @@ namespace SM2D.Shader
uniforms["TextureScale"].SetUniform2(instance.TextureScale);
return true;
});
});*/
// Fragment Uniforms
Uniforms["Tint"].SetUniform4(context.Material.Tint);

View file

@ -24,6 +24,6 @@ uniform sampler2D Texture;
layout(location = 0) out vec4 color;
void fmain() {
color = vColor * Tint;
if (UseTexture) color *= texture(Texture, vTexture);
color = vColor;
//if (UseTexture) color *= texture(Texture, vTexture);
}