本文整理匯總了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);
}
示例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);
}
示例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));
}
示例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
}
示例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
}