## Protocol packets Vec is stored as `len:u32 *(data:T)`. All packets are preceeded by a u32 indicating its length. ```rs type Obj = [u8; 16] type Res = [u8; 32] 00 connect(identity: u128) ff disconnect() 01 request_resource(name: Res) 02 respond_resource(data: Vec) 03 add(id: Obj, prefab: Res) 04 remove(id: Obj) 05 position(id: Obj, pos: Vec3, rot: Vec3) 06 pose(id: Obj, params: Vec) 07 parent(parent: Obj, child: Obj) 08 sound(id: Obj, data: Vec) 09 prefab_index(res: Res) ``` ## Resource formats ### PrefabIndex ``` PrefabIndex = *(len_key:u16 len_value:u16 *(key:u8) *(value:u8)) ``` Key is string with model name. Value is prefab resource. ### Prefab ``` Prefab = *(pos:f32x3 mat:f32_3x3 part:Res) ``` ### Part ``` Part = *(len_key:u16 len_value:u16 *(key:u8) *(value:u8)) Attribute = 0x01 constant:f32 / 0x02 buffer:Res / 0x03 texture:Res NewAttribute = flag:u8 constant:f32 buffer:Res texture:Res ``` Combinations of g__, va__ and tex_* are multiplied except normal which is added. Defaults should be the identity for that operation, so default is 1 / white except normals are zero. | Key | Value Type | | | ---------------- | ------------- | ------------------ | | index | Resource | | | g_metallic | f32 | | | g_roughness | f32 | | | g_albedo | \[f32;3\] | | | g_transmission | f32 | | | va_position | [Resource; 3] | | | va_normal | [Resource; 3] | | | va_texcoord | [Resource; 2] | | | va_roughness | Resource | | | va_metallic | Resource | | | va_albedo | [Resource; 3] | | | va_transmission | Resource | | | tex_normal | Resource | Use color channels | | tex_roughness | Resource | Use green channel | | tex_metallic | Resource | Use blue channel | | tex_albedo | Resource | Use color channels | | tex_transmission | Resource | Use alpha channel | ### Texture WebP ### Shader glsl source, todo ## Player tree - LowerTorso (2x leg tilt) - FootL - FootR - UpperTorso (2x arm tilt) - HandL (5x finger, 5x tilt) - HandR (5x finger, 5x tilt) - Head (2x brow, 2x eyelid, 2x eye, 3x mouth)