Example #1
0
        internal static void AddMaterialProperty(ref MaterialContext context, Vector4 param, int shaderID)
        {
            ShaderPropertyValue stpv = new ShaderPropertyValue()
            {
                shaderID = shaderID,
                value    = param,
            };

            context.shaderIDs.Add(stpv);
        }
Example #2
0
 internal static bool AddMaterialProperty(ref MaterialContext context, Material material, ShaderProperty sp)
 {
     if (material.HasProperty(sp.shaderProperty))
     {
         if (sp.isTex)
         {
             Texture tex = material.GetTexture(sp.shaderProperty);
             if (tex != null)
             {
                 ShaderTexPropertyValue stpv = new ShaderTexPropertyValue()
                 {
                     shaderID = sp.shaderID,
                     value    = tex,
                     path     = tex.name
                 };
                 context.textureValue.Add(stpv);
                 return(true);
             }
             else
             {
                 Debug.LogErrorFormat("null tex property:{0} mat:{1}", sp.shaderProperty, material.name);
                 return(false);
             }
         }
         else
         {
             Vector4             param = material.GetVector(sp.shaderProperty);
             ShaderPropertyValue spv   = new ShaderPropertyValue()
             {
                 shaderID = sp.shaderID,
                 value    = param,
             };
             context.shaderIDs.Add(spv);
             return(true);
         }
     }
     return(false);
 }