本文整理汇总了C#中UnityEngine.Material.DisableKeyword方法的典型用法代码示例。如果您正苦于以下问题:C# Material.DisableKeyword方法的具体用法?C# Material.DisableKeyword怎么用?C# Material.DisableKeyword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Material
的用法示例。
在下文中一共展示了Material.DisableKeyword方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
IEnumerator Start()
{
foreach (var r in GetComponentsInChildren<Renderer>()) {
renderers.Add(r);
originalMaterials[r] = r.sharedMaterial;
var material = new Material(r.material);
material.SetFloat("_Mode", 2);
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.EnableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = 3000;
r.material = material;
}
for (float t = 0; t < 1f; t += Time.deltaTime) {
if (!UpdateRenderers(t)) {
yield break;
}
yield return null;
}
foreach (var r in renderers) {
if (r) {
r.material = originalMaterials[r];
}
}
Destroy(this);
}
示例2: SetColorRange
private void SetColorRange(Material material)
{
switch (ColorRange)
{
case TOD_ColorRangeType.Auto:
if (Components.Camera && Components.Camera.HDR)
{
material.EnableKeyword("HDR");
material.DisableKeyword("LDR");
}
else
{
material.DisableKeyword("HDR");
material.EnableKeyword("LDR");
}
break;
case TOD_ColorRangeType.HDR:
material.EnableKeyword("HDR");
material.DisableKeyword("LDR");
break;
case TOD_ColorRangeType.LDR:
material.DisableKeyword("HDR");
material.EnableKeyword("LDR");
break;
}
}
示例3: SetColorSpace
private void SetColorSpace(Material material)
{
switch (ColorSpace)
{
case TOD_ColorSpaceType.Auto:
if (QualitySettings.activeColorSpace == UnityEngine.ColorSpace.Linear)
{
material.EnableKeyword("LINEAR");
material.DisableKeyword("GAMMA");
}
else
{
material.DisableKeyword("LINEAR");
material.EnableKeyword("GAMMA");
}
break;
case TOD_ColorSpaceType.Linear:
material.EnableKeyword("LINEAR");
material.DisableKeyword("GAMMA");
break;
case TOD_ColorSpaceType.Gamma:
material.DisableKeyword("LINEAR");
material.EnableKeyword("GAMMA");
break;
}
}
示例4: SetupMaterialWithBlendMode
public static void SetupMaterialWithBlendMode(Material material, BlendMode blendMode)
{
switch (blendMode)
{
case BlendMode.Opaque:
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.renderQueue = -1;
break;
case BlendMode.Cutout:
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.EnableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.renderQueue = 2450;
break;
case BlendMode.Transparent:
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.EnableKeyword("_ALPHABLEND_ON");
material.renderQueue = 3000;
break;
}
}
示例5: SetTransparent
public static void SetTransparent(Material material)
{
material.SetOverrideTag("RenderType", "Transparent");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = 3000;
}
示例6: SetOpaque
public static void SetOpaque(Material material)
{
material.SetOverrideTag("RenderType", "");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = -1;
}
示例7: Transparent
void Transparent(Material material)
{
material.SetFloat("_Mode", 3);
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
material.SetInt("_ZWrite", 0);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.EnableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = 3000;
}
示例8: Opaque
void Opaque(Material material)
{
material.SetFloat("_Mode", 0);
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = -1;
}
示例9: setMaterialToFade
private void setMaterialToFade(Material m)
{
m.SetFloat("_Mode", 2);
m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
m.SetInt("_ZWrite", 0);
m.DisableKeyword("_ALPHATEST_ON");
m.EnableKeyword("_ALPHABLEND_ON");
m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
m.renderQueue = 3000;
}
示例10: Start
void Start()
{
Material m = new Material(Shader.Find("Custom/StandardDepthBuffer"));
m.SetFloat("_Mode", 2);
m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
m.SetInt("_ZWrite", 0);
m.DisableKeyword("_ALPHATEST_ON");
m.EnableKeyword("_ALPHABLEND_ON");
m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
m.renderQueue = 3000;
}
示例11: ApplyOpaque
public void ApplyOpaque(Color col)
{
rend = this.gameObject.GetComponent<Renderer>().material;
rend.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
rend.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
rend.SetInt("_ZWrite", 1);
rend.DisableKeyword("_ALPHATEST_ON");
rend.DisableKeyword("_ALPHABLEND_ON");
rend.DisableKeyword("_ALPHAPREMULTIPLY_ON");
rend.renderQueue = -1;
StartCoroutine(colorLerp1(rend.GetColor("_Color"), col));
}
示例12: CreateMaterial
Material CreateMaterial(Color emissionColor)
{
Material m = new Material(outlineBufferShader);
m.SetColor("_Color", emissionColor);
m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
m.SetInt("_ZWrite", 0);
m.DisableKeyword("_ALPHATEST_ON");
m.EnableKeyword("_ALPHABLEND_ON");
m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
m.renderQueue = 3000;
return m;
}
示例13: ApplyTransparent
void ApplyTransparent(Color col)
{
rend = this.gameObject.GetComponent<Renderer>().material;
rend.SetFloat("_Mode", 3f);
rend.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
rend.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
rend.SetInt("_ZWrite", 0);
rend.DisableKeyword("_ALPHATEST_ON");
rend.DisableKeyword("_ALPHABLEND_ON");
rend.EnableKeyword("_ALPHAPREMULTIPLY_ON");
rend.renderQueue = 3000;
StartCoroutine(colorLerp1(rend.GetColor("_Color"), col));
}
示例14: SetOpaque
public static void SetOpaque(Material material)
{
if (material.shader != StandardShader)
Debug.LogWarning("Trying to set opaque mode on non-standard shader. Please use the Standard Shader instead or modify this method.");
material.SetOverrideTag("RenderType", "");
material.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
material.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
material.SetInt("_ZWrite", 1);
material.DisableKeyword("_ALPHATEST_ON");
material.DisableKeyword("_ALPHABLEND_ON");
material.DisableKeyword("_ALPHAPREMULTIPLY_ON");
material.renderQueue = -1;
}
示例15: SetKeyword
static void SetKeyword(Material m, string keyword, bool state)
{
if (state)
m.EnableKeyword(keyword);
else
m.DisableKeyword(keyword);
}