Ejemplo n.º 1
0
            public static bool TryCreate(ShaderField field, MaterialProperty[] properties, out IFieldDrawer drawer)
            {
                var materialProperty = ShaderDrawerHelper.PublicFindProperty(field.ShaderFieldName, properties);

                if (materialProperty != null)
                {
                    drawer = new StandardFieldDrawer(field, materialProperty);
                    return(true);
                }
                else
                {
                    drawer = default(IFieldDrawer);
                    return(false);
                }
            }
Ejemplo n.º 2
0
        public ShaderFieldDrawer(IShaderFieldGroup group, MaterialProperty[] properties)
        {
            if (group == null)
            {
                throw new ArgumentNullException(nameof(group));
            }

            Group   = group;
            Drawers = new List <IFieldDrawer>(group.Children.Count);

            foreach (var child in Group.Children)
            {
                if (child is ShaderField)
                {
                    var          field = (ShaderField)child;
                    IFieldDrawer drawer;
                    if (StandardFieldDrawer.TryCreate(field, properties, out drawer))
                    {
                        Drawers.Add(drawer);
                    }
                }
                if (child is ShaderKeyword)
                {
                    var field = (ShaderKeyword)child;
                    Drawers.Add(new ShaderKeywordDrawer(field));
                }
                else if (child is ShaderEnumKeyword)
                {
                    var field = (ShaderEnumKeyword)child;
                    Drawers.Add(new ShaderEnumKeywordDrawer(field));
                }
                else if (child is ShaderEnumFlagsKeyword)
                {
                    var field = (ShaderEnumFlagsKeyword)child;
                    Drawers.Add(new ShaderEnumFlagsKeywordDrawer(field));
                }
            }
        }