Beispiel #1
0
 RecordCoordinates GetRecordCoordinates(DebugCostAggregate.Record record, TimelineWidget.DrawInfo drawInfo)
 {
     return(new RecordCoordinates()
     {
         startX = ClampPosX((int)math.round(drawInfo.GetPixelPosition(record.startTime) - drawInfo.timeline.drawRect.x)),
         endX = ClampPosX((int)math.round(drawInfo.GetPixelPosition(record.endTime) - drawInfo.timeline.drawRect.x)),
         poseY = ClampPosY((int)math.round(math.min(record.poseCost / m_MaxCost, 1.0f) * m_CacheTexture.height)),
         trajectoryY = record.trajectoryCost >= 0.0f ? ClampPosY((int)math.round(math.min(record.trajectoryCost / m_MaxCost, 1.0f) * m_CacheTexture.height)) : -1
     });
 }
Beispiel #2
0
        void DrawCostTimeline(int queryIdentifier, DebugCostAggregate aggregate, TimelineWidget.DrawInfo drawInfo)
        {
            m_MouseTime = GetMouseTime(drawInfo);
            m_MouseCost = -1.0f;

            (DebugCostAggregate.Record, RecordCoordinates) ? prevRecord = null;

            m_MaxCost = kDefaultMaxCost;

            for (int index = 0; index < aggregate.NumRecords; ++index)
            {
                DebugCostAggregate.Record record = aggregate.GetRecord(index);

                if (record.queryIdentifier != queryIdentifier ||
                    record.endTime <= drawInfo.timeline.startTime)
                {
                    continue;
                }

                if (record.startTime >= drawInfo.timeline.endTime)
                {
                    break;
                }

                m_MaxCost = math.max(m_MaxCost, record.poseCost);
                if (record.trajectoryCost >= 0.0f)
                {
                    m_MaxCost = math.max(m_MaxCost, record.TotalCost);
                }

                if (m_MouseTime >= 0.0f && m_MouseTime >= record.startTime && m_MouseTime <= record.endTime)
                {
                    if (m_bDisplayTotalCost)
                    {
                        m_MouseCost = record.TotalCost;
                    }
                    else if (m_bDisplayPoseCost)
                    {
                        m_MouseCost = record.poseCost;
                    }
                    else if (m_bDisplayTrajectoryCost)
                    {
                        m_MouseCost = record.trajectoryCost;
                    }
                    else
                    {
                        m_MouseCost = -1.0f;
                    }
                }
            }

            for (int index = 0; index < aggregate.NumRecords; ++index)
            {
                DebugCostAggregate.Record record = aggregate.GetRecord(index);

                if (record.queryIdentifier != queryIdentifier ||
                    record.endTime <= drawInfo.timeline.startTime)
                {
                    continue;
                }

                if (record.startTime >= drawInfo.timeline.endTime)
                {
                    break;
                }

                RecordCoordinates recordCoordinates = GetRecordCoordinates(record, drawInfo);

                if (prevRecord.HasValue && prevRecord.Value.Item1.endTime == record.startTime)
                {
                    DrawRecord(recordCoordinates, prevRecord.Value.Item2, drawInfo);
                }
                else
                {
                    DrawRecord(recordCoordinates, drawInfo);
                }
                prevRecord = (record, recordCoordinates);
            }
        }