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


C# Material.SetInt方法代码示例

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


在下文中一共展示了Material.SetInt方法的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);
    }
开发者ID:rcd229,项目名称:Crystallize2D,代码行数:34,代码来源:MaterialFadeIn.cs

示例2: DrawProteinsAtoms

    public static void DrawProteinsAtoms(Material renderProteinsMaterial, Camera camera, RenderBuffer instanceId, RenderBuffer atomId, RenderBuffer depthBuffer, int pass)
    {
        // Protein params
        renderProteinsMaterial.SetInt("_EnableLod", Convert.ToInt32(GlobalProperties.Get.EnableLod));
        renderProteinsMaterial.SetFloat("_Scale", GlobalProperties.Get.Scale);
        renderProteinsMaterial.SetFloat("_FirstLevelBeingRange", GlobalProperties.Get.FirstLevelOffset);
        renderProteinsMaterial.SetVector("_CameraForward", camera.transform.forward);

        renderProteinsMaterial.SetBuffer("_LodLevelsInfos", GPUBuffers.Get.LodInfo);
        renderProteinsMaterial.SetBuffer("_ProteinInstanceInfo", GPUBuffers.Get.ProteinInstancesInfo);
        renderProteinsMaterial.SetBuffer("_ProteinInstancePositions", GPUBuffers.Get.ProteinInstancePositions);
        renderProteinsMaterial.SetBuffer("_ProteinInstanceRotations", GPUBuffers.Get.ProteinInstanceRotations);

        renderProteinsMaterial.SetBuffer("_ProteinColors", GPUBuffers.Get.IngredientsColors);
        renderProteinsMaterial.SetBuffer("_ProteinAtomInfo", GPUBuffers.Get.ProteinAtomInfo);
        renderProteinsMaterial.SetBuffer("_ProteinAtomPositions", GPUBuffers.Get.ProteinAtoms);
        renderProteinsMaterial.SetBuffer("_ProteinClusterPositions", GPUBuffers.Get.ProteinAtomClusters);
        renderProteinsMaterial.SetBuffer("_ProteinSphereBatchInfos", GPUBuffers.Get.SphereBatches);

        /****/
        renderProteinsMaterial.SetInt("_NumCutObjects", SceneManager.Get.NumCutObjects);
        renderProteinsMaterial.SetInt("_NumIngredientTypes", SceneManager.Get.NumAllIngredients);
        

        renderProteinsMaterial.SetBuffer("_CutInfos", GPUBuffers.Get.CutInfo);
        renderProteinsMaterial.SetBuffer("_CutScales", GPUBuffers.Get.CutScales);
        renderProteinsMaterial.SetBuffer("_CutPositions", GPUBuffers.Get.CutPositions);
        renderProteinsMaterial.SetBuffer("_CutRotations", GPUBuffers.Get.CutRotations);
        /****/

        Graphics.SetRenderTarget(new[] { instanceId, atomId }, depthBuffer);
        renderProteinsMaterial.SetPass(1);
        Graphics.DrawProceduralIndirect(MeshTopology.Points, GPUBuffers.Get.ArgBuffer);
    }
开发者ID:matmuze,项目名称:cellVIEW_color,代码行数:34,代码来源:RenderUtils.cs

示例3: Awake

    // Use this for initialization
    void Awake()
    {
        //Initalize render textures
        m_inputRenderTex = new RenderTexture(m_shadowSize, m_shadowSize, 0, RenderTextureFormat.ARGB32);
        m_middleRenderTex = new RenderTexture(m_shadowSize, 1, 0, RenderTextureFormat.ARGB32);

        //Initialize light material
        m_lightMaterial = new Material(Shader.Find("2DLighting/Deferred_Point_2"));
        m_lightMaterial.SetTexture("_DepthMap", m_middleRenderTex);
        m_lightMaterial.SetInt("_Penumbra", m_penumbra ? 1 : 0);
        m_lightMaterial.SetInt("_GradientFalloff", m_gradientFalloff ? 1 : 0);

        //Initialize phase one material
        phaseOneMaterial = new Material(Shader.Find("2DLighting/Deferred_Point_1"));
        phaseOneMaterial.SetFloat("_DistanceModifier", 0.001f);

        //Aquire camera component and initialize it
        m_camera = GetComponent<Camera>();
        m_camera.enabled = true;
        m_camera.targetTexture = m_inputRenderTex;

        //Create culling mask from given occluder layers
        int occluders = 0;
        for (int i = 0; i < m_occluderLayers.Count; i++)
        {
            occluders = occluders | (1 << LayerMask.NameToLayer(m_occluderLayers[i]));
        }
        m_camera.cullingMask = occluders;

        //Assign mesh material
        m_meshRenderer.material = m_lightMaterial;
    }
开发者ID:Dunnings,项目名称:Creative_Technologies,代码行数:33,代码来源:Shader_Light.cs

示例4: CreateLineMaterial

        public static void CreateLineMaterial(int iMat = 1)
        {
            Material mMat = lineMaterial1;
            if (iMat == 2) mMat = lineMaterial2;
            if (iMat == 3) mMat = lineMaterial3;
            if (iMat == 4) mMat = lineMaterial4;
            if (iMat == 5) mMat = lineMaterial5;

            if (mMat == null)
            {
                var shader = Shader.Find("Hidden/Internal-Colored");
                mMat = new Material(shader);
                mMat.hideFlags = HideFlags.HideAndDontSave;
                // Turn on alpha blending
                mMat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.SrcAlpha);
                mMat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusSrcAlpha);
                // Turn backface culling off
                mMat.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);
                // Turn off depth writes
                mMat.SetInt("_ZWrite", 0);

                if (iMat == 1) lineMaterial1 = mMat;
                if (iMat == 2) lineMaterial2 = mMat;
                if (iMat == 3) lineMaterial3 = mMat;
                if (iMat == 4) lineMaterial4 = mMat;
                if (iMat == 5) lineMaterial5 = mMat;
            }
        }
开发者ID:AlphaAsh,项目名称:Kerbal-Konstructs_DEV,代码行数:28,代码来源:NavUtils.cs

示例5: CloneMaterial

 public override Material CloneMaterial(Material src, int nth)
 {
     Material m = new Material(src);
     m.SetInt("g_batch_begin", nth * m_instances_par_batch);
     m.SetBuffer("particles", m_world.GetParticleBuffer());
     if (m_hdr)
     {
         m.SetInt("_SrcBlend", (int)BlendMode.One);
         m.SetInt("_DstBlend", (int)BlendMode.One);
     }
     else
     {
         m.SetInt("_SrcBlend", (int)BlendMode.DstColor);
         m.SetInt("_DstBlend", (int)BlendMode.Zero);
     }
     if(m_enable_shadow)
     {
         m.EnableKeyword("ENABLE_SHADOW");
         switch (m_sample)
         {
             case Sample.Fast:
                 m.EnableKeyword("QUALITY_FAST");
                 break;
             case Sample.Medium:
                 m.EnableKeyword("QUALITY_MEDIUM");
                 break;
             case Sample.High:
                 m.EnableKeyword("QUALITY_HIGH");
                 break;
         }
     }
     return m;
 }
开发者ID:xeroskiller,项目名称:Unity5Effects,代码行数:33,代码来源:MPGPLightRenderer.cs

示例6: CloneMaterial

    public override Material CloneMaterial(Material src, int nth)
    {
        var instance_texture = m_world.GetInstanceTexture();

        Material m = new Material(src);
        m.SetInt("g_batch_begin", nth * m_instances_par_batch);
        m.SetTexture("g_instance_data", instance_texture);

        Vector4 ts = new Vector4(
            1.0f / instance_texture.width,
            1.0f / instance_texture.height,
            instance_texture.width,
            instance_texture.height);
        m.SetVector("g_instance_data_size", ts);

        if (m_hdr)
        {
            m.SetInt("_SrcBlend", (int)BlendMode.One);
            m.SetInt("_DstBlend", (int)BlendMode.One);
        }
        else
        {
            m.SetInt("_SrcBlend", (int)BlendMode.DstColor);
            m.SetInt("_DstBlend", (int)BlendMode.Zero);
        }

        if (m_enable_shadow)
        {
            m.EnableKeyword("ENABLE_SHADOW");
            switch (m_sample)
            {
                case Sample.Fast:
                    m.EnableKeyword ("QUALITY_FAST");
                    m.DisableKeyword("QUALITY_MEDIUM");
                    m.DisableKeyword("QUALITY_HIGH");
                    break;
                case Sample.Medium:
                    m.DisableKeyword("QUALITY_FAST");
                    m.EnableKeyword ("QUALITY_MEDIUM");
                    m.DisableKeyword("QUALITY_HIGH");
                    break;
                case Sample.High:
                    m.DisableKeyword("QUALITY_FAST");
                    m.DisableKeyword("QUALITY_MEDIUM");
                    m.EnableKeyword ("QUALITY_HIGH");
                    break;
            }
        }
        else
        {
            m.DisableKeyword("ENABLE_SHADOW");
        }

        return m;
    }
开发者ID:robterrell,项目名称:MassParticle,代码行数:55,代码来源:MPLightRenderer.cs

示例7: 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;
 }
开发者ID:apekshadarbari,项目名称:PokerFace,代码行数:11,代码来源:NVRHelpers.cs

示例8: 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;
 }
开发者ID:jrand35,项目名称:AmazingRPG,代码行数:11,代码来源:Comb.cs

示例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;
 }
开发者ID:DarkDecaydence,项目名称:MGAE_4D-Puzzle,代码行数:11,代码来源:ParentFourthDimensional.cs

示例10: setMaterialToOpaque

 private void setMaterialToOpaque(Material m)
 {
     m.SetFloat("_Mode", 0);
     m.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
     m.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
     m.SetInt("_ZWrite", 1);
     m.DisableKeyword("_ALPHATEST_ON");
     m.DisableKeyword("_ALPHABLEND_ON");
     m.DisableKeyword("_ALPHAPREMULTIPLY_ON");
     m.renderQueue = m.shader.renderQueue;
 }
开发者ID:DarkDecaydence,项目名称:MGAE_4D-Puzzle,代码行数:11,代码来源:ParentFourthDimensional.cs

示例11: 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;
 }
开发者ID:TomorrowTodayLabs,项目名称:VRInteraction,代码行数:11,代码来源:VRIHelpers.cs

示例12: 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;
 }
开发者ID:jrand35,项目名称:AmazingRPG,代码行数:11,代码来源:Comb.cs

示例13: 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));
 }
开发者ID:RuslanAhmetsharipov,项目名称:TalkingHead,代码行数:12,代码来源:MaterialChanging.cs

示例14: CreateMaterial

 void CreateMaterial()
 {
     var shader = Shader.Find("Hidden/Internal-Colored");
     mat = new Material(shader);
     mat.hideFlags = HideFlags.HideAndDontSave;
     mat.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.OneMinusDstColor);
     mat.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
     // Turn off backface culling, depth writes, depth test.
     mat.SetInt("_Cull", (int)UnityEngine.Rendering.CullMode.Off);
     mat.SetInt("_ZWrite", 0);
     mat.SetInt("_ZTest", (int)UnityEngine.Rendering.CompareFunction.Always);
 }
开发者ID:cupsster,项目名称:drawLine,代码行数:12,代码来源:VertexLine.cs

示例15: 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;
 }
开发者ID:youdiaozi,项目名称:PokeVive,代码行数:12,代码来源:Calibration.cs


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