diff --git a/Quik/CommandMachine/CommandEngine.cs b/Quik/CommandMachine/CommandEngine.cs index fdb8771..246bb8e 100644 --- a/Quik/CommandMachine/CommandEngine.cs +++ b/Quik/CommandMachine/CommandEngine.cs @@ -16,12 +16,12 @@ namespace Quik.CommandMachine private Command _customCommandBase = Command.CustomCommandBase; private readonly List _customCommands = new List(); - public QuikRectangle Viewport { get; } + public QuikRectangle Viewport => _viewport; // TODO: Make a real matrix class. public float[] ActiveTransforms { get; } - public StyleStack Style { get; } + public StyleStack Style { get; } = new StyleStack(new Quik.Style()); protected CommandEngine() { @@ -106,7 +106,7 @@ namespace Quik.CommandMachine { } - private void Reset() + public virtual void Reset() { _zIndex = 0; _zStack.Clear(); diff --git a/Quik/CommandMachine/Frame.cs b/Quik/CommandMachine/Frame.cs index c17cc7b..83567cc 100644 --- a/Quik/CommandMachine/Frame.cs +++ b/Quik/CommandMachine/Frame.cs @@ -27,7 +27,7 @@ namespace Quik.CommandMachine [FieldOffset(sizeof(FrameType) + 3*sizeof(float))] private float _f4; - [FieldOffset(sizeof(FrameType))] + [FieldOffset(24)] private object _object; public bool IsCommand => _type == FrameType.Command; @@ -37,10 +37,10 @@ namespace Quik.CommandMachine _type == FrameType.IVec3 || _type == FrameType.IVec4; public bool IsFloat => - _type == FrameType.IVec1 || - _type == FrameType.IVec2 || - _type == FrameType.IVec3 || - _type == FrameType.IVec4; + _type == FrameType.Vec1 || + _type == FrameType.Vec2 || + _type == FrameType.Vec3 || + _type == FrameType.Vec4; public int VectorSize { @@ -73,13 +73,15 @@ namespace Quik.CommandMachine public float F2 => _f2; public float F3 => _f3; public float F4 => _f4; - + public static Frame None { get; } = new Frame() { _type = FrameType.None }; - public Frame(Command command) : this((int)command) + public Frame(Command command) : this() { + _type = FrameType.Command; + _i1 = (int)command; } public Frame(object o) diff --git a/Quik/VertexGenerator/VertexCommandEngine.cs b/Quik/VertexGenerator/VertexCommandEngine.cs index e62ad30..0ffcc44 100644 --- a/Quik/VertexGenerator/VertexCommandEngine.cs +++ b/Quik/VertexGenerator/VertexCommandEngine.cs @@ -24,6 +24,12 @@ namespace Quik.VertexGenerator Color = Style.Color ?? QuikColor.White, }; + public override void Reset() + { + base.Reset(); + DrawQueue.Clear(); + } + protected override void ChildProcessCommand(Command name, CommandQueue queue) { base.ChildProcessCommand(name, queue); @@ -473,7 +479,7 @@ namespace Quik.VertexGenerator DrawQueue.AddVertex(v); DrawQueue.AddElement(0); DrawQueue.AddElement(1); DrawQueue.AddElement(2); - DrawQueue.AddElement(1); DrawQueue.AddElement(2); DrawQueue.AddElement(3); + DrawQueue.AddElement(0); DrawQueue.AddElement(2); DrawQueue.AddElement(3); if (radius == 0.0f) return;