-
Notifications
You must be signed in to change notification settings - Fork 53
/
hl2ss_rus.py
92 lines (62 loc) · 2.39 KB
/
hl2ss_rus.py
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
import struct
import hl2ss
# 3D Primitive Types
class PrimitiveType:
Sphere = 0
Capsule = 1
Cylinder = 2
Cube = 3
Plane = 4
Quad = 5
# Server Target Mode
class TargetMode:
UseID = 0
UseLast = 1
# Object Active State
class ActiveState:
Inactive = 0
Active = 1
#------------------------------------------------------------------------------
# Commands
#------------------------------------------------------------------------------
class command_buffer(hl2ss.umq_command_buffer):
def create_primitive(self, type):
self.add(0, struct.pack('<I', type))
def set_active(self, key, state):
self.add(1, struct.pack('<II', key, state))
def set_world_transform(self, key, position, rotation, scale):
self.add(2, struct.pack('<Iffffffffff', key, position[0], position[1], position[2], rotation[0], rotation[1], rotation[2], rotation[3], scale[0], scale[1], scale[2]))
def set_local_transform(self, key, position, rotation, scale):
self.add(3, struct.pack('<Iffffffffff', key, position[0], position[1], position[2], rotation[0], rotation[1], rotation[2], rotation[3], scale[0], scale[1], scale[2]))
def set_color(self, key, rgba):
self.add(4, struct.pack('<Iffff', key, rgba[0], rgba[1], rgba[2], rgba[3]))
def set_texture(self, key, texture):
self.add(5, struct.pack('<I', key) + texture)
def create_text(self):
self.add(6, b'')
def set_text(self, key, font_size, rgba, string):
self.add(7, struct.pack('<Ifffff', key, font_size, rgba[0], rgba[1], rgba[2], rgba[3]) + string.encode('utf-8'))
def say(self, text):
self.add(8, text.encode('utf-8'))
def load_mesh(self, data):
self.add(15, data)
def remove(self, key):
self.add(16, struct.pack('<I', key))
def remove_all(self):
self.add(17, b'')
def begin_display_list(self):
self.add(18, b'')
def end_display_list(self):
self.add(19, b'')
def set_target_mode(self, mode):
self.add(20, struct.pack('<I', mode))
def debug_try_lock_pv(self):
self.add(0xFFFFFF00, b'')
def debug_unlock_pv(self):
self.add(0xFFFFFF01, b'')
def debug_try_lock_ev(self):
self.add(0xFFFFFF02, b'')
def debug_unlock_ev(self):
self.add(0xFFFFFF03, b'')
def debug_message(self, text):
self.add(0xFFFFFFFE, text.encode('utf-8'))