本文整理汇总了C#中DepthFormat类的典型用法代码示例。如果您正苦于以下问题:C# DepthFormat类的具体用法?C# DepthFormat怎么用?C# DepthFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DepthFormat类属于命名空间,在下文中一共展示了DepthFormat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例2: PostProcesses
public PostProcesses(SurfaceFormat? surface = null, DepthFormat? depth = null, bool mipmap = false, RenderTargetUsage? usage = null)
{
FormatSurface = surface;
FormatDepth = depth;
MipMap = mipmap;
Usage = usage;
}
示例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
});
}
}
示例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;
}
示例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
}
示例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);
}));
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
示例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 );
}
}
示例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);
}
示例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();
}