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


C# MaterialPropertyBlock.AddColor方法代码示例

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


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

示例1: Awake

	void Awake()
	{
		mb = new MaterialPropertyBlock();
		mb.AddColor("_Color",newColor);
		mb.AddColor("_TintColor",newColor);

		this.transform.renderer.SetPropertyBlock(mb);
	}
开发者ID:marcteys,项目名称:trauts,代码行数:8,代码来源:SetThisColor.cs

示例2: Awake

	void Awake()
	{
		mb = new MaterialPropertyBlock();
		mb.AddColor("_Color",newColor);
		mb.AddColor("_TintColor",newColor);

		foreach (Transform child in transform)
		{
			child.renderer.SetPropertyBlock(mb);
		}
	}
开发者ID:marcteys,项目名称:trauts,代码行数:11,代码来源:SetChildColor.cs

示例3: SetColor

	public void SetColor(Color col)
	{
		mb = new MaterialPropertyBlock();
		mb.AddColor("_Color",col);
		mb.AddColor("_TintColor",col);
		
		foreach (Transform child in transform)
		{
			child.renderer.SetPropertyBlock(mb);
		}
	}
开发者ID:marcteys,项目名称:trauts,代码行数:11,代码来源:SetChildColor.cs

示例4: SetColor

	public void SetColor(Color col)
	{

		mb = new MaterialPropertyBlock();

		foreach (Transform child in transform)
		{	
			//col.a = (1-child.localPosition.y*6)/2f;
			
			mb.AddColor("_Color",col);
			mb.AddColor("_TintColor",col);

			child.renderer.SetPropertyBlock(mb);
		}
	}
开发者ID:marcteys,项目名称:trauts,代码行数:15,代码来源:SetHologramColor.cs

示例5: DrawCube

	public static void DrawCube(Vector3 position, Quaternion rotation, float size, Color color)
	{
		Matrix4x4 mat = Matrix4x4.TRS(position, rotation, size * Vector3.one);
		MaterialPropertyBlock block = new MaterialPropertyBlock();
		block.AddColor("_Color", color);
		Graphics.DrawMesh(solidCube, mat, material, 0, null, 0, block);
	}
开发者ID:Deus0,项目名称:Zeltex,代码行数:7,代码来源:DebugDraw.cs

示例6: DrawSphere

	public static void DrawSphere(Vector3 position, float radius, Color color)
	{
		Matrix4x4 mat = Matrix4x4.TRS(position, Quaternion.identity, radius * 0.5f * Vector3.one);
		MaterialPropertyBlock block = new MaterialPropertyBlock();
		block.AddColor("_Color", color);
		Graphics.DrawMesh(solidSphere, mat, material, 0, null, 0, block);
	}
开发者ID:Deus0,项目名称:Zeltex,代码行数:7,代码来源:DebugDraw.cs

示例7: Awake

	void Awake()
	{
		mb = new MaterialPropertyBlock();
		mb.AddTexture("_MainTex",texture);

		foreach (Transform child in transform)
		{	defaultColor = child.renderer.material.color;


			Color newColor = defaultColor;
			//newColor.a = (1-child.localPosition.y*8)/2f;
			mb.AddColor("_Color",newColor);
			mb.AddColor("_TintColor",newColor);

			child.renderer.SetPropertyBlock(mb);
			child.renderer.material.SetTexture("_MainTex", texture);
		}
	}
开发者ID:marcteys,项目名称:trauts,代码行数:18,代码来源:SetHologramColor.cs

示例8: AddToMaterialPropertyBlock

 public void AddToMaterialPropertyBlock(MaterialPropertyBlock block)
 {
     UIPanelMaterialPropertyBlock.Node node = this.first;
     int num = this.count;
     while (true)
     {
         int num1 = num;
         num = num1 - 1;
         if (num1 <= 0)
         {
             break;
         }
         switch (node.type)
         {
             case UIPanelMaterialPropertyBlock.PropType.Float:
             {
                 block.AddFloat(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Vector:
             {
                 block.AddVector(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Color:
             {
                 block.AddColor(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Matrix:
             {
                 block.AddMatrix(node.property, [email protected]);
                 break;
             }
         }
         node = node.next;
     }
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:38,代码来源:UIPanelMaterialPropertyBlock.cs

示例9: Update

        // Update is called once per frame
        void Update()
        {
            m_playCenter = UserProfile.SafeAreaCenter;
            m_playRadius = UserProfile.SafeAreaRadius;

            for (int i = 0; i < m_warning.Length; i++)
            {
                var w = m_warning[i];
                float wdist = m_warnDistance;

                Vector3 center = transform.position + transform.rotation * m_playCenter;

                Vector3 track;
                Quaternion r;

                if (i == 0)
                {
                    m_solver.GetTrackerTransform(Tracker.LEFT, out track, out r);
                    var con = m_avatar.GetInput(Tracker.LEFT);
                    if (con == null)
                    {
                        w.enabled = false;
                        continue;
                    }
                    w.transform.localScale = Vector3.one * 0.5f;
                    wdist *= 0.5f;
                }
                else if (i == 1)
                {
                    m_solver.GetTrackerTransform(Tracker.RIGHT, out track, out r);
                    var con = m_avatar.GetInput(Tracker.RIGHT);
                    if (con == null)
                    {
                        w.enabled = false;
                        continue;
                    }
                    w.transform.localScale = Vector3.one * 0.5f;
                    wdist *= 0.5f;
                }
                else
                {
                    var con = m_avatar.GetInput(Tracker.HEAD);
                    if (con == null)
                    {
                        w.enabled = false;
                        continue;
                    }
                    m_solver.GetEyeTransform(out track, out r);
                    w.transform.localScale = Vector3.one * 1f;
                }

                Vector3 delta = track - center;

                delta.y = 0;

                float dist = m_playRadius * m_playRadius - delta.sqrMagnitude;
                float t = 1f - dist / (m_playRadius * m_playRadius);

                if (t > 0.1f && m_playRadius != 0)
                {
                    w.enabled = true;

                    delta.Normalize();

                    Vector3 pos = delta * m_playRadius + center;
                    pos.y = track.y;

                    w.transform.position = pos;
                    w.transform.LookAt(track);

                    float heading = Mathf.Atan(delta.z / delta.x);
                    if (delta.x < 0)
                        heading += Mathf.PI;

                    float arc = heading * m_playRadius;
                    float height = pos.y;

                    if (t > 1)
                    {
                        arc *= -1;
                    }

                    float bright = wdist - dist;
                    MaterialPropertyBlock block = new MaterialPropertyBlock();

                    if (t > 1 && i == 2)
                        block.AddColor("_TintColor", new Color(0, 1, 0, 0.1f));
                    else
                        block.AddColor("_TintColor", new Color(1, 0, 0, Mathf.Clamp01(bright) * 0.75f));

                    block.AddVector("_GridOffset", new Vector4(arc, height, w.transform.lossyScale.x, w.transform.lossyScale.y));

                    w.SetPropertyBlock(block);
                }
                else
                    w.enabled = false;
            }
        }
开发者ID:hazzed,项目名称:Smackitball-the-game-,代码行数:99,代码来源:BoundaryFence.cs

示例10: IssueDrawCall

        protected override void IssueDrawCall()
        {
            if (m_cb == null)
            {
                m_cb = new CommandBuffer();
                m_cb.name = "MPLightRenderer";
                foreach (var c in m_cameras)
                {
                    if (c != null) c.AddCommandBuffer(CameraEvent.AfterLighting, m_cb);
                }

                m_mpb = new MaterialPropertyBlock();
                m_mpb.AddColor("_Color", GetLinearColor());

            }
            m_cb.Clear();

            if (m_hdr)
            {
                m_cb.SetRenderTarget(BuiltinRenderTextureType.CameraTarget);
            }
            else
            {
                m_cb.SetRenderTarget(BuiltinRenderTextureType.GBuffer3);
            }
            m_mpb.SetColor("_Color", GetLinearColor());
            m_mpb.SetFloat("g_size", m_size);
            m_mpb.SetFloat("_OcculusionStrength", m_occulusion_strength);
            m_mpb.SetColor("_HeatColor", GetLinearHeatColor());
            m_mpb.SetFloat("_HeatThreshold", m_heat_threshold);

            Matrix4x4 matrix = Matrix4x4.identity;
            m_actual_materials.ForEach(a =>
            {
                for (int i = 0; i < m_batch_count; ++i)
                {
                    m_cb.DrawMesh(m_expanded_mesh, matrix, a[i], 0, 0, m_mpb);
                }
            });
        }
开发者ID:davidlawson,项目名称:ggj2016,代码行数:40,代码来源:MPLightRenderer.cs


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