Ejemplo n.º 1
0
        public void GenerateRuntimeMesh()
        {
            HUtils.log();

//		    Debug.Log("GenerateRuntimeMesh");
            if (!isLegal)
            {
                Debug.LogWarning("Illegal Runtime Volume. Base points likely intersect");
                for (int p = 0; p < numberOfPoints; p++)
                {
                    Debug.Log(this[p].position.vector3XY);
                }
            }
            if (visualPart == null)
            {
                _visualPart = VisualPartRuntime.GetPoolItem();
            }
            _visualPart.GenerateFromDynamicMesh();
            for (int f = 0; f < _interiorFloorplans.Count; f++)
            {
                _interiorFloorplans[f].GenerateRuntimeMesh();
                _interiorFloorplans[f].transform.parent        = transform;
                _interiorFloorplans[f].transform.localPosition = Vector3.zero;
            }
        }
Ejemplo n.º 2
0
 public void GenerateRuntimeMesh()
 {
     if (visualPart == null)
     {
         _visualPart = VisualPartRuntime.GetPoolItem();
     }
     _visualPart.GenerateFromDynamicMesh();
 }
Ejemplo n.º 3
0
        public void GenerateFromDynamicMesh(BuildRMesh overflow = null)
        {
            HUtils.log();

            if (_dynamicMesh.vertexCount == 0)
            {
                return;
            }
            if (_mesh == null)
            {
                _mesh = new Mesh();
            }
            if (_filter == null)
            {
                _filter = gameObject.AddComponent <MeshFilter>();
            }
            if (_renderer == null)
            {
                _renderer = gameObject.AddComponent <MeshRenderer>();
            }
            if (overflow != null)
            {
                _dynamicMesh = overflow;
            }
            _dynamicMesh.Build(_mesh);
            _filter.sharedMesh        = _mesh;
            _renderer.sharedMaterials = _dynamicMesh.materials.ToArray();


            if (_dynamicMesh.hasOverflowed)
            {
                if (_sibling == null)
                {
                    _sibling = GetPoolItem();
                }
                _sibling.GenerateFromDynamicMesh(_dynamicMesh.overflow);
            }
            else
            {
                if (_sibling != null)
                {
                    _sibling.Deactivate();
                    VisualPartRuntimePool.Instance.Push(_sibling);
                }
                _sibling = null;
            }

            if (_colliderPart == null)
            {
                _colliderPart = ColliderPartRuntime.GetPoolItem();
                _colliderPart.GenerateFromColliderMesh(_colliderMesh);
            }
        }