/usr/include/g3d/types.h is in libg3d-dev 0.0.8-22.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | /* $Id$ */
/*
libg3d - 3D object loading library
Copyright (C) 2005-2009 Markus Dahms <mad@automagically.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __G3D_TYPES_H__
#define __G3D_TYPES_H__
/**
* SECTION:types
* @short_description: some defined types for libg3d
* @include: g3d/g3d.h
*/
#include <glib.h>
#ifdef USE_LIBMAGIC
#include <magic.h>
#endif
G_BEGIN_DECLS
/* goffset is defined since glib 2.14 */
#ifndef G_MAXOFFSET
typedef gint64 goffset;
#endif
/* supposed to trick gtk-doc not to ignore these functions - not really... */
#define _G3D_STATIC_INLINE static inline
/*****************************************************************************
* basic types
*****************************************************************************/
/**
* SECTION:types
* @short_description: Basic types
* @include: g3d/types.h
*
* Some basic type abstractions used in libg3d.
*/
/**
* G3DFloat:
*
* Default floating point type. If used consistently in the library (not the
* case at the moment) this type can be switched between single and double
* precision at compile-time.
*/
/**
* G3D_FLOAT_IS_DOUBLE
*
* A flag indicating type of #G3DFloat. It is TRUE if #G3DFloat is double and
* FALSE if #G3DFloat is single precision.
*/
#if 0
#define G3D_FLOAT_IS_DOUBLE TRUE
typedef gdouble G3DFloat;
#else
#define G3D_FLOAT_IS_DOUBLE FALSE
typedef gfloat G3DFloat;
#endif
/**
* G3DSingle:
*
* Single-precision floating point number.
*/
typedef gfloat G3DSingle;
/**
* G3DDouble:
*
* Double-precision floating point number.
*/
typedef gdouble G3DDouble;
/**
* G3DVector
*
* Vector element type.
*/
typedef G3DFloat G3DVector;
/**
* G3DMatrix:
*
* Matrix element type.
*/
typedef G3DFloat G3DMatrix;
/**
* G3DQuat
*
* Quaternion element type.
*/
typedef G3DFloat G3DQuat;
/*****************************************************************************
* G3DImage
*****************************************************************************/
/**
* G3D_FLAG_IMG_GREYSCALE:
*
* The image just uses the red channel for grey value
*/
#define G3D_FLAG_IMG_GREYSCALE (1L << 1)
/**
* G3DTexEnv:
* @G3D_TEXENV_UNSPECIFIED: unspecified, application decides
* @G3D_TEXENV_BLEND: use blending
* @G3D_TEXENV_DECAL: use as decal
* @G3D_TEXENV_MODULATE: use modulate
* @G3D_TEXENV_REPLACE: replace color
*
* Specify how the texture should interact with other material properties.
*/
typedef enum {
G3D_TEXENV_UNSPECIFIED = 0,
G3D_TEXENV_BLEND,
G3D_TEXENV_DECAL,
G3D_TEXENV_MODULATE,
G3D_TEXENV_REPLACE
} G3DTexEnv;
/**
* G3DImage:
* @name: name of image
* @width: width of image in pixels
* @height: height of image in pixels
* @depth: depth of image in bits
* @flags: flags
* @pixeldata: the binary image data
* @tex_id: the OpenGL texture id, should be unique model-wide
* @tex_env: texture environment flags
* @tex_scale_u: factor scaling texture width, should be 1.0 for most cases
* @tex_scale_v: factor scaling texture height, should be 1.0 for most cases
*
* Object containing a two-dimensional pixel image.
*/
typedef struct {
gchar *name;
guint32 width;
guint32 height;
guint8 depth;
guint32 flags;
guint8 *pixeldata;
guint32 tex_id;
G3DTexEnv tex_env;
G3DFloat tex_scale_u;
G3DFloat tex_scale_v;
} G3DImage;
/*****************************************************************************
* G3DMaterial
*****************************************************************************/
/**
* G3D_FLAG_MAT_TWOSIDE:
*
* Faces using this material should be rendered two-sided as the direction
* is unknown.
*/
#define G3D_FLAG_MAT_TWOSIDE (1L << 0)
/**
* G3DMaterial:
* @name: name of material
* @r: red component of color
* @g: green component of color
* @b: blue component of color
* @a: alpha component of color
* @shininess: shiny color
* @specular: specular color
* @flags: flags
* @tex_image: texture image (optional, may be NULL)
*
* A material object.
*/
typedef struct {
gchar *name;
G3DFloat r, g, b, a;
G3DFloat shininess;
G3DFloat specular[4];
guint32 flags;
G3DImage *tex_image;
} G3DMaterial;
/*****************************************************************************
* G3DFace
*****************************************************************************/
/**
* G3D_FLAG_FAC_NORMALS:
*
* The face has custom normals.
*/
#define G3D_FLAG_FAC_NORMALS (1L << 0)
/**
* G3D_FLAG_FAC_TEXMAP:
*
* The face has a texture map and texture coordinates.
*/
#define G3D_FLAG_FAC_TEXMAP (1L << 1)
/**
* G3DFace:
* @vertex_count: number of vertices
* @vertex_indices: indices of vertices in #G3DObject
* @material: material to use for surface
* @flags: flags
* @normals: optional normal array (one vector - 3 #G3DVector values - for each
* vertex)
* @tex_image: optional texture image
* @tex_vertex_count: number of texture vertices, should be 0 or match
* vertex_count
* @tex_vertex_data: array of texture vertices
*
* An object representing a surface.
*/
typedef struct {
guint32 vertex_count;
guint32 *vertex_indices;
G3DMaterial *material;
guint32 flags;
G3DVector *normals;
G3DImage *tex_image;
guint32 tex_vertex_count;
G3DVector *tex_vertex_data;
} G3DFace;
/*****************************************************************************
* G3DTransformation
*****************************************************************************/
/**
* G3DTransformation:
* @matrix: the transformation matrix
* @flags: flags
*
* A three-dimensional matrix transformation object.
*/
typedef struct {
G3DMatrix matrix[16];
guint32 flags;
} G3DTransformation;
/*****************************************************************************
* G3DObject
*****************************************************************************/
/**
* G3DObject:
* @name: name of object
* @materials: list of materials
* @faces: list of faces
* @objects: list of sub-objects
* @transformation: optional transformation
* @hide: flag to disable object rendering
* @vertex_count: number of vertices
* @vertex_data: vertex vector data
*
* A three-dimensional object.
*/
typedef struct {
gchar *name;
GSList *materials;
GSList *faces;
GSList *objects;
/* transformation, may be NULL */
G3DTransformation *transformation;
/* don't render this object */
gboolean hide;
/* vertices */
guint32 vertex_count;
G3DVector *vertex_data;
/*< private >*/
/* FIXME: texture stuff: temporary storage, should be in G3DFace items */
guint32 tex_vertex_count;
G3DVector *tex_vertex_data;
G3DImage *tex_image;
/*< private >*/
/* some fields to speed up rendering, should not be used by plugins */
/* FIXME: remove from API (replace with user_data pointer?) */
G3DVector *_normals;
G3DMaterial **_materials;
guint32 _num_faces;
guint32 *_indices;
guint32 *_flags;
guint32 *_tex_images;
G3DVector *_tex_coords;
} G3DObject;
/*****************************************************************************
* G3DContext
*****************************************************************************/
/**
* G3DSetBgColorFunc:
* @r: red component
* @g: green component
* @b: blue component
* @a: alpha component
* @user_data: opaque data as given to g3d_context_set_set_bgcolor_func()
*
* Background color setting callback.
*
* Returns: TRUE on success, FALSE else.
*/
typedef gboolean (* G3DSetBgColorFunc)(G3DFloat r, G3DFloat g, G3DFloat b,
G3DFloat a, gpointer user_data);
/**
* G3DUpdateInterfaceFunc:
* @user_data: opaque data as given to g3d_context_set_update_interface_func()
*
* Interface updating callback.
*
* Returns: TRUE on success, FALSE else.
*/
typedef gboolean (* G3DUpdateInterfaceFunc)(gpointer user_data);
/**
* G3DUpdateProgressBarFunc:
* @percentage: progress of plugin operation
* @show: #TRUE if the progress bar should be visible, #FALSE else
* @user_data: opaque data as given to
* g3d_context_set_update_progress_bar_func()
*
* Progress updating callback.
*
* Returns: TRUE on success, FALSE else.
*/
typedef gboolean (* G3DUpdateProgressBarFunc)(G3DFloat percentage,
gboolean show, gpointer user_data);
/*< private >*/
#ifdef USE_LIBMAGIC
#define MAGIC_PTR_TYPE magic_t
#else
#define MAGIC_PTR_TYPE void *
#endif
/*< public >*/
/**
* G3DContext:
*
* Internal stuff for libg3d.
*/
typedef struct {
/*< private >*/
GSList *plugins;
MAGIC_PTR_TYPE magic_cookie;
GHashTable *exts_import;
GHashTable *exts_image;
G3DSetBgColorFunc set_bgcolor_func;
gpointer set_bgcolor_data;
G3DUpdateInterfaceFunc update_interface_func;
gpointer update_interface_data;
G3DUpdateProgressBarFunc update_progress_bar_func;
gpointer update_progress_bar_data;
} G3DContext;
/*****************************************************************************
* G3DPlugin: real definition in g3d/plugins.h
*****************************************************************************/
typedef struct _G3DPlugin G3DPlugin;
/*****************************************************************************
* G3DModel
*****************************************************************************/
/**
* G3DModel:
* @filename: file name or URI of loaded model, may be set by application
* @materials: list of materials (#G3DMaterial)
* @objects: list of objects (#G3DObject)
*
* A 3D model.
*/
typedef struct {
gchar *filename;
/*< private >*/
G3DContext *context;
/*< public >*/
GSList *materials;
GSList *objects;
/*< private >*/
GHashTable *tex_images;
/* the plugin used to load the image, may be NULL */
G3DPlugin *plugin;
} G3DModel;
/*****************************************************************************
* G3DStream
*****************************************************************************/
/* declared in stream.h */
typedef struct _G3DStream G3DStream;
G_END_DECLS
#endif /* __G3D_TYPES_H__ */
|