本文整理汇总了C#中ViewModel.UpdateMaterials方法的典型用法代码示例。如果您正苦于以下问题:C# ViewModel.UpdateMaterials方法的具体用法?C# ViewModel.UpdateMaterials怎么用?C# ViewModel.UpdateMaterials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewModel
的用法示例。
在下文中一共展示了ViewModel.UpdateMaterials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetReplacementRenderMaterial
private void SetReplacementRenderMaterial(ref ViewModel.MeshInstance.ReplacementRenderer rr, int itsa, Material mat)
{
if (!this.disposed)
{
if (rr.initialized)
{
rr.SetOverride(this.originalMaterials, mat, itsa);
}
else
{
this.legacy = (ViewModel.force_legacy_fallback ? true : this.renderer.sharedMesh.subMeshCount > 1);
rr.Initialize(this.renderer, this.renderer, this.originalMaterials, mat, itsa, this.legacy);
}
Material[] materialArray = rr.UpdateMaterials(this.legacy);
if (!this.legacy)
{
if (materialArray != null)
{
if (rr.offset == 0)
{
rr.offset = (int)this.modifiedMaterials.Length;
Array.Resize<Material>(ref this.modifiedMaterials, (int)this.modifiedMaterials.Length + (int)this.originalMaterials.Length);
}
int num = rr.offset;
for (int i = 0; i < (int)this.originalMaterials.Length; i++)
{
this.modifiedMaterials[num] = materialArray[i];
num++;
}
}
else if (rr.offset != 0)
{
int num1 = rr.offset;
for (int j = rr.offset + (int)this.originalMaterials.Length; j < (int)this.modifiedMaterials.Length; j++)
{
this.modifiedMaterials[num1] = this.modifiedMaterials[j];
num1++;
}
Array.Resize<Material>(ref this.modifiedMaterials, (int)this.modifiedMaterials.Length - (int)this.originalMaterials.Length);
rr.offset = 0;
}
this.renderer.sharedMaterials = this.modifiedMaterials;
}
}
}