void OnRenderedObjectInfosCalculated(int frameCount, NativeArray <RenderedObjectInfo> renderedObjectInfos) { if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation)) { return; } m_AsyncAnnotations.Remove(frameCount); using (s_BoundingBoxCallback.Auto()) { if (m_BoundingBoxValues == null || m_BoundingBoxValues.Length != renderedObjectInfos.Length) { m_BoundingBoxValues = new BoundingBoxValue[renderedObjectInfos.Length]; } for (var i = 0; i < renderedObjectInfos.Length; i++) { var objectInfo = renderedObjectInfos[i]; if (!idLabelConfig.TryGetLabelEntryFromInstanceId(objectInfo.instanceId, out var labelEntry)) { continue; } m_BoundingBoxValues[i] = new BoundingBoxValue { label_id = labelEntry.id, label_name = labelEntry.label, instance_id = objectInfo.instanceId, x = objectInfo.boundingBox.x, y = objectInfo.boundingBox.y, width = objectInfo.boundingBox.width, height = objectInfo.boundingBox.height, }; } if (!CaptureOptions.useAsyncReadbackIfSupported && frameCount != Time.frameCount) { Debug.LogWarning("Not on current frame: " + frameCount + "(" + Time.frameCount + ")"); } if (visualizationEnabled) { Visualize(); } asyncAnnotation.ReportValues(m_BoundingBoxValues); } }
void OnRenderedObjectInfosCalculated(int frameCount, NativeArray <RenderedObjectInfo> renderedObjectInfos) { if (!m_AsyncAnnotations.TryGetValue(frameCount, out var asyncAnnotation)) { return; } m_AsyncAnnotations.Remove(frameCount); using (s_BoundingBoxCallback.Auto()) { if (m_BoundingBoxValues == null || m_BoundingBoxValues.Length != renderedObjectInfos.Length) { m_BoundingBoxValues = new BoundingBoxValue[renderedObjectInfos.Length]; } for (var i = 0; i < renderedObjectInfos.Length; i++) { var objectInfo = renderedObjectInfos[i]; if (!idLabelConfig.TryGetLabelEntryFromInstanceId(objectInfo.instanceId, out var labelEntry)) { continue; } m_BoundingBoxValues[i] = new BoundingBoxValue { label_id = labelEntry.id, label_name = labelEntry.label, instance_id = objectInfo.instanceId, x = objectInfo.boundingBox.x, y = objectInfo.boundingBox.y, width = objectInfo.boundingBox.width, height = objectInfo.boundingBox.height, }; } asyncAnnotation.ReportValues(m_BoundingBoxValues); } }