本文整理汇总了C#中InputLayout类的典型用法代码示例。如果您正苦于以下问题:C# InputLayout类的具体用法?C# InputLayout怎么用?C# InputLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputLayout类属于命名空间,在下文中一共展示了InputLayout类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BasicEffect
/// <summary>
/// Crée une nouvelle instance de BasicEffect.
/// </summary>
public BasicEffect(Device device)
{
m_effect = Ressources.EffectCache.Get("Shaders\\basic_effect2.fx");
float Km = 0.0025f;
float Kr = 0.0015f;
float ESun = Planet.ESun;
float fOuterRadius = Planet.AtmosphereRadius; // 50
float fInnerRadius = Planet.PlanetRadius; // 44
float fScale = 1.0f / (fOuterRadius - fInnerRadius);
float fScaleDepth = Planet.ScaleDepth;
m_effect.GetVariableByName("v3InvWavelength").AsVector().Set(new Vector3(1.0f / (float)Math.Pow(0.650, 4),
1.0f / (float)Math.Pow(0.570f, 4),
1.0f / (float)Math.Pow(0.475f, 4)));
m_effect.GetVariableByName("fOuterRadius").AsScalar().Set(fOuterRadius);
m_effect.GetVariableByName("fOuterRadius2").AsScalar().Set(fOuterRadius * fOuterRadius);
m_effect.GetVariableByName("fInnerRadius").AsScalar().Set(fInnerRadius);
m_effect.GetVariableByName("fInnerRadius2").AsScalar().Set(fInnerRadius * fInnerRadius);
m_effect.GetVariableByName("fKrESun").AsScalar().Set(Kr * ESun);
m_effect.GetVariableByName("fKmESun").AsScalar().Set(Km * ESun);
m_effect.GetVariableByName("fKr4PI").AsScalar().Set(Kr * 4.0f * (float)Math.PI);
m_effect.GetVariableByName("fKm4PI").AsScalar().Set(Km * 4.0f * (float)Math.PI);
m_effect.GetVariableByName("fScaleDepth").AsScalar().Set(fScaleDepth);
m_effect.GetVariableByName("fInvScaleDepth").AsScalar().Set(1.0f / fScaleDepth);
m_effect.GetVariableByName("fScale").AsScalar().Set(fScale);
m_effect.GetVariableByName("fScaleOverScaleDepth").AsScalar().Set(fScale / fScaleDepth);
m_effect.GetVariableByName("xFar").AsScalar().Set(100f);
m_effect.GetVariableByName("xNear").AsScalar().Set(0.1f);
m_inputLayout = new InputLayout(
device,
m_effect.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature,
VertexPositionTextureNormal.LayoutElements);
m_device = device;
}
开发者ID:crissian,项目名称:planets,代码行数:38,代码来源:BasicEffect.cs
示例2: DrawBatch
public DrawBatch(Device device, Effect effect, IEnumerable<VertexBufferBinding> vertexBuffers, InputLayout inputLayout,
int vertexCount, int baseVertex)
: base(device, effect, vertexBuffers, inputLayout)
{
VertexCount = vertexCount;
BaseVertex = baseVertex;
}
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:7,代码来源:DrawBatch.cs
示例3: ObjRenderer
public ObjRenderer(Form1 F)
: base(F.Device)
{
P = F;
PortalRoomManager.Equals(null, null);
S = new Sorter();
string s0 = Environment.CurrentDirectory + "/resources/shaders/ambient_fast.fx";
SB_V = ShaderBytecode.CompileFromFile(s0, "VS_STATIC", "vs_4_0", ManagedSettings.ShaderCompileFlags, EffectFlags.None);
SB_P = ShaderBytecode.CompileFromFile(s0, "PS", "ps_4_0", ManagedSettings.ShaderCompileFlags, EffectFlags.None);
VS = new VertexShader(F.Device.HadrwareDevice(), SB_V);
PS = new PixelShader(F.Device.HadrwareDevice(), SB_P);
IL = new InputLayout(Device.HadrwareDevice(), SB_V, StaticVertex.ies);
BufferDescription desc = new BufferDescription
{
Usage = ResourceUsage.Default,
SizeInBytes = 2 * 64,
BindFlags = BindFlags.ConstantBuffer
};
cBuf = new SlimDX.Direct3D11.Buffer(Device.HadrwareDevice(), desc);
dS = new DataStream(2 * 64, true, true);
BufferDescription desc2 = new BufferDescription
{
Usage = ResourceUsage.Default,
SizeInBytes = 64,
BindFlags = BindFlags.ConstantBuffer
};
cBuf2 = new SlimDX.Direct3D11.Buffer(Device.HadrwareDevice(), desc2);
dS2 = new DataStream(64, true, true);
}
开发者ID:hhergeth,项目名称:RisenEditor,代码行数:30,代码来源:ObjRenderer.cs
示例4: LoadResources
public override void LoadResources()
{
if (m_Disposed == true)
{
m_Effect = m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Effect.FromFile(GameEnvironment.Device, Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
m_Technique = m_Effect.GetTechniqueByName("RenderParticles");
m_ParticlePass_Add = m_Technique.GetPassByName("Add");
m_Layout = new InputLayout(GameEnvironment.Device, m_ParticlePass_Add.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 16, 0),
new InputElement("INST_POSITION", 0, Format.R32G32B32_Float, 0, 1, InputClassification.PerInstanceData, 1),
new InputElement("INST_COLOR", 0, Format.R32G32B32A32_Float, 12, 1, InputClassification.PerInstanceData, 1),
});
m_WorldViewProj = m_Effect.GetVariableByName("worldViewProj").AsMatrix();
m_ParticleTexture = m_Effect.GetVariableByName("particle_texture").AsResource();
m_AmpScale = m_Effect.GetVariableByName("ampScale").AsScalar();
m_PartScaleX = m_Effect.GetVariableByName("partScaleX").AsScalar();
m_PartScaleY = m_Effect.GetVariableByName("partScaleY").AsScalar();
m_MaxDistance = m_Effect.GetVariableByName("maxDistance").AsScalar();
m_MinDistance = m_Effect.GetVariableByName("minDistance").AsScalar();
m_ScaleDistance = m_Effect.GetVariableByName("scaleDistance").AsScalar();
m_Disposed = false;
}
}
开发者ID:RugCode,项目名称:drg-pt,代码行数:27,代码来源:ParticleEffect.cs
示例5: OnResourceLoad
protected override void OnResourceLoad()
{
using (Texture2D texture = Texture2D.FromSwapChain<Texture2D>(Context10.SwapChain, 0))
{
renderTargetView = new RenderTargetView(Context10.Device, texture);
}
effect = Effect.FromFile(Context10.Device, "SimpleTriangle10.fx", "fx_4_0");
technique = effect.GetTechniqueByIndex(0);
pass = technique.GetPassByIndex(0);
ShaderSignature signature = pass.Description.Signature;
inputLayout = new InputLayout(Context10.Device, signature, new[] {
new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 0, 0),
new InputElement("COLOR", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 16, 0)
});
vertexBuffer = new Buffer(
Context10.Device,
3 * 32,
ResourceUsage.Dynamic,
BindFlags.VertexBuffer,
CpuAccessFlags.Write,
ResourceOptionFlags.None
);
DataStream stream = vertexBuffer.Map(MapMode.WriteDiscard, MapFlags.None);
stream.WriteRange(new[] {
new Vector4(0.0f, 0.5f, 0.5f, 1.0f), new Vector4(1.0f, 0.0f, 0.0f, 1.0f),
new Vector4(0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 1.0f, 0.0f, 1.0f),
new Vector4(-0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 0.0f, 1.0f, 1.0f)
});
vertexBuffer.Unmap();
}
开发者ID:zhandb,项目名称:slimdx,代码行数:34,代码来源:SimpleTriangleSample10.cs
示例6: RenderTechnique
public RenderTechnique(string name, Effect effect, InputLayout layout)
{
this.Name = name;
this.Device = effect.Device;
this.Effect = effect;
this.EffectTechnique = effect.GetTechniqueByName(this.Name);
this.InputLayout = layout;
}
开发者ID:dermeister0,项目名称:helix-toolkit,代码行数:8,代码来源:Effects.cs
示例7: MeshMaterialBinding
public MeshMaterialBinding(Device device, Material material, Mesh mesh)
{
mDevice = device;
mMesh = mesh;
mPass = material.GetFirstPass();
mInputLayout = new InputLayout(device, mPass.Description.Signature, mesh.GetInputElements());
}
开发者ID:Christof,项目名称:ionfish,代码行数:8,代码来源:MeshMaterialBinding.cs
示例8: SetLayout
protected override int SetLayout(Device device)
{
layout = new InputLayout(device, effect.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0),
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0)
});
return 16 * 2;
}
开发者ID:samuto,项目名称:HelloWorld,代码行数:8,代码来源:FXSimple.cs
示例9: LoadResources
public override void LoadResources()
{
if (m_Disposed == true)
{
m_Effect = m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Effect.FromFile(GameEnvironment.Device, Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
m_Technique = m_Effect.GetTechniqueByName("Imposter");
m_Pass_NoBlend = m_Technique.GetPassByName("NoBlend");
m_Pass_OverlayAdd = m_Technique.GetPassByName("OverlayAdd");
m_Pass_OverlaySubtract = m_Technique.GetPassByName("OverlaySubtract");
m_Pass_OverlayInvert = m_Technique.GetPassByName("OverlayInvert");
m_Pass_OverlayAlpha = m_Technique.GetPassByName("OverlayAlpha");
m_Technique_BrightPass = m_Effect.GetTechniqueByName("Imposter_BrightPass");
m_Pass_NoBlend_BrightPass = m_Technique_BrightPass.GetPassByName("NoBlend");
m_Pass_OverlayAdd_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAdd");
m_Pass_OverlaySubtract_BrightPass = m_Technique_BrightPass.GetPassByName("OverlaySubtract");
m_Pass_OverlayAlpha_BrightPass = m_Technique_BrightPass.GetPassByName("OverlayAlpha");
m_ImposterTextureResource = m_Effect.GetVariableByName("imposter").AsResource();
m_BrightPassThreshold = m_Effect.GetVariableByName("brightPassThreshold").AsScalar();
m_Layout = new InputLayout(GameEnvironment.Device, m_Pass_NoBlend.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 8, 0)
});
float minX = -1f, miny = -1f, maxX = 1f, maxY = 1f;
using (DataStream stream = new DataStream(4 * Marshal.SizeOf(typeof(Vertex2D)), true, true))
{
stream.WriteRange(new Vertex2D[] {
new Vertex2D() { Position = new Vector2(maxX, miny), TextureCoords = new Vector2(1.0f, 1.0f) },
new Vertex2D() { Position = new Vector2(minX, miny), TextureCoords = new Vector2(0.0f, 1.0f) },
new Vertex2D() { Position = new Vector2(maxX, maxY), TextureCoords = new Vector2(1.0f, 0.0f) },
new Vertex2D() { Position = new Vector2(minX, maxY), TextureCoords = new Vector2(0.0f, 0.0f) }
});
stream.Position = 0;
m_Vertices = new SlimDX.Direct3D11.Buffer(GameEnvironment.Device, stream, new BufferDescription()
{
BindFlags = BindFlags.VertexBuffer,
CpuAccessFlags = CpuAccessFlags.None,
OptionFlags = ResourceOptionFlags.None,
SizeInBytes = 4 * Marshal.SizeOf(typeof(Vertex2D)),
Usage = ResourceUsage.Default
});
}
m_VerticesBindings = new VertexBufferBinding(m_Vertices, Marshal.SizeOf(typeof(Vertex2D)), 0);
m_Disposed = false;
}
}
开发者ID:RugCode,项目名称:drg-pt,代码行数:56,代码来源:ImposterFloatEffect.cs
示例10: DrawIndexedBatch
public DrawIndexedBatch(Device device, Effect effect, IEnumerable<VertexBufferBinding> vertexBuffers, InputLayout inputLayout,
Buffer indexBuffer, Format indexBufferFormat,
int indexCount, int startIndex, int baseVertex)
: base(device, effect, vertexBuffers, inputLayout)
{
IndexBuffer = indexBuffer;
IndexBufferFormat = indexBufferFormat;
IndexCount = indexCount;
StartIndex = startIndex;
BaseVertex = baseVertex;
}
开发者ID:TheProjecter,项目名称:romantiquex,代码行数:11,代码来源:DrawIndexedBatch.cs
示例11: GeometryInputShaderBinding
public GeometryInputShaderBinding(GeometryMesh geometryMesh, VertexShader10 vertexShader, PixelShader10 pixelShader)
{
m_geometryMesh = geometryMesh;
m_pixelShader = pixelShader;
m_vertexShader = vertexShader;
/* Create the D3D input layout for the GPU */
m_inputLayout = new InputLayout(geometryMesh.InternalDevice,
vertexShader.InternalShaderByteCode,
geometryMesh.GetInputElements());
}
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:11,代码来源:GeometryInputShaderBinding.cs
示例12: SetLayout
protected override int SetLayout(Device device)
{
layout = new InputLayout(device, effect.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), //16
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0), //16
new InputElement("NORMAL", 0, Format.R32G32B32_Float, 32, 0), //12
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 44, 0), //8
new InputElement("PSIZE", 0, Format.R32_Float, 52, 0), //4
});
return 56;
}
开发者ID:samuto,项目名称:HelloWorld,代码行数:11,代码来源:FXTiles.cs
示例13: ShaderBase
/// <summary>
/// Initializes a new instance of the <see cref="ShaderBase" /> class.
/// </summary>
/// <param name="device">The device.</param>
/// <param name="vertexShaderPath">The vertex shader file path.</param>
/// <param name="pixelShaderPath">The pixel shader file path.</param>
protected ShaderBase(Device device, string vertexShaderPath, string pixelShaderPath, IInputLayoutProvider inputLayoutMaker)
{
ShaderSignature inputSignature;
using (ShaderBytecode bytecode = ShaderBytecode.CompileFromFile(vertexShaderPath, "VShader", "vs_4_0", ShaderFlags.None, EffectFlags.None))
{
vertexShader = new VertexShader(device, bytecode);
inputSignature = ShaderSignature.GetInputSignature(bytecode);
}
using (ShaderBytecode bytecode = ShaderBytecode.CompileFromFile(pixelShaderPath, "PShader", "ps_4_0", ShaderFlags.None, EffectFlags.None))
pixelShader = new PixelShader(device, bytecode);
inputLayout = inputLayoutMaker.MakeInputLayout(device, inputSignature);
}
开发者ID:nickudell,项目名称:PigmentFramework,代码行数:18,代码来源:ShaderBase.cs
示例14: DebugRenderer
public DebugRenderer( SlimDX.Direct3D11.Device device )
{
mEffect = EffectUtil.CompileEffect( device, @"Shaders\DebugRenderer.fx" );
var positionInputElements = new[]
{
new InputElement( "POSITION", 0, POSITION_FORMAT, POSITION_SLOT )
};
var positionTexcoordInputElements = new[]
{
new InputElement( "POSITION", 0, POSITION_FORMAT, POSITION_SLOT ),
new InputElement( "TEXCOORD", 0, TEXCOORD_FORMAT, TEXCOORD_SLOT )
};
EffectTechnique effectTechnique;
effectTechnique = mEffect.GetTechniqueByName( "RenderWireframe" );
mRenderWireframePass = effectTechnique.GetPassByName( "RenderWireframe" );
effectTechnique = mEffect.GetTechniqueByName( "RenderSolid" );
mRenderSolidPass = effectTechnique.GetPassByName( "RenderSolid" );
effectTechnique = mEffect.GetTechniqueByName( "RenderTexture3D" );
mRenderTexture3DPass = effectTechnique.GetPassByName( "RenderTexture3D" );
effectTechnique = mEffect.GetTechniqueByName( "RenderGreyScaleTexture3D" );
mRenderGreyScaleTexture3DPass = effectTechnique.GetPassByName( "RenderGreyScaleTexture3D" );
mRenderWireframeInputLayout = new InputLayout( device, mRenderWireframePass.Description.Signature, positionInputElements );
mRenderSolidInputLayout = new InputLayout( device, mRenderSolidPass.Description.Signature, positionInputElements );
mRenderTexture3DInputLayout = new InputLayout( device, mRenderTexture3DPass.Description.Signature, positionTexcoordInputElements );
mRenderGreyScaleTexture3DInputLayout = new InputLayout( device, mRenderGreyScaleTexture3DPass.Description.Signature, positionTexcoordInputElements );
mPositionVertexBuffer = new SlimDX.Direct3D11.Buffer( device,
null,
NUM_VERTICES * POSITION_NUM_COMPONENTS_PER_VERTEX * POSITION_NUM_BYTES_PER_COMPONENT,
ResourceUsage.Dynamic,
BindFlags.VertexBuffer,
CpuAccessFlags.Write,
ResourceOptionFlags.None,
0 );
mTexCoordVertexBuffer = new SlimDX.Direct3D11.Buffer( device,
null,
NUM_VERTICES * TEXCOORD_NUM_COMPONENTS_PER_VERTEX * TEXCOORD_NUM_BYTES_PER_COMPONENT,
ResourceUsage.Dynamic,
BindFlags.VertexBuffer,
CpuAccessFlags.Write,
ResourceOptionFlags.None,
0 );
}
开发者ID:Rhoana,项目名称:Mojo,代码行数:52,代码来源:DebugRenderer.cs
示例15: ValidateLayout
public bool ValidateLayout(EffectPass pass, out InputLayout layout)
{
layout = null;
try
{
layout = new InputLayout(context.Device, pass.Description.Signature, this.InputLayout);
return true;
}
catch
{
return false;
}
}
开发者ID:kopffarben,项目名称:FeralTic,代码行数:13,代码来源:DX11BaseGeometry.cs
示例16: RenderCommand
public RenderCommand(Renderer renderer, IMaterial material, RenderableCollection sceneNodeCollection)
: base(CommandType.Render)
{
Contract.Requires<NullReferenceException>(renderer != null);
Contract.Requires<NullReferenceException>(material != null);
CommandAttributes |= CommandAttributes.MonoRendering;
Renderer = renderer;
Items = sceneNodeCollection;
Material = material;
Technique = Material.EffectDescription.Technique;
Pass = Technique.GetPassByIndex(Material.EffectDescription.Pass);
InputLayout = new InputLayout(Game.Context.Device, Pass.Description.Signature, Items.Description.InputElements);
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:13,代码来源:RenderCommand.cs
示例17: Draw
internal override void Draw(SlimDX.Direct3D11.DeviceContext context)
{
Effect effect;
using (ShaderBytecode byteCode = ShaderBytecode.CompileFromFile("Graphics/Effects/default.fx", "bidon", "fx_5_0", ShaderFlags.OptimizationLevel3, EffectFlags.None))
{
effect = new Effect(context.Device, byteCode);
}
var technique = effect.GetTechniqueByIndex(1);
var pass = technique.GetPassByIndex(0);
InputLayout inputLayout = new InputLayout(context.Device, pass.Description.Signature, new[] {
new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0),
new InputElement("COLOR", 0, SlimDX.DXGI.Format.R8G8B8A8_UNorm, InputElement.AppendAligned, 0)
});
DataStream vertices = new DataStream((Vector3.SizeInBytes + 4) * 6, true, true);
vertices.Write(new ColoredVertex(new Vector3(1.0f, 1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Write(new ColoredVertex(new Vector3(-1.0f, 1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Write(new ColoredVertex(new Vector3(-1.0f, -1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Write(new ColoredVertex(new Vector3(-1.0f, -1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Write(new ColoredVertex(new Vector3(1.0f, 1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Write(new ColoredVertex(new Vector3(1.0f, -1.0f, 0.0f), new Color4(1.0f, 0.0f, 0.0f, 0.0f).ToArgb()));
vertices.Position = 0;
BufferDescription bd = new BufferDescription()
{
Usage = ResourceUsage.Default,
SizeInBytes = 16 * 6,
BindFlags = BindFlags.VertexBuffer,
CpuAccessFlags = CpuAccessFlags.None
};
var vertexBuffer = new SlimDX.Direct3D11.Buffer(context.Device, vertices, bd);
context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertexBuffer, 16, 0));
//context.InputAssembler.SetIndexBuffer(indices, Format.R16_UInt, 0);
/* scale * rotation * translation */
Matrix worldMatrix = Matrix.Scaling(Scale) * Matrix.RotationYawPitchRoll(Rotation.Y, Rotation.X, Rotation.Z) * Matrix.Translation(Position);
Matrix viewMatrix = Camera.ViewMatrix;
Matrix projectionMatrix = Camera.ProjectionMatrix;
effect.GetVariableByName("finalMatrix").AsMatrix().SetMatrix(worldMatrix * viewMatrix * projectionMatrix);
context.InputAssembler.InputLayout = inputLayout;
context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip;
pass.Apply(context);
context.Draw(6, 0);
}
开发者ID:eldernos,项目名称:SlimDXEngine,代码行数:51,代码来源:Rectangle.cs
示例18: UserInterfaceRenderCommand
public UserInterfaceRenderCommand(Renderer renderer, Hud hud, RenderableNode rNode)
: base(renderer, new UIMaterial(),
new RenderableCollection(UIMaterial.ItemsDescription, new [] {rNode}))
{
CommandType = CommandType.UserInterfaceRenderCommand;
CommandAttributes |= Graphics.CommandAttributes.MonoRendering;
this.hud = hud;
textMaterial = new TextMaterial();
this.rNode = rNode;
this.rNode.RenderableObject.Material = Material;
tNode = (TransformNode)rNode.Parent;
UpdateSprites(hud.SpriteControls);
textTechnique = textMaterial.EffectDescription.Technique;
textPass = textTechnique.GetPassByIndex(textMaterial.EffectDescription.Pass);
textLayout = new InputLayout(Game.Context.Device, textPass.Description.Signature,
TextItems.Description.InputElements);
}
开发者ID:yong-ja,项目名称:starodyssey,代码行数:17,代码来源:UserInterfaceRenderCommand.cs
示例19: DefaultRenderer
public DefaultRenderer(Device graphicsDevice, Camera camera, VoxelMeshContainer container)
{
this.graphicsDevice = graphicsDevice;
this.camera = camera;
this.container = container;
#if DEBUG
shader = new Effect(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\VoxelMesh.hlsl", "fx_5_0", ShaderFlags.Debug, EffectFlags.None));
#else
shader = new Effect(graphicsDevice, ShaderPrecompiler.PrecompileOrLoad(@"Shaders\VoxelMesh.hlsl", "fx_5_0", ShaderFlags.None, EffectFlags.None));
#endif
layout = new InputLayout(graphicsDevice, shader.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature, new[]
{
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0, InputClassification.PerVertexData, 0),
new InputElement("AMBIENT", 0, Format.R32_Float, 24, 0, InputClassification.PerVertexData, 0)
});
}
开发者ID:barograf,项目名称:VoxelTerrain,代码行数:19,代码来源:DefaultRenderer.cs
示例20: AdjustSegmentationRenderingStrategy
public AdjustSegmentationRenderingStrategy( SlimDX.Direct3D11.Device device, DeviceContext deviceContext, TileManager tileManager )
{
mTileManager = tileManager;
mDebugRenderer = new DebugRenderer( device );
mEffect = EffectUtil.CompileEffect( device, @"Shaders\AdjustRenderer2D.fx" );
var positionTexcoordInputElements = new[]
{
new InputElement( "POSITION", 0, POSITION_FORMAT, POSITION_SLOT ),
new InputElement( "TEXCOORD", 0, TEXCOORD_FORMAT, TEXCOORD_SLOT )
};
EffectTechnique effectTechnique = mEffect.GetTechniqueByName( "TileManager2D" );
mPass = effectTechnique.GetPassByName( "TileManager2D" );
mInputLayout = new InputLayout( device, mPass.Description.Signature, positionTexcoordInputElements );
mPositionVertexBuffer = new Buffer( device,
null,
QUAD_NUM_VERTICES * POSITION_NUM_COMPONENTS_PER_VERTEX * POSITION_NUM_BYTES_PER_COMPONENT,
ResourceUsage.Dynamic,
BindFlags.VertexBuffer,
CpuAccessFlags.Write,
ResourceOptionFlags.None,
0 );
mTexCoordVertexBuffer = new Buffer( device,
null,
QUAD_NUM_VERTICES * TEXCOORD_NUM_COMPONENTS_PER_VERTEX * TEXCOORD_NUM_BYTES_PER_COMPONENT,
ResourceUsage.Dynamic,
BindFlags.VertexBuffer,
CpuAccessFlags.Write,
ResourceOptionFlags.None,
0 );
//bool result;
//mTinyTextContext = new Context( device, deviceContext, Constants.MAX_NUM_TINY_TEXT_CHARACTERS, out result );
//Release.Assert( result );
mStopwatch.Start();
}
开发者ID:Rhoana,项目名称:Mojo,代码行数:42,代码来源:AdjustSegmentationRenderingStrategy.cs
注:本文中的InputLayout类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论