当前位置: 首页>>代码示例>>C#>>正文


C# Shader.ToString方法代码示例

本文整理汇总了C#中Shader.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Shader.ToString方法的具体用法?C# Shader.ToString怎么用?C# Shader.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shader的用法示例。


在下文中一共展示了Shader.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddShader

        public override void AddShader(int id, string code, Shader.ShaderTypes type)
        {
            ShaderType stype = ShaderType.VertexShader;

            if (type == Shader.ShaderTypes.Vertex)
                stype = ShaderType.VertexShader;
            else if (type == Shader.ShaderTypes.Fragment)
                stype = ShaderType.FragmentShader;
            else if (type == Shader.ShaderTypes.Geometry)
                stype = ShaderType.GeometryShader;
            else if (type == Shader.ShaderTypes.TessControl)
                stype = ShaderType.TessControlShader;
            else if (type == Shader.ShaderTypes.TessEval)
                stype = ShaderType.TessEvaluationShader;

            int shader = GL.CreateShader(stype);
            if (shader == 0)
            {
                throw new Exception("Error creating shader.\n\tShader type: " + type + "\n\tCode: " + code);
            }
            GL.ShaderSource(shader, code);
            GL.CompileShader(shader);
            GL.AttachShader(id, shader);
            int status = -1;
            string info = "";
            GL.GetShaderInfoLog(shader, out info);
            GL.GetShader(shader, ShaderParameter.CompileStatus, out status);
            if (status != 1)
            {
                Console.WriteLine("Shader compiler error!\nType: " + type.ToString() + "\nName: " + this.GetType().ToString() + "\n\n"/* + "Source code:\n" + code + "\n\n"*/ +
                           info + "\n" + "Status Code: " + status.ToString());
            }
        }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:33,代码来源:GLRenderer.cs

示例2: CheckShaderAndCreateMaterial

    public Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
    {
        if (!s)
        {
            Debug.Log("Missing shader in " + this.ToString());
            enabled = false;
            return null;
        }

        if (s.isSupported && m2Create && m2Create.shader == s)
            return m2Create;

        if (!s.isSupported)
        {
            NotSupported();
            Debug.Log("The shader " + s.ToString() + " on effect "+this.ToString()+" is not supported on this platform!");
            return null;
        }
        else
        {
            m2Create = new Material(s);
            m2Create.hideFlags = HideFlags.DontSave;
            if (m2Create)
                return m2Create;
            else return null;
        }
    }
开发者ID:RavenNevermore,项目名称:EndOfLine,代码行数:27,代码来源:PostEffectBase.cs

示例3: CheckShaderAndCreateMaterial

 public virtual Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
 {
     if (!(bool)((Object)s))
     {
         Debug.Log("Missing shader in " + this.ToString());
         this.enabled = false;
         return (Material)null;
     }
     else
     {
         if (s.isSupported && (bool)((Object)m2Create) && (Object)m2Create.shader == (Object)s)
             return m2Create;
         if (!s.isSupported)
         {
             this.NotSupported();
             Debug.LogError("The shader " + s.ToString() + " on effect " + this.ToString() + " is not supported on this platform!");
             return (Material)null;
         }
         else
         {
             m2Create = new Material(s);
             m2Create.hideFlags = HideFlags.DontSave;
             if ((bool)((Object)m2Create))
                 return m2Create;
             else
                 return (Material)null;
         }
     }
 }
开发者ID:Ramzawulf,项目名称:unityassets,代码行数:29,代码来源:PostEffectsBase.cs

示例4: CheckShaderAndCreateMaterial

 public override Material CheckShaderAndCreateMaterial(Shader s, Material m2Create)
 {
     Material arg_D0_0;
     if (!s)
     {
         Debug.Log("Missing shader in " + this.ToString());
         this.enabled = false;
         arg_D0_0 = null;
     }
     else if (s.isSupported && m2Create && m2Create.shader == s)
     {
         arg_D0_0 = m2Create;
     }
     else if (!s.isSupported)
     {
         this.NotSupported();
         Debug.Log("The shader " + s.ToString() + " on effect " + this.ToString() + " is not supported on this platform!");
         arg_D0_0 = null;
     }
     else
     {
         m2Create = new Material(s);
         m2Create.hideFlags = HideFlags.DontSave;
         arg_D0_0 = ((!m2Create) ? null : m2Create);
     }
     return arg_D0_0;
 }
开发者ID:GameDiffs,项目名称:TheForest,代码行数:27,代码来源:PostEffectsBase.cs

示例5: CheckShaderAndCreateMaterial

    protected Material CheckShaderAndCreateMaterial(Shader shader, Material material)
    {
        if (!shader)
        {
            Debug.Log("Missing shader in " + this.ToString());
            enabled = false;
            return null;
        }

        if (shader.isSupported && material && material.shader == shader)
        {
            return material;
        }

        if (!shader.isSupported)
        {
            NotSupported();
            Debug.LogError("The shader " + shader.ToString() + " on effect " + this.ToString() + " is not supported on this platform!");
            return null;
        }
        else
        {
            material = new Material(shader);
            material.hideFlags = HideFlags.DontSave;
            return material ? material : null;
        }
    }
开发者ID:esmayl,项目名称:De-Zuidlanden-Stage-project,代码行数:27,代码来源:TOD_PostEffectsBase.cs

示例6: CheckShaderAndCreateMaterial

 protected Material CheckShaderAndCreateMaterial(Shader shader, Material material)
 {
     Material material1;
     if (!shader)
     {
         Debug.Log(string.Concat("Missing shader in ", this.ToString()));
         base.enabled = false;
         return null;
     }
     if (shader.isSupported && material && material.shader == shader)
     {
         return material;
     }
     if (shader.isSupported)
     {
         material = new Material(shader)
         {
             hideFlags = HideFlags.DontSave
         };
         if (!material)
         {
             material1 = null;
         }
         else
         {
             material1 = material;
         }
         return material1;
     }
     this.NotSupported();
     Debug.LogError(string.Concat(new string[] { "The shader ", shader.ToString(), " on effect ", this.ToString(), " is not supported on this platform!" }));
     return null;
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:33,代码来源:TOD_PostEffectsBase.cs

示例7: CheckShader

 // deprecated but needed for old effects to survive upgrading
 protected bool CheckShader(Shader s)
 {
     Debug.Log("The shader " + s.ToString () + " on effect "+ this.ToString () + " is not part of the Unity 3.2+ effects suite anymore. For best performance and quality, please ensure you are using the latest Standard Assets Image Effects (Pro only) package.");
     if (!s.isSupported) {
         NotSupported ();
         return false;
     }
     else {
         return false;
     }
 }
开发者ID:Juli3nnicolas,项目名称:TempOcean,代码行数:12,代码来源:OsvrPostEffectsBase.cs

示例8: CheckShaderAndCreateMaterial

    public static Material CheckShaderAndCreateMaterial( Shader s ,   Material m2Create  )
    {
        if (m2Create && m2Create.shader == s)
            return m2Create;

        if (!s) {
            Debug.LogWarning("PostEffects: missing shader for " + m2Create.ToString ());
            return null;
        }

        if(!s.isSupported) {
            Debug.LogWarning ("The shader " + s.ToString () + " is not supported");
            return null;
        }
        else {
            m2Create = new Material (s);
            m2Create.hideFlags = HideFlags.DontSave;
            return m2Create;
        }
    }
开发者ID:cn00,项目名称:U3D5_CSharp_AngryBots,代码行数:20,代码来源:PostEffects.cs

示例9: CreateMaterial

	protected Material CreateMaterial(Shader shader)
	{
		if (!shader)
		{
			Debug.Log("Missing shader in " + this.ToString());
			enabled = false;
			return null;
		}

		if (!shader.isSupported)
		{
			Debug.LogError("The shader " + shader.ToString() + " on effect " + this.ToString() + " is not supported on this platform!");
			enabled = false;
			return null;
		}

		var material = new Material(shader);
		material.hideFlags = HideFlags.DontSave;

		return material;
	}
开发者ID:TK-97,项目名称:ICO_AGM_Asg02,代码行数:21,代码来源:TOD_ImageEffect.cs


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