浏览代码
Fixing labeling on per-material MaterialPropertyBlocks (#73)
Fixing labeling on per-material MaterialPropertyBlocks (#73)
* Fixing labeling when renderers have per-material MaterialPropertyBlocks. Also supporting refreshing labeling manually after making changes to renderers or the Labeling component. * updating changelog/main
GitHub
4 年前
当前提交
bca49aeb
共有 10 个文件被更改,包括 199 次插入 和 11 次删除
-
36TestProjects/PerceptionURP/Assets/Scenes/SampleScene.unity
-
2TestProjects/PerceptionURP/ProjectSettings/QualitySettings.asset
-
4com.unity.perception/CHANGELOG.md
-
19com.unity.perception/Runtime/GroundTruth/GroundTruthLabelSetupSystem.cs
-
11com.unity.perception/Runtime/GroundTruth/Labeling/Labeling.cs
-
70com.unity.perception/Tests/Runtime/GroundTruthTests/SegmentationGroundTruthTests.cs
-
18com.unity.perception/Tests/Runtime/GroundTruthTests/TestHelper.cs
-
8TestProjects/PerceptionURP/Assets/Scenes/SampleScene.meta
-
31TestProjects/PerceptionURP/Assets/TestMpbPerMaterial.cs
-
11TestProjects/PerceptionURP/Assets/TestMpbPerMaterial.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: c63d11a708fe3f047a545d7e457f6e81 |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEngine; |
|||
|
|||
public enum MaterialPropertyTarget |
|||
{ |
|||
Renderer, |
|||
Material |
|||
} |
|||
[ExecuteInEditMode] |
|||
public class TestMpbPerMaterial : MonoBehaviour |
|||
{ |
|||
public MaterialPropertyTarget materialPropertyTarget = MaterialPropertyTarget.Material; |
|||
public Color color; |
|||
// Update is called once per frame
|
|||
void Start() |
|||
{ |
|||
var meshRenderer = GetComponent<MeshRenderer>(); |
|||
MaterialPropertyBlock mpb = new MaterialPropertyBlock(); |
|||
mpb.SetColor("_BaseColor", color); |
|||
if (materialPropertyTarget == MaterialPropertyTarget.Renderer) |
|||
meshRenderer.SetPropertyBlock(mpb); |
|||
else |
|||
{ |
|||
for (int i = 0; i < meshRenderer.sharedMaterials.Length; i++) |
|||
{ |
|||
meshRenderer.SetPropertyBlock(mpb, i); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 695e410829600ff40bcdd76fa0818f6a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue