private static void WriteLevel(BinaryWriter writer, HdMorph.Level level)
    {
        writer.Write(level.ControlFaceCount);
        writer.Write(level.LevelIdx);

        int vertexEditCount = 0;
        int sizeInBytes     = 0;

        foreach (var faceEdit in level.FaceEdits)
        {
            sizeInBytes += FaceEditHeaderSizeInBytes;
            foreach (var vertexEdit in faceEdit.VertexEdits)
            {
                vertexEditCount += 1;
                sizeInBytes     += level.LevelIdx < LongPathLevelThreshold ? ShortVertexEditSizeInBytes : LongVertexEditSizeInBytes;
            }
        }

        writer.Write(vertexEditCount);
        writer.Write(sizeInBytes);

        foreach (var faceEdit in level.FaceEdits)
        {
            WriteFaceEdit(writer, level.LevelIdx, faceEdit);
        }
    }
Exemple #2
0
    private void TestLevel1HdMorph()
    {
        var delta      = new Vector3(10, 20, 30);
        var vertexEdit = new HdMorph.VertexEdit(HdMorph.VertexEdit.PackPath(0, 2), delta);
        var faceEdit   = new HdMorph.FaceEdit(100, ImmutableArray.Create(vertexEdit));

        var     level1  = new HdMorph.Level(controlTopology.Faces.Length, 1, ImmutableArray.Create(faceEdit));
        var     levels  = ImmutableArray.Create(level1);
        HdMorph hdMorph = new HdMorph(levels);

        Vector3 expectedPosition = new Vector3(29.7680817f, 183.135971f, 13.2819338f);         //from Daz studio export

        TestHdMorph(hdMorph, 100 * 4, 2, expectedPosition);
    }
Exemple #3
0
    private void TestLevel2HdMorph()
    {
        var delta      = new Vector3(10, 20, 30);
        var vertexEdit = new HdMorph.VertexEdit(HdMorph.VertexEdit.PackPath(0, 2, 1), delta);
        var faceEdit   = new HdMorph.FaceEdit(200, ImmutableArray.Create(vertexEdit));

        var     level1  = new HdMorph.Level(controlTopology.Faces.Length, 1, ImmutableArray <HdMorph.FaceEdit> .Empty);
        var     level2  = new HdMorph.Level(controlTopology.Faces.Length, 2, ImmutableArray.Create(faceEdit));
        var     levels  = ImmutableArray.Create(level1, level2);
        HdMorph hdMorph = new HdMorph(levels);

        Vector3 expectedPosition = new Vector3(7.82922983f, 197.132507f, -15.0236731f);         //from Daz studio export

        TestHdMorph(hdMorph, ((200 * 4) + 0) * 4 + 2, 1, expectedPosition);
    }
    public void Run()
    {
        var delta      = new Vector3(10, 20, 30);
        var vertexEdit = new HdMorph.VertexEdit(HdMorph.VertexEdit.PackPath(0, 2, 1), delta);
        var faceEdit   = new HdMorph.FaceEdit(200, ImmutableArray.Create(vertexEdit));

        var     level1  = new HdMorph.Level(G3FControlFaceCount, 1, ImmutableArray <HdMorph.FaceEdit> .Empty);
        var     level2  = new HdMorph.Level(G3FControlFaceCount, 2, ImmutableArray.Create(faceEdit));
        var     levels  = ImmutableArray.Create(level1, level2);
        HdMorph hdMorph = new HdMorph(levels);

        var outFile = new FileInfo(@"C:\Users\Public\Documents\My DAZ 3D Library\data\DAZ 3D\Genesis 3\Female\Morphs\GregTest\FBM-GregHDTest.dhdm");

        HdMorphSerialization.SaveHdMorph(outFile, hdMorph);
    }