UnityEngine.Material.SetVector C# (CSharp) Method

SetVector() public method

Set a named vector value.

public SetVector ( int nameID, Vector4 vector ) : void
nameID int Property name ID, use Shader.PropertyToID to get it.
vector Vector4 Vector value to set.
return void
        public void SetVector(int nameID, Vector4 vector)
        {
            this.SetColor(nameID, new Color(vector.x, vector.y, vector.z, vector.w));
        }

Same methods

Material::SetVector ( string propertyName, Vector4 vector ) : void

Usage Example

示例#1
0
文件: Init.cs 项目: TheMunro/space
	void InitMaterial(Material mat)
	{
		Vector3 invWaveLength4 = new Vector3(1.0f / Mathf.Pow(m_waveLength.x, 4.0f), 1.0f / Mathf.Pow(m_waveLength.y, 4.0f), 1.0f / Mathf.Pow(m_waveLength.z, 4.0f));
		float scale = 1.0f / (m_outerRadius - m_innerRadius);

		mat.SetVector("v3LightPos", m_sun.transform.forward*-1.0f);
		mat.SetVector("v3InvWavelength", invWaveLength4);
		mat.SetFloat("fOuterRadius", m_outerRadius);
		mat.SetFloat("fOuterRadius2", m_outerRadius*m_outerRadius);
		mat.SetFloat("fInnerRadius", m_innerRadius);
		mat.SetFloat("fInnerRadius2", m_innerRadius*m_innerRadius);
		mat.SetFloat("fKrESun", m_kr*m_ESun);
		mat.SetFloat("fKmESun", m_km*m_ESun);
		mat.SetFloat("fKr4PI", m_kr*4.0f*Mathf.PI);
		mat.SetFloat("fKm4PI", m_km*4.0f*Mathf.PI);
		mat.SetFloat("fScale", scale);
		mat.SetFloat("fScaleDepth", m_scaleDepth);
		mat.SetFloat("fScaleOverScaleDepth", scale/m_scaleDepth);
		mat.SetFloat("fHdrExposure", m_hdrExposure);
		mat.SetFloat("g", m_g);
		mat.SetFloat("g2", m_g*m_g);
		mat.SetVector("v3LightPos", m_sun.transform.forward*-1.0f);
		mat.SetVector("v3Translate", transform.localPosition);

	}
All Usage Examples Of UnityEngine.Material::SetVector