Beispiel #1
0
 void IGroundTruthGenerator.SetupMaterialProperties(MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
 {
     if (m_IdLabelConfig.TryGetMatchingConfigurationEntry(labeling, out _, out var index))
     {
         if (m_InstanceIdToLabelEntryIndexLookup.Length <= instanceId)
         {
             m_InstanceIdToLabelEntryIndexLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory);
         }
         m_InstanceIdToLabelEntryIndexLookup[(int)instanceId] = (ushort)index;
     }
 }
Beispiel #2
0
        void IGroundTruthGenerator.SetupMaterialProperties(MaterialPropertyBlock mpb, Renderer renderer, Labeling labeling, uint instanceId)
        {
            if (m_IdLabelConfig.TryGetMatchingConfigurationEntry(labeling, out _, out var index))
            {
                m_DefaultValue = ushort.MaxValue;
                Debug.Assert(index < m_DefaultValue, "Too many entries in the label config");
                if (m_InstanceIdToLabelEntryIndexLookup.Length <= instanceId)
                {
                    var oldLength = m_InstanceIdToLabelEntryIndexLookup.Length;
                    m_InstanceIdToLabelEntryIndexLookup.Resize((int)instanceId + 1, NativeArrayOptions.ClearMemory);

                    for (int i = oldLength; i < instanceId; i++)
                    {
                        m_InstanceIdToLabelEntryIndexLookup[i] = m_DefaultValue;
                    }
                }
                m_InstanceIdToLabelEntryIndexLookup[(int)instanceId] = (ushort)index;
            }
        }