mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-26 22:40:27 +00:00
97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Switch_Toolbox.Library.NodeWrappers;
|
|
|
|
namespace Switch_Toolbox.Library.Animations
|
|
{
|
|
public class MaterialAnimation : Animation
|
|
{
|
|
public AnimationType AnimType;
|
|
public enum AnimationType
|
|
{
|
|
ShaderParam,
|
|
Color,
|
|
TextureSrt,
|
|
TexturePattern,
|
|
Visibilty,
|
|
}
|
|
|
|
public virtual void NextFrame(Viewport viewport)
|
|
{
|
|
if (Frame > FrameCount) return;
|
|
}
|
|
|
|
public List<string> Textures = new List<string>();
|
|
public List<Material> Materials = new List<Material>();
|
|
|
|
public class Material : STGenericWrapper
|
|
{
|
|
public List<ParamKeyGroup> Params = new List<ParamKeyGroup>();
|
|
public List<SamplerKeyGroup> Samplers = new List<SamplerKeyGroup>();
|
|
|
|
public Material()
|
|
{
|
|
ImageKey = "material";
|
|
SelectedImageKey = "material";
|
|
}
|
|
public Material(string Name)
|
|
{
|
|
Text = Name;
|
|
ImageKey = "material";
|
|
SelectedImageKey = "material";
|
|
}
|
|
}
|
|
|
|
public class ParamKeyGroup : TreeNodeCustom
|
|
{
|
|
public AnimationType Type;
|
|
|
|
public string UniformName;
|
|
|
|
//Params will have multiple curves for values
|
|
public List<KeyGroup> Values = new List<KeyGroup>();
|
|
}
|
|
|
|
public class SamplerKeyGroup : KeyGroup
|
|
{
|
|
MaterialAnimation MaterialAnimation;
|
|
|
|
public SamplerKeyGroup(MaterialAnimation materialAnimation)
|
|
{
|
|
ImageKey = "sampler";
|
|
SelectedImageKey = "sampler";
|
|
|
|
MaterialAnimation = materialAnimation;
|
|
}
|
|
|
|
public virtual string GetActiveTextureNameByIndex(int index)
|
|
{
|
|
return MaterialAnimation.Textures[(int)index];
|
|
}
|
|
|
|
public virtual string GetActiveTextureNameByFrame(float frame)
|
|
{
|
|
var KeyFrame = GetKeyFrame(frame);
|
|
return MaterialAnimation.Textures[(int)KeyFrame.Value];
|
|
}
|
|
|
|
public virtual void SetActiveTextureName(int Frame, string TextureName)
|
|
{
|
|
if (!MaterialAnimation.Textures.Contains(TextureName))
|
|
MaterialAnimation.Textures.Add(TextureName);
|
|
|
|
int index = MaterialAnimation.Textures.IndexOf(TextureName);
|
|
|
|
SetValue(index, Frame);
|
|
}
|
|
|
|
|
|
|
|
public virtual STGenericTexture GetActiveTexture(int Frame) { return null; }
|
|
}
|
|
}
|
|
}
|