basic TransformPoint work
This commit is contained in:
parent
e28bcf9982
commit
9b6add0e40
|
@ -247,6 +247,20 @@ namespace BizHawk.Client.EmuHawk
|
||||||
return new Point((int)v.X, (int)v.Y);
|
return new Point((int)v.X, (int)v.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Using the current filter program, turn a emulator screen space coordinat to a window coordinate (suitable for lua layer drawing)
|
||||||
|
/// </summary>
|
||||||
|
public Point TransformPoint(Point p)
|
||||||
|
{
|
||||||
|
//now, if theres no filter program active, just give up
|
||||||
|
if (CurrentFilterProgram == null) return p;
|
||||||
|
|
||||||
|
//otherwise, have the filter program untransform it
|
||||||
|
Vector2 v = new Vector2(p.X, p.Y);
|
||||||
|
v = CurrentFilterProgram.TransformPoint("default", v);
|
||||||
|
return new Point((int)v.X, (int)v.Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This will receive an emulated output frame from an IVideoProvider and run it through the complete frame processing pipeline
|
/// This will receive an emulated output frame from an IVideoProvider and run it through the complete frame processing pipeline
|
||||||
|
|
|
@ -94,6 +94,19 @@ namespace BizHawk.Client.EmuHawk.FilterManager
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Receives a point in the input space of the filter program and transforms it through to output points
|
||||||
|
/// </summary>
|
||||||
|
public Vector2 TransformPoint(string channel, Vector2 point)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < Filters.Count; i++)
|
||||||
|
{
|
||||||
|
var filter = Filters[i];
|
||||||
|
point = filter.TransformPoint(channel, point);
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
public class ProgramStep
|
public class ProgramStep
|
||||||
{
|
{
|
||||||
public ProgramStep(ProgramStepType type, object args, string comment = null)
|
public ProgramStep(ProgramStepType type, object args, string comment = null)
|
||||||
|
|
|
@ -51,6 +51,20 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
}
|
}
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual Vector2 TransformPoint(string channel, Vector2 point)
|
||||||
|
{
|
||||||
|
//base class behaviour here just uses the input and output sizes, if appropriate. few filters will have to do anything more complex
|
||||||
|
var input = FindInput(channel);
|
||||||
|
var output = FindOutput(channel);
|
||||||
|
if (input != null && output != null)
|
||||||
|
{
|
||||||
|
point.X *= ((float)output.SurfaceFormat.Size.Width) / (float)input.SurfaceFormat.Size.Width;
|
||||||
|
point.Y *= ((float)output.SurfaceFormat.Size.Height) / (float)input.SurfaceFormat.Size.Height;
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
public void SetInput(Texture2d tex)
|
public void SetInput(Texture2d tex)
|
||||||
{
|
{
|
||||||
InputTexture = tex;
|
InputTexture = tex;
|
||||||
|
|
|
@ -232,6 +232,17 @@ namespace BizHawk.Client.EmuHawk.Filters
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Vector2 TransformPoint(string channel, Vector2 point)
|
||||||
|
{
|
||||||
|
if (nop)
|
||||||
|
return point;
|
||||||
|
point.X *= LL.WidthScale;
|
||||||
|
point.Y *= LL.HeightScale;
|
||||||
|
point.X += LL.vx;
|
||||||
|
point.Y += LL.vy;
|
||||||
|
return point;
|
||||||
|
}
|
||||||
|
|
||||||
public override void Run()
|
public override void Run()
|
||||||
{
|
{
|
||||||
if (nop)
|
if (nop)
|
||||||
|
|
Loading…
Reference in New Issue