Release s3d 0.2.2
[s3d.git] / server / proto.h
blob88f15c218efb3c5f40d52a1b9e847fa8bb6fa916
1 /*
2 * proto.h
4 * Copyright (C) 2004-2011 Simon Wunderlich <dotslash@packetmixer.de>
6 * This file is part of s3d, a 3d network display server.
7 * See http://s3d.berlios.de/ for more updates.
9 * s3d is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * s3d is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with s3d; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 /* this defines the protocol */
26 /* simply put, a command can be issued from either the client or */
27 /* the server. of course, the client's command-set should be kept */
28 /* as low as possible to keep the library added to the client's code */
29 /* small. */
31 /* S3D_P_(C=Client,S=Server)_(command) */
32 /* C/S defines if who can invoke the command */
33 /* */
34 /* every command is 1 byte long, arguments differ. */
35 #define S3D_P_C_INIT 1
36 /* max 256b: name */
37 #define S3D_P_C_QUIT 2 /* no argument */
39 #define S3D_P_C_NEW_OBJ 3 /* add a new object */
40 /* return: 4b: object id */
41 #define S3D_P_C_DEL_OBJ 4
42 /* 4b: object id */
43 #define S3D_P_C_CLONE 5
44 /* 4b: object id */
45 /* return: 4b: object id */
46 /* if 8b: */
47 /* 4b: object id */
48 /* 4b: target oid */
49 #define S3D_P_C_LINK 6
50 /* if 4b: */
51 /* 4b: oid (for unlink) */
52 /* if 8b: */
53 /* 4b: oid from */
54 /* 4b: oid to */
55 #define S3D_P_C_PUSH_LINE 7
56 /* 4b: object id */
57 /* n*3d from vertex, to vertex, color */
58 #define S3D_P_C_PUSH_VERTEX 8
59 /* 4b: object id */
60 /* n*3f: vertexes, each with x,y,z in float */
61 #define S3D_P_C_PUSH_MAT 9
62 /* 4b: object id */
63 /* 3*4f: material elements [amb,spec,diff with r,g,b,a] */
64 #define S3D_P_C_PUSH_POLY 10
65 /* 4b: object id */
66 #define S3D_P_C_PUSH_TEX 11
67 /* 4b: object id */
68 /* nx(2x2b): width,height */
69 #define S3D_P_C_DEL_VERTEX 12
70 /* 4b: object id */
71 /* 4b: number */
72 #define S3D_P_C_DEL_POLY 13
73 /* 4b: object id */
74 /* 4b: number */
75 #define S3D_P_C_DEL_MAT 14
76 /* 4b: object id */
77 /* 4b: number */
78 #define S3D_P_C_DEL_TEX 15
79 /* 4b: object id */
80 /* 4b: number */
81 #define S3D_P_C_PEP_POLY_NORMAL 16
82 /* 4b: object id */
83 /* n*9f: normals (3* x/y/z for each vertex of the poly) */
84 #define S3D_P_C_PEP_POLY_TEXC 17
85 /* 4b: object id */
86 /* n*6f poly texture coordinates (3* u/v for each vertex of the poly) */
87 #define S3D_P_C_PEP_MAT 18
88 /* 4b: object id */
89 /* 3*4f: material elements [amb,spec,diff with r,g,b,a] */
90 #define S3D_P_C_PEP_MAT_TEX 19
91 /* 4b: object id */
92 /* 4b: texture index references */
93 #define S3D_P_C_PEP_VERTEX 20
94 /* 4b: object id */
95 /* n*3f: vertexes, each with x,y,z in float */
96 #define S3D_P_C_PEP_LINE 21
97 /* 4b: object id */
98 /* n*3u: line information (from,to,color)*/
99 #define S3D_P_C_DEL_LINE 22
100 /* 4b: object id */
101 /* 4b: number */
102 #define S3D_P_C_PEP_LINE_NORMAL 23
103 /* 4b: object id */
104 /* n*6f: normals (2* x/y/z for each vertex of the line) */
105 #define S3D_P_C_LOAD_POLY_NORMAL 24
106 /* 4b: object id */
107 /* 4b: position */
108 /* n*9f: normals (3* x/y/z for each vertex of the poly) */
109 #define S3D_P_C_LOAD_POLY_TEXC 25
110 /* 4b: object id */
111 /* 4b: position */
112 /* n*6f poly texture coordinates (3* u/v for each vertex of the poly) */
113 #define S3D_P_C_LOAD_MAT 26
114 /* 4b: object id */
115 /* 4b: position */
116 /* 3*4f: material elements [amb,spec,diff with r,g,b,a] */
117 #define S3D_P_C_UPDATE_TEX 29
118 /* 4b: object id */
119 /* 4b: texture id */
120 /* 4*2b: xpos,ypos,width,height */
121 #define S3D_P_C_LOAD_TEX 28
122 /* 4b: object id */
123 /* 4b: texture number */
124 /* 4*2b: xpos,ypos,width,height */
125 /* n*2b: pixbuf (16bit) */
126 #define S3D_P_C_LOAD_MAT_TEX 29
127 /* 4b: object id */
128 /* 4b: texture index references */
129 #define S3D_P_C_LOAD_LINE_NORMAL 30
130 /* 4b: object id */
131 /* 4b: position */
132 /* n*6f: normals (2* x/y/z for each vertex of the line) */
134 #define S3D_P_C_TOGGLE_FLAGS 32
135 /* 4b: object id */
136 /* 1b: type */
137 /* 4b: flags */
138 #define S3D_P_C_TRANSLATE 33
139 /* 4b: object id */
140 /* 3f: position */
141 #define S3D_P_C_ROTATE 34
142 /* 4b: object id */
143 /* 3f: rotation angle over x,y,z axis */
144 #define S3D_P_C_SCALE 35
145 /* 4b: object id */
146 /* 1f: scale */
147 #define S3D_P_C_GET_SIZE 36
148 /* 4b: object id */
149 #define S3D_P_MCP_FOCUS 66 /* set the app which should get the keystrokes etc */
150 /* 4b: object id/pid */
151 /* */
152 /* */
153 /* */
154 #define S3D_P_MCP_OBJECT 67
155 /* 4b: oid */
156 /* 3*f: translate */
157 /* ... ? */
158 /* max 256b:name */
159 #define S3D_P_MCP_DEL_OBJECT 68
161 #define S3D_P_S_INIT 1
162 /* 1b: acknowledged */
163 /* 3b: version,major,minor */
164 /* description string */
165 #define S3D_P_S_QUIT 2
166 #define S3D_P_S_CLICK 3
167 /* 4b: oid */
168 #define S3D_P_S_KEY 4
169 /* 2b: button */
170 /* 2b: unicode translation */
171 /* 2b: modifier information */
172 /* 2b: state */
173 #define S3D_P_S_MBUTTON 5
174 /* 1b: button number */
175 /* 2b: button state */
176 #define S3D_P_S_SHMTEX 6
177 /* 4b: object id */
178 /* 4b: texture number */
179 /* 4b: shmid */
180 /* 4*2b: width, height, bufwidth, bufheight */
181 #define S3D_P_S_NEWOBJ 16
182 /* 4b: oid */
184 #define S3D_P_S_OINFO 32
185 /* 4b: oid */
186 /* 3*f: translate */
187 /* 3*f: rotate */
188 /* 1*f: scale */
189 /* 1*f: radius */
190 /* max 256b:name */