Example #1
0
    public static RefinementResult Combine(RefinementResult resultA, RefinementResult resultB)
    {
        SubdivisionMesh combinedMesh = SubdivisionMesh.Combine(
            resultA.Mesh,
            resultB.Mesh);

        int[] combinedControlFaceMap = Enumerable.Concat(
            resultA.ControlFaceMap,
            resultB.ControlFaceMap).ToArray();

        return(new RefinementResult(combinedMesh, combinedControlFaceMap));
    }
Example #2
0
    public ArraySegment Add(SubdivisionMesh mesh, float[] faceTransparencies)
    {
        if (mesh.Topology.Faces.Length != faceTransparencies.Length)
        {
            throw new ArgumentException("face count mismatch");
        }

        int startingOffset = combinedMesh.Topology.VertexCount;

        combinedMesh = SubdivisionMesh.Combine(this.combinedMesh, mesh);
        combinedFaceTransparencies = this.combinedFaceTransparencies.Concat(faceTransparencies).ToArray();
        Array.Resize(ref faceMasks, combinedMesh.Topology.Faces.Count());
        Array.Resize(ref vertexMasks, combinedMesh.Topology.VertexCount);

        int count = mesh.Topology.VertexCount;

        return(new ArraySegment(startingOffset, count));
    }