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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
|
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libg3d-model">
<refmeta>
<refentrytitle role="top_of_page" id="libg3d-model.top_of_page">model</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBG3D Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>model</refname>
<refpurpose>Model manipulation functions</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv id="libg3d-model.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
#include <g3d/g3d.h>
#define <link linkend="G3D-MODEL-CENTER:CAPS">G3D_MODEL_CENTER</link>
#define <link linkend="G3D-MODEL-NOCHECK:CAPS">G3D_MODEL_NOCHECK</link>
#define <link linkend="G3D-MODEL-OPTIMIZE:CAPS">G3D_MODEL_OPTIMIZE</link>
#define <link linkend="G3D-MODEL-SCALE:CAPS">G3D_MODEL_SCALE</link>
<link linkend="G3DModel">G3DModel</link>;
<link linkend="G3DModel">G3DModel</link>* <link linkend="g3d-model-new">g3d_model_new</link> (void);
<link linkend="G3DModel">G3DModel</link>* <link linkend="g3d-model-load">g3d_model_load</link> (<link linkend="G3DContext">G3DContext</link> *context,
const <link linkend="gchar">gchar</link> *filename);
<link linkend="G3DModel">G3DModel</link>* <link linkend="g3d-model-load-full">g3d_model_load_full</link> (<link linkend="G3DContext">G3DContext</link> *context,
const <link linkend="gchar">gchar</link> *filename,
<link linkend="guint32">guint32</link> flags);
<link linkend="gboolean">gboolean</link> <link linkend="g3d-model-check">g3d_model_check</link> (<link linkend="G3DModel">G3DModel</link> *model);
<link linkend="gboolean">gboolean</link> <link linkend="g3d-model-center">g3d_model_center</link> (<link linkend="G3DModel">G3DModel</link> *model);
<link linkend="gboolean">gboolean</link> <link linkend="g3d-model-transform">g3d_model_transform</link> (<link linkend="G3DModel">G3DModel</link> *model,
<link linkend="G3DMatrix">G3DMatrix</link> *matrix);
<link linkend="void">void</link> <link linkend="g3d-model-clear">g3d_model_clear</link> (<link linkend="G3DModel">G3DModel</link> *model);
<link linkend="void">void</link> <link linkend="g3d-model-free">g3d_model_free</link> (<link linkend="G3DModel">G3DModel</link> *model);
<link linkend="G3DObject">G3DObject</link>* <link linkend="g3d-model-get-object-by-name">g3d_model_get_object_by_name</link> (<link linkend="G3DModel">G3DModel</link> *model,
const <link linkend="gchar">gchar</link> *name);
</synopsis>
</refsynopsisdiv>
<refsect1 id="libg3d-model.description" role="desc">
<title role="desc.title">Description</title>
<para>
A model is a group of objects. All information loaded from a file by libg3d
is found in this model.</para>
<para>
</para>
</refsect1>
<refsect1 id="libg3d-model.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="G3D-MODEL-CENTER:CAPS" role="macro">
<title>G3D_MODEL_CENTER</title>
<indexterm zone="G3D-MODEL-CENTER:CAPS"><primary>G3D_MODEL_CENTER</primary></indexterm><programlisting>#define G3D_MODEL_CENTER (1 << 1)
</programlisting>
<para>
The model should be centered around the (0,0,0).</para>
<para>
</para></refsect2>
<refsect2 id="G3D-MODEL-NOCHECK:CAPS" role="macro">
<title>G3D_MODEL_NOCHECK</title>
<indexterm zone="G3D-MODEL-NOCHECK:CAPS"><primary>G3D_MODEL_NOCHECK</primary></indexterm><programlisting>#define G3D_MODEL_NOCHECK (1 << 3)
</programlisting>
<para>
The common checks should be disabled. The checks include:
<itemizedlist>
<listitem>faces have at least 3 indices</listitem>
<listitem>face indices are <= number of vertices</listitem>
<listitem>material of faces is not NULL</listitem>
</itemizedlist></para>
<para>
</para></refsect2>
<refsect2 id="G3D-MODEL-OPTIMIZE:CAPS" role="macro">
<title>G3D_MODEL_OPTIMIZE</title>
<indexterm zone="G3D-MODEL-OPTIMIZE:CAPS"><primary>G3D_MODEL_OPTIMIZE</primary></indexterm><programlisting>#define G3D_MODEL_OPTIMIZE (1 << 2)
</programlisting>
<para>
The model material/object/face lists should be serialized to some private
arrays (deprecated).</para>
<para>
</para></refsect2>
<refsect2 id="G3D-MODEL-SCALE:CAPS" role="macro">
<title>G3D_MODEL_SCALE</title>
<indexterm zone="G3D-MODEL-SCALE:CAPS"><primary>G3D_MODEL_SCALE</primary></indexterm><programlisting>#define G3D_MODEL_SCALE (1 << 0)
</programlisting>
<para>
The model should be scaled to a maximum extension of +/- 10.0.</para>
<para>
</para></refsect2>
<refsect2 id="G3DModel" role="struct">
<title>G3DModel</title>
<indexterm zone="G3DModel"><primary>G3DModel</primary></indexterm><programlisting>typedef struct {
gchar *filename;
GSList *materials;
GSList *objects;
} G3DModel;
</programlisting>
<para>
A 3D model.</para>
<para>
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="gchar">gchar</link> *<structfield>filename</structfield>;</term>
<listitem><simpara> file name or URI of loaded model, may be set by application
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>materials</structfield>;</term>
<listitem><simpara> list of materials (<link linkend="G3DMaterial"><type>G3DMaterial</type></link>)
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GSList">GSList</link> *<structfield>objects</structfield>;</term>
<listitem><simpara> list of objects (<link linkend="G3DObject"><type>G3DObject</type></link>)
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-new" role="function">
<title>g3d_model_new ()</title>
<indexterm zone="g3d-model-new"><primary>g3d_model_new</primary></indexterm><programlisting><link linkend="G3DModel">G3DModel</link>* g3d_model_new (void);</programlisting>
<para>
This functions allocates and initializes a new G3DModel.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> a newly allocated G3DModel
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-load" role="function">
<title>g3d_model_load ()</title>
<indexterm zone="g3d-model-load"><primary>g3d_model_load</primary></indexterm><programlisting><link linkend="G3DModel">G3DModel</link>* g3d_model_load (<link linkend="G3DContext">G3DContext</link> *context,
const <link linkend="gchar">gchar</link> *filename);</programlisting>
<para>
Loads a model from a file. The model is checked, centered, resized,
optimized.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter> :</term>
<listitem><simpara> a valid context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>filename</parameter> :</term>
<listitem><simpara> the file name of the model to load
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the loaded model or NULL in case of an error
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-load-full" role="function">
<title>g3d_model_load_full ()</title>
<indexterm zone="g3d-model-load-full"><primary>g3d_model_load_full</primary></indexterm><programlisting><link linkend="G3DModel">G3DModel</link>* g3d_model_load_full (<link linkend="G3DContext">G3DContext</link> *context,
const <link linkend="gchar">gchar</link> *filename,
<link linkend="guint32">guint32</link> flags);</programlisting>
<para>
Loads a model from a file. Depending on <parameter>flags</parameter> the model is checked,
centered, resized, optimized.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter> :</term>
<listitem><simpara> a valid context
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>filename</parameter> :</term>
<listitem><simpara> the file name of the model to load
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>flags</parameter> :</term>
<listitem><simpara> object manipulation flags
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the loaded model or NULL in case of an error.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-check" role="function">
<title>g3d_model_check ()</title>
<indexterm zone="g3d-model-check"><primary>g3d_model_check</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g3d_model_check (<link linkend="G3DModel">G3DModel</link> *model);</programlisting>
<para>
Checks whether a model returned by plugin is valid.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model to check
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE on success, FALSE on error
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-center" role="function">
<title>g3d_model_center ()</title>
<indexterm zone="g3d-model-center"><primary>g3d_model_center</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g3d_model_center (<link linkend="G3DModel">G3DModel</link> *model);</programlisting>
<para>
Translates all object coordinates that the object center is at (0, 0, 0)</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model to center
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE on success, FALSE on error
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-transform" role="function">
<title>g3d_model_transform ()</title>
<indexterm zone="g3d-model-transform"><primary>g3d_model_transform</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link> g3d_model_transform (<link linkend="G3DModel">G3DModel</link> *model,
<link linkend="G3DMatrix">G3DMatrix</link> *matrix);</programlisting>
<para>
Transform all toplevel objects in model with matrix.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>matrix</parameter> :</term>
<listitem><simpara> transformation matrix
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> TRUE on success, FALSE else
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-clear" role="function">
<title>g3d_model_clear ()</title>
<indexterm zone="g3d-model-clear"><primary>g3d_model_clear</primary></indexterm><programlisting><link linkend="void">void</link> g3d_model_clear (<link linkend="G3DModel">G3DModel</link> *model);</programlisting>
<para>
Removes all objects from a model.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model to clear
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-free" role="function">
<title>g3d_model_free ()</title>
<indexterm zone="g3d-model-free"><primary>g3d_model_free</primary></indexterm><programlisting><link linkend="void">void</link> g3d_model_free (<link linkend="G3DModel">G3DModel</link> *model);</programlisting>
<para>
Frees all memory allocated for the model including all objects, materials
and textures.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model to free
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="g3d-model-get-object-by-name" role="function">
<title>g3d_model_get_object_by_name ()</title>
<indexterm zone="g3d-model-get-object-by-name"><primary>g3d_model_get_object_by_name</primary></indexterm><programlisting><link linkend="G3DObject">G3DObject</link>* g3d_model_get_object_by_name (<link linkend="G3DModel">G3DModel</link> *model,
const <link linkend="gchar">gchar</link> *name);</programlisting>
<para>
Searches the object tree for an object with the given name.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>model</parameter> :</term>
<listitem><simpara> the model containing all objects
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>name</parameter> :</term>
<listitem><simpara> the name of the requested object
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> the requested object or NULL if non was found
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|