Beispiel #1
0
    public ArraySegment Add(ImporterOcclusionSurrogate surrogate)
    {
        int dummyVertexCount = surrogate.SampleCount;
        var dummyMesh        = new SubdivisionMesh(
            0,
            new QuadTopology(dummyVertexCount, new Quad[0]),
            PackedLists <WeightedIndexWithDerivatives> .MakeEmptyLists(dummyVertexCount));
        var dummyFaceTransparencies = new float[0];

        var segment = Add(dummyMesh, dummyFaceTransparencies);

        //apply mask
        int  maskIdx = nextMaskIdx++;
        uint mask    = 1u << maskIdx;

        for (int i = 0; i < segment.Count; ++i)
        {
            int vertexIdx = i + segment.Offset;
            vertexMasks[vertexIdx] |= mask;
        }
        foreach (int faceIdx in surrogate.AttachedFaces)
        {
            faceMasks[faceIdx] |= mask;
        }

        return(segment);
    }
Beispiel #2
0
    public OcclusionSurrogateParameters[] MakeSurrogateParameters()
    {
        OcclusionSurrogateParameters[] parameters = new OcclusionSurrogateParameters[surrogates.Count];

        int offset = vertexCount;

        for (int surrogateIdx = 0; surrogateIdx < surrogates.Count; ++surrogateIdx)
        {
            ImporterOcclusionSurrogate surrogate = surrogates[surrogateIdx];
            parameters[surrogateIdx] = new OcclusionSurrogateParameters(
                surrogate.AttachedBone.Index,
                offset);

            offset += surrogate.SampleCount;
        }

        return(parameters);
    }
Beispiel #3
0
    public int[] MakeSurrogateMap()
    {
        int[] map = new int[vertexCount];
        for (int surrogateIdx = 0; surrogateIdx < surrogates.Count; ++surrogateIdx)
        {
            ImporterOcclusionSurrogate surrogate = surrogates[surrogateIdx];
            foreach (var vertexIdx in surrogate.AttachedVertices)
            {
                if (map[vertexIdx] != 0)
                {
                    throw new Exception("surrogate map conflict");
                }

                map[vertexIdx] = surrogateIdx + 1;
            }
        }

        return(map);
    }
Beispiel #4
0
    public static OcclusionBinding MakeForFigure(string figureName, Geometry geometry, BoneSystem boneSystem, SkinBinding skinBinding)
    {
        var surrogates = ImporterOcclusionSurrogate.MakeForFigure(figureName, geometry, boneSystem, skinBinding);

        return(new OcclusionBinding(geometry.VertexCount, surrogates));
    }