本文整理汇总了C#中EffectTechnique.GetPassByName方法的典型用法代码示例。如果您正苦于以下问题:C# EffectTechnique.GetPassByName方法的具体用法?C# EffectTechnique.GetPassByName怎么用?C# EffectTechnique.GetPassByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EffectTechnique
的用法示例。
在下文中一共展示了EffectTechnique.GetPassByName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadResources
public override void LoadResources()
{
if (m_Disposed == true)
{
m_TextFont.LoadResources();
//SlimDX.D3DCompiler.ShaderBytecode blob = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile(Helper.ResolvePath(m_ShaderLocation), "fx_4_0", SlimDX.D3DCompiler.ShaderFlags.EnableStrictness, SlimDX.D3DCompiler.EffectFlags.None);
m_Effect = new Effect(GameEnvironment.Device, Bytecode);
m_Technique = m_Effect.GetTechniqueByName("LinesAndBoxes");
m_Pass_BoxesAndText = m_Technique.GetPassByName("BoxesAndText");
m_Pass_Lines = m_Technique.GetPassByName("Lines");
m_Layout = new InputLayout(GameEnvironment.Device, m_Pass_Lines.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 12, 0),
new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 20, 0),
});
m_UiElementsTexture = m_Effect.GetVariableByName("UiElementsTexture").AsResource();
m_UiElementsTexture.SetResource(m_TextFont.TexureView);
m_Disposed = false;
}
}
示例2: 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;
}
}
示例3: 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;
}
}
示例4: LoadResources
public override void LoadResources()
{
if (m_Disposed == true)
{
m_Effect = new Effect(GameEnvironment.Device, Bytecode); // Helper.ResolvePath(m_ShaderLocation), "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
m_Technique = m_Effect.GetTechniqueByName("BlurBilinear");
m_Pass_Gaussian = m_Technique.GetPassByName("Gaussian");
m_SourceTex = m_Effect.GetVariableByName("g_SourceTex").AsResource();
m_GWeights = m_Effect.GetVariableByName("g_GWeights").AsScalar();
//m_ElementCount = 1 + GAUSSIAN_MAX_SAMPLES;
m_DataStride = Marshal.SizeOf(typeof(Vector2)) * (1 + GAUSSIAN_MAX_SAMPLES);
InputElement[] IADesc = new InputElement[1 + (GAUSSIAN_MAX_SAMPLES / 2)];
IADesc[0] = new InputElement()
{
SemanticName = "POSITION",
SemanticIndex = 0,
AlignedByteOffset = 0,
Slot = 0,
Classification = InputClassification.PerVertexData,
Format = Format.R32G32_Float
};
for (int i = 1; i < 1 + (GAUSSIAN_MAX_SAMPLES / 2); i++)
{
IADesc[i] = new InputElement()
{
SemanticName = "TEXCOORD",
SemanticIndex = i - 1,
AlignedByteOffset = 8 + (i - 1) * 16,
Slot = 0,
Classification = InputClassification.PerVertexData,
Format = Format.R32G32B32A32_Float
};
}
// Real number of "sematinc based" elements
//m_ElementCount = 1 + GAUSSIAN_MAX_SAMPLES / 2;
EffectPassDescription PassDesc = m_Pass_Gaussian.Description;
m_Layout = new InputLayout(GameEnvironment.Device, PassDesc.Signature, IADesc);
m_Disposed = false;
}
}
示例5: 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.Debug | ShaderFlags.EnableStrictness, EffectFlags.None, null, null);
m_Technique = m_Effect.GetTechniqueByName("Render");
m_Pass0 = m_Technique.GetPassByName("P0");
/*m_Layout = new InputLayout(GameEnvironment.Device, m_Pass0.Description.Signature, new[] {
new InputElement( "POSITION", 0, Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement( "NORMAL", 0, Format.R32G32B32_Float, 0, 12, InputClassification.PerVertexData, 0),
new InputElement( "TEXCOORD", 0, Format.R32G32_Float, 0, 24, InputClassification.PerVertexData, 0),
});*/
m_Layout = new InputLayout(GameEnvironment.Device, m_Pass0.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 24, 0)
});
//texColorMap
//texNormalMap
//texDiffuseMap
//texSpecularMap
//m_DiffuseVariable = m_Effect.GetVariableByName("g_txDiffuse").AsResource();
m_DiffuseVariable = m_Effect.GetVariableByName("texColorMap").AsResource();
m_NormalMapVariable = m_Effect.GetVariableByName("texNormalMap").AsResource();
m_WorldVariable = m_Effect.GetVariableByName("World").AsMatrix();
m_ViewVariable = m_Effect.GetVariableByName("View").AsMatrix();
m_InvViewVariable = m_Effect.GetVariableByName("InvView").AsMatrix();
m_ProjectionVariable = m_Effect.GetVariableByName("Projection").AsMatrix();
//m_SpecularMapVariable = m_Effect.GetVariableByName("g_txEnvMap").AsResource();
m_SpecularMapVariable = m_Effect.GetVariableByName("texSpecularMap").AsResource();
m_DiffuseMapVariable = m_Effect.GetVariableByName("texDiffuseMap").AsResource();
m_EyeVariable = m_Effect.GetVariableByName("Eye").AsVector();
m_Disposed = false;
}
}
示例6: LoadResources
public override void LoadResources()
{
if (m_Disposed == true)
{
#region Load Volume Effect
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);
RayStartTechnique = m_Effect.GetTechniqueByName("RayStart");
RayStartOutsidePass = RayStartTechnique.GetPassByName("Outside");
RayStartInsidePass = RayStartTechnique.GetPassByName("Inside");
VolumeLayout = new InputLayout(GameEnvironment.Device, RayStartOutsidePass.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
new InputElement("COLOR", 0, Format.R32G32B32_Float, 12, 0)
});
RayDirectionTechnique = m_Effect.GetTechniqueByName("RayDirection");
RayDirectionPass0 = RayDirectionTechnique.GetPassByIndex(0);
//RayDirectionPass1 = RayDirectionTechnique.GetPassByIndex(1);
BillboardTechnique = m_Effect.GetTechniqueByName("Final");
BillboardPass0 = BillboardTechnique.GetPassByIndex(0);
ImposterTechnique = m_Effect.GetTechniqueByName("Imposter");
ImposterPass0 = ImposterTechnique.GetPassByIndex(0);
BillboardLayout = new InputLayout(GameEnvironment.Device, BillboardPass0.Description.Signature, new[] {
new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0),
new InputElement("TEXCOORD", 0, Format.R32G32_Float, 8, 0)
});
rayStart_texture = m_Effect.GetVariableByName("rayStart_texture").AsResource();
rayDir_texture = m_Effect.GetVariableByName("rayDir_texture").AsResource();
imposter = m_Effect.GetVariableByName("imposter").AsResource();
volume_texture = m_Effect.GetVariableByName("volume_texture").AsResource();
LocationColor = m_Effect.GetVariableByName("locationColor").AsVector();
#endregion
#region Billboard Verts
float minX = -1f;
float miny = -1f;
float maxX = 1f;
float 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;
BillboardVertices = 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
});
}
BillboardVerticesBindings = new VertexBufferBinding(BillboardVertices, Marshal.SizeOf(typeof(UIVertex)), 0);
#endregion
m_Disposed = false;
}
}