Ejemplo n.º 1
0
    private static ImporterMain Make(string[] args)
    {
        ContentFileLocator fileLocator   = new ContentFileLocator();
        DsonObjectLocator  objectLocator = new DsonObjectLocator(fileLocator);

        return(new ImporterMain(fileLocator, objectLocator));
    }
Ejemplo n.º 2
0
 public ImporterMain(ContentFileLocator fileLocator, DsonObjectLocator objectLocator)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
     this.device        = new Device(DriverType.Hardware, DeviceCreationFlags.None, FeatureLevel.Level_11_1);
     this.shaderCache   = new ShaderCache(device);
 }
 public FaceTransparencyDemo()
 {
     fileLocator   = new ContentFileLocator();
     objectLocator = new DsonObjectLocator(fileLocator);
     device        = new Device(DriverType.Hardware, DeviceCreationFlags.None, FeatureLevel.Level_11_1);
     shaderCache   = new ShaderCache(device);
 }
Ejemplo n.º 4
0
    public static void DumpAllForFigure(ImportSettings settings, ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, Figure parentFigure, Figure figure)
    {
        ShapeImportConfiguration[] configurations = ShapeImportConfiguration.Load(figure.Name);
        var baseConf = configurations.SingleOrDefault(conf => conf.name == "Base");

        ShapeDumper dumper = new ShapeDumper(fileLocator, device, shaderCache, parentFigure, figure, baseConf);

        foreach (var conf in configurations)
        {
            if (!settings.ShouldImportShape(figure.Name, conf.name))
            {
                continue;
            }

            dumper.Dump(conf);
        }

        dumper.DumpUnmorphed();

        MaterialSetImportConfiguration[] materialSetImportConfigurations = MaterialSetImportConfiguration.Load(figure.Name);
        foreach (var materialSetConf in materialSetImportConfigurations)
        {
            if (!settings.ShouldImportMaterialSet(figure.Name, materialSetConf.name))
            {
                continue;
            }

            if (!materialSetConf.useCustomOcclusion)
            {
                continue;
            }

            dumper.DumpOcclusionForMaterialSet(materialSetConf.name);
        }
    }
 public DsonMaterialAggregator(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Dictionary <string, DsonTypes.Image> imagesByUrl, Dictionary <string, MaterialBag> bags)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
     this.imagesByUrl   = imagesByUrl;
     this.bags          = bags;
 }
 public MaterialBag(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Dictionary <string, DsonTypes.Image> imagesByUrl, HashSet <string> extraTypes, Dictionary <string, object> values)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
     this.imagesByUrl   = imagesByUrl;
     this.extraTypes    = extraTypes;
     this.values        = values;
 }
Ejemplo n.º 7
0
    public OccluderParametersCalculator(ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, Figure figure, float[] faceTransparencies, ChannelInputs shapeInputs)
    {
        this.figure      = figure;
        this.shapeInputs = shapeInputs;
        figureGroup      = new FigureGroup(figure);
        var faceTransparenciesGroup = new FaceTransparenciesGroup(faceTransparencies);

        occlusionCalculator = new FigureOcclusionCalculator(fileLocator, device, shaderCache, figureGroup, faceTransparenciesGroup);
    }
Ejemplo n.º 8
0
 public ShapeDumper(ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, Figure parentFigure, Figure figure, ShapeImportConfiguration baseConfiguration)
 {
     this.fileLocator       = fileLocator;
     this.device            = device;
     this.shaderCache       = shaderCache;
     this.parentFigure      = parentFigure;
     this.figure            = figure;
     this.baseConfiguration = baseConfiguration;
     this.figureDirectory   = CommonPaths.WorkDir.Subdirectory("figures").Subdirectory(figure.Name);
 }
    public FaceTransparencyDemo()
    {
        fileLocator   = new ContentFileLocator();
        objectLocator = new DsonObjectLocator(fileLocator);
        var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir);

        pathManager = ImporterPathManager.Make(contentPackConfs);
        device      = new Device(DriverType.Hardware, DeviceCreationFlags.None, FeatureLevel.Level_11_1);
        shaderCache = new ShaderCache(device);
    }
    public Figure Bake(ContentFileLocator fileLocator, Figure parentFigure)
    {
        if (Channels == null)
        {
            Channels = new List <ChannelRecipe>();
        }
        if (Formulas == null)
        {
            Formulas = new List <FormulaRecipe>();
        }
        if (Morphs == null)
        {
            Morphs = new List <MorphRecipe>();
        }

        Geometry geometry = Geometry.Bake();

        Dictionary <string, UvSet> uvSets = new Dictionary <string, UvSet>();

        UvSets.ForEach(recipe => recipe.Bake(geometry, uvSets));
        UvSet defaultUvSet = uvSets[Geometry.DefaultUvSet];

        ChannelSystem channelSystem = new ChannelSystemRecipe(Channels, Formulas).Bake(parentFigure?.ChannelSystem);

        int graftVertexOffset = Geometry.VertexPositions.Length;

        List <MorphRecipe> rewrittenMorphRecipes = Automorpher != null?Automorpher.Rewrite(Morphs, parentFigure) : Morphs;

        List <Morph> morphs  = rewrittenMorphRecipes.Select(recipe => recipe.Bake(fileLocator, channelSystem.ChannelsByName)).ToList();
        Morpher      morpher = new Morpher(morphs);

        Automorpher automorpher = Automorpher?.Bake();

        BoneSystem selfBoneSystem = new BoneSystemRecipe(Bones).Bake(channelSystem.ChannelsByName);

        BoneSystem boneSystem;

        RigidTransform[] childToParentBindPoseTransforms;
        if (parentFigure != null)
        {
            boneSystem = parentFigure.BoneSystem;
            childToParentBindPoseTransforms = MakeChildToParentBindPoseTransforms(channelSystem, selfBoneSystem, boneSystem);
        }
        else
        {
            boneSystem = selfBoneSystem;
            childToParentBindPoseTransforms = null;
        }

        SkinBinding skinBinding = SkinBinding.Bake(boneSystem.BonesByName, selfBoneSystem.BonesByName);

        OcclusionBinding occlusionBinding = OcclusionBinding.MakeForFigure(Name, geometry, boneSystem, skinBinding);

        return(new Figure(Name, parentFigure, this, geometry, channelSystem, boneSystem, childToParentBindPoseTransforms, morpher, automorpher, skinBinding, uvSets, defaultUvSet, occlusionBinding));
    }
Ejemplo n.º 11
0
    public static IEnumerable <MorphRecipe> ImportForFigure(ContentFileLocator fileLocator, DsonObjectLocator locator, FigureUris figureUris)
    {
        MorphImporter importer = new MorphImporter(fileLocator);

        foreach (DsonTypes.DsonDocument doc in locator.GetAllDocumentsUnderPath(figureUris.MorphsBasePath))
        {
            importer.ImportFrom(doc);
        }

        return(importer.MorphRecipes);
    }
Ejemplo n.º 12
0
 public ShapeDumper(ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, Figure parentFigure, float[] parentFaceTransparencies, Figure figure, SurfaceProperties surfaceProperties, ShapeImportConfiguration baseConfiguration)
 {
     this.fileLocator              = fileLocator;
     this.device                   = device;
     this.shaderCache              = shaderCache;
     this.parentFigure             = parentFigure;
     this.parentFaceTransparencies = parentFaceTransparencies;
     this.figure                   = figure;
     this.surfaceProperties        = surfaceProperties;
     this.baseConfiguration        = baseConfiguration;
 }
Ejemplo n.º 13
0
 public FigureDumper(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Device device, ShaderCache shaderCache, Figure parentFigure, Figure figure, SurfaceProperties surfaceProperties, MaterialSetImportConfiguration baseMaterialSetImportConfiguration, ShapeImportConfiguration baseShapeImportConfiguration, ShapeDumper shapeDumper)
 {
     this.device            = device;
     this.shaderCache       = shaderCache;
     this.fileLocator       = fileLocator;
     this.objectLocator     = objectLocator;
     this.parentFigure      = parentFigure;
     this.figure            = figure;
     this.surfaceProperties = surfaceProperties;
     this.baseMaterialSetImportConfiguration = baseMaterialSetImportConfiguration;
     this.baseShapeImportConfiguration       = baseShapeImportConfiguration;
     this.shapeDumper = shapeDumper;
 }
Ejemplo n.º 14
0
    public ApplyHdMorphDemo()
    {
        var fileLocator      = new ContentFileLocator();
        var objectLocator    = new DsonObjectLocator(fileLocator);
        var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir);
        var pathManager      = ImporterPathManager.Make(contentPackConfs);
        var loader           = new FigureRecipeLoader(fileLocator, objectLocator, pathManager);
        var figureRecipe     = loader.LoadFigureRecipe("genesis-3-female", null);
        var figure           = figureRecipe.Bake(fileLocator, null);
        var geometry         = figure.Geometry;

        controlTopology        = new QuadTopology(geometry.VertexCount, geometry.Faces);
        controlVertexPositions = geometry.VertexPositions;
    }
Ejemplo n.º 15
0
    public FigureOcclusionCalculator(ContentFileLocator fileLocator, Device device, ShaderCache shaderCache, FigureGroup figureGroup, FaceTransparenciesGroup faceTransparenciesGroup)
    {
        this.device = device;

        this.figureGroup = figureGroup;

        var geometryConcatenator = new OcclusionGeometryConcatenator();

        //parent
        {
            var figure             = figureGroup.Parent;
            var faceTransparencies = faceTransparenciesGroup.Parent;

            var refinementResult = figure.Geometry.AsTopology().Refine(0);

            var segment = geometryConcatenator.Add(refinementResult.Mesh, faceTransparencies);
            parentSegment = segment;

            var surrogates = figure.OcclusionBinding.Surrogates;
            surrogateSegments = surrogates.Select(geometryConcatenator.Add).ToList();
        }

        //children
        for (int childIdx = 0; childIdx < figureGroup.Children.Length; ++childIdx)
        {
            var figure             = figureGroup.Children[childIdx];
            var faceTransparencies = faceTransparenciesGroup.Children[childIdx];

            var refinementResult = figure.Geometry.AsTopology().Refine(0);

            var segment = geometryConcatenator.Add(refinementResult.Mesh, faceTransparencies);
            childSegments.Add(segment);

            var surrogates = figure.OcclusionBinding.Surrogates;
            if (surrogates.Count != 0)
            {
                // There's no technical reason this couldn't be implemented; I just haven't needed it yet.
                throw new NotImplementedException("occlusion surrogates aren't supported on child figures");
            }
        }

        groupControlPositionsBufferManager = new StructuredBufferManager <Vector3>(device, geometryConcatenator.Mesh.ControlVertexCount);
        vertexRefiner = new BasicVertexRefiner(device, shaderCache, geometryConcatenator.Mesh.Stencils);
        refinedVertexInfosBufferManager = new InOutStructuredBufferManager <BasicRefinedVertexInfo>(device, vertexRefiner.RefinedVertexCount);
        occlusionCalculator             = new GpuOcclusionCalculator(device, shaderCache,
                                                                     geometryConcatenator.Mesh.Topology,
                                                                     geometryConcatenator.FaceTransparencies,
                                                                     geometryConcatenator.FaceMasks,
                                                                     geometryConcatenator.VertexMasks);
    }
    public void Run()
    {
        var fileLocator   = new ContentFileLocator();
        var objectLocator = new DsonObjectLocator(fileLocator);
        var loader        = new FigureRecipeLoader(objectLocator);
        var figureRecipe  = loader.LoadFigureRecipe("genesis-3-female", null);
        var figure        = figureRecipe.Bake(null);

        var calculator = new BoneAttributesCalculator(figure.ChannelSystem, figure.BoneSystem, figure.Geometry, figure.SkinBinding);

        BoneAttributes[] boneAttributes = calculator.CalculateBoneAttributes();

        for (int boneIdx = 0; boneIdx < figure.Bones.Count; ++boneIdx)
        {
            Console.WriteLine("{0}: {1}", figure.Bones[boneIdx].Name, boneAttributes[boneIdx]);
        }
    }
    public void Run()
    {
        var fileLocator      = new ContentFileLocator();
        var objectLocator    = new DsonObjectLocator(fileLocator);
        var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir);
        var pathManager      = ImporterPathManager.Make(contentPackConfs);
        var loader           = new FigureRecipeLoader(fileLocator, objectLocator, pathManager);
        var figureRecipe     = loader.LoadFigureRecipe("genesis-3-female", null);
        var figure           = figureRecipe.Bake(fileLocator, null);

        var calculator = new BoneAttributesCalculator(figure.ChannelSystem, figure.BoneSystem, figure.Geometry, figure.SkinBinding);

        BoneAttributes[] boneAttributes = calculator.CalculateBoneAttributes();

        for (int boneIdx = 0; boneIdx < figure.Bones.Count; ++boneIdx)
        {
            Console.WriteLine("{0}: {1}", figure.Bones[boneIdx].Name, boneAttributes[boneIdx]);
        }
    }
Ejemplo n.º 18
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;
    }
Ejemplo n.º 19
0
    public static FigureRecipe ImportFor(string figureName, ContentFileLocator fileLocator, DsonObjectLocator locator, FigureUris figureUris, FigureRecipe parentRecipe, double hdCorrectionInitialValue, ImmutableHashSet <string> visibleProducts)
    {
        var geometryRecipe = GeometryImporter.ImportForFigure(locator, figureUris);

        FigureRecipe recipe = new FigureRecipe {
            Name        = figureName,
            Geometry    = geometryRecipe,
            Channels    = ChannelImporter.ImportForFigure(locator, figureUris, visibleProducts).ToList(),
            Formulas    = FormulaImporter.ImportForFigure(locator, figureUris).ToList(),
            Bones       = BoneImporter.ImportForFigure(locator, figureUris).ToList(),
            Morphs      = MorphImporter.ImportForFigure(fileLocator, locator, figureUris).ToList(),
            SkinBinding = SkinBindingImporter.ImportForFigure(locator, figureUris),
            UvSets      = UvSetImporter.ImportForFigure(locator, figureUris, geometryRecipe).ToList()
        };

        Geometry geometry = recipe.Geometry.Bake();

        var correctionSynthesizer = new HdCorrectionMorphSynthesizer(figureName, geometry);

        recipe.Channels.Add(correctionSynthesizer.SynthesizeChannel(hdCorrectionInitialValue));
        recipe.Morphs.Add(correctionSynthesizer.SynthesizeMorph());

        if (parentRecipe == null)
        {
            var scaleControlSynthesizer = new ScaleControlChannelSynthesizer(recipe.Bones);
            recipe.Channels.Add(scaleControlSynthesizer.SynthesizeChannel());
            recipe.Formulas.Add(scaleControlSynthesizer.SynthesizeFormula());
        }

        if (parentRecipe != null)
        {
            Geometry parentGeometry = parentRecipe.Geometry.Bake();
            recipe.Automorpher = AutomorpherRecipe.Make(parentGeometry, geometry);
        }

        return(recipe);
    }
Ejemplo n.º 20
0
 public MaterialBag(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Dictionary <string, DsonTypes.Image> imagesByUrl)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
     this.imagesByUrl   = imagesByUrl;
 }
 public MaterialBag(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Dictionary <string, DsonTypes.Image> imagesByUrl) : this(
         fileLocator, objectLocator, imagesByUrl,
         new HashSet <string>(),
         new Dictionary <string, object>())
 {
 }
Ejemplo n.º 22
0
    private static MultiMaterialSettings DumpMaterialSet(ImportSettings settings, Device device, ShaderCache shaderCache, ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Figure figure, SurfaceProperties surfaceProperties, MaterialSetImportConfiguration baseConfiguration, DirectoryInfo figureDestDir, MaterialSetImportConfiguration configuration, TextureProcessor textureProcessor)
    {
        DirectoryInfo materialsSetsDirectory     = figureDestDir.Subdirectory("material-sets");
        DirectoryInfo materialSetDirectory       = materialsSetsDirectory.Subdirectory(configuration.name);
        FileInfo      materialSettingsFileInfo   = materialSetDirectory.File("material-settings.dat");
        FileInfo      faceTransparenciesFileInfo = materialSetDirectory.File("face-transparencies.array");

        if (materialSettingsFileInfo.Exists && faceTransparenciesFileInfo.Exists)
        {
            return(Persistance.Load <MultiMaterialSettings>(UnpackedArchiveFile.Make(materialSettingsFileInfo)));
        }

        var aggregator = new DsonMaterialAggregator(fileLocator, objectLocator);
        IEnumerable <string> dufPaths = Enumerable.Concat(baseConfiguration.materialsDufPaths, configuration.materialsDufPaths);

        foreach (string path in dufPaths)
        {
            DsonTypes.DsonDocument doc = objectLocator.LocateRoot(path);
            aggregator.IncludeDuf(doc.Root);
        }

        var faceTransparencyProcessor = new FaceTransparencyProcessor(device, shaderCache, figure, surfaceProperties);

        IMaterialImporter materialImporter;

        if (figure.Name.EndsWith("-hair"))
        {
            materialImporter = new HairMaterialImporter(figure, textureProcessor, faceTransparencyProcessor);
        }
        else
        {
            materialImporter = new UberMaterialImporter(figure, textureProcessor, faceTransparencyProcessor);
        }

        string[] surfaceNames = figure.Geometry.SurfaceNames;
        Dictionary <string, int> surfaceNameToIdx = Enumerable.Range(0, surfaceNames.Length)
                                                    .ToDictionary(idx => surfaceNames[idx], idx => idx);

        var perMaterialSettings = Enumerable.Range(0, figure.Geometry.SurfaceCount)
                                  .Select(surfaceIdx => {
            string surfaceName   = figure.Geometry.SurfaceNames[surfaceIdx];
            var bag              = aggregator.GetBag(surfaceName);
            var materialSettings = materialImporter.Import(surfaceIdx, bag);
            return(materialSettings);
        })
                                  .ToArray();

        var variantCategories = configuration.variantCategories
                                .Select(variantCategoryConf => {
            int[] surfaceIdxs = variantCategoryConf.surfaces
                                .Select(surfaceName => surfaceNameToIdx[surfaceName])
                                .ToArray();

            var variants = variantCategoryConf.variants
                           .Select(variantConf => {
                var variantAggregator = aggregator.Branch();
                foreach (string path in variantConf.materialsDufPaths)
                {
                    DsonTypes.DsonDocument doc = objectLocator.LocateRoot(path);
                    variantAggregator.IncludeDuf(doc.Root);
                }

                var settingsBySurface = variantCategoryConf.surfaces
                                        .Select(surfaceName => {
                    int surfaceIdx       = surfaceNameToIdx[surfaceName];
                    var bag              = variantAggregator.GetBag(surfaceName);
                    var materialSettings = materialImporter.Import(surfaceIdx, bag);
                    return(materialSettings);
                })
                                        .ToArray();

                return(new MultiMaterialSettings.Variant(variantConf.name, settingsBySurface));
            })
                           .ToArray();

            return(new MultiMaterialSettings.VariantCategory(variantCategoryConf.name, surfaceIdxs, variants));
        })
                                .ToArray();

        var multiMaterialSettings = new MultiMaterialSettings(perMaterialSettings, variantCategories);

        materialSetDirectory.CreateWithParents();

        textureProcessor.RegisterAction(() => {
            Persistance.Save(materialSettingsFileInfo, multiMaterialSettings);
        });

        var faceTranparencies = faceTransparencyProcessor.FaceTransparencies;

        faceTransparenciesFileInfo.WriteArray(faceTranparencies);

        faceTransparencyProcessor.Dispose();

        return(multiMaterialSettings);
    }
    public Morph Bake(ContentFileLocator fileLocator, Dictionary <string, Channel> channels)
    {
        var hdFile = HdUrl != null?fileLocator.Locate(HdUrl).File : null;

        return(new Morph(channels[Channel], Deltas, hdFile));
    }
Ejemplo n.º 24
0
    public static void DumpMaterialSetAndScattering(ImportSettings settings, Device device, ShaderCache shaderCache, ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Figure figure, SurfaceProperties surfaceProperties,
                                                    MaterialSetImportConfiguration baseConfiguration, TextureProcessor sharedTextureProcessor, DirectoryInfo figureDestDir, MaterialSetImportConfiguration configuration)
    {
        var materialSettings = DumpMaterialSet(settings, device, shaderCache, fileLocator, objectLocator, figure, surfaceProperties, baseConfiguration, figureDestDir, configuration, sharedTextureProcessor);

        ScatteringDumper.Dump(figure, surfaceProperties, materialSettings.PerMaterialSettings, figureDestDir, configuration.name);
    }
 public DsonObjectLocator(ContentFileLocator fileLocator)
 {
     this.fileLocator = fileLocator;
 }
 public DsonMaterialAggregator(ContentFileLocator fileLocator, DsonObjectLocator objectLocator)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
 }
Ejemplo n.º 27
0
    public void Run()
    {
        LeakTracking.Setup();

        var device           = new Device(DriverType.Hardware, DeviceCreationFlags.Debug, FeatureLevel.Level_11_1);
        var shaderCache      = new ShaderCache(device);
        var fileLocator      = new ContentFileLocator();
        var objectLocator    = new DsonObjectLocator(fileLocator);
        var contentPackConfs = ContentPackImportConfiguration.LoadAll(CommonPaths.ConfDir);
        var pathManager      = ImporterPathManager.Make(contentPackConfs);
        var loader           = new FigureRecipeLoader(fileLocator, objectLocator, pathManager);
        var figureRecipe     = loader.LoadFigureRecipe("genesis-3-female", null);
        var figure           = figureRecipe.Bake(fileLocator, null);
        var geometry         = figure.Geometry;

        var ldChannelInputs = figure.ChannelSystem.MakeDefaultChannelInputs();

        figure.ChannelsByName["PBMNavel?value"].SetValue(ldChannelInputs, 1);
        figure.ChannelsByName["PBMNipples?value"].SetValue(ldChannelInputs, 1);
        figure.ChannelsByName["CTRLRune7?value"].SetValue(ldChannelInputs, 1);

        var hdChannelInputs = figure.ChannelSystem.MakeDefaultChannelInputs();

        figure.ChannelsByName["PBMNavel?value"].SetValue(hdChannelInputs, 1);
        figure.ChannelsByName["PBMNipples?value"].SetValue(hdChannelInputs, 1);
        figure.ChannelsByName["CTRLRune7?value"].SetValue(hdChannelInputs, 1);
        figure.ChannelsByName["CTRLRune7HD?value"].SetValue(hdChannelInputs, 1);

        var converter = new HdMorphToNormalMapConverter(device, shaderCache, figure);

        var mapRenderer = converter.MakeNormalMapRenderer(ldChannelInputs, hdChannelInputs, figure.UvSets["Rune 7"]);

        string character = "rune";

        var faceMap = mapRenderer.Render(new HashSet <int> {
            9, 13, 5, 6
        });

        faceMap.Save(CommonPaths.WorkDir.File(character + "-face.png"));
        faceMap.Dispose();

        var torsoMap = mapRenderer.Render(new HashSet <int> {
            12
        });

        torsoMap.Save(CommonPaths.WorkDir.File(character + "-torso.png"));
        torsoMap.Dispose();

        var legsMap = mapRenderer.Render(new HashSet <int> {
            11, 2
        });

        legsMap.Save(CommonPaths.WorkDir.File(character + "-legs.png"));
        legsMap.Dispose();

        var armsMap = mapRenderer.Render(new HashSet <int> {
            16, 1
        });

        armsMap.Save(CommonPaths.WorkDir.File(character + "-arms.png"));
        armsMap.Dispose();

        mapRenderer.Dispose();

        shaderCache.Dispose();
        device.Dispose();

        LeakTracking.Finish();
    }
Ejemplo n.º 28
0
    public static void DumpAllForFigure(ImportSettings settings, Device device, ShaderCache shaderCache, ContentFileLocator fileLocator, DsonObjectLocator objectLocator, Figure figure, TextureProcessorSharer textureProcessorSharer)
    {
        MaterialSetImportConfiguration[] configurations = MaterialSetImportConfiguration.Load(figure.Name);

        var baseConf = configurations.Single(conf => conf.name == "Base");

        var surfaceProperties = SurfacePropertiesJson.Load(figure);
        TextureProcessor sharedTextureProcessor = surfaceProperties.ShareTextures != null?
                                                  textureProcessorSharer.GetSharedProcessor(surfaceProperties.ShareTextures) : null;

        foreach (var conf in configurations)
        {
            if (conf == baseConf)
            {
                continue;
            }

            if (!settings.ShouldImportMaterialSet(figure.Name, conf.name))
            {
                continue;
            }

            DumpMaterialSetAndScattering(settings, device, shaderCache, fileLocator, objectLocator, figure, baseConf, conf, sharedTextureProcessor);
        }
    }
 public DsonMaterialAggregator(ContentFileLocator fileLocator, DsonObjectLocator objectLocator) : this(
         fileLocator, objectLocator,
         new Dictionary <string, DsonTypes.Image>(),
         new Dictionary <string, MaterialBag>())
 {
 }
 public FigureRecipeLoader(ContentFileLocator fileLocator, DsonObjectLocator objectLocator, ImporterPathManager pathManager)
 {
     this.fileLocator   = fileLocator;
     this.objectLocator = objectLocator;
     this.pathManager   = pathManager;
 }