public CollisionPoly(CollisionMesh mesh, Ptr ptr)
        {
            short  type;
            ushort vA;
            ushort vB;
            ushort vC;
            short  vertexA;
            short  vertexB;
            short  vertexC;

            Id = (ptr - mesh.PolyArray) / 0x10;

            type         = ptr.ReadInt16(0x00);
            vA           = ptr.ReadUInt16(0x02);
            vB           = ptr.ReadUInt16(0x04);
            vC           = ptr.ReadUInt16(0x06);
            vertexA      = (short)(vA & 0x1FFF);
            vertexB      = (short)(vB & 0x1FFF);
            vertexC      = (short)(vC & 0x1FFF);
            VertexFlagsA = Shift.AsByte(vA, 0xE000);
            VertexFlagsB = Shift.AsByte(vB, 0xE000);
            VertexFlagsC = Shift.AsByte(vC, 0xE000);

            Normal = new Vector3 <short>(
                ptr.ReadInt16(0x08),
                ptr.ReadInt16(0x0A),
                ptr.ReadInt16(0x0C));
            D = ptr.ReadInt16(0x0E);

            Type    = CollisionPolyType.GetPolyType(mesh, type);
            VertexA = CollisionVertex.GetVertex(mesh, vertexA);
            VertexB = CollisionVertex.GetVertex(mesh, vertexB);
            VertexC = CollisionVertex.GetVertex(mesh, vertexC);
        }
Beispiel #2
0
        public static CollisionVertex GetVertex(CollisionMesh mesh, short id)
        {
            var ptr = mesh.VertexArray.RelOff(id * 6);

            return(new CollisionVertex(id,
                                       ptr.ReadInt16(0),
                                       ptr.ReadInt16(2),
                                       ptr.ReadInt16(4)));
        }
        public static CollisionPolyType GetPolyType(CollisionMesh mesh, short id)
        {
            var ptr = mesh.PolyTypeArray.RelOff(id * 8);

            return(new CollisionPolyType(id, ptr, ptr.ReadInt32(0), ptr.ReadInt32(4)));
        }