Ejemplo n.º 1
0
                public SerializedBundle(byte[] _data)
                {
                    byte32         = new Byte32();
                    bytesVec2      = new ByteVector2();
                    bytesVec3      = new ByteVector3();
                    SerializedData = _data;
                    BufIdx         = 0;


                    var totalLen = byte32.ReadInt(SerializedData, ref BufIdx);

                    var version = byte32.ReadInt(SerializedData, ref BufIdx);

                    var vertexCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    Vertices = DeserializeVectors(vertexCount);

                    var triangleCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    Triangles = DeserializeTris(triangleCount);

                    var hullSitesCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    HullSites = DeserializeHullSites(hullSitesCount);

                    var siteCornerCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    SiteCorners = DeserializeSiteCorners(siteCornerCount);

                    var siteNeighborsCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    SiteNeighbors = DeserializeSiteNeighbors(siteNeighborsCount);

                    var sitePositionsCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    SitePositions = DeserializeSitePositions(sitePositionsCount);

                    var sitesHavingCornerCount = byte32.ReadInt(SerializedData, ref BufIdx);

                    SitesHavingCorner = DeserializeSitesHavingCorner(sitesHavingCornerCount);
                }
Ejemplo n.º 2
0
 public UserByteVector3Property(string name, ByteVector3 value) : base(UserPropertyValueType.ByteVector3, name) => Value = value;
Ejemplo n.º 3
0
                public SerializedBundle(TerraMesh _tm)
                {
                    Version = CUR_VERSION;

                    //Vector3 -- 12 bytes
                    Vertices = _tm.Vertices; //TODO Broken
                    //int - 4 bytes
                    Triangles = _tm.Triangles;
                    //int - 4 bytes
                    HullSites = _tm.HullSites;
                    //3 ints - 12 bytes
                    SiteCorners = _tm.SiteCorners;
                    //3 ints - 12 bytes
                    SiteNeighbors = _tm.SiteNeighbors;
                    //Vector3 -- 12 bytes
                    //SitePositions = _tm.SitePositions; //TODO BROKEN
                    //Variable -- need to track length for each set
                    SitesHavingCorner = _tm.SitesHavingCorner;

                    var totalSetCount = 0;

                    for (var cornerIdx = 0; cornerIdx < SitesHavingCorner.Length; ++cornerIdx)
                    {
                        totalSetCount += _tm.SitesHavingCorner[cornerIdx].Count;
                    }

                    var dataLen = sizeof(int);                           //Total size header

                    dataLen += sizeof(int);                              // Version
                    dataLen += sizeof(int);                              // Vertex count header
                    dataLen += Vertices.Length * sizeof(float) * 2;      // Vector2
                    dataLen += sizeof(int);                              // Triangle count header
                    dataLen += Triangles.Length * sizeof(int);           //int
                    dataLen += sizeof(int);                              // HullSites count header
                    dataLen += HullSites.Length * sizeof(int);           //int
                    dataLen += sizeof(int);                              // SiteCorners count header
                    dataLen += SiteCorners.Length * sizeof(int) * 3;     //int * 3
                    dataLen += sizeof(int);                              // SiteNeighbors count header
                    dataLen += SiteNeighbors.Length * sizeof(int) * 3;   // int * 3
                    dataLen += sizeof(int);                              // SitePositions count header
                    dataLen += SitePositions.Length * sizeof(float) * 3; // Vector3
                    dataLen += sizeof(int);                              // Site having corner set count
                    dataLen += SitesHavingCorner.Length * sizeof(int);   //Site Having corner count headers
                    dataLen += totalSetCount * sizeof(int);              //Sites having corner set indexes

                    SerializedData = new byte[dataLen];
                    BufIdx         = 0;

                    byte32    = new Byte32();
                    bytesVec2 = new ByteVector2();
                    bytesVec3 = new ByteVector3();

                    byte32.Write(SerializedData, ref BufIdx, dataLen);
                    byte32.Write(SerializedData, ref BufIdx, Version);
                    SerializeVertices(ref BufIdx, SerializedData);
                    SerializeTris(ref BufIdx, SerializedData);
                    SerializeHullSites(ref BufIdx, SerializedData);
                    SerializeSiteCorners(ref BufIdx, SerializedData);
                    SerializeSiteNeighbors(ref BufIdx, SerializedData);
                    SerializeSitePositions(ref BufIdx, SerializedData);
                    SerializeSitesHavingCorner(ref BufIdx, SerializedData);
                }
Ejemplo n.º 4
0
 public void WriteByteVector3(ByteVector3 value)
 {
     WriteByte(value.X);
     WriteByte(value.Y);
     WriteByte(value.Z);
 }
Ejemplo n.º 5
0
 private void WriteByteVector3(ByteVector3 value)
 {
     WriteByte(value.X);
     WriteByte(value.Y);
     WriteByte(value.Z);
 }