-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqb.go
79 lines (67 loc) · 1.36 KB
/
qb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package qb
import (
"image/color"
"log"
"os"
)
// Version represents Qubicle Binary file version.
type Version struct {
Major int8
Minor int8
Release int8
Build int8
}
type ZAxisOrientation int
const (
LeftHanded ZAxisOrientation = iota
RightHanded
)
// Header represents Qubicle Binary file header.
type Header struct {
Version Version
ColorFormat color.RGBA
ZAxisOrientation ZAxisOrientation
}
type QB struct {
Version uint32
ColorFormat uint32
ZAxisOrientation uint32
Compressed uint32
VisibilityMaskEncoded uint32
NumMatrices uint32
F *os.File
I uint32
J uint32
X uint32
Y uint32
Z uint32
SizeX uint32
SizeY uint32
SizeZ uint32
PosX int32
PosY int32
PosZ int32
//Matrix array
//MatrixList array
Index uint32
Data uint32
Count uint32
}
const CODEFLAG = 2
const NEXTSLICEFLAG = 6
func Parse(filename string) {
f, err := os.Open("~/Desktop/castle_lv1.qb")
if err != nil {
log.Fatal(err)
}
defer f.Close()
b := make([]byte, 4)
_, err = f.Read(b)
if err != nil {
log.Fatal(err)
}
// version
version := uint32(b)
log.Println(version)
//
}