當前位置: 首頁>>代碼示例>>C#>>正文


C# Renderer.GetPropertyBlock方法代碼示例

本文整理匯總了C#中UnityEngine.Renderer.GetPropertyBlock方法的典型用法代碼示例。如果您正苦於以下問題:C# Renderer.GetPropertyBlock方法的具體用法?C# Renderer.GetPropertyBlock怎麽用?C# Renderer.GetPropertyBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Renderer的用法示例。


在下文中一共展示了Renderer.GetPropertyBlock方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SetupMaterialPropertyBlock

 public static void SetupMaterialPropertyBlock(MaterialProperty materialProp, int changedMask, Renderer target)
 {
   MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock();
   target.GetPropertyBlock(materialPropertyBlock);
   materialProp.WriteToMaterialPropertyBlock(materialPropertyBlock, changedMask);
   target.SetPropertyBlock(materialPropertyBlock);
 }
開發者ID:BlakeTriana,項目名稱:unity-decompiled,代碼行數:7,代碼來源:MaterialAnimationUtility.cs

示例2: Awake

  protected virtual void Awake() {
    _handModel = GetComponent<HandModel>();
    _renderer = GetComponentInChildren<Renderer>();

    _fadePropertyBlock = new MaterialPropertyBlock();
    _renderer.GetPropertyBlock(_fadePropertyBlock);
    _fadePropertyBlock.SetFloat("_Fade", 0);
    _renderer.SetPropertyBlock(_fadePropertyBlock);
  }
開發者ID:CMPUT302-W2016,項目名稱:HCI-Gestures,代碼行數:9,代碼來源:HandFader.cs

示例3: Start

    void Start()
    {
        _rnd = GetComponent<Renderer>();
        _rnd.GetPropertyBlock(_block = new MaterialPropertyBlock());

        _inputs = input.GetPixels();

        _width = input.width;
        _height = input.height;
        _pixelCount = _inputs.Length;
        _texSize = new Vector2(_width, _height);

        output = new Texture2D(_width, _height, TextureFormat.ARGB32, false);
        _outputs = input.GetPixels();
        output.SetPixels(_outputs);
        output.Apply();

        _block.SetTexture(PROP_MAIN_TEX, output);
        _rnd.SetPropertyBlock(_block);
        _mcmc = new MCMC(output, stdDev);

        StartCoroutine (Pinning (0.01f, 200));
    }
開發者ID:nobnak,項目名稱:MCMC,代碼行數:23,代碼來源:TextureModifier.cs

示例4: SetBlendWeight

		//renderer
		public static void SetBlendWeight(Renderer target, float weight) {
			#if USE_PROPERTY_BLOCKS
			if( propBlock == null ) propBlock = new MaterialPropertyBlock();
			else propBlock.Clear();
			//NOTE: this expects the property block to be cleared prior to being called or the weight property will accumulate every frame!
			//MaterialPropertyBlock block = new MaterialPropertyBlock();
			target.GetPropertyBlock(propBlock);
			propBlock.AddFloat("_BlendWeightIBL", weight);
			target.SetPropertyBlock(propBlock);
			#else
			Material[] mats = getTargetMaterials(target);
			foreach(Material mat in mats) {
				mat.SetFloat("_BlendWeightIBL", weight);
			}
			#endif
		}
開發者ID:elephantatwork,項目名稱:Secret-Game,代碼行數:17,代碼來源:Sky.cs

示例5: ApplyFast

		public void ApplyFast(Renderer target, int blendIndex) {
			// Binds IBL data, exposure, and a skybox texture globally or to a specific game object
			#if USE_PROPERTY_BLOCKS
				if(propBlock == null) propBlock = new MaterialPropertyBlock();
				if(blendIndex == 0) {
					propBlock.Clear();
				} else {
					target.GetPropertyBlock(propBlock);						
				}
				ApplyToBlock(ref propBlock, this.blendIDs[blendIndex]);
				target.SetPropertyBlock(propBlock);
			#else
				//SharedMaterials are now used everywhere except through SkyAnchor
				foreach(Material mat in target.sharedMaterials) {
					Apply(mat, blendIndex);
				}				
			#endif
		}
開發者ID:elephantatwork,項目名稱:Secret-Game,代碼行數:18,代碼來源:Sky.cs


注:本文中的UnityEngine.Renderer.GetPropertyBlock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。