File: libs3d.docbook

package info (click to toggle)
s3d 0.2.2.1-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 5,356 kB
  • sloc: ansic: 21,128; python: 488; perl: 98; makefile: 31; sh: 29
file content (202 lines) | stat: -rw-r--r-- 5,931 bytes parent folder | download | duplicates (8)
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?xml version="1.0" encoding="UTF-8" ?>
<chapter id="libs3d">
<title>libs3d - The S3D API</title>
<sect1 id="using">
<title>Using the <application>s3d</application> library</title>
<sect2 id="setup">
<title>Setting <application>s3d</application> up</title>
 <para>
 Install the lib using the usual usual mechanism:
 <programlisting>
 cmake .
 make
 make install
 </programlisting>
 You might need to have superuser rights in order to do make install. You should now have the server,
 the library and some applications installed somewhere.
 </para>
</sect2>
<sect2 id="gettingstarted">
<title>Getting started</title>
<para>
 After having <application>s3d</application> installed, you can write your own <application>s3d</application> programs (yeah, that is what this guide is about ;)
 <programlisting>
 <![CDATA[#include <s3d.h>]]>
 </programlisting>
 should be enough to access the 3d functions. If you want to use keyboard interaction, do
 <programlisting>
 <![CDATA[#include <s3d_keysym.h>]]>
 </programlisting>
 for the keycode table.
 Now you can compile your program with 
 <screen>
 <prompt>bash$</prompt> <command> gcc <replaceable>program</replaceable>.c -ls3d -o <replaceable>program</replaceable> </command>
 That wasn't that hard, wasn't it?
 </screen>
</para>
</sect2>
</sect1>


<sect1 id="functions">
<title>function reference</title>

&libs3d_func;
</sect1>


<sect1 id="data_types">
<title>Data types</title>

&libs3d_struct;
&libs3d_typedef;
</sect1>




<sect1 id="definitions">
<title>Definitions</title>




<sect2 id="s3d_events">
<title>S3D events</title>
<para>
This defines the callback format. Each callback should return void and take an argument of <link linkend="structs3d_evt">struct s3d_evt *</link>.
Callbacks can be defined with <link linkend="s3d_set_callback">s3d_set_callback()</link>.
<variablelist>

<varlistentry>
<term><anchor id="S3D_EVENT_OBJ_CLICK"/>S3D_EVENT_OBJ_CLICK</term>
<listitem><para>
An object got clicked (when you set the flag <link linkend="S3D_OF_SELECTABLE">S3D_OF_SELECTABLE</link>), buf will contain the object id
of the object which got clicked (uint32_t)
</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_EVENT_KEY"/>S3D_EVENT_KEY</term>
<listitem><para>
A key was pressed, buf will contain a keycode. use  <![CDATA[#include <s3d_keysym.h>]]> to have the keycodes available. buf is a 2 byte unsigned short keycode.
</para></listitem>
</varlistentry>


<varlistentry>
<term><anchor id="S3D_EVENT_MBUTTON"/>S3D_EVENT_MBUTTON</term>
<listitem><para>
A mouse button was clicked. Use <link linkend="structs3d_but_info">struct s3d_but_info</link> on buf to get more info.
</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_EVENT_NEW_OBJECT"/>S3D_EVENT_NEW_OBJECT</term>
<listitem><para>
deprecated, will use <link linkend="S3D_EVENT_OBJ_INFO">S3D_EVENT_OBJ_INFO</link>
</para></listitem>
</varlistentry>


<varlistentry>
<term><anchor id="S3D_EVENT_OBJ_INFO"/>S3D_EVENT_OBJ_INFO</term>
<listitem><para>
Something happened to an object. This can happen if the camera was moved, the mouse (pointer) was moved or an application appeared/changed in the mcp

</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_MCP_OBJECT"/>S3D_MCP_OBJECT</term>
<listitem><para>
As the name suggests, those will only happen to the MCP. 
This tells it about new/changed application object. <link linkend="structmcp_object">struct mcp_object</link>
can be used on buf. To be removed in the future.
</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_MCP_DEL_OBJECT"/>S3D_MCP_DEL_OBJECT</term>
<listitem><para>
As the name suggests, those will only happen to the MCP. 
This tells it about deleted application object. <link linkend="structmcp_object">struct mcp_object</link>
can be used on buf. To be removed in the future.
</para></listitem>
</varlistentry>


<varlistentry>
<term><anchor id="S3D_EVENT_QUIT"/>S3D_EVENT_QUIT</term>
<listitem><para>
Server sent the quit signal, or the connection was terminated. Usually, this is only processed internally.
</para></listitem>
</varlistentry>



</variablelist>
</para>
<programlisting>
/* a callback handler could look like this: */
void my_key_handler(struct s3d_evt *event_data)
{
	...
}
</programlisting>
</sect2>


<sect2 id="s3d_object_flags">
<title>S3D Object Flags</title>
<para>
Objects can have several flags to change their behavior in the server and can be set with
<link linkend="s3d_flags_on">s3d_flags_on()</link> and
<link linkend="s3d_flags_off">s3d_flags_off()</link>
<variablelist>
<varlistentry>
<term><anchor id="S3D_OF_VISIBLE"/>S3D_OF_VISIBLE</term>
<listitem><para>default:off</para><para>
Obviously, if this flag is toggled the user can see it, if not it will be hidden. ;)
</para><para>
When an object is created it's turned off, so you will be able push your geometry data and
turn it on after you're done. That avoids flickering and stuff.
</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_OF_SELECTABLE"/>S3D_OF_SELECTABLE</term>
<listitem><para>default:off</para><para>
When this is toggled on, you will receive <link linkend="S3D_EVENT_OBJ_CLICK">click events</link>.
Don't use it if you don't need it, it will eat performance.
</para></listitem>
</varlistentry>

<varlistentry>
<term><anchor id="S3D_OF_POINTABLE"/>S3D_OF_POINTABLE</term>
<listitem><para>default:off</para><para>
Placeholder for pointer (onmouseover-event enabler) events. Not implemented yet.
</para></listitem>
</varlistentry>

</variablelist>
</para>
</sect2>

</sect1>

<sect1 id="Notes">
<title>Additional Notes</title>
<sect2 id="alpha">
<title>About alpha transparency</title>
<para>
Alpha transparency works, but polygons don't get ordered in view direction on the server yet. So please don't
use this feature yet. If you have an easy idea how to do that with OpenGL please drop me a line.
</para>
</sect2>
</sect1>




</chapter>