-
Notifications
You must be signed in to change notification settings - Fork 31
/
shared.go
executable file
·136 lines (127 loc) · 4.48 KB
/
shared.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Autogenerated Go message buffer code.
// Source: clad/gateway/shared.clad
// Full command line: victor-clad/tools/message-buffers/emitters/Go_emitter.py -C src -o generated/cladgo/src clad/gateway/shared.clad
package gateway
import (
"bytes"
"encoding/binary"
"fmt"
)
// STRUCTURE PoseStruct3d
type PoseStruct3d struct {
X float32
Y float32
Z float32
Q0 float32
Q1 float32
Q2 float32
Q3 float32
OriginID uint32
}
func (p *PoseStruct3d) Size() uint32 {
var result uint32
result += 4 // X float_32
result += 4 // Y float_32
result += 4 // Z float_32
result += 4 // Q0 float_32
result += 4 // Q1 float_32
result += 4 // Q2 float_32
result += 4 // Q3 float_32
result += 4 // OriginID uint_32
return result
}
func (p *PoseStruct3d) Unpack(buf *bytes.Buffer) error {
if err := binary.Read(buf, binary.LittleEndian, &p.X); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Y); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Z); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Q0); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Q1); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Q2); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.Q3); err != nil {
return err
}
if err := binary.Read(buf, binary.LittleEndian, &p.OriginID); err != nil {
return err
}
return nil
}
func (p *PoseStruct3d) Pack(buf *bytes.Buffer) error {
if err := binary.Write(buf, binary.LittleEndian, p.X); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Y); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Z); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Q0); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Q1); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Q2); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.Q3); err != nil {
return err
}
if err := binary.Write(buf, binary.LittleEndian, p.OriginID); err != nil {
return err
}
return nil
}
func (p *PoseStruct3d) String() string {
return fmt.Sprint("X: {", p.X, "} ",
"Y: {", p.Y, "} ",
"Z: {", p.Z, "} ",
"Q0: {", p.Q0, "} ",
"Q1: {", p.Q1, "} ",
"Q2: {", p.Q2, "} ",
"Q3: {", p.Q3, "} ",
"OriginID: {", p.OriginID, "}")
}
// ENUM ObjectType
type ObjectType int32
const (
ObjectType_UnknownObject ObjectType = ObjectType(0)
ObjectType_Block_LIGHTCUBE1 ObjectType = ObjectType(1)
ObjectType_Block_LIGHTCUBE2 ObjectType = ObjectType_Block_LIGHTCUBE1 + 1
ObjectType_Block_LIGHTCUBE3 ObjectType = ObjectType_Block_LIGHTCUBE2 + 1
ObjectType_Block_LIGHTCUBE_GHOST ObjectType = ObjectType_Block_LIGHTCUBE3 + 1
ObjectType_Charger_Basic ObjectType = ObjectType(5)
ObjectType_CustomType00 ObjectType = ObjectType(14)
ObjectType_CustomType01 ObjectType = ObjectType_CustomType00 + 1
ObjectType_CustomType02 ObjectType = ObjectType_CustomType01 + 1
ObjectType_CustomType03 ObjectType = ObjectType_CustomType02 + 1
ObjectType_CustomType04 ObjectType = ObjectType_CustomType03 + 1
ObjectType_CustomType05 ObjectType = ObjectType_CustomType04 + 1
ObjectType_CustomType06 ObjectType = ObjectType_CustomType05 + 1
ObjectType_CustomType07 ObjectType = ObjectType_CustomType06 + 1
ObjectType_CustomType08 ObjectType = ObjectType_CustomType07 + 1
ObjectType_CustomType09 ObjectType = ObjectType_CustomType08 + 1
ObjectType_CustomType10 ObjectType = ObjectType_CustomType09 + 1
ObjectType_CustomType11 ObjectType = ObjectType_CustomType10 + 1
ObjectType_CustomType12 ObjectType = ObjectType_CustomType11 + 1
ObjectType_CustomType13 ObjectType = ObjectType_CustomType12 + 1
ObjectType_CustomType14 ObjectType = ObjectType_CustomType13 + 1
ObjectType_CustomType15 ObjectType = ObjectType_CustomType14 + 1
ObjectType_CustomType16 ObjectType = ObjectType_CustomType15 + 1
ObjectType_CustomType17 ObjectType = ObjectType_CustomType16 + 1
ObjectType_CustomType18 ObjectType = ObjectType_CustomType17 + 1
ObjectType_CustomType19 ObjectType = ObjectType_CustomType18 + 1
ObjectType_CustomFixedObstacle ObjectType = ObjectType_CustomType19 + 1
)