Example #1
0
        private void ProcessMaterialKeyFrames(IList <MaterialAnimationKeyFrame> frames)
        {
            if (frames == null || frames.Count == 0)
            {
                return;
            }

            processedMaterialFrameGroups = new LightList <ProcessedMaterialKeyFrameGroup>();
            // todo -- ensure we release lists where we need to
            // todo -- dont use a list each processed frame group, use a single list sorted sensibly
            for (int i = 0; i < frames.Count; i++)
            {
                MaterialAnimationKeyFrame f          = frames[i];
                MaterialKeyFrameValue[]   properties = f.properties;

                for (int j = 0; j < f.properties.Length; j++)
                {
                    AddMaterialKeyFrame(f.key, properties[j]);
                }
            }

            for (int i = 0; i < processedMaterialFrameGroups.Count; i++)
            {
                MaterialPropertyId property = processedMaterialFrameGroups[i].materialIdPair;

                LightList <ProcessedMaterialKeyFrame> processedKeyFrames = processedMaterialFrameGroups[i].frames;

                processedKeyFrames.Sort(s_MaterialKeyFrameSorter);

                if (processedKeyFrames[0].time != 0f)
                {
                    processedKeyFrames.Insert(0, new ProcessedMaterialKeyFrame(0f, default));
                }
            }
        }
 public ProcessedMaterialKeyFrameGroup(MaterialPropertyId materialIdPair, LightList <ProcessedMaterialKeyFrame> frames)
 {
     this.materialIdPair = materialIdPair;
     this.frames         = frames;
 }