예제 #1
0
 public static bool NeedDestroy(this EffectVariable var, IWorldRenderVariable shadervar)
 {
     //For pins, if type/elements or now has a semantic, we need to recreate the pin
     return(var.GetVariableType().Description.TypeName != shadervar.TypeName ||
            var.GetVariableType().Description.Elements != shadervar.Elements ||
            var.Description.Semantic != shadervar.Semantic);
 }
예제 #2
0
        protected override void CreatePin(EffectVariable var)
        {
            if (var.AsInterface() != null)
            {
                if (var.LinkClasses().Length == 0)
                {
                    if (var.GetVariableType().Description.Elements == 0)
                    {
                        /*InterfaceShaderPin ip = new InterfaceShaderPin(var, this.host, this.iofactory);
                         * ip.ParentEffect = this.shader.DefaultEffect;
                         * this.shaderpins.Add(var.Description.Name, ip);*/
                    }
                }
                else
                {
                    RestrictedInterfaceShaderPin rp = new RestrictedInterfaceShaderPin();
                    rp.Initialize(this.iofactory, var);
                    rp.ParentEffect = this.shader.DefaultEffect;
                    this.shaderpins.Add(var.Description.Name, rp);
                }
                return;
            }

            //Search for render variable first
            if (ShaderPinFactory.IsRenderVariable(var))
            {
                IRenderVariable rv = ShaderPinFactory.GetRenderVariable(var, this.host, this.iofactory);
                this.rendervariables.Add(rv.Name, rv);
            }
            else if (ShaderPinFactory.IsWorldRenderVariable(var))
            {
                IWorldRenderVariable wv = ShaderPinFactory.GetWorldRenderVariable(var, this.host, this.iofactory);
                this.worldvariables.Add(wv.Name, wv);
            }
            else if (ShaderPinFactory.IsShaderPin(var))
            {
                IShaderPin sp = traverseResult().Pins[var.Description.Name];
                sp.Initialize(iofactory, var);
                if (sp != null)
                {
                    this.shaderpins.Add(sp.Name, sp);
                }
            }
            else
            {
                if (var.Description.Semantic != "IMMUTABLE" && var.Description.Semantic != "")
                {
                    this.customvariables.Add(new DX11CustomRenderVariable(var));
                }
            }
        }
 public static bool NeedDestroy(this EffectVariable var, IWorldRenderVariable shadervar)
 {
     //For pins, if type/elements or now has a semantic, we need to recreate the pin
     return var.GetVariableType().Description.TypeName != shadervar.TypeName
         || var.GetVariableType().Description.Elements != shadervar.Elements
         || var.Description.Semantic != shadervar.Semantic;
 }