예제 #1
0
        //-----------------------------------------------
        public void addGamaMeshData(List <Vector3> vertices, List <Vector2> uVs, List <Submesh> Submeshes)
        {
            MeshBucket meshBucket = new MeshBucket();

            meshBucket.Vertices  = vertices;
            meshBucket.UVs       = uVs;
            meshBucket.Submeshes = Submeshes;

            this.Meshes.Add(meshBucket);
        }
예제 #2
0
        public void AddElements(IEnumerable <Vector3> vertices, IEnumerable <Vector2> uvs, IEnumerable <int> indices, Material material)
        {
            var vertexList  = new List <Vector3>(vertices);
            int vertexCount = vertexList.Count;

            MeshBucket bucket = null;

            // Check whether the last available bucket is valid for use given the maximum vertex count
            if (Meshes.Count > 0)
            {
                var last = Meshes[Meshes.Count - 1];
                if (last.Vertices.Count + vertexCount < MaxVertexCount)
                {
                    bucket = last;
                }
            }

            // No bucket were found, instantiate a new one
            if (bucket == null)
            {
                bucket = new MeshBucket();
                Meshes.Add(bucket);
            }


            int offset = bucket.Vertices.Count;

            bucket.Vertices.AddRange(vertexList);
            bucket.UVs.AddRange(uvs);

            // Find a submesh with this material, or create a new one.
            Submesh submesh = null;

            foreach (var s in bucket.Submeshes)
            {
                if (s.Material == material)
                {
                    submesh = s;
                    break;
                }
            }

            if (submesh == null)
            {
                submesh = new Submesh {
                    Indices = new List <int>(), Material = material
                };
                bucket.Submeshes.Add(submesh);
            }

            foreach (var index in indices)
            {
                submesh.Indices.Add(index + offset);
            }
        }
예제 #3
0
        //-----------------------------------------------
        public void addGamaMeshData(List <Vector3> vertices, List <Vector2> uVs, List <Submesh> Submeshes, Agent gamaAgent)
        {
            MeshBucket meshBucket = new MeshBucket();

            meshBucket.Vertices  = vertices;
            meshBucket.UVs       = uVs;
            meshBucket.Submeshes = Submeshes;
            meshBucket.gamaAgent = gamaAgent;
            Debug.Log("-----------------------------------========================++++++++++++++++++++++++>>>>>>>>>>>> " + meshBucket.gamaAgent.geometry);
            this.Meshes.Add(meshBucket);
        }