• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# InputElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中InputElement的典型用法代码示例。如果您正苦于以下问题:C# InputElement类的具体用法?C# InputElement怎么用?C# InputElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



InputElement类属于命名空间,在下文中一共展示了InputElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
            }
        }
开发者ID:hameleon-ed,项目名称:dx11-vvvv,代码行数:60,代码来源:ImageShaderPassInfo.cs


示例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);

            }
        }
开发者ID:hameleon-ed,项目名称:dx11-vvvv,代码行数:25,代码来源:InputElementJoinNode.cs


示例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;
        }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:12,代码来源:ShaderQuad.cs


示例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;
			
			
			
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:11,代码来源:WatermarkExtender.cs


示例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);
			
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:11,代码来源:MultiSelectorBehaviour.cs


示例6: WhenLoggedInButtonNoValidation

		public static bool WhenLoggedInButtonNoValidation(InputElement element)
		{
			PageImplementation.WhenLoggedIn(
				new Action(
					delegate()
					{
						Script.Eval("__doPostBack(\"" + element.ID.Replace(new RegularExpression("_", "g"), "$") + "\",'');");
					}
				)
			);
			return false;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:12,代码来源:Controller.cs


示例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;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:12,代码来源:Controller.cs


示例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;
			}
		}
开发者ID:RugCode,项目名称:drg-pt,代码行数:50,代码来源:BloomEffect.cs


示例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;
        }
开发者ID:vokac,项目名称:F2B,代码行数:17,代码来源:Base.cs


示例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");
        }
开发者ID:nezbo,项目名称:Descent,代码行数:22,代码来源:ChatElement.cs


示例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;
        }
开发者ID:nissidis,项目名称:dx11-vvvv,代码行数:22,代码来源:DX11StreamOutShaderNode.cs


示例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;
 }
开发者ID:adrianj,项目名称:Direct3D-Testing,代码行数:10,代码来源:Vertex.cs


示例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;
        }
开发者ID:treytomes,项目名称:DirectCanvas,代码行数:20,代码来源:SpriteQuad.cs


示例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();
        }
开发者ID:dtysky,项目名称:TearsOfTimes-MinecraftRemake,代码行数:33,代码来源:ModelRender.cs


示例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();

			                                                      };
			

		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:67,代码来源:HtmlAutoCompleteBehaviour.cs


示例16: LoadAssets

        private void LoadAssets()
        {
            DescriptorRange[] ranges = new DescriptorRange[] { new DescriptorRange() { RangeType = DescriptorRangeType.ShaderResourceView, DescriptorCount = 1, OffsetInDescriptorsFromTableStart = int.MinValue, BaseShaderRegister = 0 } };

            StaticSamplerDescription sampler = new StaticSamplerDescription()
            {
                Filter = Filter.MinimumMinMagMipPoint,
                AddressU = TextureAddressMode.Border,
                AddressV = TextureAddressMode.Border,
                AddressW = TextureAddressMode.Border,
                MipLODBias = 0,
                MaxAnisotropy = 0,
                ComparisonFunc = Comparison.Never,
                BorderColor = StaticBorderColor.TransparentBlack,
                MinLOD = 0.0f,
                MaxLOD = float.MaxValue,
                ShaderRegister = 0,
                RegisterSpace = 0,
                ShaderVisibility = ShaderVisibility.Pixel,
            };

            RootParameter[] rootParameters = new RootParameter[] { new RootParameter(ShaderVisibility.Pixel, ranges) };

            RootSignatureDescription rootSignatureDesc = new RootSignatureDescription(RootSignatureFlags.AllowInputAssemblerInputLayout, rootParameters, new StaticSamplerDescription[] { sampler });
            rootSignature = device.CreateRootSignature(0, rootSignatureDesc.Serialize());

            // Create the pipeline state, which includes compiling and loading shaders.
            #if DEBUG
            var vertexShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "VSMain", "vs_5_0", SharpDX.D3DCompiler.ShaderFlags.Debug));
            #else
            var vertexShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "VSMain", "vs_5_0"));
            #endif

            #if DEBUG
            var pixelShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "PSMain", "ps_5_0", SharpDX.D3DCompiler.ShaderFlags.Debug));
            #else
            var pixelShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "PSMain", "ps_5_0"));
            #endif

            // Define the vertex input layout.
            InputElement[] inputElementDescs = new InputElement[]
            {
                    new InputElement("POSITION",0,Format.R32G32B32_Float,0,0),
                    new InputElement("TEXCOORD",0,Format.R32G32_Float,12,0)
            };

            // Describe and create the graphics pipeline state object (PSO).
            GraphicsPipelineStateDescription 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 = false, 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);

            // Create the command list.
            commandList = device.CreateCommandList(CommandListType.Direct, commandAllocator, pipelineState);

            // Create the vertex buffer.
            float aspectRatio = viewport.Width / viewport.Height;

            // Define the geometry for a triangle.
            Vertex[] triangleVertices = new Vertex[]
            {
                    new Vertex() {position=new Vector3(0.0f, 0.25f * aspectRatio, 0.0f ),uv=new Vector2(0.5f, 0.0f) },
                    new Vertex() {position=new Vector3(0.25f, -0.25f * aspectRatio, 0.0f),uv=new Vector2(1.0f, 1.0f) },
                    new Vertex() {position=new Vector3(-0.25f, -0.25f * aspectRatio, 0.0f),uv=new Vector2(0.0f, 1.0f) },
            };

            int vertexBufferSize = Utilities.SizeOf(triangleVertices);

            // Note: using upload heaps to transfer static data like vert buffers is not
            // recommended. Every time the GPU needs it, the upload heap will be marshalled
            // over. Please read up on Default Heap usage. An upload heap is used here for
            // code simplicity and because there are very few verts to actually transfer.
            vertexBuffer = device.CreateCommittedResource(new HeapProperties(HeapType.Upload), HeapFlags.None, ResourceDescription.Buffer(vertexBufferSize), ResourceStates.GenericRead);

            // Copy the triangle data to the vertex buffer.
            IntPtr pVertexDataBegin = vertexBuffer.Map(0);
            Utilities.Write(pVertexDataBegin, triangleVertices, 0, triangleVertices.Length);
            vertexBuffer.Unmap(0);

            // Initialize the vertex buffer view.
            vertexBufferView = new VertexBufferView();
            vertexBufferView.BufferLocation = vertexBuffer.GPUVirtualAddress;
            vertexBufferView.StrideInBytes = Utilities.SizeOf<Vertex>();
            vertexBufferView.SizeInBytes = vertexBufferSize;
//.........这里部分代码省略.........
开发者ID:RobyDX,项目名称:SharpDX_D3D12HelloWorld,代码行数:101,代码来源:HelloTexture.cs


示例17: defaultButton

		void defaultButton(InputElement textBox, InputElement button)
		{
			DomEvent.AddHandler(textBox, "keyup", delegate(DomEvent e)
			{
				if (e.KeyCode == 13)
				{
					if (AsyncInProgress)
						return;

					button.Click();

				}
			});
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:14,代码来源:Controller.cs


示例18: _UpdateElements

    private void _UpdateElements(IEnumerable<RawInput> inputs)
    {
        foreach (var element in _InputElements.Values)
            element.Unplugged = true;

        foreach (var input in inputs)
        {
            if (!_InputElements.ContainsKey(input.ElementType))
            {
                var inputElement = new InputElement();
                inputElement.ControlPosition = input.Position;
                inputElement.EntryTime = Time.time;
                inputElement.ElementType = input.ElementType;

                _InputElements.Add(input.ElementType, inputElement);

                if (_Prefabs.ContainsKey(input.ElementType))
                    _CreateElement(input.ElementType, input.Position);
            }

            _InputElements[input.ElementType].Unplugged = false;
        }

        var unpluggeds = _InputElements.Values.Where(e => e.Unplugged).Select(e => e.ElementType).ToList();

        foreach (var unplugged in unpluggeds)
        {
            if (_InputElements[unplugged].Fusioned)
                _TryDefuse(unplugged);
            else
                _RemoveElement(unplugged);

            _InputElements.Remove(unplugged);
        }
    }
开发者ID:thalesalexcin,项目名称:Lirrationel,代码行数:35,代码来源:GameController.cs


示例19: LoadAssets

        private void LoadAssets()
        {
            DescriptorRange[] ranges = new DescriptorRange[] { new DescriptorRange() { RangeType = DescriptorRangeType.ConstantBufferView, BaseShaderRegister = 0, OffsetInDescriptorsFromTableStart = int.MinValue, DescriptorCount = 1 } };
            RootParameter parameter = new RootParameter(ShaderVisibility.Vertex, ranges);

            // Create an empty root signature.
            RootSignatureDescription rootSignatureDesc = new RootSignatureDescription(RootSignatureFlags.AllowInputAssemblerInputLayout, new RootParameter[] { parameter });
            rootSignature = device.CreateRootSignature(rootSignatureDesc.Serialize());

            // Create the pipeline state, which includes compiling and loading shaders.
            #if DEBUG
            var vertexShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "VSMain", "vs_5_0", SharpDX.D3DCompiler.ShaderFlags.Debug));
            #else
            var vertexShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "VSMain", "vs_5_0"));
            #endif

            #if DEBUG
            var pixelShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "PSMain", "ps_5_0", SharpDX.D3DCompiler.ShaderFlags.Debug));
            #else
            var pixelShader = new ShaderBytecode(SharpDX.D3DCompiler.ShaderBytecode.CompileFromFile("shaders.hlsl", "PSMain", "ps_5_0"));
            #endif

            // Define the vertex input layout.
            InputElement[] inputElementDescs = new InputElement[]
            {
                    new InputElement("POSITION",0,Format.R32G32B32_Float,0,0),
                    new InputElement("COLOR",0,Format.R32G32B32A32_Float,12,0)
            };

            // Describe and create the graphics pipeline state object (PSO).
            GraphicsPipelineStateDescription 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 = false, 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);

            // Create the command list.
            commandList = device.CreateCommandList(CommandListType.Direct, commandAllocator, pipelineState);

            // Create the vertex buffer.
            float aspectRatio = viewport.Width / viewport.Height;

            // Define the geometry for a triangle.
            Vertex[] triangleVertices = new Vertex[]
            {
                    new Vertex() {position=new Vector3(0.0f, 0.25f * aspectRatio, 0.0f ),color=new Vector4(1.0f, 0.0f, 0.0f, 1.0f ) },
                    new Vertex() {position=new Vector3(0.25f, -0.25f * aspectRatio, 0.0f),color=new Vector4(0.0f, 1.0f, 0.0f, 1.0f) },
                    new Vertex() {position=new Vector3(-0.25f, -0.25f * aspectRatio, 0.0f),color=new Vector4(0.0f, 0.0f, 1.0f, 1.0f ) },
            };

            int vertexBufferSize = Utilities.SizeOf(triangleVertices);

            // Note: using upload heaps to transfer static data like vert buffers is not
            // recommended. Every time the GPU needs it, the upload heap will be marshalled
            // over. Please read up on Default Heap usage. An upload heap is used here for
            // code simplicity and because there are very few verts to actually transfer.
            vertexBuffer = device.CreateCommittedResource(new HeapProperties(HeapType.Upload), HeapFlags.None, ResourceDescription.Buffer(vertexBufferSize), ResourceStates.GenericRead);

            // Copy the triangle data to the vertex buffer.
            IntPtr pVertexDataBegin = vertexBuffer.Map(0);
            Utilities.Write(pVertexDataBegin, triangleVertices, 0, triangleVertices.Length);
            vertexBuffer.Unmap(0);

            // Initialize the vertex buffer view.
            vertexBufferView = new VertexBufferView();
            vertexBufferView.BufferLocation = vertexBuffer.GPUVirtualAddress;
            vertexBufferView.StrideInBytes = Utilities.SizeOf<Vertex>();
            vertexBufferView.SizeInBytes = vertexBufferSize;

            // Command lists are created in the recording state, but there is nothing
            // to record yet. The main loop expects it to be closed, so close it now.
            commandList.Close();

            constantBuffer = device.CreateCommittedResource(new HeapProperties(HeapType.Upload), HeapFlags.None, ResourceDescription.Buffer(1024 * 64), ResourceStates.GenericRead);

            //// Describe and create a constant buffer view.
            ConstantBufferViewDescription cbvDesc = new ConstantBufferViewDescription()
            {
                BufferLocation = constantBuffer.GPUVirtualAddress,
                SizeInBytes = (Utilities.SizeOf<ConstantBuffer>() + 255) & ~255
            };
            device.CreateConstantBufferView(cbvDesc, constantBufferViewHeap.CPUDescriptorHandleForHeapStart);

            // Initialize and map the constant buffers. We don't unmap this until the
            // app closes. Keeping things mapped for the lifetime of the resource is okay.
//.........这里部分代码省略.........
开发者ID:RobyDX,项目名称:SharpDX_D3D12HelloWorld,代码行数:101,代码来源:HelloConstBuffers.cs


示例20: WhenLoggedInRadio

		public static bool WhenLoggedInRadio(InputElement element)
		{
			PageImplementation.WhenLoggedIn(
				new Action(
					delegate()
					{
						Script.Eval("setTimeout('__doPostBack(\\'" + element.ID.Replace(new RegularExpression("_", "g"), "$") + "\\',\\'\\')', 0);");
					}
				)
			);
			return true;
		}
开发者ID:davelondon,项目名称:dontstayin,代码行数:12,代码来源:Controller.cs



注:本文中的InputElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# InputElementType类代码示例发布时间:2022-05-24
下一篇:
C# InputDialog类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap