Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Structure ObjFacesInfo
- Dim CurrNormalIdx As Int16
- Dim TextureIdx As Int16
- Dim Flags As UInt16
- Dim NumPoints As Byte
- Dim PolyDrawMode As SByte
- Dim X As List(Of Single) '4!
- Dim Y As List(Of Single) '4!
- Dim PointOffsets As List(Of SByte) '4!
- Dim BaseNormalIdxs As List(Of Byte) '4!
- Dim UVCursorInfo As Byte
- Dim General As Byte
- Dim BucketAdj As SByte
- Dim BldgConstructFlags As Byte
- End Structure
- Private Sub Load_FacesInfo(ByVal filepath)
- Dim reader As New BinaryReader(File.Open(filepath, FileMode.Open))
- Dim TABPG As New TabPage
- Dim DGV As New DataGridView
- Dim Objects As New List(Of ObjFacesInfo)
- Dim ObjCount = 0
- While ((reader.BaseStream.Position = reader.BaseStream.Length) = False)
- Dim SingleObj As New ObjFacesInfo
- SingleObj.PointOffsets = New List(Of SByte)
- SingleObj.BaseNormalIdxs = New List(Of Byte)
- SingleObj.X = New List(Of Single)
- SingleObj.Y = New List(Of Single)
- Dim object_reader As New BinaryReader(New MemoryStream(reader.ReadBytes(60))) ' Read 54 bytes
- SingleObj.CurrNormalIdx = object_reader.ReadInt16
- SingleObj.TextureIdx = object_reader.ReadInt16
- SingleObj.Flags = object_reader.ReadUInt16
- SingleObj.NumPoints = object_reader.ReadByte
- SingleObj.PolyDrawMode = object_reader.ReadSByte
- For i As Integer = 0 To 3
- SingleObj.X.Add(object_reader.ReadSingle)
- SingleObj.Y.Add(object_reader.ReadSingle)
- Next
- For i As Integer = 0 To 7
- SingleObj.PointOffsets.Add(object_reader.ReadSByte)
- Next
- For i As Integer = 0 To 7
- SingleObj.BaseNormalIdxs.Add(object_reader.ReadByte)
- Next
- SingleObj.UVCursorInfo = object_reader.ReadByte
- SingleObj.General = object_reader.ReadByte
- SingleObj.BucketAdj = object_reader.ReadSByte
- SingleObj.BldgConstructFlags = object_reader.ReadByte
- ObjCount = ObjCount + 1
- Objects.Add(SingleObj)
- End While
- DGV.Dock = DockStyle.Fill
- DGV.Name = "DataGridView1"
- DGV.Columns.Add("CurrNormalIdx", "CurrNormalIdx")
- DGV.Columns.Add("TextureIdx", "TextureIdx")
- DGV.Columns.Add("Flags", "Flags")
- DGV.Columns.Add("NumPoints", "NumPoints")
- DGV.Columns.Add("PolyDrawMode", "PolyDrawMode")
- For i As Integer = 1 To 4
- DGV.Columns.Add("X" & i, "X" & i)
- DGV.Columns.Add("Y" & i, "Y" & i)
- Next
- For i As Integer = 1 To 8
- DGV.Columns.Add("PointOffsets" & i, "PointOffsets" & i)
- Next
- For i As Integer = 1 To 8
- DGV.Columns.Add("BaseNormalIdxs", "BaseNormalIdxs")
- Next
- DGV.Columns.Add("UVCursorInfo", "UVCursorInfo")
- DGV.Columns.Add("General", "General")
- DGV.Columns.Add("BucketAdj", "BucketAdj")
- DGV.Columns.Add("BldgConstructFlags", "BldgConstructFlags")
- For Each obj In Objects
- DGV.Rows.Add(obj.CurrNormalIdx, obj.TextureIdx, obj.Flags, obj.NumPoints, obj.PolyDrawMode, _
- obj.X(0), obj.Y(0), obj.X(1), obj.Y(1), obj.X(2), obj.Y(2), obj.X(3), obj.Y(3), _
- obj.PointOffsets(0), obj.PointOffsets(1), obj.PointOffsets(2), obj.PointOffsets(3), obj.PointOffsets(4), obj.PointOffsets(5), obj.PointOffsets(6), obj.PointOffsets(7), _
- obj.BaseNormalIdxs(0), obj.BaseNormalIdxs(1), obj.BaseNormalIdxs(2), obj.BaseNormalIdxs(3), obj.BaseNormalIdxs(4), obj.BaseNormalIdxs(5), obj.BaseNormalIdxs(6), obj.BaseNormalIdxs(7), _
- obj.UVCursorInfo, obj.General, obj.BucketAdj, obj.BldgConstructFlags)
- Next
- TABPG.Controls.Add(DGV)
- TABPG.Text = filepath
- TabControl.TabPages.Add(TABPG)
- For Each row As DataGridViewRow In DGV.Rows
- row.HeaderCell.Value = row.Index.ToString()
- Next
- DGV.RowHeadersWidth = 60
- Status.Text = ObjCount & " Objects Loaded!"
- AddEventHandlers(DGV)
- reader.Close()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement