本文整理汇总了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
}