Esempio n. 1
0
        private void LoadTexturePatternGroup(BxlytMaterial mat, LytTexturePatternGroup group)
        {
            for (int i = 0; i < 1; i++)
            {
                if (group.GetTrack(i).HasKeys)
                {
                    var track  = group.GetTrack(i);
                    var value  = track.GetFrameValue(Frame, StartFrame);
                    var target = (LTPTarget)i;

                    if (Textures.Count > value && value >= 0)
                    {
                        string texName = Textures[(int)value];

                        if (!mat.animController.TexturePatterns.ContainsKey(target))
                        {
                            mat.animController.TexturePatterns.Add(target, texName);
                        }
                        else
                        {
                            mat.animController.TexturePatterns[target] = texName;
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        public LytAnimGroup(BxlanPaiEntry entry)
        {
            animEntry = entry;
            Name      = entry.Name;
            if (entry.Target == AnimationTarget.Material)
            {
                Category = "Materials";
            }
            else if (entry.Target == AnimationTarget.Pane)
            {
                Category = "Panes";
            }
            else
            {
                Category = "User Data";
            }

            //Generate sub groups which contain the track data
            for (int i = 0; i < entry.Tags?.Count; i++)
            {
                STAnimGroup group = new STAnimGroup();
                string      tag   = entry.Tags[i].Tag.Remove(0, 1);
                switch (tag)
                {
                case "LPA":
                    group = new LytPaneSRTGroup(entry.Tags[i]);
                    break;

                case "LVI":
                    group = new LytVisibiltyGroup(entry.Tags[i]);
                    break;

                case "LTS":
                    group = new LytTextureSRTGroup(entry.Tags[i]);
                    break;

                case "LVC":
                    group = new LytVertexColorGroup(entry.Tags[i]);
                    break;

                case "LMC":
                    group = new LytMaterialColorGroup(entry.Tags[i]);
                    break;

                case "LIM":
                    group = new LytIndirectSRTGroup(entry.Tags[i]);
                    break;

                case "LTP":
                    group = new LytTexturePatternGroup(entry.Tags[i]);
                    break;

                case "LAC":
                    group = new LytAlphaTestGroup(entry.Tags[i]);
                    break;

                case "LCT":
                    group = new LytFontShadowGroup(entry.Tags[i]);
                    break;

                case "LCC":
                    group = new LytPerCharacterTransformCurveGroup(entry.Tags[i]);
                    break;
                }

                foreach (var keyGroup in entry.Tags[i].Entries)
                {
                    if (!(group is IAnimationTarget))
                    {
                        continue;
                    }

                    var targetGroup = ((IAnimationTarget)group).GetTrack(keyGroup.AnimationTarget);
                    if (targetGroup != null)
                    {
                        targetGroup.LoadKeyFrames(keyGroup.KeyFrames);
                        targetGroup.Name = keyGroup.TargetName;

                        if (keyGroup.CurveType == CurveType.Constant)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Constant;
                        }
                        else if (keyGroup.CurveType == CurveType.Hermite)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Hermite;
                        }
                        else if (keyGroup.CurveType == CurveType.Step)
                        {
                            targetGroup.InterpolationType = STInterpoaltionType.Step;
                        }
                    }
                    else
                    {
                        Console.WriteLine($"Unsupported track type for tag {keyGroup.TargetName} {keyGroup.AnimationTarget}");
                    }
                }

                group.Name = entry.Tags[i].Type;
                SubAnimGroups.Add(group);
            }
        }