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
|
<sect2 id="s3d_usage"><title>s3d_usage</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_usage</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Prints the possible parameter for the client library (which can be passed in <link linkend="s3d_init">s3d_init</link>()) </para></sect2>
<sect2 id="s3d_init"><title>s3d_init</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_init</function></funcdef><paramdef>int *<parameter>argc</parameter></paramdef><paramdef>char ***<parameter>argv</parameter></paramdef><paramdef>const char *<parameter>name</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This will initialize the s3d-library and the connection to the Server. It will return 0 on success in server initialization. name specifies the your programs name.</para><programlisting> int main(char argc, char **argv)
{
if (!<link linkend="s3d_init">s3d_init</link>(&argc, &argv, "Hello world"))
{
...
<link linkend="s3d_quit">s3d_quit</link>();
}
return 0;
}
</programlisting></sect2>
<sect2 id="s3d_quit"><title>s3d_quit</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_quit</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Closes the connection and clears the event-stack. It can also be used to leave the <link linkend="s3d_mainloop">s3d_mainloop</link>(). </para></sect2>
<sect2 id="s3d_mainloop"><title>s3d_mainloop</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_mainloop</function></funcdef><paramdef>void(*)(void) <parameter>f</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Takes a function as argument. It will loop this function until a quit-event is received. You can pass NULL if you have no function to be looped, but its better to sleep some time if you have nothing to do anyway to save cpu-time.</para><programlisting> void mainloop(void)
{
usleep(1000); // sleep 1 ms in every cycle
}
...
<link linkend="s3d_mainloop">s3d_mainloop</link>(mainloop());
</programlisting></sect2>
<sect2 id="s3d_push_vertex"><title>s3d_push_vertex</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_vertex</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>x</parameter></paramdef><paramdef>float <parameter>y</parameter></paramdef><paramdef>float <parameter>z</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pushes a vertex onto the vertex stack. Make sure that you count how many vertices you've pushed because you'll need that for referencing when you push your polygons. </para></sect2>
<sect2 id="s3d_push_vertices"><title>s3d_push_vertices</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_vertices</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>vbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Push some vertices from an array. that's much better for performing than using <link linkend="s3d_push_vertex">s3d_push_vertex</link>() if you have a lot of vertices (and that's probably the usual case). </para><programlisting> float vertices[] = { 0.0, 0.0, 0.0,
1.0, 2.0, 3.0,
3.0, 2.0, 1.0};
<link linkend="s3d_push_vertices">s3d_push_vertices</link>(object, vertices, 3); // pushing 3 vertices
</programlisting></sect2>
<sect2 id="s3d_push_material"><title>s3d_push_material</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_material</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>amb_r</parameter></paramdef><paramdef>float <parameter>amb_g</parameter></paramdef><paramdef>float <parameter>amb_b</parameter></paramdef><paramdef>float <parameter>spec_r</parameter></paramdef><paramdef>float <parameter>spec_g</parameter></paramdef><paramdef>float <parameter>spec_b</parameter></paramdef><paramdef>float <parameter>diff_r</parameter></paramdef><paramdef>float <parameter>diff_g</parameter></paramdef><paramdef>float <parameter>diff_b</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pushes a material for an object. you will have to count them yourself too, as polygons will ask for the material index number. The material properties are given in rgb (red/green/blue) color codes, in float. 0.0 is the minimum, 1.0 is the maximum a color value can be. The specular color is the color which is directly reflected from the light source. The diffuse color is the color which can be seen in the bright side of the object, and the ambience color is the color of the shadow side of the object. </para></sect2>
<sect2 id="s3d_pep_material"><title>s3d_pep_material</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_material</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>amb_r</parameter></paramdef><paramdef>float <parameter>amb_g</parameter></paramdef><paramdef>float <parameter>amb_b</parameter></paramdef><paramdef>float <parameter>spec_r</parameter></paramdef><paramdef>float <parameter>spec_g</parameter></paramdef><paramdef>float <parameter>spec_b</parameter></paramdef><paramdef>float <parameter>diff_r</parameter></paramdef><paramdef>float <parameter>diff_g</parameter></paramdef><paramdef>float <parameter>diff_b</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Overwriting the latest pushed material, overwriting the current value with the specified one. See <link linkend="s3d_pep_materials_a">s3d_pep_materials_a</link> if you want to pep more materials. </para></sect2>
<sect2 id="s3d_push_material_a"><title>s3d_push_material_a</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_material_a</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>amb_r</parameter></paramdef><paramdef>float <parameter>amb_g</parameter></paramdef><paramdef>float <parameter>amb_b</parameter></paramdef><paramdef>float <parameter>amb_a</parameter></paramdef><paramdef>float <parameter>spec_r</parameter></paramdef><paramdef>float <parameter>spec_g</parameter></paramdef><paramdef>float <parameter>spec_b</parameter></paramdef><paramdef>float <parameter>spec_a</parameter></paramdef><paramdef>float <parameter>diff_r</parameter></paramdef><paramdef>float <parameter>diff_g</parameter></paramdef><paramdef>float <parameter>diff_b</parameter></paramdef><paramdef>float <parameter>diff_a</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Same as <link linkend="s3d_push_material">s3d_push_material</link>, but color has alpha value added. Use <link linkend="s3d_push_materials_a">s3d_push_materials_a</link>() if you have a lot of materials to push. </para></sect2>
<sect2 id="s3d_push_materials_a"><title>s3d_push_materials_a</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_materials_a</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>mbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pushes a buffer of materials. Those materials are in the format float[n*12], with
</para><para>mbuf[n*12 + 0-3] - ambience</para><para>mbuf[n*12 + 4-7] - specular</para><para>mbuf[n *12 + 8-11] - diffusion values
</para><para>of each entry. n is the number of materials pushed. The values are in the order r,g,b,a. If you only want to push one material, use the more easy <link linkend="s3d_push_material_a">s3d_push_material_a</link>() function.</para><programlisting> // each line has r,g,b,a value
float bla[24]=
{1, 0, 0, 1,
1, 0, 0, 1,
1, 0, 0, 1,
0, 1, 1, 1,
0, 1, 1, 1,
0, 1, 1, 1};
<link linkend="s3d_push_materials_a">s3d_push_materials_a</link>(object, bla, 2); // push a red and a cyan material
</programlisting></sect2>
<sect2 id="s3d_pep_material_a"><title>s3d_pep_material_a</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_material_a</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>amb_r</parameter></paramdef><paramdef>float <parameter>amb_g</parameter></paramdef><paramdef>float <parameter>amb_b</parameter></paramdef><paramdef>float <parameter>amb_a</parameter></paramdef><paramdef>float <parameter>spec_r</parameter></paramdef><paramdef>float <parameter>spec_g</parameter></paramdef><paramdef>float <parameter>spec_b</parameter></paramdef><paramdef>float <parameter>spec_a</parameter></paramdef><paramdef>float <parameter>diff_r</parameter></paramdef><paramdef>float <parameter>diff_g</parameter></paramdef><paramdef>float <parameter>diff_b</parameter></paramdef><paramdef>float <parameter>diff_a</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Overwriting the latest pushed material, overwriting the current value with the specified one, with alpha value in contrast to <link linkend="s3d_pep_material">s3d_pep_material</link> See <link linkend="s3d_push_materials_a">s3d_push_materials_a</link> if you want to pep more materials. </para></sect2>
<sect2 id="s3d_pep_materials_a"><title>s3d_pep_materials_a</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_materials_a</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>mbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Alters the last n pushed materials. See <link linkend="s3d_push_materials_a">s3d_push_materials_a</link>() for more information how mbuf should look like. Use <link linkend="s3d_pep_material_a">s3d_pep_material_a</link>() if you only want to alter the latest material. </para></sect2>
<sect2 id="s3d_load_materials_a"><title>s3d_load_materials_a</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_load_materials_a</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>mbuf</parameter></paramdef><paramdef>uint32_t <parameter>start</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Loads n materials starting from index position start into the material stack. See <link linkend="s3d_push_materials_a">s3d_push_materials_a</link> for more information about the values in mbuf. </para></sect2>
<sect2 id="s3d_push_polygon"><title>s3d_push_polygon</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_polygon</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>v1</parameter></paramdef><paramdef>uint32_t <parameter>v2</parameter></paramdef><paramdef>uint32_t <parameter>v3</parameter></paramdef><paramdef>uint32_t <parameter>material</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Push one polygon on the polygon stack of the object. It takes 3 vertex-index numbers and one material material-index-no. as argument.</para><programlisting> int oid = <link linkend="s3d_new_object">s3d_new_object</link>(); // create a new object
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 0.0, 0.0, 0.0);
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 0.0, 1.0, 0.0);
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 1.0, 0.0, 0.0);
<link linkend="s3d_push_material">s3d_push_material</link>(oid, 0.3, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0);
<link linkend="s3d_push_polygon">s3d_push_polygon</link>(oid, 0, 1, 2, 0);
// this will create a red polygon
</programlisting></sect2>
<sect2 id="s3d_push_polygons"><title>s3d_push_polygons</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_polygons</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const uint32_t *<parameter>pbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>As for vertices, you can push arrays of polygons to have greater performance. The pbuf should contain n polygons which consist of 4 uint32_t values of 3 vertices indices and 1 material index.</para><programlisting> uint32_t pbuf[] = { 0, 1, 2, 0};
int oid = <link linkend="s3d_new_object">s3d_new_object</link>(); // create a new object
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 0.0, 0.0, 0.0);
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 0.0, 1.0, 0.0);
<link linkend="s3d_push_vertex">s3d_push_vertex</link>(oid, 1.0, 0.0, 0.0);
<link linkend="s3d_push_material">s3d_push_material</link>(oid, 0.3, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0);
<link linkend="s3d_push_polygons">s3d_push_polygons</link>(oid, pbuf, 1);
// push one polygon with the pbuf data
</programlisting></sect2>
<sect2 id="s3d_push_line"><title>s3d_push_line</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_line</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>v1</parameter></paramdef><paramdef>uint32_t <parameter>v2</parameter></paramdef><paramdef>uint32_t <parameter>material</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Push one line on the line stack of the object. It takes 2 vertex-index-no, and one material material-index-no. as argument. If you have a lot of lines to push, use <link linkend="s3d_push_lines">s3d_push_lines</link>() </para></sect2>
<sect2 id="s3d_push_lines"><title>s3d_push_lines</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_lines</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const uint32_t *<parameter>lbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pushing n lines on the line stack of the object, each lbuf has a size of n*3, each entry has the index number of the first vertex, second vertex and material number just as in <link linkend="s3d_push_line">s3d_push_line</link>(). </para></sect2>
<sect2 id="s3d_push_texture"><title>s3d_push_texture</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_texture</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint16_t <parameter>w</parameter></paramdef><paramdef>uint16_t <parameter>h</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Adds a new texture with height w and height h on the texture stack. </para></sect2>
<sect2 id="s3d_push_textures"><title>s3d_push_textures</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_push_textures</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const uint16_t *<parameter>tbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>As for vertices, you can push arrays of textures on the texture stack to have greater performance. The tbuf should contain n texture sizes which consist of 2 uint16_t values for width and height for each texture. </para></sect2>
<sect2 id="s3d_pop_vertex"><title>s3d_pop_vertex</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pop_vertex</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the latest n vertices from the vertex stack of the object. </para></sect2>
<sect2 id="s3d_pop_polygon"><title>s3d_pop_polygon</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pop_polygon</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the latest n polygon from the polygon stack of the object. </para></sect2>
<sect2 id="s3d_pop_material"><title>s3d_pop_material</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pop_material</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the latest n material from the material stack of the object. </para></sect2>
<sect2 id="s3d_pop_texture"><title>s3d_pop_texture</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pop_texture</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the latest n textures from the texture stack of the object. </para></sect2>
<sect2 id="s3d_pop_line"><title>s3d_pop_line</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pop_line</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the latest n lines from the line stack of the object. </para></sect2>
<sect2 id="s3d_pep_line_normals"><title>s3d_pep_line_normals</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_line_normals</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>nbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Adds normal information to lines, giving each vertex of a line a normal information. This makes lines somewhat nicer, you'll need that especially when you're going to build wireframe models.</para><para>nbuf should contain n * 6 float values, for each vertex a normal vector (x,y,z), and you have 2 vertices for each line so that makes 6 float values per line in total. </para></sect2>
<sect2 id="s3d_pep_polygon_normals"><title>s3d_pep_polygon_normals</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_polygon_normals</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>nbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Adds normal information to polygons, giving each vertex of a polygon a normal information. With this, you can achieve smoothed edge effects.</para><para>nbuf should contain n * 9 float values, for each vertex a normal vector (x,y,z), and you have 3 vertices for each Polygon so that makes 9 float values per Polygon in total. Don't worry if you don't use this, it's kind of hard to calculate and the server will always use some proper normal values (same for every vertex, calculated by the plane which is defined by the 3 points of the polygon. </para></sect2>
<sect2 id="s3d_pep_polygon_tex_coord"><title>s3d_pep_polygon_tex_coord</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_polygon_tex_coord</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>x1</parameter></paramdef><paramdef>float <parameter>y1</parameter></paramdef><paramdef>float <parameter>x2</parameter></paramdef><paramdef>float <parameter>y2</parameter></paramdef><paramdef>float <parameter>x3</parameter></paramdef><paramdef>float <parameter>y3</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pimp the last polygon pushed with some textures coordinates, x and y values for each vertex point respectively. Those values may be between 0 and 1 and are vertex points on the texture defined in the material of the polygon. If you have more polygons which should get a texture, use <link linkend="s3d_pep_polygon_tex_coords">s3d_pep_polygon_tex_coords</link>() </para></sect2>
<sect2 id="s3d_pep_polygon_tex_coords"><title>s3d_pep_polygon_tex_coords</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_polygon_tex_coords</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>tbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pimp the latest n polygons with texture coordinates. tbuf has 6*n float values for its entries, which are supplied in the order as in <link linkend="s3d_pep_polygon_tex_coord">s3d_pep_polygon_tex_coord</link>() </para></sect2>
<sect2 id="s3d_pep_material_texture"><title>s3d_pep_material_texture</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_material_texture</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>tex</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Assign the latest material a texture referenced by the index tex. Of course, you will have pushed this texture with <link linkend="s3d_push_texture">s3d_push_texture</link>() </para></sect2>
<sect2 id="s3d_pep_vertex"><title>s3d_pep_vertex</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_vertex</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>x</parameter></paramdef><paramdef>float <parameter>y</parameter></paramdef><paramdef>float <parameter>z</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Alter the latest pushed vertex, overwriting with the supplied values. </para></sect2>
<sect2 id="s3d_pep_vertices"><title>s3d_pep_vertices</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_vertices</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>vbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Alter the latest n pushed vertex. vbuf holds the values which are used to overwrite the old data, n entries with each 3 floats specifying x,y,z of the vertices. </para></sect2>
<sect2 id="s3d_pep_line"><title>s3d_pep_line</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_line</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>int <parameter>v1</parameter></paramdef><paramdef>int <parameter>v2</parameter></paramdef><paramdef>int <parameter>material</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Alter the latest pushed line, overwriting with the supplied values. </para></sect2>
<sect2 id="s3d_pep_lines"><title>s3d_pep_lines</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_pep_lines</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const uint32_t *<parameter>lbuf</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Alter the latest n pushed lines. lbuf holds the values which are used to overwrite the old data, n entries with each 3 uint32_t specifying first, second vertex and material of each line. </para></sect2>
<sect2 id="s3d_load_line_normals"><title>s3d_load_line_normals</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_load_line_normals</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>nbuf</parameter></paramdef><paramdef>uint32_t <parameter>start</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Just as <link linkend="s3d_pep_line_normals">s3d_pep_line_normals</link>(), with the difference you won't alter the latest n lines but n lines starting with index start. </para></sect2>
<sect2 id="s3d_load_polygon_normals"><title>s3d_load_polygon_normals</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_load_polygon_normals</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>nbuf</parameter></paramdef><paramdef>uint32_t <parameter>start</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Just as <link linkend="s3d_pep_polygon_normals">s3d_pep_polygon_normals</link>(), with the difference you won't alter the latest n polygons but n polygons starting with index start. </para></sect2>
<sect2 id="s3d_load_polygon_tex_coords"><title>s3d_load_polygon_tex_coords</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_load_polygon_tex_coords</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>const float *<parameter>tbuf</parameter></paramdef><paramdef>uint32_t <parameter>start</parameter></paramdef><paramdef>uint16_t <parameter>n</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Just as <link linkend="s3d_pep_polygon_tex_coords">s3d_pep_polygon_tex_coords</link>(), with the difference you won't alter the latest n polygons but n polygons starting with index start. </para></sect2>
<sect2 id="s3d_load_texture"><title>s3d_load_texture</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_load_texture</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>tex</parameter></paramdef><paramdef>uint16_t <parameter>xpos</parameter></paramdef><paramdef>uint16_t <parameter>ypos</parameter></paramdef><paramdef>uint16_t <parameter>w</parameter></paramdef><paramdef>uint16_t <parameter>h</parameter></paramdef><paramdef>const uint8_t *<parameter>data</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This will load an 32bit rgba image supplied in data at position xpos,ypos of the texture tex. The image has the width w and height h. This can be used to update only parts of the texture. It's no problem to supply big textures, as the image will be sent to server in fragments. Of course, you will have created the texture with <link linkend="s3d_push_texture">s3d_push_texture</link>, have an material assigned to the texture with <link linkend="s3d_pep_material_texture">s3d_pep_material_texture</link>() and have your polygons set sane polygon texture coords using <link linkend="s3d_pep_polygon_tex_coord">s3d_pep_polygon_tex_coord</link>(). </para></sect2>
<sect2 id="s3d_new_object"><title>s3d_new_object</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_new_object</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Creates a new object, returning the object id.</para><warning><para>Of course, you won't forget to toggle it visible, won't you?
</para></warning></sect2>
<sect2 id="s3d_del_object"><title>s3d_del_object</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_del_object</function></funcdef><paramdef>int <parameter>oid</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes the object referenced by oid. </para></sect2>
<sect2 id="s3d_clone"><title>s3d_clone</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_clone</function></funcdef><paramdef>int <parameter>oid</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Clones an already existing object. They get just look the same as the parent-object and will change when the parent-object changes. Cloning especially makes sense if you want to use the same object a lot of times. Move and transform is independent from the parent. The function returns the children object id. </para></sect2>
<sect2 id="s3d_clone_target"><title>s3d_clone_target</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_clone_target</function></funcdef><paramdef>int <parameter>oid</parameter></paramdef><paramdef>int <parameter>toid</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Changes the clone target of oid to another object (toid). This assumes you've got oid from <link linkend="s3d_clone">s3d_clone</link> before. </para></sect2>
<sect2 id="s3d_link"><title>s3d_link</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_link</function></funcdef><paramdef>int <parameter>oid_from</parameter></paramdef><paramdef>int <parameter>oid_to</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>A linked object will move along with it's link parent. For example if you have a book on a table, you can link the book to the table so the book will "keep on the table" if you move the table around in space. It will also rotate with the table etc. </para></sect2>
<sect2 id="s3d_unlink"><title>s3d_unlink</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_unlink</function></funcdef><paramdef>int <parameter>oid</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Remove the link of object oid to its target. </para></sect2>
<sect2 id="s3d_flags_on"><title>s3d_flags_on</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_flags_on</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>flags</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Turn some flags on for object.</para><warning><para>If you don't toggle OF_VISIBLE on, you won't see your object. usually you want this. (at least after you *push()d all your content)
</para></warning></sect2>
<sect2 id="s3d_flags_off"><title>s3d_flags_off</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_flags_off</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>uint32_t <parameter>flags</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Turn some flags off for object. </para></sect2>
<sect2 id="s3d_translate"><title>s3d_translate</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_translate</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>x</parameter></paramdef><paramdef>float <parameter>y</parameter></paramdef><paramdef>float <parameter>z</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Move the object to some position in space. when you create an object, it's always located at 0.0 , 0.0, 0.0.</para><warning><para>Translation is absolute, not relative!
</para></warning><programlisting> <link linkend="s3d_translate">s3d_translate</link>(object, 2, 0, 0);
<link linkend="s3d_translate">s3d_translate</link>(object, 4, 0, 0);
// object will end up at 4,0,0 and not 6,0,0!!
</programlisting></sect2>
<sect2 id="s3d_rotate"><title>s3d_rotate</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_rotate</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>x</parameter></paramdef><paramdef>float <parameter>y</parameter></paramdef><paramdef>float <parameter>z</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Rotate an object around the x, y and z-axis respectively. x,y,z may have values between [0,360] degrees.</para><para>You will usually only rotate around one axis, leaving the unused fields on 0, I guess. If you want to rotate around more than one axis, please note: The order of the rotation applies is y-axis, x-axis, and then z-axis. You can think of it as the earth position coordinates: x is the longitude, y is the latitude, and z is the rotation at this point of the earth around your bodies axis. (I wonder if that makes it any clearer ;)</para><warning><para>Rotate is absolute, not relative!
</para></warning><programlisting> <link linkend="s3d_rotate">s3d_rotate</link>(object, 90, 0, 0);
<link linkend="s3d_rotate">s3d_rotate</link>(object, 180, 0, 0);
// object will be rotated 180 degrees around the x-axis, not 270 degress!
</programlisting></sect2>
<sect2 id="s3d_scale"><title>s3d_scale</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_scale</function></funcdef><paramdef>int <parameter>object</parameter></paramdef><paramdef>float <parameter>s</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Scales the object. about factor s. s=1 will be the original size, -1 will mirror it.</para><warning><para>s=0 is forbidden and will be ignored! <link linkend="s3d_scale">s3d_scale</link> is also absolute, not relative!
</para></warning></sect2>
<sect2 id="s3d_import_model_file"><title>s3d_import_model_file</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_import_model_file</function></funcdef><paramdef>const char *<parameter>fname</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Imports an 3d object file and returns the object number. Quite a number of formats are supported, like 3D Studio (.3ds, .prj), Lightwave (.lw, .lwb, .lwo), Quake Models (.md3), or simply everything libg3d supports. :)</para><warning><para>Of course, you won't forget to toggle it visible, won't you?
</para></warning></sect2>
<sect2 id="s3d_open_file"><title>s3d_open_file</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_open_file</function></funcdef><paramdef>const char *<parameter>fname</parameter></paramdef><paramdef>char **<parameter>pointer</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This opens the file fname, setting *pointer to it's memory position. the function will return the size of buffer. you can free() the pointer when you're finished. </para></sect2>
<sect2 id="s3d_select_font"><title>s3d_select_font</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_select_font</function></funcdef><paramdef>const char *<parameter>mask</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This selects a font for the <link linkend="s3d_draw_string">s3d_draw_string</link>() function.</para><warning><para>Of course, you won't forget to toggle it visible, won't you?
</para></warning><programlisting> <link linkend="s3d_select_font">s3d_select_font</link>("vera"); // will use the vera font face
</programlisting></sect2>
<sect2 id="s3d_draw_string"><title>s3d_draw_string</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_draw_string</function></funcdef><paramdef>const char *<parameter>str</parameter></paramdef><paramdef>float *<parameter>xlen</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Renders the string str with in Truetype format with the height 1, returns the length of the rendered string in *xlen (or set len=NULL to disable this).</para><programlisting> char str="hello world!";
float len;
<link linkend="s3d_select_font">s3d_select_font</link>("vera");
<link linkend="s3d_draw_string">s3d_draw_string</link>(str, len);
// not interested in the length? do that: <link linkend="s3d_draw_string">s3d_draw_string</link>(str, NULL);
</programlisting></sect2>
<sect2 id="s3d_strlen"><title>s3d_strlen</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>float <function>s3d_strlen</function></funcdef><paramdef>const char *<parameter>str</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Returns the length of the string if it were rendered with the currently selected font. That might be useful to estimate the size used for a text and render the background or bounding box before inserting the text. </para></sect2>
<sect2 id="s3d_vector_length"><title>s3d_vector_length</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>float <function>s3d_vector_length</function></funcdef><paramdef>const float <parameter>vector</parameter>[]</paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Calculates and returns the length of the given vector (which should be of the type float[3]). More info on wikipedia http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_vector_dot_product"><title>s3d_vector_dot_product</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>float <function>s3d_vector_dot_product</function></funcdef><paramdef>const float <parameter>vector1</parameter>[]</paramdef><paramdef>const float <parameter>vector2</parameter>[]</paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Calculates and returns the dot product of vector1 and vector2. All vectors should have the format float[3]. More info on wikipedia. http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_vector_subtract"><title>s3d_vector_subtract</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_vector_subtract</function></funcdef><paramdef>const float <parameter>vector1</parameter>[]</paramdef><paramdef>const float <parameter>vector2</parameter>[]</paramdef><paramdef>float <parameter>result_vector</parameter>[]</paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Subtracts vector1 from vector2, writing result into result_vector. All vectors should have the format float[3]. More info on wikipedia. http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_vector_angle"><title>s3d_vector_angle</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>float <function>s3d_vector_angle</function></funcdef><paramdef>const float <parameter>vector1</parameter>[]</paramdef><paramdef>const float <parameter>vector2</parameter>[]</paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Calculates and returns the angle between vector1 and vector2. Please note that the resulting angle is between 0 and PI, therefore not covering the whole period! To convert in degrees just do result*180/M_PI. All vectors should have the format float[3]. More info on wikipedia. http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_angle_to_cam"><title>s3d_angle_to_cam</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>float <function>s3d_angle_to_cam</function></funcdef><paramdef>const float <parameter>obj_pos</parameter>[]</paramdef><paramdef>const float <parameter>cam_pos</parameter>[]</paramdef><paramdef>float *<parameter>angle_rad</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Given obj_pos and cam_pos in the format float[3], angle_rad about which angle the object should be rotated around the y-axis so that it faces the camera. This might become handy if you have some text floating in space and want it to face the camera. http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_vector_cross_product"><title>s3d_vector_cross_product</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_vector_cross_product</function></funcdef><paramdef>const float <parameter>vector1</parameter>[]</paramdef><paramdef>const float <parameter>vector2</parameter>[]</paramdef><paramdef>float <parameter>result_vector</parameter>[]</paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Calculates and returns the cross product of vector1 and vector2. All vectors should have the format float[3]. More info on wikipedia. http://en.wikipedia.org/wiki/Vector_(spatial) </para></sect2>
<sect2 id="s3d_push_event"><title>s3d_push_event</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_push_event</function></funcdef><paramdef>struct s3d_evt *<parameter>newevt</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pushes an event onto the event-stack. Usually you don't need to do this manually. </para></sect2>
<sect2 id="s3d_pop_event"><title>s3d_pop_event</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>struct s3d_evt *<function>s3d_pop_event</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Pops the latest event from the stack. Don't forget to free() both the event and its buffer! Returns a pointer to struct <link linkend="structs3d_evt">s3d_evt</link>. </para></sect2>
<sect2 id="s3d_find_event"><title>s3d_find_event</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>struct s3d_evt *<function>s3d_find_event</function></funcdef><paramdef>uint8_t <parameter>event</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Finds the latest occurrence of an event, giving the event type as argument. Returns a pointer to struct <link linkend="structs3d_evt">s3d_evt</link>. </para></sect2>
<sect2 id="s3d_delete_event"><title>s3d_delete_event</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_delete_event</function></funcdef><paramdef>const struct s3d_evt *<parameter>devt</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Deletes an event, the argument is the pointer to the event which is to be deleted (maybe obtained from <link linkend="s3d_find_event">s3d_find_event</link>). </para></sect2>
<sect2 id="s3d_set_callback"><title>s3d_set_callback</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_set_callback</function></funcdef><paramdef>uint8_t <parameter>event</parameter></paramdef><paramdef>s3d_cb <parameter>func</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Sets a callback for a certain event. this is very useful for event-oriented applications. event callbacks will not interrupt each other or the mainloop.</para><warning><para>Defining callbacks will only work after calling <link linkend="s3d_init">s3d_init</link>()
</para></warning><programlisting> #include <inttypes.h>
void obj_click(struct <link linkend="structs3d_evt">s3d_evt</link> event)
{
printf("object id %"PRIu32" got clicked", *((uint32_t *)event->buf));
}
...
<link linkend="s3d_set_callback">s3d_set_callback</link>(S3D_EVENT_NEW_OBJECT, obj_click);
// this will tell you when a object got clicked
</programlisting></sect2>
<sect2 id="s3d_clear_callback"><title>s3d_clear_callback</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_clear_callback</function></funcdef><paramdef>uint8_t <parameter>event</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Clears the callback which is associated with the event. </para></sect2>
<sect2 id="s3d_ignore_callback"><title>s3d_ignore_callback</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_ignore_callback</function></funcdef><paramdef>uint8_t <parameter>event</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Sets the callback on ignore, that means it won't be queued up for later use. An incoming event of this type will simply be skipped. </para></sect2>
<sect2 id="s3d_get_callback"><title>s3d_get_callback</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>s3d_cb <function>s3d_get_callback</function></funcdef><paramdef>uint8_t <parameter>event</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>Returns the Callback-function of the event.</para><programlisting> struct <link linkend="structs3d_evt">s3d_evt</link> e;
...
<link linkend="s3d_get_callback">s3d_get_callback</link>(S3D_EVENT_KEY)(e);
// will call the key-handling function with argument e.
</programlisting></sect2>
<sect2 id="s3d_process_stack"><title>s3d_process_stack</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>void <function>s3d_process_stack</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This function goes through all function of the event-stack and will call functions. this is useful when you define a new function but still have a lot of events of this type on the stack.</para><para>Deprecated</para><para>This is probably obsolete </para></sect2>
<sect2 id="s3d_mcp_focus"><title>s3d_mcp_focus</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_mcp_focus</function></funcdef><paramdef>int <parameter>object</parameter></paramdef></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This is an mcp-only function. It gives focus (for receiving key-strokes etc.) to an app referenced by it's mcp-object-id. </para></sect2>
<sect2 id="s3d_net_check"><title>s3d_net_check</title><funcsynopsis><funcsynopsisinfo>#include <s3d.h></funcsynopsisinfo><funcprototype><funcdef>int <function>s3d_net_check</function></funcdef><void/></funcprototype><?dbhtml funcsynopsis-style='ansi'?></funcsynopsis><para>This functions is for programs which do not employ a mainloop, hence they need to check for new events on their own. Programs like these must make sure to call this function from time to time to convince the server that they did not freeze or bail out. </para></sect2>
|