Exemplo n.º 1
0
    private void Run(string[] args)
    {
        ImportSettings settings;

        if (args.Length > 0 && args[0] == "release")
        {
            settings = ImportSettings.MakeReleaseSettings();
        }
        else
        {
            settings = ImportSettings.MakeFromViewerInitialSettings();
        }

        new UiImporter().Run();
        new EnvironmentCubeGenerator().Run(settings);

        OutfitImporter.ImportAll();

        var loader = new FigureRecipeLoader(objectLocator);

        FigureRecipe genesis3FemaleRecipe = loader.LoadFigureRecipe("genesis-3-female", null);
        FigureRecipe genitaliaRecipe      = loader.LoadFigureRecipe("genesis-3-female-genitalia", genesis3FemaleRecipe);
        FigureRecipe genesis3FemaleWithGenitaliaRecipe = new FigureRecipeMerger(genesis3FemaleRecipe, genitaliaRecipe).Merge();
        Figure       genesis3FemaleWithGenitalia       = genesis3FemaleWithGenitaliaRecipe.Bake(null);

        Figure parentFigure = genesis3FemaleWithGenitalia;

        List <Figure> childFigures = settings.FiguresToImport
                                     .Where(figureName => figureName != parentFigure.Name)
                                     .Select(figureName => loader.LoadFigureRecipe(figureName, genesis3FemaleRecipe).Bake(parentFigure))
                                     .ToList();

        List <Figure> figuresToDump = Enumerable.Repeat(parentFigure, 1)
                                      .Concat(childFigures)
                                      .ToList();

        Console.WriteLine($"Dumping parent...");
        AnimationDumper.DumpAllAnimations(parentFigure);

        var textureProcessorSharer = new TextureProcessorSharer(device, shaderCache, settings.CompressTextures);

        foreach (Figure figure in figuresToDump)
        {
            bool[] channelsToInclude = figure != parentFigure?ChannelShaker.MakeChannelsToIncludeFromShapes(figure) : null;

            Console.WriteLine($"Dumping {figure.Name}...");
            SystemDumper.DumpFigure(figure, channelsToInclude);
            GeometryDumper.DumpFigure(figure);
            UVSetDumper.DumpFigure(figure);

            MaterialSetDumper.DumpAllForFigure(settings, device, shaderCache, fileLocator, objectLocator, figure, textureProcessorSharer);

            ShapeDumper.DumpAllForFigure(settings, fileLocator, device, shaderCache, parentFigure, figure);
        }

        textureProcessorSharer.Finish();
    }
Exemplo n.º 2
0
    public FigureDumperLoader(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, ImporterPathManager pathManager, Device device, ShaderCache shaderCache)
    {
        this.fileLocator   = fileLocator;
        this.objectLocator = objectLocator;
        this.pathManager   = pathManager;
        this.device        = device;
        this.shaderCache   = shaderCache;

        figureRecipeLoader = new FigureRecipeLoader(objectLocator, pathManager);

        FigureRecipe      genesis3FemaleRecipe = figureRecipeLoader.LoadFigureRecipe("genesis-3-female", null);
        FigureRecipe      genitaliaRecipe      = figureRecipeLoader.LoadFigureRecipe("genesis-3-female-genitalia", genesis3FemaleRecipe);
        FigureRecipe      genesis3FemaleWithGenitaliaRecipe = new FigureRecipeMerger(genesis3FemaleRecipe, genitaliaRecipe).Merge();
        Figure            genesis3FemaleWithGenitalia       = genesis3FemaleWithGenitaliaRecipe.Bake(null);
        SurfaceProperties genesis3FemaleSurfaceProperties   = SurfacePropertiesJson.Load(pathManager, genesis3FemaleWithGenitalia);

        float[] genesis3FemaleFaceTransparencies = FaceTransparencies.For(genesis3FemaleWithGenitalia, genesis3FemaleSurfaceProperties, null);

        parentFigureRecipe       = genesis3FemaleRecipe;
        parentFigure             = genesis3FemaleWithGenitalia;
        parentFaceTransparencies = genesis3FemaleFaceTransparencies;
    }
    public void Run()
    {
        var loader = new FigureRecipeLoader(fileLocator, objectLocator, pathManager);

        FigureRecipe genesis3FemaleRecipe = loader.LoadFigureRecipe("genesis-3-female", null);
        FigureRecipe genitaliaRecipe      = loader.LoadFigureRecipe("genesis-3-female-genitalia", genesis3FemaleRecipe);
        FigureRecipe genesis3FemaleWithGenitaliaRecipe = new FigureRecipeMerger(genesis3FemaleRecipe, genitaliaRecipe).Merge();
        Figure       genesis3FemaleWithGenitalia       = genesis3FemaleWithGenitaliaRecipe.Bake(fileLocator, null);

        Figure parentFigure = genesis3FemaleWithGenitalia;

        FigureRecipe livHairRecipe = loader.LoadFigureRecipe("liv-hair", null);
        var          livHairFigure = livHairRecipe.Bake(fileLocator, parentFigure);

        var surfaceProperties = SurfacePropertiesJson.Load(pathManager, livHairFigure);
        var processor         = new FaceTransparencyProcessor(device, shaderCache, livHairFigure, surfaceProperties);

        for (int surfaceIdx = 0; surfaceIdx < livHairFigure.Geometry.SurfaceCount; ++surfaceIdx)
        {
            string surfaceName = livHairFigure.Geometry.SurfaceNames[surfaceIdx];

            FileInfo textureFile;
            if (surfaceName == "Hairband")
            {
                continue;
            }
            else if (surfaceName == "Cap")
            {
                textureFile = fileLocator.Locate("/Runtime/Textures/outoftouch/!hair/OOTHairblending2/Liv/OOTUtilityLivCapT.jpg").File;
            }
            else
            {
                textureFile = fileLocator.Locate("/Runtime/Textures/outoftouch/!hair/OOTHairblending2/Liv/OOTUtilityLivHairT.png").File;
            }

            RawFloatTexture opacityTexture = new RawFloatTexture {
                value = 1,
                image = new RawImageInfo {
                    file  = textureFile,
                    gamma = 1
                }
            };

            processor.ProcessSurface(surfaceIdx, livHairFigure.DefaultUvSet.Name, opacityTexture);
        }

        var transparencies = processor.FaceTransparencies;

        for (int i = 0; i < 10; ++i)
        {
            int    faceIdx     = i * 3000;
            int    surfaceIdx  = livHairFigure.Geometry.SurfaceMap[faceIdx];
            string surfaceName = livHairFigure.Geometry.SurfaceNames[surfaceIdx];

            var  uvSet = livHairFigure.DefaultUvSet;
            Quad face  = uvSet.Faces[faceIdx];

            Console.WriteLine("face {0}: ", faceIdx);
            Console.WriteLine("  transparency: " + transparencies[faceIdx]);
            Console.WriteLine("  surface: " + surfaceName);
            Console.WriteLine("  uv 0: {0}", uvSet.Uvs[face.Index0]);
            Console.WriteLine("  uv 1: {0}", uvSet.Uvs[face.Index1]);
            Console.WriteLine("  uv 2: {0}", uvSet.Uvs[face.Index2]);
            Console.WriteLine("  uv 3: {0}", uvSet.Uvs[face.Index3]);
            Console.WriteLine();
        }
        Console.WriteLine("min = " + transparencies.Min());
        Console.WriteLine("avg = " + transparencies.Average());
        Console.WriteLine("max = " + transparencies.Max());
    }