本文整理汇总了C#中BizHawk.Bizware.BizwareGL.Texture2d类的典型用法代码示例。如果您正苦于以下问题:C# Texture2d类的具体用法?C# Texture2d怎么用?C# Texture2d使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Texture2d类属于BizHawk.Bizware.BizwareGL命名空间,在下文中一共展示了Texture2d类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderTarget
public RenderTarget(IGL owner, object opaque, Texture2d tex)
{
Owner = owner;
Opaque = opaque;
Texture2d = tex;
tex.IsUpsideDown = true;
}
示例2: RenderTarget
public RenderTarget(IGL owner, IntPtr handle, Texture2d tex)
{
Owner = owner;
Id = handle;
Texture2d = tex;
tex.IsUpsideDown = true;
}
示例3: Set
public void Set(Texture2d tex)
{
IntPtr handle;
if (tex == null)
handle = Owner.Owner.GetEmptyHandle();
else handle = tex.Id;
Owner.Owner.SetPipelineUniformSampler(this, handle);
}
示例4: Run
public unsafe void Run(Texture2d tex, Size InputSize, Size OutputSize, bool flip)
{
flip = false;
//test
//ack! make sure to set the pipeline before setting uniforms
Bind();
Pipeline["IN.video_size"].Set(new Vector2(InputSize.Width, InputSize.Height));
Pipeline["IN.texture_size"].Set(new Vector2(tex.Width, tex.Height));
Pipeline["IN.output_size"].Set(new Vector2(OutputSize.Width, OutputSize.Height));
Pipeline["IN.frame_count"].Set(1); //todo
Pipeline["IN.frame_direction"].Set(1); //todo
var Projection = Owner.CreateGuiProjectionMatrix(OutputSize);
var Modelview = Owner.CreateGuiViewMatrix(OutputSize);
var mat = Modelview * Projection;
mat.Transpose();
Pipeline["modelViewProj"].Set(mat, true);
Owner.SetTextureWrapMode(tex, true);
sampler0.Set(tex);
Owner.SetViewport(OutputSize);
int w = OutputSize.Width;
int h = OutputSize.Height;
float v0,v1;
if (flip) { v0 = 1; v1 = 0; }
else { v0 = 0; v1 = 1; }
float* pData = stackalloc float[10*4];
int i=0;
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 1; //topleft vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //useless color
pData[i++] = 0; pData[i++] = v0;
pData[i++] = w; pData[i++] = 0; pData[i++] = 0; pData[i++] = 1; //topright vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //useless color
pData[i++] = 1; pData[i++] = v0;
pData[i++] = 0; pData[i++] = h; pData[i++] = 0; pData[i++] = 1; //bottomleft vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //useless color
pData[i++] = 0; pData[i++] = v1;
pData[i++] = w; pData[i++] = h; pData[i++] = 0; pData[i++] = 1; //bottomright vert
pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; pData[i++] = 0; //useless color
pData[i++] = 1; pData[i++] = v1;
Owner.SetBlendState(Owner.BlendNoneCopy);
Owner.BindArrayData(pData);
Owner.DrawArrays(PrimitiveType.TriangleStrip, 0, 4);
}
示例5: Set
public void Set(Texture2d tex)
{
if (Owner == null) return; //uniform was optimized out
Owner.Owner.SetPipelineUniformSampler(this, tex);
}
示例6: PrepDrawSubrectInternal
unsafe void PrepDrawSubrectInternal(Texture2d tex)
{
if (sTexture != tex)
{
sTexture = tex;
CurrPipeline["uSampler0"].Set(tex);
if (sTexture == null)
{
CurrPipeline["uSamplerEnable"].Set(false);
}
else
{
CurrPipeline["uSamplerEnable"].Set(true);
}
}
if (_Projection.IsDirty)
{
CurrPipeline["um44Projection"].Set(ref _Projection.Top, false);
_Projection.IsDirty = false;
}
if (_Modelview.IsDirty)
{
CurrPipeline["um44Modelview"].Set(ref _Modelview.Top, false);
_Modelview.IsDirty = false;
}
}
示例7: Draw
public void Draw(Texture2d art, float x, float y, float width, float height)
{
DrawInternal(art, x, y, width, height);
}
示例8: SetTextureWrapMode
public void SetTextureWrapMode(Texture2d tex, bool clamp)
{
if (CurrentBoundTexture == null)
throw new InvalidOperationException();
}
示例9: LoadTextureData
public unsafe void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
sdi.BitmapData bmp_data = bmp.LockBits();
var tw = tex.Opaque as TextureWrapper;
var dr = tw.Texture.LockRectangle(0, LockFlags.None);
//TODO - do we need to handle odd sizes, weird pitches here?
if (bmp.Width * 4 != bmp_data.Stride)
throw new InvalidOperationException();
dr.Data.WriteRange(bmp_data.Scan0, bmp.Width * bmp.Height * 4);
dr.Data.Close();
tw.Texture.UnlockRectangle(0);
bmp.UnlockBits(bmp_data);
}
示例10: TexParameter2d
public void TexParameter2d(Texture2d tex, gl.TextureParameterName pname, int param)
{
var tw = tex.Opaque as TextureWrapper;
if(pname == gl.TextureParameterName.TextureMinFilter)
tw.MinFilter = (param == (int)gl.TextureMinFilter.Linear) ? TextureFilter.Linear : TextureFilter.Point;
if (pname == gl.TextureParameterName.TextureMagFilter)
tw.MagFilter = (param == (int)gl.TextureMagFilter.Linear) ? TextureFilter.Linear : TextureFilter.Point;
}
示例11: SetTextureWrapMode
public void SetTextureWrapMode(Texture2d tex, bool clamp)
{
var tw = tex.Opaque as TextureWrapper;
tw.WrapClamp = clamp ? TextureAddress.Clamp : TextureAddress.Wrap;
}
示例12: SetPipelineUniformSampler
public void SetPipelineUniformSampler(PipelineUniform uniform, Texture2d tex)
{
if (uniform.Owner == null) return; //uniform was optimized out
var tw = tex.Opaque as TextureWrapper;
foreach (var ui in uniform.UniformInfos)
{
var uw = ui.Opaque as UniformWrapper;
dev.SetTexture(uw.SamplerIndex, tw.Texture);
dev.SetSamplerState(uw.SamplerIndex, SamplerState.AddressU, tw.WrapClamp);
dev.SetSamplerState(uw.SamplerIndex, SamplerState.AddressV, tw.WrapClamp);
dev.SetSamplerState(uw.SamplerIndex, SamplerState.MinFilter, tw.MinFilter);
dev.SetSamplerState(uw.SamplerIndex, SamplerState.MagFilter, tw.MagFilter);
}
}
示例13: FreeTexture
public void FreeTexture(Texture2d tex) {
var tw = tex.Opaque as TextureWrapper;
tw.Texture.Dispose();
}
示例14: LoadTextureData
public void LoadTextureData(Texture2d tex, BitmapBuffer bmp)
{
bmp.ToSysdrawingBitmap(BitmapForTexture(tex));
}
示例15: ResolveTexture2d
public unsafe BitmapBuffer ResolveTexture2d(Texture2d tex)
{
//todo
return null;
}