コード例 #1
0
        public void EditParameter(EffectParameterDefinition param)
        {
            // populate the editing panel
            paramNameBox.Text = param.Name;
            paramTypeBox.SelectedItem = param.Type.Type.ToString();

            if (param.Name != HlslType.Texture.ToString())
            {
                if (param.Type.IsVector)
                {
                    paramTypeSizeBox.SelectedItem = "Vector";
                    paramTypeSizeA.Value = param.Type.Size;
                }
                else if (param.Type.IsArray)
                {
                    paramTypeSizeBox.SelectedItem = "Array";
                    paramTypeSizeA.Value = param.Type.Size;
                }
                else if (param.Type.IsMatrix)
                {
                    paramTypeSizeBox.SelectedItem = "Matrix";
                    paramTypeSizeA.Value = param.Type.Size;
                    paramTypeSizeB.Value = param.Type.MatrixColumns;
                }
                else
                {
                    paramTypeSizeBox.SelectedItem = "Scalar";
                }
            }

            bool semanticChanged = false;

            if (mSemanticEnabled)
            {
                if (param.Semantic.Name == null || param.Semantic.Name == String.Empty)
                {
                    param.Semantic = mSemantics[0];
                    param.Semantic.ResourceNumber = 0;
                    semanticChanged = true;
                }

                // Find the index to select
                int index = -1;
                if (semanticBox.Items.Contains(param.Semantic))
                {
                    index = semanticBox.Items.IndexOf(param.Semantic);
                }
                else
                {
                    for (int i = 0; i < semanticBox.Items.Count; i++)
                    {
                        if (param.Semantic.Name.Equals(((HlslSemantic)semanticBox.Items[i]).Name))
                        {
                            index = i;
                        }
                    }
                }
                if (index == -1) index = 0;

                semanticBox.SelectedIndex = index;
            }

            if (mStorageClassEnabled)
            {
                storageClassBox.Text = (param.StorageClass == StorageClass.None) ?
                    String.Empty : param.StorageClass.ToString();
            }

            if (semanticChanged) EditParameter(parameterListBox.SelectedIndex);
        }
コード例 #2
0
        public void AddParameter(EffectParameterDefinition param)
        {
            mParameters.Add(param);
            mParameters.Sort();

            UpdateList();

            parameterListBox.SelectedItem = param;

            DoParametersChanged();
        }