本文整理汇总了C#中SharpDX.Direct3D11.SamplerStateDescription类 的典型用法代码示例。如果您正苦于以下问题:C# SamplerStateDescription类的具体用法?C# SamplerStateDescription怎么用?C# SamplerStateDescription使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SamplerStateDescription类 属于SharpDX.Direct3D11命名空间,在下文中一共展示了SamplerStateDescription类 的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Postprocess
public Postprocess(Game game, string shaderFile, RenderTexture rt = null, string name = null)
{
this.game = game;
this.renderTexture = rt;
if(name == null)
{
this.Name = System.IO.Path.GetFileNameWithoutExtension(shaderFile);
this.debugName = "Postprocess " + this.Name;
}
else
{
this.debugName = this.Name = name;
}
this.shaderFile = shaderFile;
var desc = SamplerStateDescription.Default();
desc.Filter = Filter.MinMagMipPoint;
defaultSamplerStateDescription = desc;
LoadShader();
BuildVertexBuffer();
ppBuffer = Material.CreateBuffer<LiliumPostprocessData>();
game.AddObject(this);
}
开发者ID:woncomp, 项目名称:LiliumLab, 代码行数:25, 代码来源:Postprocess.cs
示例2: TextureShader
public TextureShader(Device device)
{
var vertexShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "TextureVertexShader", "vs_4_0", ShaderFlags);
var pixelShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "TexturePixelShader", "ps_4_0", ShaderFlags);
VertexShader = new VertexShader(device, vertexShaderByteCode);
PixelShader = new PixelShader(device, pixelShaderByteCode);
Layout = VertexDefinition.PositionTexture.GetInputLayout(device, vertexShaderByteCode);
vertexShaderByteCode.Dispose();
pixelShaderByteCode.Dispose();
ConstantMatrixBuffer = new Buffer(device, MatrixBufferDesription);
// Create a texture sampler state description.
var samplerDesc = new SamplerStateDescription
{
Filter = Filter.Anisotropic,
AddressU = TextureAddressMode.Mirror,
AddressV = TextureAddressMode.Mirror,
AddressW = TextureAddressMode.Mirror,
MipLodBias = 0,
MaximumAnisotropy = 16,
ComparisonFunction = Comparison.Always,
BorderColor = new Color4(1, 1, 1, 1),
MinimumLod = 0,
MaximumLod = 0
};
// Create the texture sampler state.
SamplerState = new SamplerState(device, samplerDesc);
}
开发者ID:ndech, 项目名称:Alpha, 代码行数:33, 代码来源:TextureShader.cs
示例3: WorldTerrainShader
public WorldTerrainShader(Device device)
{
var vertexShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "TerrainVertexShader", "vs_4_0", ShaderFlags);
var pixelShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "TerrainPixelShader", "ps_4_0", ShaderFlags);
VertexShader = new VertexShader(device, vertexShaderByteCode);
PixelShader = new PixelShader(device, pixelShaderByteCode);
Layout = VertexDefinition.PositionTexture.GetInputLayout(device, vertexShaderByteCode);
vertexShaderByteCode.Dispose();
pixelShaderByteCode.Dispose();
ConstantMatrixBuffer = new Buffer(device, MatrixBufferDesription);
var samplerDescMap = new SamplerStateDescription
{
Filter = Filter.MinMagMipPoint,
AddressU = TextureAddressMode.Clamp,
AddressV = TextureAddressMode.Clamp,
AddressW = TextureAddressMode.Clamp,
MipLodBias = 0,
MaximumAnisotropy = 1,
ComparisonFunction = Comparison.Always,
BorderColor = Color.Transparent,
MinimumLod = 0,
MaximumLod = float.MaxValue
};
SamplerStateMap = new SamplerState(device, samplerDescMap);
}
开发者ID:ndech, 项目名称:Alpha, 代码行数:30, 代码来源:WorldTerrainShader.cs
示例4: ProjectiveTexturingShader
public ProjectiveTexturingShader(Device device)
{
var shaderByteCode = new ShaderBytecode(File.ReadAllBytes("Content/DepthAndProjectiveTextureVS.cso"));
vertexShader = new VertexShader(device, shaderByteCode);
geometryShader = new GeometryShader(device, new ShaderBytecode(File.ReadAllBytes("Content/DepthAndColorGS.cso")));
pixelShader = new PixelShader(device, new ShaderBytecode(File.ReadAllBytes("Content/DepthAndColorPS.cso")));
// depth stencil state
var depthStencilStateDesc = new DepthStencilStateDescription()
{
IsDepthEnabled = true,
DepthWriteMask = DepthWriteMask.All,
DepthComparison = Comparison.LessEqual,
IsStencilEnabled = false,
};
depthStencilState = new DepthStencilState(device, depthStencilStateDesc);
// rasterizer states
var rasterizerStateDesc = new RasterizerStateDescription()
{
CullMode = CullMode.None,
FillMode = FillMode.Solid,
IsDepthClipEnabled = true,
IsFrontCounterClockwise = true,
IsMultisampleEnabled = true,
};
rasterizerState = new RasterizerState(device, rasterizerStateDesc);
// constant buffer
var constantBufferDesc = new BufferDescription()
{
Usage = ResourceUsage.Dynamic,
BindFlags = BindFlags.ConstantBuffer,
SizeInBytes = Constants.size,
CpuAccessFlags = CpuAccessFlags.Write,
StructureByteStride = 0,
OptionFlags = 0,
};
constantBuffer = new SharpDX.Direct3D11.Buffer(device, constantBufferDesc);
// user view sampler state
var colorSamplerStateDesc = new SamplerStateDescription()
{
Filter = Filter.MinMagMipLinear,
AddressU = TextureAddressMode.Border,
AddressV = TextureAddressMode.Border,
AddressW = TextureAddressMode.Border,
//BorderColor = new SharpDX.Color4(0.5f, 0.5f, 0.5f, 1.0f),
BorderColor = new SharpDX.Color4(0, 0, 0, 1.0f),
};
colorSamplerState = new SamplerState(device, colorSamplerStateDesc);
vertexInputLayout = new InputLayout(device, shaderByteCode.Data, new[]
{
new InputElement("SV_POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
});
}
开发者ID:Dallemanden, 项目名称:RoomAliveToolkit, 代码行数:58, 代码来源:ProjectiveTexturingShader.cs
示例5: TerrainMinimapShader
public TerrainMinimapShader(Device device)
{
var vertexShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "MinimapTerrainVertexShader", "vs_4_0", ShaderFlags);
var pixelShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "MinimapTerrainPixelShader", "ps_4_0", ShaderFlags);
VertexShader = new VertexShader(device, vertexShaderByteCode);
PixelShader = new PixelShader(device, pixelShaderByteCode);
Layout = VertexDefinition.TerrainVertex.GetInputLayout(device, vertexShaderByteCode);
vertexShaderByteCode.Dispose();
pixelShaderByteCode.Dispose();
ConstantMatrixBuffer = new Buffer(device, MatrixBufferDesription);
ConstantSelectionBuffer = new Buffer(device, new BufferDescription
{
Usage = ResourceUsage.Dynamic,
SizeInBytes = Utilities.SizeOf<SelectionBuffer>(),
BindFlags = BindFlags.ConstantBuffer,
CpuAccessFlags = CpuAccessFlags.Write,
OptionFlags = ResourceOptionFlags.None,
StructureByteStride = 0
});
var samplerDescBorder = new SamplerStateDescription
{
Filter = Filter.Anisotropic,
AddressU = TextureAddressMode.MirrorOnce,
AddressV = TextureAddressMode.Clamp,
AddressW = TextureAddressMode.Clamp,
MipLodBias = 0,
MaximumAnisotropy = 16,
ComparisonFunction = Comparison.Always,
BorderColor = Color.Transparent,
MinimumLod = 0,
MaximumLod = float.MaxValue
};
// Create the texture sampler state.
SamplerStateBorder = new SamplerState(device, samplerDescBorder);
var samplerDescColor = new SamplerStateDescription
{
Filter = Filter.Anisotropic,
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
MipLodBias = 0,
MaximumAnisotropy = 16,
ComparisonFunction = Comparison.Always,
BorderColor = Color.Transparent,
MinimumLod = 0,
MaximumLod = float.MaxValue
};
// Create the texture sampler state.
SamplerStateColor = new SamplerState(device, samplerDescColor);
}
开发者ID:ndech, 项目名称:Alpha, 代码行数:58, 代码来源:TerrainMinimapShader.cs
示例6: LightShader
public LightShader(Device device)
{
var vertexShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "LightVertexShader", "vs_4_0", ShaderFlags);
var pixelShaderByteCode = ShaderBytecode.CompileFromFile(ShaderFileName, "LightPixelShader", "ps_4_0", ShaderFlags);
VertexShader = new VertexShader(device, vertexShaderByteCode);
PixelShader = new PixelShader(device, pixelShaderByteCode);
Layout = VertexDefinition.PositionTextureNormal.GetInputLayout(device, vertexShaderByteCode);
vertexShaderByteCode.Dispose();
pixelShaderByteCode.Dispose();
ConstantMatrixBuffer = new Buffer(device, MatrixBufferDesription);
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
var lightBufferDesc = new BufferDescription
{
Usage = ResourceUsage.Dynamic, // Updated each frame
SizeInBytes = Utilities.SizeOf<LightBuffer>(), // Contains three matrices
BindFlags = BindFlags.ConstantBuffer,
CpuAccessFlags = CpuAccessFlags.Write,
OptionFlags = ResourceOptionFlags.None,
StructureByteStride = 0
};
ConstantLightBuffer = new Buffer(device, lightBufferDesc);
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
var cameraBufferDesc = new BufferDescription
{
Usage = ResourceUsage.Dynamic, // Updated each frame
SizeInBytes = Utilities.SizeOf<CameraBuffer>(), // Contains three matrices
BindFlags = BindFlags.ConstantBuffer,
CpuAccessFlags = CpuAccessFlags.Write,
OptionFlags = ResourceOptionFlags.None,
StructureByteStride = 0
};
ConstantCameraBuffer = new Buffer(device, cameraBufferDesc);
// Create a texture sampler state description.
var samplerDesc = new SamplerStateDescription
{
Filter = Filter.Anisotropic,
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
MipLodBias = 0,
MaximumAnisotropy = 16,
ComparisonFunction = Comparison.Always,
BorderColor = new Color4(0, 0, 0, 0),
MinimumLod = 0,
MaximumLod = 10
};
// Create the texture sampler state.
SamplerState = new SamplerState(device, samplerDesc);
}
开发者ID:ndech, 项目名称:Alpha, 代码行数:57, 代码来源:LightShader.cs
示例7: SamplerState
/// <summary>
/// Initializes a new instance of the <see cref="SamplerState" /> class.
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/>.</param>
/// <param name="description">The description.</param>
private SamplerState(GraphicsDevice device, SamplerStateDescription description) : base(device.MainDevice)
{
// For 9.1, anisotropy cannot be larger then 2
if (device.Features.Level == FeatureLevel.Level_9_1)
{
description.MaximumAnisotropy = Math.Min(2, description.MaximumAnisotropy);
}
Description = description;
Initialize(new SharpDX.Direct3D11.SamplerState(device, description));
}
开发者ID:numo16, 项目名称:SharpDX, 代码行数:15, 代码来源:SamplerState.cs
示例8: InitializeInternal
protected override void InitializeInternal()
{
var descr = new SamplerStateDescription
{
AddressU = GetTextureAddressMode(Settings.WrapU),
AddressV = GetTextureAddressMode(Settings.WrapV),
AddressW = GetTextureAddressMode(Settings.WrapW),
Filter = GetFilterType(Settings.Filter)
};
SamplerState = new SamplerState(DeviceManager.Device, descr);
}
开发者ID:gitter-badger, 项目名称:Grasshopper, 代码行数:11, 代码来源:TextureSampler.cs
示例9: TextureMap
public TextureMap(int w, int h)
{
m_width = (ushort)w;
m_height = (ushort)h;
// Create a texture sampler default state description.
m_samplerDesc = new SamplerStateDescription
{
Filter = Filter.MinMagMipPoint,
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
ComparisonFunction = Comparison.Never,
MinimumLod = 0,
MaximumLod = 0,
};
}
开发者ID:MercurialForge, 项目名称:VSViewer, 代码行数:17, 代码来源:TextureMap.cs
示例10: InitOnce
internal static void InitOnce()
{
SamplerStateDescription description = new SamplerStateDescription();
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
m_default = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Border;
description.AddressV = TextureAddressMode.Border;
description.AddressW = TextureAddressMode.Border;
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
description.BorderColor = new Color4(0, 0, 0, 0);
m_alphamask = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.MinMagMipPoint;
description.MaximumLod = System.Single.MaxValue;
m_point = MyPipelineStates.CreateSamplerState(description);
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
m_linear = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.ComparisonMinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
description.ComparisonFunction = Comparison.LessEqual;
m_shadowmap = MyPipelineStates.CreateSamplerState(description);
m_texture = MyPipelineStates.CreateSamplerState(description);
m_alphamaskArray = MyPipelineStates.CreateSamplerState(description);
UpdateFiltering();
Init();
}
开发者ID:ChristianHeinz71, 项目名称:SpaceEngineers, 代码行数:44, 代码来源:SamplerStates.cs
示例11: Sampler
public Sampler(GxContext context)
{
mContext = context;
mDescription = new SamplerStateDescription
{
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
BorderColor = SharpDX.Color4.Black,
ComparisonFunction = Comparison.Always,
Filter = Filter.MinMagMipLinear,
MaximumAnisotropy = 0,
MaximumLod = float.MaxValue,
MinimumLod = float.MinValue,
MipLodBias = 0.0f
};
mChanged = true;
}
开发者ID:Linrasis, 项目名称:WoWEditor, 代码行数:19, 代码来源:Sampler.cs
示例12: InitilizeSamplerStates
private static void InitilizeSamplerStates()
{
SamplerStateDescription description = new SamplerStateDescription();
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
m_defaultSamplerState = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Border;
description.AddressV = TextureAddressMode.Border;
description.AddressW = TextureAddressMode.Border;
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
description.BorderColor = new Color4(0, 0, 0, 0);
m_alphamaskSamplerState = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.MinMagMipPoint;
description.MaximumLod = System.Single.MaxValue;
m_pointSamplerState = MyPipelineStates.CreateSamplerState(description);
description.Filter = Filter.MinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
m_linearSamplerState = MyPipelineStates.CreateSamplerState(description);
description.AddressU = TextureAddressMode.Clamp;
description.AddressV = TextureAddressMode.Clamp;
description.AddressW = TextureAddressMode.Clamp;
description.Filter = Filter.ComparisonMinMagMipLinear;
description.MaximumLod = System.Single.MaxValue;
description.ComparisonFunction = Comparison.LessEqual;
m_shadowmapSamplerState = MyPipelineStates.CreateSamplerState(description);
m_textureSamplerState = MyPipelineStates.CreateSamplerState(description);
m_alphamaskarraySamplerState = MyPipelineStates.CreateSamplerState(description);
UpdateTextureSampler(m_textureSamplerState, TextureAddressMode.Wrap);
UpdateTextureSampler(m_alphamaskarraySamplerState, TextureAddressMode.Clamp);
}
开发者ID:stanhebben, 项目名称:SpaceEngineers, 代码行数:43, 代码来源:MyRender-SamplerStates.cs
示例13: Initialize
/// <summary>
/// Binds the effect shader to the specified <see cref="Device"/>.
/// </summary>
/// <param name="device">The device to bind the shader to.</param>
/// <returns>If the binding was successful.</returns>
public bool Initialize(Device device)
{
try
{
matrixBuffer = new Buffer(device, Matrix.SizeInBytes * 3, ResourceUsage.Dynamic, BindFlags.ConstantBuffer, CpuAccessFlags.Write, ResourceOptionFlags.None, 0) {DebugName = "Matrix buffer"};
using (var bytecode = ShaderBytecode.CompileFromFile("Shaders/Texture.vs", "TextureVertexShader", "vs_4_0"))
{
layout = new InputLayout(device, ShaderSignature.GetInputSignature(bytecode), TextureDrawingVertex.VertexDeclaration) { DebugName = "Color vertex layout" };
vertexShader = new VertexShader(device, bytecode) { DebugName = "Texture vertex shader" };
}
using (var bytecode = ShaderBytecode.CompileFromFile("Shaders/Texture.ps", "TexturePixelShader", "ps_4_0"))
{
pixelShader = new PixelShader(device, bytecode) { DebugName = "Texture pixel shader" };
}
var samplerDesc = new SamplerStateDescription
{
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
Filter = Filter.ComparisonMinMagMipLinear,
MaximumAnisotropy = 1,
MipLodBias = 0f,
MinimumLod = 0,
MaximumLod = float.MaxValue,
BorderColor = Color.LimeGreen,
ComparisonFunction = Comparison.Always
};
pixelSampler = new SamplerState(device, samplerDesc);
texture = new Texture();
return texture.Initialize(device, "Textures/dirt.dds");
}
catch (Exception e)
{
MessageBox.Show("Shader error: " + e.Message);
return false;
}
}
开发者ID:Earthmark, 项目名称:RenderTest, 代码行数:46, 代码来源:TextureShader.cs
示例14: Texture
/* CONSTRUCTORS & DESTRUCTOR */
/// <summary>
/// Constructs an blank texture object that has no effect on rendered objects.
/// </summary>
/// <param name="window">A reference to the Direct3D-capable window in which this texture will be rendered.</param>
public Texture(Window3D window)
: base()
{
Window = window;
Window.OnClose += Dispose;
_TSSD = new SamplerStateDescription()
{
AddressU = TextureAddressMode.Wrap,
AddressV = TextureAddressMode.Wrap,
AddressW = TextureAddressMode.Wrap,
BorderColor = Color4.Black,
ComparisonFunction = Comparison.Never,
Filter = Filter.Anisotropic,
MaximumAnisotropy = 16,
MaximumLod = float.MaxValue,
MinimumLod = 0f,
MipLodBias = 0f,
};
UpdateSettings = true;
}
开发者ID:JoshGrooms, 项目名称:Tesseract, 代码行数:26, 代码来源:Texture.cs
示例15: UpdateTextureSampler
internal static void UpdateTextureSampler(SamplerId samplerState, TextureAddressMode addressMode)
{
SamplerStateDescription description = new SamplerStateDescription();
description.AddressU = addressMode;
description.AddressV = addressMode;
description.AddressW = addressMode;
description.MaximumLod = System.Single.MaxValue;
if(MyRender11.RenderSettings.AnisotropicFiltering == MyTextureAnisoFiltering.NONE)
{
description.Filter = Filter.MinMagMipLinear;
}
else
{
description.Filter = Filter.Anisotropic;
switch(MyRender11.RenderSettings.AnisotropicFiltering)
{
case MyTextureAnisoFiltering.ANISO_1:
description.MaximumAnisotropy = 1;
break;
case MyTextureAnisoFiltering.ANISO_4:
description.MaximumAnisotropy = 4;
break;
case MyTextureAnisoFiltering.ANISO_8:
description.MaximumAnisotropy = 8;
break;
case MyTextureAnisoFiltering.ANISO_16:
description.MaximumAnisotropy = 16;
break;
default:
description.MaximumAnisotropy = 1;
break;
}
}
MyPipelineStates.ChangeSamplerState(samplerState, description);
}
开发者ID:stanhebben, 项目名称:SpaceEngineers, 代码行数:38, 代码来源:MyRender-SamplerStates.cs
示例16: New
/// <summary>
/// <p>Create a sampler-state object that encapsulates sampling information for a texture.</p>
/// </summary>
/// <param name="device">The <see cref="GraphicsDevice"/>.</param>
/// <param name="description">A sampler state description</param>
/// <returns>A new <see cref="SamplerState"/> instance</returns>
/// <remarks>
/// <p>4096 unique sampler state objects can be created on a device at a time.</p><p>If an application attempts to create a sampler-state interface with the same state as an existing interface, the same interface will be returned and the total number of unique sampler state objects will stay the same.</p>
/// </remarks>
/// <msdn-id>ff476518</msdn-id>
/// <unmanaged>HRESULT ID3D11Device::CreateSamplerState([In] const D3D11_SAMPLER_DESC* pSamplerDesc,[Out, Fast] ID3D11SamplerState** ppSamplerState)</unmanaged>
/// <unmanaged-short>ID3D11Device::CreateSamplerState</unmanaged-short>
public static SamplerState New(GraphicsDevice device, SamplerStateDescription description)
{
return new SamplerState(device, description);
}
开发者ID:Ziriax, 项目名称:SharpDX, 代码行数:16, 代码来源:SamplerState.cs
示例17: DepthAndColorShader
public DepthAndColorShader(Device device)
{
shaderByteCode = new ShaderBytecode(File.ReadAllBytes("Content/DepthAndColorFloatVS.cso"));
depthAndColorVS = new VertexShader(device, shaderByteCode);
depthAndColorGS = new GeometryShader(device, new ShaderBytecode(File.ReadAllBytes("Content/DepthAndColorGS.cso")));
depthAndColorPS = new PixelShader(device, new ShaderBytecode(File.ReadAllBytes("Content/DepthAndColorPS.cso")));
// depth stencil state
var depthStencilStateDesc = new DepthStencilStateDescription()
{
IsDepthEnabled = true,
DepthWriteMask = DepthWriteMask.All,
DepthComparison = Comparison.LessEqual,
IsStencilEnabled = false,
};
depthStencilState = new DepthStencilState(device, depthStencilStateDesc);
// rasterizer state
var rasterizerStateDesc = new RasterizerStateDescription()
{
CullMode = CullMode.None,
FillMode = FillMode.Solid,
IsDepthClipEnabled = true,
IsFrontCounterClockwise = true,
IsMultisampleEnabled = true,
};
rasterizerState = new RasterizerState(device, rasterizerStateDesc);
// color sampler state
var colorSamplerStateDesc = new SamplerStateDescription()
{
Filter = Filter.MinMagMipLinear,
AddressU = TextureAddressMode.Border,
AddressV = TextureAddressMode.Border,
AddressW = TextureAddressMode.Border,
//BorderColor = new SharpDX.Color4(0.5f, 0.5f, 0.5f, 1.0f),
BorderColor = new SharpDX.Color4(0, 0, 0, 1.0f),
};
colorSamplerState = new SamplerState(device, colorSamplerStateDesc);
//// Kinect depth image
//var depthImageTextureDesc = new Texture2DDescription()
//{
// Width = depthImageWidth,
// Height = depthImageHeight,
// MipLevels = 1,
// ArraySize = 1,
// Format = SharpDX.DXGI.Format.R16_UInt, // R32_Float
// SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
// Usage = ResourceUsage.Dynamic,
// BindFlags = BindFlags.ShaderResource,
// CpuAccessFlags = CpuAccessFlags.Write,
//};
//depthImageTexture = new Texture2D(device, depthImageTextureDesc);
//depthImageTextureRV = new ShaderResourceView(device, depthImageTexture);
// filtered depth image
var filteredDepthImageTextureDesc = new Texture2DDescription()
{
Width = Kinect2Calibration.depthImageWidth * 3,
Height = Kinect2Calibration.depthImageHeight * 3,
MipLevels = 1,
ArraySize = 1,
Format = SharpDX.DXGI.Format.R32G32_Float,
SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
Usage = ResourceUsage.Default,
BindFlags = BindFlags.RenderTarget | BindFlags.ShaderResource,
CpuAccessFlags = CpuAccessFlags.None,
};
filteredDepthImageTexture = new Texture2D(device, filteredDepthImageTextureDesc);
filteredRenderTargetView = new RenderTargetView(device, filteredDepthImageTexture);
filteredDepthImageSRV = new ShaderResourceView(device, filteredDepthImageTexture);
filteredDepthImageTexture2 = new Texture2D(device, filteredDepthImageTextureDesc);
filteredRenderTargetView2 = new RenderTargetView(device, filteredDepthImageTexture2);
filteredDepthImageSRV2 = new ShaderResourceView(device, filteredDepthImageTexture2);
//// Kinect color image
//var colorImageStagingTextureDesc = new Texture2DDescription()
//{
// Width = colorImageWidth,
// Height = colorImageHeight,
// MipLevels = 1,
// ArraySize = 1,
// Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm,
// //Format = SharpDX.DXGI.Format.YUY2
// SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
// Usage = ResourceUsage.Dynamic,
// BindFlags = BindFlags.ShaderResource,
// CpuAccessFlags = CpuAccessFlags.Write
//};
//colorImageStagingTexture = new Texture2D(device, colorImageStagingTextureDesc);
//var colorImageTextureDesc = new Texture2DDescription()
//{
// Width = colorImageWidth,
// Height = colorImageHeight,
// MipLevels = 0,
// ArraySize = 1,
// Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm,
//.........这里部分代码省略.........
开发者ID:virrkharia, 项目名称:RoomAliveToolkit, 代码行数:101, 代码来源:DepthAndColorShader.cs
示例18: Initialize
public void Initialize()
{
LoadSky(0);
Texture2DDescription descTex = new Texture2DDescription();
descTex.ArraySize = 6;
descTex.Width = Size;
descTex.Height = Size;
descTex.Usage = ResourceUsage.Default;
descTex.CpuAccessFlags = CpuAccessFlags.None;
descTex.Format = SharpDX.DXGI.Format.R8G8B8A8_UNorm;
descTex.SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0);
descTex.MipLevels = MipLevel;
descTex.BindFlags = BindFlags.ShaderResource | BindFlags.RenderTarget;
descTex.OptionFlags = ResourceOptionFlags.GenerateMipMaps | ResourceOptionFlags.TextureCube;
//Create the texture and shader view
CubeTexture = new Texture2D(ModelViewer.Program.device, descTex);
CubeSRV = new ShaderResourceView(ModelViewer.Program.device, CubeTexture);
RenderTargetViewDescription RTVD = new RenderTargetViewDescription();
RTVD.Format = descTex.Format;
RTVD.Dimension = RenderTargetViewDimension.Texture2DArray;
RTVD.Texture2DArray.FirstArraySlice = 0;
RTVD.Texture2DArray.ArraySize = 1;
RTVD.Texture2DArray.MipSlice = 0;
CubeRenderTarget = new RenderTargetView[6];
for (int i = 0; i < 6; i++)
{
RTVD.Texture2DArray.FirstArraySlice = i;
CubeRenderTarget[i] = new RenderTargetView(ModelViewer.Program.device, CubeTexture, RTVD);
}
SamplerStateDescription a = new SamplerStateDescription();
a.AddressU = TextureAddressMode.Clamp;
a.AddressV = TextureAddressMode.Clamp;
a.AddressW = TextureAddressMode.Clamp;
a.Filter = Filter.MinMagMipLinear;
SSWrapMipLinear = new SamplerState(ModelViewer.Program.device, a);
MContains = new MeshContainer();
MContains.BytesPerVertex = 20;
MContains.FaceCount = 12;
MContains.VertexsCount = 24;
Vector3 vExtents = new Vector3(500, 500, 500);
var vertices = new DataStream(MContains.BytesPerVertex * MContains.VertexsCount, true, true);
//Back
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(1, 1));
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(1, 0));
vertices.Write(new Vector3(vExtents.X, vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 0));
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 1));
//Front
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 1));
vertices.Write(new Vector3(vExtents.X, vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 0));
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(0, 0));
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(0, 1));
//Bottom
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(0, 0));
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 1));
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(1, 1));
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 0));
//Top
vertices.Write(new Vector3(vExtents.X, vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 1));
vertices.Write(new Vector3(vExtents.X, vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(1, 0));
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 0));
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(0, 1));
//Left
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 0));
vertices.Write(new Vector3(-vExtents.X, vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 0));
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, vExtents.Z));
vertices.Write(new Vector2(0, 1));
vertices.Write(new Vector3(-vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(1, 1));
//Right
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, -vExtents.Z));
vertices.Write(new Vector2(0, 1));
vertices.Write(new Vector3(vExtents.X, -vExtents.Y, vExtents.Z));
//.........这里部分代码省略.........
开发者ID:MagistrAVSH, 项目名称:my-spacegame-engine, 代码行数:101, 代码来源:EESkyBox.cs
示例19: CreateSamplerState
public static D3D.SamplerState CreateSamplerState(this D3D.Device device, WrapMode wrapMode, InterpolationMode interpolationMode)
{
var desc = new D3D.SamplerStateDescription();
if (wrapMode.HasFlag(WrapMode.Tile))
{
desc.AddressU = D3D.TextureAddressMode.Wrap;
desc.AddressV = D3D.TextureAddressMode.Wrap;
}
else
{
desc.AddressU = D3D.TextureAddressMode.Clamp;
desc.AddressV = D3D.TextureAddressMode.Clamp;
}
if (wrapMode.HasFlag(WrapMode.MirrorX)) desc.AddressU = D3D.TextureAddressMode.Mirror;
if (wrapMode.HasFlag(WrapMode.MirrorY)) desc.AddressV = D3D.TextureAddressMode.Mirror;
desc.AddressW = D3D.TextureAddressMode.Clamp;
switch (interpolationMode)
{
case InterpolationMode.Linear:
desc.Filter = D3D.Filter.MinMagMipLinear;
break;
case InterpolationMode.Anisotropic:
desc.Filter = D3D.Filter.Anisotropic;
break;
default:
desc.Filter = D3D.Filter.MinLinearMagMipPoint;
break;
}
desc.ComparisonFunction = D3D.Comparison.Never;
desc.MaximumAnisotropy = 16;
desc.MinimumLod = 0;
desc.MaximumLod = float.MaxValue;
var samplerState = new D3D.SamplerState(device, desc);
return samplerState;
}
开发者ID:Artentus, 项目名称:GameUtils, 代码行数:39, 代码来源:HelperExtensions.cs
六六分期app的软件客服如何联系?不知道吗?加qq群【895510560】即可!标题:六六分期
阅读:18163| 2023-10-27
今天小编告诉大家如何处理win10系统火狐flash插件总是崩溃的问题,可能很多用户都不知
阅读:9639| 2022-11-06
今天小编告诉大家如何对win10系统删除桌面回收站图标进行设置,可能很多用户都不知道
阅读:8163| 2022-11-06
今天小编告诉大家如何对win10系统电脑设置节能降温的设置方法,想必大家都遇到过需要
阅读:8540| 2022-11-06
我们在使用xp系统的过程中,经常需要对xp系统无线网络安装向导设置进行设置,可能很多
阅读:8443| 2022-11-06
今天小编告诉大家如何处理win7系统玩cf老是与主机连接不稳定的问题,可能很多用户都不
阅读:9362| 2022-11-06
电脑对日常生活的重要性小编就不多说了,可是一旦碰到win7系统设置cf烟雾头的问题,很
阅读:8413| 2022-11-06
我们在日常使用电脑的时候,有的小伙伴们可能在打开应用的时候会遇见提示应用程序无法
阅读:7850| 2022-11-06
今天小编告诉大家如何对win7系统打开vcf文件进行设置,可能很多用户都不知道怎么对win
阅读:8396| 2022-11-06
今天小编告诉大家如何对win10系统s4开启USB调试模式进行设置,可能很多用户都不知道怎
阅读:7389| 2022-11-06
请发表评论