god where was i

master
Jordan Orelli 8 years ago
parent 8d06c4ecc3
commit 16aa368ca1

@ -113,12 +113,6 @@ func vectorDecoder(f *Field) decoder {
} }
} }
type vector struct {
x float32
y float32
z float32
}
func decodeNormalVector(br bit.Reader) interface{} { func decodeNormalVector(br bit.Reader) interface{} {
var v vector var v vector
x, y := bit.ReadBool(br), bit.ReadBool(br) x, y := bit.ReadBool(br), bit.ReadBool(br)

@ -38,6 +38,7 @@ func init() {
{name: "int32", read: readInt32}, {name: "int32", read: readInt32},
{name: "int64", read: readInt64}, {name: "int64", read: readInt64},
{name: "Color", read: readColor}, {name: "Color", read: readColor},
{name: "HSequence", read: readIntMinusOne},
} }
primitives = make(map[string]Primitive, len(types)) primitives = make(map[string]Primitive, len(types))
for _, t := range types { for _, t := range types {
@ -49,6 +50,10 @@ func readBool(br bit.Reader, d *Dict) (interface{}, error) {
return bit.ReadBool(br), br.Err() return bit.ReadBool(br), br.Err()
} }
// ------------------------------------------------------------------------------
// uints
// ------------------------------------------------------------------------------
func readUint8(br bit.Reader, d *Dict) (interface{}, error) { func readUint8(br bit.Reader, d *Dict) (interface{}, error) {
return uint8(br.ReadBits(8)), br.Err() return uint8(br.ReadBits(8)), br.Err()
} }
@ -65,6 +70,10 @@ func readUint64(br bit.Reader, d *Dict) (interface{}, error) {
return bit.ReadVarInt(br), br.Err() return bit.ReadVarInt(br), br.Err()
} }
// ------------------------------------------------------------------------------
// ints
// ------------------------------------------------------------------------------
func readInt8(br bit.Reader, d *Dict) (interface{}, error) { func readInt8(br bit.Reader, d *Dict) (interface{}, error) {
return int8(bit.ReadZigZag(br)), br.Err() return int8(bit.ReadZigZag(br)), br.Err()
} }
@ -90,3 +99,8 @@ func readColor(br bit.Reader, d *Dict) (interface{}, error) {
a: uint8(u & 0x000000ff), a: uint8(u & 0x000000ff),
}, br.Err() }, br.Err()
} }
// what in the good fuck is this
func readIntMinusOne(br bit.Reader, d *Dict) (interface{}, error) {
return bit.ReadVarInt(br) - 1, br.Err()
}

@ -0,0 +1,7 @@
package ent
type vector struct {
x float32
y float32
z float32
}
Loading…
Cancel
Save