本文整理汇总了C#中InputElement类的典型用法代码示例。如果您正苦于以下问题:C# InputElement类的具体用法?C# InputElement怎么用?C# InputElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputElement类属于命名空间,在下文中一共展示了InputElement类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetStreamOutputLayout
public static InputElement[] GetStreamOutputLayout(this EffectPass pass, out int vertexsize)
{
vertexsize = 0;
if (pass.GeometryShaderDescription.Variable == null)
{
return new InputElement[0];
}
else
{
EffectShaderVariable gs = pass.GeometryShaderDescription.Variable;
int outputcount = gs.GetShaderDescription(0).OutputParameterCount;
InputElement[] elems = new InputElement[outputcount];
int offset = 0;
for (int vip = 0; vip < outputcount; vip++)
{
ShaderParameterDescription sd = gs.GetOutputParameterDescription(0, vip);
int componentcount = 0;
if (sd.UsageMask.HasFlag(RegisterComponentMaskFlags.ComponentX)) { componentcount++; }
if (sd.UsageMask.HasFlag(RegisterComponentMaskFlags.ComponentY)) { componentcount++; }
if (sd.UsageMask.HasFlag(RegisterComponentMaskFlags.ComponentZ)) { componentcount++; }
if (sd.UsageMask.HasFlag(RegisterComponentMaskFlags.ComponentW)) { componentcount++; }
int vsize = 4 * componentcount;
string fmt = "";
if (componentcount == 1) { fmt = "R32_"; }
if (componentcount == 2) { fmt = "R32G32_"; }
if (componentcount == 3) { fmt = "R32G32B32_"; }
if (componentcount == 4) { fmt = "R32G32B32A32_"; }
switch (sd.ComponentType)
{
case RegisterComponentType.Float32:
fmt += "Float";
break;
case RegisterComponentType.SInt32:
fmt += "SInt";
break;
case RegisterComponentType.UInt32:
fmt += "UInt";
break;
}
Format f = (Format)Enum.Parse(typeof(Format), fmt);
InputElement elem = new InputElement(sd.SemanticName, (int)sd.SemanticIndex, f, offset, 0);
elems[vip] = elem;
offset += vsize;
vertexsize += vsize;
}
return elems;
}
}
示例2: Evaluate
public void Evaluate(int SpreadMax)
{
if (this.FInLayoutType.IsChanged || this.FInFormat.IsChanged || this.FAutoIndex.IsChanged)
{
this.FOutput.SliceCount = SpreadMax;
int offset = 0;
InputElement[] elements = new InputElement[SpreadMax];
for (int i = 0; i < SpreadMax; i++)
{
Format fmt= (Format)Enum.Parse(typeof(Format), this.FInFormat[i].Name);
elements[i] = InputLayoutFactory.GetInputElement(this.FInLayoutType[i],fmt,0,offset);
offset += FormatHelper.Instance.GetSize(fmt);
}
if (this.FAutoIndex[0])
{
InputLayoutFactory.AutoIndex(elements);
}
this.FOutput.AssignFrom(elements);
}
}
示例3: CreateInputElements
/// <summary>
/// Creates the input elements that describe the vertices to the GPU
/// </summary>
private static InputElement[] CreateInputElements()
{
var layoutInstanced = new InputElement[2];
layoutInstanced[0] = new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0, InputClassification.PerVertexData, 0);
layoutInstanced[1] = new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0);
return layoutInstanced;
}
示例4: WatermarkExtender
public WatermarkExtender(InputElement el, string watermark)
{
this.el = el;
this.watermark = watermark;
DomEvent.AddHandler(el, "focus", OnFocus);
DomEvent.AddHandler(el, "blur", OnBlur);
((Dictionary)(object)el)["readOnly"] = null;
}
示例5: MultiSelectorBehaviour
public MultiSelectorBehaviour(DOMElement container, HtmlAutoCompleteBehaviour htmlAutoComplete, InputElement hiddenOutput)
{
this.container = container;
this.hiddenOutput = hiddenOutput;
this.HtmlAutoComplete = htmlAutoComplete;
this.HtmlAutoComplete.ItemChosen = htmlAutoComplete_ItemChosen;
selections = new PairListField(hiddenOutput);
InitialiseInitialSelections();
DomEvent.AddHandler(this.container, "click", this.OnClick);
}
示例6: WhenLoggedInButtonNoValidation
public static bool WhenLoggedInButtonNoValidation(InputElement element)
{
PageImplementation.WhenLoggedIn(
new Action(
delegate()
{
Script.Eval("__doPostBack(\"" + element.ID.Replace(new RegularExpression("_", "g"), "$") + "\",'');");
}
)
);
return false;
}
示例7: WhenLoggedInButtonValidator
public static bool WhenLoggedInButtonValidator(InputElement element, string validators)
{
PageImplementation.WhenLoggedIn(
new Action(
delegate()
{
Script.Eval("WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(\"" + element.ID.Replace(new RegularExpression("_", "g"), "$") + "\", \"\", true, \"" + validators + "\", \"\", false, true));");
}
)
);
return false;
}
示例8: 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;
}
}
示例9: BaseInput
public BaseInput(InputElement input, SelectorElement selector, EventQueue queue)
: base()
{
InputName = input.Name;
InputType = input.Type;
SelectorName = selector.Name;
Processor = selector.Processor;
switch (selector.Login)
{
case "success": Login = LoginStatus.SUCCESS; break;
case "failure": Login = LoginStatus.FAILURE; break;
default: Login = LoginStatus.UNKNOWN; break;
}
equeue = queue;
}
示例10: ChatElement
/// <summary>
/// Creates a new Chat for the given Game.
/// </summary>
/// <param name="game">The current Game object.</param>
public ChatElement(Game game)
: base(game, "chat", (int)(game.GraphicsDevice.Viewport.Width * (3 / 4.0)), (Player.Instance.NumberOfPlayers - 1) * 100, game.GraphicsDevice.Viewport.Width / 4, game.GraphicsDevice.Viewport.Height - (Player.Instance.NumberOfPlayers - 1) * 100)
{
InputElement input = new InputElement(game, "chatInput", Bound.X + 10, Bound.Y + Bound.Height - 40, Bound.Width - 18, 30);
AddChild(input);
messages = new LinkedList<string>();
AddDrawable(this.Name, new Image(game.Content.Load<Texture2D>("chatbg")),
new Rectangle(Bound.X, Bound.Y + Bound.Height - 50, Bound.Width, 50));
// external events
manager.ChatMessageEvent += new ChatMessageHandler(GetMessage);
manager.GiveEquipmentEvent += new GiveEquipmentHandler(GiveEquipment);
this.SetDrawBackground(true);
this.SetBackground("chatbg");
}
示例11: BindInputLayout
private InputElement[] BindInputLayout(out int vertexsize)
{
InputElement[] inputlayout = new InputElement[this.FInLayout.SliceCount];
vertexsize = 0;
for (int i = 0; i < this.FInLayout.SliceCount; i++)
{
if (this.FInLayout.PluginIO.IsConnected && this.FInLayout[i] != null)
{
inputlayout[i] = this.FInLayout[i];
}
else
{
//Set deault, can do better here
inputlayout[i] = new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0);
}
vertexsize += FormatHelper.Instance.GetSize(inputlayout[i].Format);
}
InputLayoutFactory.AutoIndex(inputlayout);
return inputlayout;
}
示例12: GetInputElements
public InputElement[] GetInputElements()
{
InputElement [] ret = new InputElement[]
{
new InputElement("POSITION",0,Format.R32G32B32_Float,0,0),
new InputElement("NORMAL",0,Format.R32G32B32A32_Float,16,0),
new InputElement("COLOR",0,Format.R32G32B32A32_Float,32,0)
};
return ret;
}
示例13: CreateInputElements
/// <summary>
/// Creates the input elements that describe the vertices to the GPU
/// </summary>
private InputElement[] CreateInputElements()
{
var layoutInstanced = new InputElement[10];
layoutInstanced[0] = new InputElement("POSITION", 0, Format.R32G32_Float, 0, 0, InputClassification.PerVertexData, 0);
layoutInstanced[1] = new InputElement("TEXCOORD", 0, Format.R32G32_Float, InputElement.AppendAligned, 0, InputClassification.PerVertexData, 0);
layoutInstanced[2] = new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 0, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[3] = new InputElement("SOURCERECT", 0, Format.R32G32B32A32_Float, 16, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[4] = new InputElement("TEXTURESIZE", 0, Format.R32G32_Float, 32, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[5] = new InputElement("TEXTUREINDEX", 0, Format.R8_UInt, 40, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[6] = new InputElement("TRANSLATION", 0, Format.R32G32_Float, 44, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[7] = new InputElement("SCALEFACTOR", 0, Format.R32G32_Float, 52, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[8] = new InputElement("ROTATE", 0, Format.R32G32B32_Float, 60, 1, InputClassification.PerInstanceData, 1);
layoutInstanced[9] = new InputElement("ROTATIONCENTER", 0, Format.R32G32_Float, 72, 1, InputClassification.PerInstanceData, 1);
return layoutInstanced;
}
示例14: CreatePSO
private void CreatePSO(InputElement[] inputElementDescs,ShaderBytecode vertexShader,ShaderBytecode pixelShader)
{
// Describe and create the graphics pipeline state object (PSO).
var psoDesc = new GraphicsPipelineStateDescription()
{
InputLayout = new InputLayoutDescription(inputElementDescs),
RootSignature = rootSignature,
VertexShader = vertexShader,
PixelShader = pixelShader,
RasterizerState = RasterizerStateDescription.Default(),
BlendState = BlendStateDescription.Default(),
DepthStencilFormat = SharpDX.DXGI.Format.D32_Float,
DepthStencilState = new DepthStencilStateDescription()
{
IsDepthEnabled = true,
DepthComparison = Comparison.LessEqual,
DepthWriteMask = DepthWriteMask.All,
IsStencilEnabled = false
},
SampleMask = int.MaxValue,
PrimitiveTopologyType = PrimitiveTopologyType.Triangle,
RenderTargetCount = 1,
Flags = PipelineStateFlags.None,
SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
StreamOutput = new StreamOutputDescription()
};
psoDesc.RenderTargetFormats[0] = SharpDX.DXGI.Format.R8G8B8A8_UNorm;
pipelineState = device.CreateGraphicsPipelineState(psoDesc);
commandList = device.CreateCommandList(CommandListType.Direct, commandAllocator, pipelineState);
commandList.Close();
}
示例15: HtmlAutoCompleteBehaviour
public HtmlAutoCompleteBehaviour(InputElement input, InputElement hiddenInput, DOMElement anchor, bool isSuggest, InputElement parametersHiddenField)
{
DOMAttribute cometAtt = input.GetAttributeNode(HtmlAutoCompleteAttributes.CometServiceUrl);
remoteSuggestionsGetter = new WebServiceRemoteSuggestionsGetter(
input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceUrl).Value,
input.GetAttributeNode(HtmlAutoCompleteAttributes.WebServiceMethod).Value
);
this.mode = isSuggest == true ? HtmlAutoCompleteMode.Suggest : HtmlAutoCompleteMode.Complete;
this.input = input;
this.hiddenInput = hiddenInput;
this.anchor = anchor == null ? input : anchor;
DomEvent.AddHandler(input, "blur", delegate(DomEvent e) { Window.SetTimeout(DoBlur, 250); });
DomEvent.AddHandler(input, "keydown", this.HandleKeyDown);
DomEvent.AddHandler(input, "keyup", this.HandleKeyUp);
DomEvent.AddHandler(input, "focus", CallOnFocus);
DOMAttribute waterMarkNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark);
if (waterMarkNode != null)
{
watermarker = new WatermarkExtender(input, input.GetAttributeNode(HtmlAutoCompleteAttributes.Watermark).Value);
}
DOMAttribute popupLeftNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset);
popupLeftOffset = popupLeftNode == null ? 0 : int.ParseInvariant(popupLeftNode.Value);
DOMAttribute popupTopNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupTopOffset);
popupTopOffset = popupTopNode == null ? 0 : int.ParseInvariant(popupTopNode.Value);
DOMAttribute rightAlignNode = input.GetAttributeNode(HtmlAutoCompleteAttributes.RightAlign);
rightAlign = rightAlignNode == null ? false : bool.Parse(rightAlignNode.Value);
if (input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset) != null)
{
popupLeftOffset = int.ParseInvariant(input.GetAttributeNode(HtmlAutoCompleteAttributes.PopupLeftOffset).Value);
}
Parameters = new PairListField(parametersHiddenField);
Suggestions.OnSuggestionsChanged = delegate() { DisplaySuggestionsInPopupMenu(); };
this.remoteSuggestionsGetter.OnAllSuggestionsReceived = delegate()
{
RemoveLowPrioritySuggestionsAndSetRemainingSuggestionsToLowPriority();
HideAjaxIcon();
};
this.remoteSuggestionsGetter.OnSuggestionsRequested = delegate()
{
ShowAjaxIcon();
};
this.remoteSuggestionsGetter.OnSuggestionReceived = delegate(Suggestion[] newSuggestions)
{
Trace.Write("Received" + newSuggestions.Length + "suggestions");
if (TransformReceivedSuggestions != null)
{
AddSuggestions(TransformReceivedSuggestions(newSuggestions, maxNumberOfItemsToGet));
}
else
{
AddSuggestions(newSuggestions);
}
};
this.remoteSuggestionsGetter.OnAbortCurrentRequest= delegate()
{
HideAjaxIcon();
};
}