syntax = "proto3";
package protocol;
message Geometry {
repeated float positions = 1 [ packed = true ];
repeated float uvs = 2 [ packed = true ];
repeated int32 indices = 4 [ packed = true ];
repeated int32 lights = 5 [ packed = true ];
}
message Mesh {
Geometry opaque = 1;
Geometry transparent = 2;
}
message Chunk {
int32 x = 1;
int32 z = 2;
string id = 3;
Mesh mesh = 4;
repeated uint32 voxels = 5 [ packed = true ];
repeated uint32 lights = 6 [ packed = true ];
repeated uint32 heightMap = 7 [ packed = true ];
}
message Vector3 {
float x = 1;
float y = 2;
float z = 3;
}
message Peer {
string id = 1;
string name = 2;
Vector3 position = 3;
Vector3 direction = 4;
}
message Entity {
string id = 1;
string type = 2;
string metadata = 6;
}
message Update {
int32 vx = 1;
int32 vy = 2;
int32 vz = 3;
uint32 voxel = 4;
uint32 light = 5;
uint32 height = 6;
}
message ChatMessage {
enum Type {
ERROR = 0;
SERVER = 1;
PLAYER = 2;
INFO = 3;
}
Type type = 1;
string sender = 2;
string body = 3;
}
message Message {
enum Type {
INIT = 0;
JOIN = 1;
LEAVE = 2;
SIGNAL = 3;
ERROR = 4;
PEER = 5;
ENTITY = 6;
LOAD = 7;
UNLOAD = 8;
UPDATE = 9;
DEBUG = 10;
CHAT = 11;
}
Type type = 1;
string json = 2;
string text = 3;
Peer peer = 4;
ChatMessage chat = 5;
repeated string peers = 6;
repeated Entity entities = 7;
repeated Chunk chunks = 8;
repeated Update updates = 9;
}