Exemplo n.º 1
0
        private void UpdateTriangles()
        {
            int vertInd = (LoopCount - 1) * Config.VertsPerLoop;

            for (int i = 0; i < Config.VertsPerLoop - 1; i++)
            {
                Tris.Add(vertInd);
                Tris.Add(vertInd + Config.VertsPerLoop);
                Tris.Add(vertInd + Config.VertsPerLoop + 1);
                Tris.Add(vertInd);
                Tris.Add(vertInd + Config.VertsPerLoop + 1);
                Tris.Add(vertInd + 1);
                vertInd++;
            }

            //seam triangles
            Tris.Add(vertInd);
            Tris.Add(vertInd + Config.VertsPerLoop);
            Tris.Add(vertInd + 1);
            Tris.Add(vertInd);
            Tris.Add(vertInd + 1);
            Tris.Add(vertInd - Config.VertsPerLoop + 1);

            Mesh.SetTriangles(Tris, 0);
            Mesh.RecalculateNormals();
        }
Exemplo n.º 2
0
        /////////PARENTS FUNCTION//////////
        public override void Load(BinaryReader reader, int size)
        {
            if (size < 20)
            {
                isEmpty = true;
                return;
            }
            someNumber = reader.ReadUInt32();
            uint triggerCount = reader.ReadUInt32();
            uint groupCount   = reader.ReadUInt32();
            uint triCount     = reader.ReadUInt32();
            uint vertexCount  = reader.ReadUInt32();

            Triggers.Clear();
            Groups.Clear();
            Tris.Clear();
            Vertices.Clear();
            for (int i = 0; i < triggerCount; i++)
            {
                Trigger trg = new Trigger
                {
                    X1    = reader.ReadSingle(),
                    Y1    = reader.ReadSingle(),
                    Z1    = reader.ReadSingle(),
                    Flag1 = reader.ReadInt32(),
                    X2    = reader.ReadSingle(),
                    Y2    = reader.ReadSingle(),
                    Z2    = reader.ReadSingle(),
                    Flag2 = reader.ReadInt32()
                };
                Triggers.Add(trg);
            }
            for (int i = 0; i < groupCount; i++)
            {
                GroupInfo grp = new GroupInfo
                {
                    Size   = reader.ReadUInt32(),
                    Offset = reader.ReadUInt32()
                };
                Groups.Add(grp);
            }
            for (int i = 0; i < triCount; i++)
            {
                ColTri tri    = new ColTri();
                ulong  legacy = reader.ReadUInt64();
                tri.Vert1   = (int)(legacy & mask);
                tri.Vert2   = (int)((legacy >> 18 * 1) & mask);
                tri.Vert3   = (int)((legacy >> 18 * 2) & mask);
                tri.Surface = (int)(legacy >> (18 * 3));
                Tris.Add(tri);
            }
            for (int i = 0; i < vertexCount; i++)
            {
                Pos vtx = new Pos(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
                Vertices.Add(vtx);
            }
        }
Exemplo n.º 3
0
        public ushort CreateFreshSubMesh(ushort vertsToReserve, ushort trisToReserve)
        {
            // create custom List<> implementation with NativeArray that supports growth without assignment!
            SubMesh subMesh = new SubMesh((ushort)Verts.Count, (ushort)Tris.Count, vertsToReserve, trisToReserve);

            lastVert += vertsToReserve;
            lastTri  += trisToReserve;
            SubMeshes.Add(subMesh);
            for (int i = 0; i < vertsToReserve; i++)
            {
                Verts.Add(Vector3.zero); // this is multiple assignment! BAD!
                Normals.Add(Vector3.up);
                TextureUVs.Add(Vector2.zero);
                SubmaterialUVs.Add(Vector2.zero);
            }
            for (int i = 0; i < trisToReserve; i++)
            {
                Tris.Add(0); // more evil multiple assignment!
            }
            return((ushort)(SubMeshes.Count + SubMeshBaseIdx - 1));
        }
Exemplo n.º 4
0
        protected void AddTri <T>(string libelle, Func <IQueryable <T>, IOrderedQueryable <T> > order) where T : IEntity
        {
            var indice = Tris.Count();

            Tris.Add(new TriModel <T>(indice, libelle, order));
        }
Exemplo n.º 5
0
 public void AddTri(HashSet <Point> points)
 {
     Tris.Add(new Tri(points));
 }