本文整理汇总了C#中DepthFormat类的典型用法代码示例。如果您正苦于以下问题:C# DepthFormat类的具体用法?C# DepthFormat怎么用?C# DepthFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DepthFormat类属于命名空间,在下文中一共展示了DepthFormat类的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: 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
示例3: 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
示例4: 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
示例5: 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
示例6: 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
示例7: 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
示例8: 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
示例9: DepthStencilBuffer
internal DepthStencilBuffer(GraphicsDevice device, Texture2DDescription description2D, DepthFormat depthFormat)
: base(device, description2D)
{
DepthFormat = depthFormat;
DefaultViewFormat = ComputeViewFormat(DepthFormat, out HasStencil);
Initialize(Resource);
HasReadOnlyView = InitializeViewsDelayed(out ReadOnlyView);
}
开发者ID:GrafSeismo,项目名称:SharpDX,代码行数:8,代码来源:DepthStencilBuffer.cs
示例10: DepthStencilSurface
/// <summary>
///
/// </summary>
/// <param name="dsv"></param>
internal DepthStencilSurface ( DepthStencilView dsv, DepthFormat format, int width, int height, int sampleCount )
{
Width = width;
Height = height;
Format = format;
SampleCount = sampleCount;
DSV = dsv;
}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:12,代码来源:DepthStencilSurface.cs
示例11: RenderTargetGraphicsPresenter
public RenderTargetGraphicsPresenter(GraphicsDevice device, RenderTarget2D renderTarget, DepthFormat depthFormat = DepthFormat.None)
: base(device, CreatePresentationParameters(renderTarget, depthFormat))
{
PresentInterval = Description.PresentationInterval;
// Initialize the swap chain
backBuffer = renderTarget;
}
开发者ID:rbwhitaker,项目名称:SharpDX,代码行数:8,代码来源:RenderTargetGraphicsPresenter.cs
示例12: RenderTargetCube
public RenderTargetCube(GraphicsDevice graphicsDevice, int size, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice, size, mipMap, preferredFormat, true)
{
this.DepthStencilFormat = preferredDepthFormat;
this.MultiSampleCount = preferredMultiSampleCount;
this.RenderTargetUsage = usage;
throw new NotImplementedException();
}
开发者ID:Zeludon,项目名称:FEZ,代码行数:8,代码来源:RenderTargetCube.cs
示例13: DepthStencilCube
/// <summary>
/// Creates render target
/// </summary>
/// <param name="rs"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="format"></param>
public DepthStencilCube( GraphicsDevice device, DepthFormat format, int size, int samples, string debugName = "" )
: base(device)
{
bool msaa = samples > 1;
CheckSamplesCount( samples );
SampleCount = samples;
Format = format;
SampleCount = samples;
Width = size;
Height = size;
Depth = 1;
var texDesc = new Texture2DDescription();
texDesc.Width = Width;
texDesc.Height = Height;
texDesc.ArraySize = 6;
texDesc.BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource;
texDesc.CpuAccessFlags = CpuAccessFlags.None;
texDesc.Format = Converter.ConvertToTex( format );
texDesc.MipLevels = 1;
texDesc.OptionFlags = ResourceOptionFlags.TextureCube;
texDesc.SampleDescription = new DXGI.SampleDescription(samples, 0);
texDesc.Usage = ResourceUsage.Default;
texCube = new D3D.Texture2D( device.Device, texDesc );
var srvDesc = new ShaderResourceViewDescription();
srvDesc.Dimension = samples > 1 ? ShaderResourceViewDimension.Texture2DMultisampled : ShaderResourceViewDimension.Texture2D;
srvDesc.Format = Converter.ConvertToSRV( format );
srvDesc.Texture2D.MostDetailedMip = 0;
srvDesc.Texture2D.MipLevels = 1;
SRV = new ShaderResourceView( device.Device, texCube );
//
// Create surfaces :
//
surfaces = new DepthStencilSurface[ 6 ];
for ( int face=0; face<6; face++) {
var rtvDesc = new DepthStencilViewDescription();
rtvDesc.Texture2DArray.MipSlice = 0;
rtvDesc.Texture2DArray.FirstArraySlice = face;
rtvDesc.Texture2DArray.ArraySize = 1;
rtvDesc.Dimension = msaa ? DepthStencilViewDimension.Texture2DMultisampledArray : DepthStencilViewDimension.Texture2DArray;
rtvDesc.Format = Converter.ConvertToDSV( format );
var dsv = new DepthStencilView( device.Device, texCube, rtvDesc );
int subResId = Resource.CalculateSubResourceIndex( 0, face, 1 );
surfaces[face] = new DepthStencilSurface( dsv, format, Width, Height, SampleCount );
}
}
开发者ID:temik911,项目名称:audio,代码行数:65,代码来源:DepthStencilCube.cs
示例14: RenderTarget2D
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared, int arraySize)
: base(graphicsDevice, width, height, mipMap, preferredFormat, SurfaceType.RenderTarget, shared, arraySize)
{
DepthStencilFormat = preferredDepthFormat;
MultiSampleCount = preferredMultiSampleCount;
RenderTargetUsage = usage;
PlatformConstruct(graphicsDevice, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage, shared);
}
开发者ID:Cardanis,项目名称:MonoGame,代码行数:9,代码来源:RenderTarget2D.cs
示例15: RenderTarget2D
public RenderTarget2D (GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount,
RenderTargetUsage usage)
:base(graphicsDevice, width, height,0, TextureUsage.None, format)
{
allocateOpenGLTexture();
}
开发者ID:johnkwaters,项目名称:MonoGame,代码行数:9,代码来源:RenderTarget2D.cs
示例16: RenderTargetInfo
public RenderTargetInfo(int width, int height, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, bool mipMap, RenderTargetUsage usage)
{
Width = width;
Height = height;
SurfaceFormat = format;
DepthFormat = depthFormat;
MultiSampleCount = multiSampleCount;
MipMap = mipMap;
Usage = usage;
}
开发者ID:xoxota99,项目名称:Myre,代码行数:10,代码来源:RenderTargetManager.cs
示例17: InitWithWidthAndHeight
protected virtual bool InitWithWidthAndHeight(int w, int h, SurfaceFormat colorFormat, DepthFormat depthFormat, RenderTargetUsage usage)
{
m_Width = (int)Math.Ceiling(w * CCMacros.CCContentScaleFactor());
m_Height = (int)Math.Ceiling(h * CCMacros.CCContentScaleFactor());
m_ColorFormat = colorFormat;
m_DepthFormat = depthFormat;
m_Usage = usage;
MakeTexture();
return true;
}
开发者ID:Ratel13,项目名称:cocos2d-xna,代码行数:10,代码来源:CCRenderTexture.cs
示例18: RenderTargetGraphicsPresenter
public RenderTargetGraphicsPresenter(GraphicsDevice device, RenderTarget2D backBuffer, DepthFormat depthFormat = DepthFormat.None, bool disposeRenderTarget = false, bool depthAsShaderResource = false)
: base(device, CreatePresentationParameters(backBuffer, depthFormat, depthAsShaderResource))
{
PresentInterval = Description.PresentationInterval;
this.backBuffer = backBuffer;
if (disposeRenderTarget)
ToDispose(this.backBuffer);
}
开发者ID:numo16,项目名称:SharpDX,代码行数:10,代码来源:RenderTargetGraphicsPresenter.cs
示例19: PlatformConstruct
private void PlatformConstruct(GraphicsDevice graphicsDevice, int width, int height, bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, bool shared)
{
Threading.BlockOnUIThread(() =>
{
graphicsDevice.PlatformCreateRenderTarget(this, width, height, mipMap, preferredFormat, preferredDepthFormat, preferredMultiSampleCount, usage);
});
}
开发者ID:Zodge,项目名称:MonoGame,代码行数:10,代码来源:RenderTarget2D.OpenGL.cs
示例20: DepthStencil2D
/// <summary>
/// Creates depth stencil texture, view and shader resource with format D24S8
/// </summary>
/// <param name="rs"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <param name="format"></param>
public DepthStencil2D( GraphicsDevice device, DepthFormat format, int width, int height, int samples = 1 )
: base(device)
{
CheckSamplesCount( samples );
Width = width;
Height = height;
Depth = 1;
Format = format;
SampleCount = samples;
var bindFlags = BindFlags.DepthStencil;
if (device.GraphicsProfile==GraphicsProfile.HiDef) {
bindFlags |= BindFlags.ShaderResource;
} else if (device.GraphicsProfile==GraphicsProfile.Reach) {
if (samples==1) {
bindFlags |= BindFlags.ShaderResource;
}
}
var texDesc = new Texture2DDescription();
texDesc.Width = width;
texDesc.Height = height;
texDesc.ArraySize = 1;
texDesc.BindFlags = bindFlags;
texDesc.CpuAccessFlags = CpuAccessFlags.None;
texDesc.Format = Converter.ConvertToTex( format );
texDesc.MipLevels = 1;
texDesc.OptionFlags = ResourceOptionFlags.None;
texDesc.SampleDescription = new DXGI.SampleDescription(samples, 0);
texDesc.Usage = ResourceUsage.Default;
var dsvDesc = new DepthStencilViewDescription();
dsvDesc.Dimension = samples > 1 ? DepthStencilViewDimension.Texture2DMultisampled : DepthStencilViewDimension.Texture2D;
dsvDesc.Format = Converter.ConvertToDSV( format );
dsvDesc.Flags = DepthStencilViewFlags.None;
var srvDesc = new ShaderResourceViewDescription();
srvDesc.Dimension = samples > 1 ? ShaderResourceViewDimension.Texture2DMultisampled : ShaderResourceViewDimension.Texture2D;
srvDesc.Format = Converter.ConvertToSRV( format );
srvDesc.Texture2D.MostDetailedMip = 0;
srvDesc.Texture2D.MipLevels = 1;
tex2D = new D3D.Texture2D ( device.Device, texDesc );
var dsv = new DepthStencilView ( device.Device, tex2D, dsvDesc );
if (bindFlags.HasFlag( BindFlags.ShaderResource)) {
SRV = new ShaderResourceView ( device.Device, tex2D, srvDesc );
}
surface = new DepthStencilSurface ( dsv, format, width, height, samples );
}
开发者ID:temik911,项目名称:audio,代码行数:62,代码来源:DepthStencil2D.cs
注:本文中的DepthFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论