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


C# Material.SetVector方法代码示例

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


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

示例1: InitPortraitProperties

 private void InitPortraitProperties(ref Material material)
 {
     material.SetVector("_Center", Center);
     material.SetVector("_Scale", Scale);
     material.SetVector("_ScaleIn", ScaleIn);
     material.SetVector("_HmdWarpParam", new Vector4(K0, K1, K2, 0));
 }
开发者ID:xyhak47,项目名称:learn_unity,代码行数:7,代码来源:IVRPostEffect.cs

示例2: InitMaterial

	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);

	}
开发者ID:TheMunro,项目名称:space,代码行数:25,代码来源:Init.cs

示例3: SetMatrix

 static void SetMatrix(Material material)
 {
     var r = material.GetVector("_Euler");
     var q = Quaternion.Euler(r.x, r.y, r.z);
     var m = Matrix4x4.TRS(Vector3.zero, q, Vector3.one);
     material.SetVector("_Rotation1", m.GetRow(0));
     material.SetVector("_Rotation2", m.GetRow(1));
     material.SetVector("_Rotation3", m.GetRow(2));
 }
开发者ID:esther5576,项目名称:SW-game-project,代码行数:9,代码来源:CubemapMaterialEditor.cs

示例4: InitMaterial

    void InitMaterial(Material mat)
    {
        mat.SetTexture("_Transmittance", m_transmittance);
        mat.SetTexture("_Inscatter", m_inscatter);

        mat.SetFloat("SUN_INTENSITY", m_sunIntensity);
        mat.SetVector("SUN_DIR", m_sun.transform.forward*-1.0f);

        //Dont change this
        mat.SetVector("EARTH_POS", new Vector3(0.0f, 6360010.0f, 0.0f));
    }
开发者ID:Togene,项目名称:BeCalm,代码行数:11,代码来源:Sky.cs

示例5: Start

 private void Start()
 {
     Debug.Assert(_chargeSpeed > 0f);
     Material mat = new Material(Shader.Find(_shaderName));
     _citizenBodyRenderer.material = mat;
     _currThres = _bottomThres;
     mat.SetVector("_PlanePos", new Vector4(_planeHeight, 0, 0, 1));
     mat.SetVector("_PlaneNormal", new Vector4(-1, 0, 0, 0));
     mat.SetFloat("_ThresDist", _currThres);
     mat.SetTexture("_BeforeTex", VFXManager.Instance.RandomRiotTex());
     mat.SetTexture("_AfterTex", _afterTex);
 }
开发者ID:MangoSister,项目名称:PunkRising,代码行数:12,代码来源:CitizenChargeFX.cs

示例6: UpdateVisibility

 IEnumerator UpdateVisibility(Material FogMat)
 {
     while (active)
     {
         FogMat.SetVector(puckPos, _puck.position);
         for (int i = 0; i < _allies.Count; i++)
         {
             FogMat.SetVector(witchPos[i], _allies[i].position);
         }
         yield return null;
     }
 }
开发者ID:AlbearKamoo,项目名称:Witches-vs-Aliens-2015-2016,代码行数:12,代码来源:FogSuper.cs

示例7: Start

        //        protected override void Start()
        public override void Start()
        {
            base.Start();

            m_initJacobiansMat=new Material(ShaderTool.GetMatFromShader2("CompiledInitJacobians.shader"));
            m_whiteCapsPrecomputeMat=new Material(ShaderTool.GetMatFromShader2("CompiledWhiteCapsPrecompute.shader"));

            m_initJacobiansMat.SetTexture("_Spectrum01", m_spectrum01);
            m_initJacobiansMat.SetTexture("_Spectrum23", m_spectrum23);
            m_initJacobiansMat.SetTexture("_WTable", m_WTable);
            m_initJacobiansMat.SetVector("_Offset", m_offset);
            m_initJacobiansMat.SetVector("_InverseGridSizes", m_inverseGridSizes);
        }
开发者ID:rbray89,项目名称:Scatterer,代码行数:14,代码来源:OceanWhiteCaps.cs

示例8: Start

 private void Start()
 {
     Debug.Assert(_chargeSpeed > 0f);
     Material mat = new Material(Shader.Find(_shaderName));
     _guitarBodyRenderer.material = mat;
     _currHeight = _bottomHeight;
     mat.SetVector("_PlanePos", new Vector4(0, _bottomHeight, 0, 1));
     mat.SetVector("_PlaneNormal", new Vector4(0, 1, 0, 0));
     mat.SetFloat("_ThresDist", _currHeight);
     mat.SetTexture("_MainTex", _guitarBodyTex);
     mat.SetFloat("_EmissionSwitch", 0f);
     mat.SetFloat("_EmissionIntensity", _EmissionIntensity);
 }
开发者ID:MangoSister,项目名称:PunkRising,代码行数:13,代码来源:GuitarChargeFX.cs

示例9: AddOverlay

        private void AddOverlay(TextureSet mTexture, TextureSet dTexture, float altitude, float fadeDistance, float pqsfadeDistance)
        {
            Assembly assembly = Assembly.GetExecutingAssembly();
            string[] resources = assembly.GetManifestResourceNames();

            StreamReader shaderStreamReader = new StreamReader(assembly.GetManifestResourceStream("CityLights.Shaders.Compiled-SphereCityLights.shader"));

            Log("read stream");
            String shaderString = shaderStreamReader.ReadToEnd();
            Material lightMaterial = new Material(shaderString);
            Material pqsLightMaterial = new Material(shaderString);

            lightMaterial.SetTexture("_MainTex", mTexture.Texture);
            lightMaterial.SetTexture("_DetailTex", dTexture.Texture);
            lightMaterial.SetFloat("_DetailScale", dTexture.Scale);
            lightMaterial.SetVector("_DetailOffset", dTexture.Offset);
            lightMaterial.SetFloat("_FadeDist", fadeDistance);
            lightMaterial.SetFloat("_FadeScale", 1);

            pqsLightMaterial.SetTexture("_MainTex", mTexture.Texture);
            pqsLightMaterial.SetTexture("_DetailTex", dTexture.Texture);
            pqsLightMaterial.SetFloat("_DetailScale", dTexture.Scale);
            pqsLightMaterial.SetVector("_DetailOffset", dTexture.Offset);
            pqsLightMaterial.SetFloat("_FadeDist", pqsfadeDistance);
            pqsLightMaterial.SetFloat("_FadeScale", .02f);

            overlayList.Add(Overlay.GeneratePlanetOverlay("Kerbin", altitude, lightMaterial, pqsLightMaterial, mTexture.StartOffset, false, true));
        }
开发者ID:TheTriGeo,项目名称:EnvironmentalVisualEnhancements,代码行数:28,代码来源:CityLights.cs

示例10: Awake

		void Awake()
		{
			MeshFilter mf = GetComponent<MeshFilter>();

			if(mf == null || mf.sharedMesh == null)
				highlightType = HighlightType.Bounds;

			switch( highlightType )
			{
				case HighlightType.Wireframe:
					mesh = GenerateWireframe( mf.sharedMesh );
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_Wireframe);
					break;

				case HighlightType.Bounds:

					Bounds bounds = mf != null && mf.sharedMesh != null ? mf.sharedMesh.bounds : new Bounds(Vector3.zero, Vector3.one);
					mesh = GenerateBounds( bounds );
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_UnlitVertexColor);
					break;

				case HighlightType.Glow:
					mesh = mf.sharedMesh;
					material = pb_BuiltinResource.GetMaterial(pb_BuiltinResource.mat_Highlight);
					break;
			}

			mesh.RecalculateBounds();
			material.SetVector("_Center", mesh.bounds.center);
			
			Graphics.DrawMesh(mesh, transform.localToWorldMatrix, material, 0);
		}
开发者ID:procore3d,项目名称:giles,代码行数:32,代码来源:pb_SelectionHighlight.cs

示例11: OnRestore

 public override void OnRestore()
 {
     if (_material = material)
     {
         _material.SetVector(propertyID, _original);
     }
 }
开发者ID:izaleu,项目名称:Steamplane,代码行数:7,代码来源:TweenMaterialVector.cs

示例12: SetGenericMaterialProperty

	protected void SetGenericMaterialProperty(Material destination, string property_name, object value)
	{
		try{

			ShaderUtil.ShaderPropertyType type = GetPropertyType(destination, property_name);
			switch(type)
			{
			case ShaderUtil.ShaderPropertyType.Color:
				destination.SetColor(property_name, value.UnityBridgeObjectToColor());
				break;
			case ShaderUtil.ShaderPropertyType.Range:
			case ShaderUtil.ShaderPropertyType.Float:
				destination.SetFloat(property_name, value.UnityBridgeObjectToFloat());
				break;
			case ShaderUtil.ShaderPropertyType.Vector:
				destination.SetVector(property_name, value.UnityBridgeObjectToVector());
				break;
			case ShaderUtil.ShaderPropertyType.TexEnv:
				destination.SetTexture(property_name, TextureManager.Instance.ResolveMap( destination.name + "_" + property_name, value));
				break;
			default:
				Debug.Log("Unknown shader type " + type.ToString());
				break;
			}

		}
		catch(KeyNotFoundException e)
		{
			Debug.Log(e.Message);
		}
	}
开发者ID:sebjf,项目名称:maxbridge,代码行数:31,代码来源:MaterialTemplate.cs

示例13: DrawProteinSphereBatches

    public static void DrawProteinSphereBatches(Material renderProteinsMaterial, Camera camera, RenderBuffer colorBuffer, RenderBuffer depthBuffer, int pass, bool animated = false)
    {
        // Protein params
        renderProteinsMaterial.SetInt("_EnableLod", Convert.ToInt32(PersistantSettings.Instance.EnableLod));
        renderProteinsMaterial.SetFloat("_Scale", PersistantSettings.Instance.Scale);
        renderProteinsMaterial.SetFloat("_FirstLevelBeingRange", PersistantSettings.Instance.FirstLevelOffset);
        renderProteinsMaterial.SetVector("_CameraForward", camera.transform.forward);

        renderProteinsMaterial.SetBuffer("_LodLevelsInfos", GPUBuffers.Instance.LodInfo);
        renderProteinsMaterial.SetBuffer("_ProteinInstanceInfo", GPUBuffers.Instance.ProteinInstanceInfo);

        if(animated) renderProteinsMaterial.SetBuffer("_ProteinInstancePositions", GPUBuffers.Instance.ProteinAnimationPositions);
        else renderProteinsMaterial.SetBuffer("_ProteinInstancePositions", GPUBuffers.Instance.ProteinInstancePositions);

        if (animated) renderProteinsMaterial.SetBuffer("_ProteinInstanceRotations", GPUBuffers.Instance.ProteinAnimationRotations);
        else renderProteinsMaterial.SetBuffer("_ProteinInstanceRotations", GPUBuffers.Instance.ProteinInstanceRotations);

        renderProteinsMaterial.SetBuffer("_ProteinAtomCount", GPUBuffers.Instance.ProteinAtomCount);
        renderProteinsMaterial.SetBuffer("_ProteinColors", GPUBuffers.Instance.ProteinColors);
        renderProteinsMaterial.SetBuffer("_ProteinAtomPositions", GPUBuffers.Instance.ProteinAtoms);
        renderProteinsMaterial.SetBuffer("_ProteinClusterPositions", GPUBuffers.Instance.ProteinAtomClusters);
        renderProteinsMaterial.SetBuffer("_ProteinSphereBatchInfos", GPUBuffers.Instance.SphereBatches);

        Graphics.SetRenderTarget(colorBuffer, depthBuffer);
        renderProteinsMaterial.SetPass(pass);
        Graphics.DrawProceduralIndirect(MeshTopology.Points, GPUBuffers.Instance.ArgBuffer);
    }
开发者ID:jaronimoe,项目名称:cellVIEW_animated,代码行数:27,代码来源:RenderUtils.cs

示例14: SetCurrentToFrom

 public void SetCurrentToFrom()
 {
     if (_material = material)
     {
         _material.SetVector(propertyID, from);
     }
 }
开发者ID:izaleu,项目名称:Steamplane,代码行数:7,代码来源:TweenMaterialVector.cs

示例15: CopyMaterialProperties

        /// <summary>
        /// Copy Shader properties from source to destination material.
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static void CopyMaterialProperties(Material source, Material destination)
        {
            MaterialProperty[] source_prop = MaterialEditor.GetMaterialProperties(new Material[] { source });

            for (int i = 0; i < source_prop.Length; i++)
            {
                int property_ID = Shader.PropertyToID(source_prop[i].name);
                if (destination.HasProperty(property_ID))
                {
                    //Debug.Log(source_prop[i].name + "  Type:" + ShaderUtil.GetPropertyType(source.shader, i));
                    switch (ShaderUtil.GetPropertyType(source.shader, i))
                    {
                        case ShaderUtil.ShaderPropertyType.Color:
                            destination.SetColor(property_ID, source.GetColor(property_ID));                          
                            break;
                        case ShaderUtil.ShaderPropertyType.Float:
                            destination.SetFloat(property_ID, source.GetFloat(property_ID));
                            break;
                        case ShaderUtil.ShaderPropertyType.Range:
                            destination.SetFloat(property_ID, source.GetFloat(property_ID));
                            break;
                        case ShaderUtil.ShaderPropertyType.TexEnv:
                            destination.SetTexture(property_ID, source.GetTexture(property_ID));
                            break;
                        case ShaderUtil.ShaderPropertyType.Vector:
                            destination.SetVector(property_ID, source.GetVector(property_ID));
                            break;
                    }
                }
            }

        }
开发者ID:koko11,项目名称:MatrixVR,代码行数:37,代码来源:TMPro_EditorShaderUtilities.cs


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