public InverseKinematicsPerformanceDemo()
    {
        var figureDir = UnpackedArchiveDirectory.Make(new System.IO.DirectoryInfo("work/figures/genesis-3-female"));

        var channelSystemRecipe = Persistance.Load <ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat"));

        channelSystem = channelSystemRecipe.Bake(null);

        var boneSystemRecipe = Persistance.Load <BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat"));

        boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName);

        var inverterParameters = Persistance.Load <InverterParameters>(figureDir.File("inverter-parameters.dat"));

        rigidBoneSystem = new RigidBoneSystem(boneSystem);

        goalProvider = new DemoInverseKinematicsGoalProvider(rigidBoneSystem);
        solver       = new HarmonicInverseKinematicsSolver(rigidBoneSystem, inverterParameters.BoneAttributes);

        var pose          = Persistance.Load <List <Pose> >(figureDir.File("animations/idle.dat"))[0];
        var channelInputs = channelSystem.MakeDefaultChannelInputs();

        new Poser(channelSystem, boneSystem).Apply(channelInputs, pose, DualQuaternion.Identity);
        var channelOutputs = channelSystem.Evaluate(null, channelInputs);

        rigidBoneSystem.Synchronize(channelOutputs);
        initialInputs = rigidBoneSystem.ReadInputs(channelOutputs);
    }
Exemple #2
0
    public static Shape LoadDefault(ChannelSystem channelSystem, IArchiveDirectory figureDirectory)
    {
        var channelInputsFile = figureDirectory.File("channel-inputs.dat");
        var channelInputs     = channelInputsFile != null?
                                LoadChannelInputs(channelSystem, channelInputsFile) :
                                    channelSystem.MakeDefaultChannelInputs();

        var parentOverridesFile = figureDirectory.File("parent-overrides.dat");
        var parentOverrides     = LoadParentOverrides(channelSystem, parentOverridesFile);

        return(new Shape(DefaultLabel, null, channelInputs, parentOverrides));
    }
Exemple #3
0
    private static ChannelInputs LoadChannelInputs(ChannelSystem channelSystem, IArchiveFile channelInputsFile)
    {
        var shapeInputsByName = Persistance.Load <Dictionary <string, double> >(channelInputsFile);

        ChannelInputs channelInputs = channelSystem.MakeDefaultChannelInputs();

        foreach (var entry in shapeInputsByName)
        {
            Channel channel = channelSystem.ChannelsByName[entry.Key];
            channel.SetValue(channelInputs, entry.Value);
        }

        return(channelInputs);
    }
Exemple #4
0
    public BoneSystemPerformanceDemo()
    {
        var figureDir = UnpackedArchiveDirectory.Make(new System.IO.DirectoryInfo("work/figures/genesis-3-female"));

        var channelSystemRecipe = Persistance.Load <ChannelSystemRecipe>(figureDir.File("channel-system-recipe.dat"));

        channelSystem = channelSystemRecipe.Bake(null);

        var boneSystemRecipe = Persistance.Load <BoneSystemRecipe>(figureDir.File("bone-system-recipe.dat"));

        boneSystem = boneSystemRecipe.Bake(channelSystem.ChannelsByName);

        var pose = Persistance.Load <List <Pose> >(figureDir.File("animations/idle.dat"))[0];

        inputs = channelSystem.MakeDefaultChannelInputs();
        new Poser(channelSystem, boneSystem).Apply(inputs, pose, DualQuaternion.Identity);
    }
 public ChannelInputs MakeDefaultChannelInputs()
 {
     return(channelSystem.MakeDefaultChannelInputs());
 }