Ejemplo n.º 1
0
 public AdjacencyCalculator(bool isIntersectorOcclusionCalculator = false)
 {
     adjacencyMatrix = new AdjacencyMatrix();
     if (!isIntersectorOcclusionCalculator)
     {
         this.intersectorAdjacencyCalculator = new AdjacencyCalculator(true);
     }
 }
Ejemplo n.º 2
0
        public void Build(Vector3 pos, AdjacencyMatrix adjacencyMatrix, MeshBlock block, MeshBuilder meshBuilder, BlockBounds clipBounds)
        {

        }
Ejemplo n.º 3
0
        public void Build(Vector3 pos, AdjacencyMatrix adjacencyMatrix, MeshBlock block, MeshBuilder meshBuilder, BlockBounds clipBounds)
        {
            Quaternion rot = block.RotationQuat;
            Matrix4x4 transform = Matrix4x4.TRS(pos + new Vector3(0.5f, 0.5f, 0.5f), rot, new Vector3(1, 1, 1));
            BlockBounds localClipBounds = new BlockBounds (clipBounds.Position - block.OriginalBounds.Position - pos, clipBounds.Size);
            localClipBounds.SetToRotationFrom (Quaternion.Inverse(block.RotationQuat), new Vector3(0.5f, 0.5f, 0.5f));
            meshBuilder.BeforeNext (transform, new Vector3(-0.5f, -0.5f, -0.5f), localClipBounds);

            foreach (Part part in _blockParts)
            {
                if ((part.Direction == null) || (!adjacencyMatrix.RPt(part.Direction[0], part.Direction[1], part.Direction[2]).Occluded))
                {
                    IProcMeshGenerator meshGenerator;
                    if(!_meshGenerators.TryGetValue(part.MeshGenerator, out meshGenerator)){
                        _meshGenerators[part.MeshGenerator] = (meshGenerator = (IProcMeshGenerator)Activator.CreateInstance(part.MeshGenerator));
                    }

                    meshGenerator.BuildMesh(part.PartType, adjacencyMatrix, meshBuilder, localClipBounds);
                }
            }
        }