本文整理汇总了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());
}
}
示例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;
}
}
示例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;
}
}
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}