Beispiel #1
0
 public static ROMMatrix Get(ushort index, Short3Array indices, Vector3Array vectors)
 {
     if (index == 0xFFFF || indices == null || vectors == null || index >= indices.length)
     {
         return(null);
     }
     Short3Array.Triangle tri = indices.triangles[index];
     return(new ROMMatrix()
     {
         v1 = tri.v1 != 0xFFFF && tri.v1 < vectors.length ? new Vector3?(vectors.vectors[tri.v1]) : null,
         v2 = tri.v2 != 0xFFFF && tri.v2 < vectors.length ? new Vector3?(vectors.vectors[tri.v2]) : null,
         v3 = tri.v3 != 0xFFFF && tri.v3 < vectors.length ? new Vector3?(vectors.vectors[tri.v3]) : null
     });
 }
Beispiel #2
0
        private void ParseMatrixAndVector()
        {
            R2ROMLoader l  = MapLoader.Loader as R2ROMLoader;
            LevelHeader lh = l.Get <LevelHeader>((ushort)(l.CurrentLevel | (ushort)FATEntry.Flag.Fix));

            if (lh != null)
            {
                Short3Array  indices = lh.indices.Value;
                Vector3Array vectors = lh.vectors.Value;
                matrix = ROMTransform.ROMMatrix.Get(matrixIndex, indices, vectors);
                if (vectorIndex != 0xFFFF && vectorIndex < vectors.length)
                {
                    vector = vectors.vectors[vectorIndex];
                }
            }
        }
Beispiel #3
0
        public ROMTransform(ushort index)
        {
            if (index == 0xFFFF)
            {
                return;
            }
            R2ROMLoader l  = MapLoader.Loader as R2ROMLoader;
            LevelHeader lh = l.Get <LevelHeader>((ushort)(l.CurrentLevel | (ushort)FATEntry.Flag.Fix));

            if (lh != null)
            {
                Short3Array          indices = lh.indices.Value;
                Vector3Array         vectors = lh.vectors.Value;
                Short3Array.Triangle tri     = lh.indices.Value.triangles[index];
                rotationMatrix = ROMMatrix.Get(tri.v1, indices, vectors);
                scaleMatrix    = ROMMatrix.Get(tri.v2, indices, vectors);
                if (tri.v3 != 0xFFFF && tri.v3 < vectors.length)
                {
                    //MapLoader.Loader.print(tri.v3);
                    position = vectors.vectors[tri.v3];
                    //MapLoader.Loader.print(transform.position);
                }
            }
        }