本文整理汇总了C#中SurfaceFormat类的典型用法代码示例。如果您正苦于以下问题:C# SurfaceFormat类的具体用法?C# SurfaceFormat怎么用?C# SurfaceFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SurfaceFormat类属于命名空间,在下文中一共展示了SurfaceFormat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RenderTarget2D
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice, width, height, mipMap, preferredFormat)
{
RenderTargetUsage = usage;
//allocateOpenGLTexture();
}
开发者ID:andreesteve,项目名称:MonoGame,代码行数:7,代码来源:RenderTarget2D.cs
示例2: RenderTarget2D
public RenderTarget2D (GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
:base (graphicsDevice, width, height, mipMap, preferredFormat)
{
#if IPHONE
if(GraphicsDevice.OpenGLESVersion == MonoTouch.OpenGLES.EAGLRenderingAPI.OpenGLES2)
{
GL20.GenFramebuffers(1, ref frameBuffer);
}
else
{
RenderTargetUsage = usage;
DepthStencilFormat = preferredDepthFormat;
}
#elif ANDROID
if (GraphicsDevice.OpenGLESVersion == OpenTK.Graphics.GLContextVersion.Gles2_0)
{
GL20.GenFramebuffers(1, ref frameBuffer);
}
else
{
RenderTargetUsage = usage;
DepthStencilFormat = preferredDepthFormat;
}
#else
RenderTargetUsage = usage;
DepthStencilFormat = preferredDepthFormat;
#endif
}
开发者ID:adison,项目名称:Tank-Wars,代码行数:34,代码来源:RenderTarget2D.cs
示例3: DisplayMode
internal DisplayMode(int width, int height, int refreshRate, SurfaceFormat format)
{
this.width = width;
this.height = height;
this.refreshRate = refreshRate;
this.format = format;
}
开发者ID:adison,项目名称:Tank-Wars,代码行数:7,代码来源:DisplayMode.cs
示例4: PostProcesses
public PostProcesses(SurfaceFormat? surface = null, DepthFormat? depth = null, bool mipmap = false, RenderTargetUsage? usage = null)
{
FormatSurface = surface;
FormatDepth = depth;
MipMap = mipmap;
Usage = usage;
}
开发者ID:zdawson,项目名称:Marooned,代码行数:7,代码来源:PostProcesses.cs
示例5: CreateBitmap
/// <summary>
/// 根据图像格式(SurfaceFormat) 创建Bitmap
/// </summary>
/// <param name="width">宽度</param>
/// <param name="height">高度</param>
/// <param name="format">图像格式</param>
/// <returns></returns>
public static Bitmap CreateBitmap(GraphicsDevice p_GraphicsDevice, int p_Width, int p_Height, SurfaceFormat format)
{
return new Bitmap
{
Texture = new Texture2D(p_GraphicsDevice, p_Width, p_Height, false, format)
};
}
开发者ID:tianjing,项目名称:SayWordByPicture,代码行数:14,代码来源:Bitmap.cs
示例6: FlipTexture2D
public FlipTexture2D(GraphicsDevice graphicsDeivce, int width, int height,
bool mipMap, SurfaceFormat format, int numberTextures)
{
textures = new Texture2D[numberTextures];
for (int i = 0; i < textures.Length; ++i)
textures[i] = new Texture2D(graphicsDeivce, width, height, mipMap, format);
}
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:7,代码来源:FlipTexture2D.cs
示例7: SsaoMapBlur
public SsaoMapBlur(Effect effect, SpriteBatch spriteBatch, int width, int height, SurfaceFormat format, int radius, float amount)
{
if (effect == null) throw new ArgumentNullException("effect");
if (spriteBatch == null) throw new ArgumentNullException("spriteBatch");
if (width < 1) throw new ArgumentOutOfRangeException("width");
if (height < 1) throw new ArgumentOutOfRangeException("height");
if (radius < MinAmount || MaxRadius < radius) throw new ArgumentOutOfRangeException("value");
if (amount < MinAmount) throw new ArgumentOutOfRangeException("value");
this.effect = effect;
this.spriteBatch = spriteBatch;
Width = width;
Height = height;
Radius = radius;
Amount = amount;
graphicsDevice = effect.GraphicsDevice;
normalDepthMap = effect.Parameters["NormalDepthMap"];
horizontalBlurTechnique = effect.Techniques["HorizontalBlur"];
verticalBlurTechnique = effect.Techniques["VerticalBlur"];
InitializeEffectParameters();
backingRenderTarget = new RenderTarget2D(graphicsDevice, width, height, false, format,
DepthFormat.None, 0, RenderTargetUsage.PlatformContents);
}
开发者ID:willcraftia,项目名称:TestBlocks,代码行数:27,代码来源:SsaoMapBlur.cs
示例8: PlatformConstruct
private void PlatformConstruct(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
{
// Setup the multisampling description.
var multisampleDesc = new SharpDX.DXGI.SampleDescription(1, 0);
if (preferredMultiSampleCount > 1)
{
multisampleDesc.Count = preferredMultiSampleCount;
multisampleDesc.Quality = (int)StandardMultisampleQualityLevels.StandardMultisamplePattern;
}
// Create a descriptor for the depth/stencil buffer.
// Allocate a 2-D surface as the depth/stencil buffer.
// Create a DepthStencil view on this surface to use on bind.
using (var depthBuffer = new SharpDX.Direct3D11.Texture2D(graphicsDevice._d3dDevice, new Texture2DDescription
{
Format = SharpDXHelper.ToFormat(preferredDepthFormat),
ArraySize = 1,
MipLevels = 1,
Width = width,
Height = height,
SampleDescription = multisampleDesc,
BindFlags = BindFlags.DepthStencil,
}))
{
// Create the view for binding to the device.
_depthStencilView = new DepthStencilView(graphicsDevice._d3dDevice, depthBuffer, new DepthStencilViewDescription()
{
Format = SharpDXHelper.ToFormat(preferredDepthFormat),
Dimension = DepthStencilViewDimension.Texture2D
});
}
}
开发者ID:KennethYap,项目名称:MonoGame,代码行数:33,代码来源:RenderTarget3D.DirectX.cs
示例9: ESTexture2D
public ESTexture2D(byte[] data, SurfaceFormat pixelFormat, int width, int height, Size size, ALL11 filter)
{
if (GraphicsDevice.OpenGLESVersion != OpenTK.Graphics.GLContextVersion.Gles2_0)
{
using(Bitmap bm = Bitmap.CreateBitmap(width, height, Bitmap.Config.Argb8888))
{
using (var buffer = ByteBuffer.Wrap(data))
{
bm.CopyPixelsFromBuffer(buffer);
}
InitWithBitmap(bm, filter);
}
}
else
{
var imagePtr = IntPtr.Zero;
try
{
imagePtr = Marshal.AllocHGlobal (data.Length);
Marshal.Copy (data, 0, imagePtr, data.Length);
InitWithData(imagePtr, pixelFormat, width, height, size, filter);
}
finally
{
Marshal.FreeHGlobal (imagePtr);
}
}
}
开发者ID:ustor,项目名称:MonoGame,代码行数:29,代码来源:ESTexture2D.cs
示例10: GetFormatSize
internal static int GetFormatSize(SurfaceFormat format)
{
switch (format)
{
case SurfaceFormat.Dxt1:
return 8;
case SurfaceFormat.Dxt3:
case SurfaceFormat.Dxt5:
return 16;
case SurfaceFormat.Alpha8:
return 1;
case SurfaceFormat.Bgr565:
case SurfaceFormat.Bgra4444:
case SurfaceFormat.Bgra5551:
case SurfaceFormat.HalfSingle:
case SurfaceFormat.NormalizedByte2:
return 2;
case SurfaceFormat.Color:
case SurfaceFormat.Single:
case SurfaceFormat.Rg32:
case SurfaceFormat.HalfVector2:
case SurfaceFormat.NormalizedByte4:
case SurfaceFormat.Rgba1010102:
return 4;
case SurfaceFormat.HalfVector4:
case SurfaceFormat.Rgba64:
case SurfaceFormat.Vector2:
return 8;
case SurfaceFormat.Vector4:
return 16;
default:
throw new ArgumentException("Should be a value defined in SurfaceFormat", "Format");
}
}
开发者ID:AesteroidBlues,项目名称:FNA,代码行数:34,代码来源:Texture.cs
示例11: RenderTarget2D
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice, width, height, mipMap, preferredFormat, true)
{
RenderTarget2D renderTarget2D = this;
this.DepthStencilFormat = preferredDepthFormat;
this.MultiSampleCount = preferredMultiSampleCount;
this.RenderTargetUsage = usage;
if (preferredDepthFormat == DepthFormat.None)
return;
Threading.BlockOnUIThread((Action) (() =>
{
GL.GenRenderbuffers(1, out renderTarget2D.glDepthStencilBuffer);
GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, renderTarget2D.glDepthStencilBuffer);
RenderbufferStorage local_0 = RenderbufferStorage.DepthComponent16;
switch (preferredDepthFormat)
{
case DepthFormat.Depth24Stencil8:
local_0 = RenderbufferStorage.Depth24Stencil8;
break;
case DepthFormat.Depth24:
local_0 = RenderbufferStorage.DepthComponent24;
break;
case DepthFormat.Depth16:
local_0 = RenderbufferStorage.DepthComponent16;
break;
}
if (renderTarget2D.MultiSampleCount == 0)
GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer, local_0, renderTarget2D.width, renderTarget2D.height);
else
GL.RenderbufferStorageMultisample(RenderbufferTarget.Renderbuffer, renderTarget2D.MultiSampleCount, local_0, renderTarget2D.width, renderTarget2D.height);
}));
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:32,代码来源:RenderTarget2D.cs
示例12: CreateRenderTarget
public static RenderTarget2D CreateRenderTarget(GraphicsDevice device, int numberLevels, SurfaceFormat surface, int width, int height)
{
MultiSampleType type = device.PresentationParameters.MultiSampleType;
// If the card can't use the surface format
if (!GraphicsAdapter.DefaultAdapter.CheckDeviceFormat(
DeviceType.Hardware,
GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Format,
TextureUsage.None,
QueryUsages.None,
ResourceType.RenderTarget,
surface))
{
// Fall back to current display format
surface = device.DisplayMode.Format;
}
// Or it can't accept that surface format
// with the current AA settings
else if (!GraphicsAdapter.DefaultAdapter.CheckDeviceMultiSampleType(
DeviceType.Hardware, surface,
device.PresentationParameters.IsFullScreen, type))
{
// Fall back to no antialiasing
type = MultiSampleType.None;
}
// Create our render target
return new RenderTarget2D(device,
width, height, numberLevels, surface,
type, 0, RenderTargetUsage.PreserveContents);
}
开发者ID:Tranquill6,项目名称:Project-Dollhouse,代码行数:31,代码来源:RenderUtils.cs
示例13: GetIntermediateTexture
public IntermediateRenderTarget GetIntermediateTexture(int width, int height, bool mipmap, SurfaceFormat SurfaceFormat, DepthFormat DepthFormat, int preferedMultisampleCount, RenderTargetUsage RenderTargetUsage)
{
// Look for a matching rendertarget in the cache
for (int i = 0; i < intermediateTextures.Count; i++)
{
if (intermediateTextures[i].InUse == false
&& height == intermediateTextures[i].RenderTarget.Height
&& width == intermediateTextures[i].RenderTarget.Width
&& preferedMultisampleCount == intermediateTextures[i].RenderTarget.MultiSampleCount
&& SurfaceFormat == intermediateTextures[i].RenderTarget.Format
&& DepthFormat == intermediateTextures[i].RenderTarget.DepthStencilFormat
&& RenderTargetUsage == intermediateTextures[i].RenderTarget.RenderTargetUsage
&& (mipmap == true && intermediateTextures[i].RenderTarget.LevelCount > 0 || mipmap == false && intermediateTextures[i].RenderTarget.LevelCount == 0)
)
{
intermediateTextures[i].InUse = true;
return intermediateTextures[i];
}
}
// We didn't find one, let's make one
IntermediateRenderTarget newTexture = new IntermediateRenderTarget();
newTexture.RenderTarget = new RenderTarget2D(device,width, height, mipmap, SurfaceFormat,DepthFormat, preferedMultisampleCount, RenderTargetUsage );
intermediateTextures.Add(newTexture);
newTexture.InUse = true;
return newTexture;
}
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:28,代码来源:IntermediateTexture.cs
示例14: UpdateCustomRenderTarget
public RenderTarget2D UpdateCustomRenderTarget(RenderTarget2D renderTarget, IGameContext gameContext, SurfaceFormat? surfaceFormat, DepthFormat? depthFormat, int? multiSampleCount)
{
if (IsCustomRenderTargetOutOfDate(renderTarget, gameContext, surfaceFormat, depthFormat, multiSampleCount))
{
if (renderTarget != null)
{
renderTarget.Dispose();
}
if (gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferWidth == 0 &&
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferHeight == 0)
{
return null;
}
renderTarget = new RenderTarget2D(
gameContext.Graphics.GraphicsDevice,
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferWidth,
gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferHeight,
false,
surfaceFormat ?? gameContext.Graphics.GraphicsDevice.PresentationParameters.BackBufferFormat,
depthFormat ?? gameContext.Graphics.GraphicsDevice.PresentationParameters.DepthStencilFormat,
multiSampleCount ?? gameContext.Graphics.GraphicsDevice.PresentationParameters.MultiSampleCount,
RenderTargetUsage.PreserveContents);
}
return renderTarget;
}
开发者ID:RedpointGames,项目名称:Protogame,代码行数:28,代码来源:DefaultRenderTargetBackBufferUtilities.cs
示例15: RenderTarget2D
public RenderTarget2D (
GraphicsDevice graphicsDevice,
int width,
int height,
int numberLevels,
SurfaceFormat format
)
{
// throw new NotImplementedException();
texture = new Texture2D( graphicsDevice, width, height, numberLevels, TextureUsage.None, format );
// create framebuffer
/*GL.GenBuffers(1, ref textureFrameBuffer);
GL.BindBuffer(All.Framebuffer, textureFrameBuffer);
// attach renderbuffer
GL.FramebufferTexture2D(All.Framebuffer, All.ColorAttachment0, All.Texture2D, textureFrameBuffer, 0);
// attach depth buffer
uint depthRenderbuffer;
GL.GenRenderbuffers(1, ref depthRenderbuffer);
GL.BindRenderbuffer(All.Renderbuffer, depthRenderbuffer);
GL.RenderbufferStorage(All.Renderbuffer, All.DepthComponent16, width, height);
GL.FramebufferRenderbuffer(All.Framebuffer, All.DepthAttachment, All.Renderbuffer, depthRenderbuffer);
// unbind frame buffer
GL.BindBuffer(All.Framebuffer, 0);*/
}
开发者ID:HaKDMoDz,项目名称:Zazumo,代码行数:30,代码来源:RenderTarget2D.cs
示例16: BitmapContent
public BitmapContent(SurfaceFormat format, int width, int height, byte[] data)
{
this.Format = format;
this.Width = width;
this.Height = height;
this.Data = data;
}
开发者ID:dellis1972,项目名称:XnaBuildContent,代码行数:7,代码来源:BitmapContent.cs
示例17: CudaVideoWriter
public CudaVideoWriter(String fileName, Size frameSize, double fps, SurfaceFormat format = SurfaceFormat.BGR)
{
using (CvString s = new CvString(fileName))
{
_ptr = CudaInvoke.cudaVideoWriterCreate(s, ref frameSize, fps, format);
}
}
开发者ID:neutmute,项目名称:emgucv,代码行数:7,代码来源:CudaVideoWriter.cs
示例18: RenderTarget2D
public RenderTarget2D(
GraphicsDevice graphicsDevice, int width, int height, int numberLevels,
SurfaceFormat format, MultiSampleType multiSampleType, int multiSampleQuality)
: this(graphicsDevice, width, height, numberLevels > 1, format,
DepthFormat.Unknown, 0, RenderTargetUsage.PreserveContents)
{
}
开发者ID:jbekkedal,项目名称:MonoGame,代码行数:7,代码来源:RenderTarget2D.cs
示例19: RenderTarget2D
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice, width, height, mipMap, preferredFormat)
{
RenderTargetUsage = usage;
DepthStencilFormat = preferredDepthFormat;
}
开发者ID:Grapes,项目名称:MonoGame,代码行数:7,代码来源:RenderTarget2D.cs
示例20: ToFormat
static public SharpDX.DXGI.Format ToFormat(SurfaceFormat format)
{
switch (format)
{
case SurfaceFormat.Color:
default:
return SharpDX.DXGI.Format.R8G8B8A8_UNorm;
case SurfaceFormat.Bgr565:
return SharpDX.DXGI.Format.B5G6R5_UNorm;
case SurfaceFormat.Bgra5551:
return SharpDX.DXGI.Format.B5G5R5A1_UNorm;
#if WINRT
case SurfaceFormat.Bgra4444:
return SharpDX.DXGI.Format.B4G4R4A4_UNorm;
#endif
case SurfaceFormat.Dxt1:
return SharpDX.DXGI.Format.BC1_UNorm;
case SurfaceFormat.Dxt3:
return SharpDX.DXGI.Format.BC2_UNorm;
case SurfaceFormat.Dxt5:
return SharpDX.DXGI.Format.BC3_UNorm;
case SurfaceFormat.NormalizedByte2:
return SharpDX.DXGI.Format.R8G8_SNorm;
case SurfaceFormat.NormalizedByte4:
return SharpDX.DXGI.Format.R8G8B8A8_SNorm;
case SurfaceFormat.Rgba1010102:
return SharpDX.DXGI.Format.R10G10B10A2_UNorm;
case SurfaceFormat.Rg32:
return SharpDX.DXGI.Format.R16G16_UNorm;
case SurfaceFormat.Rgba64:
return SharpDX.DXGI.Format.R16G16B16A16_UNorm;
case SurfaceFormat.Alpha8:
return SharpDX.DXGI.Format.A8_UNorm;
case SurfaceFormat.Single:
return SharpDX.DXGI.Format.R32_Float;
case SurfaceFormat.HalfSingle:
return SharpDX.DXGI.Format.R16_Float;
case SurfaceFormat.HalfVector2:
return SharpDX.DXGI.Format.R16G16_Float;
case SurfaceFormat.Vector2:
return SharpDX.DXGI.Format.R32G32_Float;
case SurfaceFormat.Vector4:
return SharpDX.DXGI.Format.R32G32B32A32_Float;
case SurfaceFormat.HalfVector4:
return SharpDX.DXGI.Format.R16G16B16A16_Float;
case SurfaceFormat.HdrBlendable:
// TODO: This needs to check the graphics device and
// return the best hdr blendable format for the device.
return SharpDX.DXGI.Format.R16G16B16A16_Float;
case SurfaceFormat.Bgr32:
return SharpDX.DXGI.Format.B8G8R8X8_UNorm;
case SurfaceFormat.Bgra32:
return SharpDX.DXGI.Format.B8G8R8A8_UNorm;
}
}
开发者ID:Boerlam001,项目名称:MonoGame,代码行数:59,代码来源:SharpDXHelper.cs
注:本文中的SurfaceFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论