本文整理汇总了C#中Effect.GetTechniqueByName方法的典型用法代码示例。如果您正苦于以下问题:C# Effect.GetTechniqueByName方法的具体用法?C# Effect.GetTechniqueByName怎么用?C# Effect.GetTechniqueByName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Effect
的用法示例。
在下文中一共展示了Effect.GetTechniqueByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: 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 );
}
示例3: 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;
}
}
示例4: RenderModel
void RenderModel(Graphics.Content.Model10 model, SlimDX.Matrix entityWorld, Effect effect)
{
throw new NotImplementedException();
//if (model == null || !model.Visible || model.Mesh == null) return;
Matrix world = model.World * entityWorld;
world.M41 = (float)((int)world.M41);
world.M42 = (float)((int)world.M42);
world *= Matrix.Scaling(2f / (float)view.Viewport.Width, 2f / (float)view.Viewport.Height, 1) * Matrix.Translation(-1, -1, 0) * Matrix.Scaling(1, -1, 1);
world.M43 = 0.5f;
effect.GetVariableByName("World").AsMatrix().SetMatrix(world);
effect.GetVariableByName("Texture").AsResource().SetResource(model.TextureShaderView);
effect.GetTechniqueByName("Render").GetPassByIndex(0).Apply();
if (model.Mesh != null)
{
model.Mesh.Setup(view.Device10, view.Content.Acquire<InputLayout>(
new Content.VertexStreamLayoutFromEffect
{
Signature10 = effect.GetTechniqueByIndex(0).GetPassByIndex(0).Description.Signature,
Layout = model.Mesh.VertexStreamLayout
}));
model.Mesh.Draw(device);
}
}
示例5: VisualEffect
protected VisualEffect(IServiceProvider services, string effectAsset,
int effectLayerCount, IEnumerable<RenderTargetLayerType> requiredRenderTargets)
{
if (services == null)
throw new ArgumentNullException("services");
if (effectAsset == null)
throw new ArgumentNullException("effectAsset");
if (requiredRenderTargets == null)
throw new ArgumentNullException("requiredRenderTargets");
if (effectLayerCount < 0)
throw new ArgumentOutOfRangeException("affectedLayers", "Parameter should have non-negative value.");
renderer = (Renderer)services.GetService(typeof(Renderer));
resourceManager = (ResourceManager)services.GetService(typeof(ResourceManager));
this.requiredRenderTargets = requiredRenderTargets;
this.effectLayerCount = effectLayerCount > 0 ? effectLayerCount : renderer.KBufferManager.Configuration.LayerCount;
effect = resourceManager.Load<Effect>(effectAsset);
effectTechnique = effect.GetTechniqueByName(VisualEffectTechniqueName);
if (!effectTechnique.IsValid)
throw new ArgumentException(
string.Format("Given effect asset '{0}' does not contain technique {1}.", effectAsset, VisualEffectTechniqueName),
"effectAsset");
}
示例6: 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;
}
}
示例7: 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;
}
示例8: Visualizer
public Visualizer( D3D10Wrapper d3d, EffectManager effectManager )
{
rootItemTree = new ItemTree( "root" );
this.d3d = d3d;
streamState = new VisualizerStreamState();
textureVertexBuffer = new DynamicVertexBuffer( VertexPosition4fColor4f.SizeInBytes, 6 );
var stream = textureVertexBuffer.MapForWriteDiscard();
stream.Write( new Vector4f( 0, 0, 0, 1 ) );
stream.Write( new Vector4f( 0, 1, 0, 1 ) );
stream.Write( new Vector4f( 1, 0, 0, 1 ) );
stream.Write( new Vector4f( 1, 1, 0, 1 ) );
stream.Write( new Vector4f( 0, 1, 0, 1 ) );
stream.Write( new Vector4f( 0, 0, 0, 1 ) );
stream.Write( new Vector4f( 0, 1, 0, 1 ) );
stream.Write( new Vector4f( 0, 0, 0, 1 ) );
stream.Write( new Vector4f( 1, 0, 0, 1 ) );
stream.Write( new Vector4f( 1, 1, 0, 1 ) );
stream.Write( new Vector4f( 1, 1, 0, 1 ) );
stream.Write( new Vector4f( 1, 0, 0, 1 ) );
textureVertexBuffer.Unmap();
effect = effectManager[ "visualizer.fx" ];
opaquePass = effectManager[ "visualizer.fx", "renderOpaque", "p0" ];
opaquePassLayout = new InputLayout( d3d.Device, opaquePass.Description.Signature, VertexPosition4fColor4f.InputElements );
alphaPass = effectManager[ "visualizer.fx", "renderAlpha", "p0" ];
alphaPassLayout = new InputLayout( d3d.Device, alphaPass.Description.Signature, VertexPosition4fColor4f.InputElements );
additivePass = effectManager[ "visualizer.fx", "renderAdditive", "p0" ];
additivePassLayout = new InputLayout( d3d.Device, additivePass.Description.Signature, VertexPosition4fColor4f.InputElements );
opaqueTexturePass = effect.GetTechniqueByName( "renderTexOpaque" ).GetPassByName( "p0" );
opaqueTexturePassLayout = new InputLayout( d3d.Device, opaqueTexturePass.Description.Signature, VertexPosition4fTexture4f.InputElements );
alphaTexturePass = effect.GetTechniqueByName( "renderTexAlpha" ).GetPassByName( "p0" );
alphaTexturePassLayout = new InputLayout( d3d.Device, alphaTexturePass.Description.Signature, VertexPosition4fTexture4f.InputElements );
}
示例9: Blender
protected Blender(IServiceProvider services, string effectAsset)
{
if (services == null)
throw new ArgumentNullException("services");
if (effectAsset == null)
throw new ArgumentNullException("effectAsset");
resourceManager = (ResourceManager) services.GetService(typeof (ResourceManager));
renderer = (Renderer) services.GetService(typeof (Renderer));
effect = resourceManager.Load<Effect>(effectAsset);
effectTechnique = effect.GetTechniqueByName(BlenderTechniqueName);
}
示例10: 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;
}
}
示例11: 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();
}
示例12: 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;
}
}
示例13: TestEffect
/// <summary>
/// Create our test RenderEffect.
/// </summary>
/// <param name="Device"></param>
public TestEffect(Device Device)
{
this.Device = Device;
ImmediateContext = Device.ImmediateContext;
// Compile our shader...
string compileErrors;
var compiledShader = SlimDX.D3DCompiler.ShaderBytecode.CompileFromFile
(
"../../Effects/TestEffect/TestEffect.fx",
null,
"fx_5_0",
SlimDX.D3DCompiler.ShaderFlags.None,
SlimDX.D3DCompiler.EffectFlags.None,
null,
null,
out compileErrors
);
if (compileErrors != null && compileErrors != "")
{
throw new EffectBuildException(compileErrors);
}
Effect = new Effect(Device, compiledShader);
EffectTechnique = Effect.GetTechniqueByName("TestTechnique");
var vertexDesc = new[]
{
new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32_Float, 0, 0, InputClassification.PerVertexData, 0),
new InputElement("COLOR", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 12, 0, InputClassification.PerVertexData, 0)
};
WorldViewProj = SlimDX.Matrix.Identity;
CPO_WorldViewProj = Effect.GetVariableByName("gWorldViewProj").AsMatrix();
InputLayout = new InputLayout(Device, EffectTechnique.GetPassByIndex(0).Description.Signature, vertexDesc);
Util.ReleaseCom(ref compiledShader);
}
示例14: Initialize
public void Initialize(Device device) {
_b = EffectUtils.Load("DeferredGObject");
E = new Effect(device, _b);
TechStandardDeferred = E.GetTechniqueByName("StandardDeferred");
TechStandardForward = E.GetTechniqueByName("StandardForward");
TechAmbientShadowDeferred = E.GetTechniqueByName("AmbientShadowDeferred");
TechTransparentDeferred = E.GetTechniqueByName("TransparentDeferred");
TechTransparentForward = E.GetTechniqueByName("TransparentForward");
TechTransparentMask = E.GetTechniqueByName("TransparentMask");
for (var i = 0; i < TechStandardDeferred.Description.PassCount && InputSignaturePNTG == null; i++) {
InputSignaturePNTG = TechStandardDeferred.GetPassByIndex(i).Description.Signature;
}
if (InputSignaturePNTG == null) throw new System.Exception("input signature (DeferredGObject, PNTG, StandardDeferred) == null");
LayoutPNTG = new InputLayout(device, InputSignaturePNTG, InputLayouts.VerticePNTG.InputElementsValue);
for (var i = 0; i < TechAmbientShadowDeferred.Description.PassCount && InputSignaturePT == null; i++) {
InputSignaturePT = TechAmbientShadowDeferred.GetPassByIndex(i).Description.Signature;
}
if (InputSignaturePT == null) throw new System.Exception("input signature (DeferredGObject, PT, AmbientShadowDeferred) == null");
LayoutPT = new InputLayout(device, InputSignaturePT, InputLayouts.VerticePT.InputElementsValue);
FxWorld = E.GetVariableByName("gWorld").AsMatrix();
FxWorldInvTranspose = E.GetVariableByName("gWorldInvTranspose").AsMatrix();
FxWorldViewProj = E.GetVariableByName("gWorldViewProj").AsMatrix();
FxDiffuseMap = E.GetVariableByName("gDiffuseMap").AsResource();
FxNormalMap = E.GetVariableByName("gNormalMap").AsResource();
FxMapsMap = E.GetVariableByName("gMapsMap").AsResource();
FxDetailsMap = E.GetVariableByName("gDetailsMap").AsResource();
FxDetailsNormalMap = E.GetVariableByName("gDetailsNormalMap").AsResource();
FxReflectionCubemap = E.GetVariableByName("gReflectionCubemap").AsResource();
FxEyePosW = E.GetVariableByName("gEyePosW").AsVector();
FxAmbientDown = E.GetVariableByName("gAmbientDown").AsVector();
FxAmbientRange = E.GetVariableByName("gAmbientRange").AsVector();
FxLightColor = E.GetVariableByName("gLightColor").AsVector();
FxDirectionalLightDirection = E.GetVariableByName("gDirectionalLightDirection").AsVector();
FxMaterial = E.GetVariableByName("gMaterial");
}
示例15: LoadEffect
private void LoadEffect(string shaderFileName = @"Assets\light.fx")
{
_effect = Effect.FromFile(_dxDevice, shaderFileName, "fx_4_0", ShaderFlags.None, EffectFlags.None, null, null);
_technique = _effect.GetTechniqueByName("Render"); //C++ Comparaison// technique = effect->GetTechniqueByName( "Render" );
_effectPass = _technique.GetPassByIndex(0);
ShaderSignature signature = _effectPass.Description.Signature;
_inputLayout = new InputLayout(_dxDevice, signature,
new[] {
new InputElement("POSITION", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 0, 0),
new InputElement("NORMAL", 0, SlimDX.DXGI.Format.R32G32B32A32_Float, 16, 0),
new InputElement("TEXCOORD", 0, SlimDX.DXGI.Format.R32G32_Float, 32, 0)
});
}