/* * GRacer * * Copyright (C) 1999 Takashi Matsuda * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */ #ifndef __GRACER_AC3D_H__ #define __GRACER_AC3D_H__ #include #include "gr_global.h" /* * gracer and ac3d coordinate translation. * gracer <-> ac3d * x <-> -z * y <-> -x * z <-> y */ typedef enum { AC3D_OBJ_WORLD, AC3D_OBJ_POLY, AC3D_OBJ_GROUP, } Ac3dObjectType; typedef enum { AC3D_OPT_TEXREP = 1<<0, AC3D_OPT_ROT = 1<<1, AC3D_OPT_LOC = 1<<2, } Ac3dOptionType; typedef enum { AC3D_SURF_POLYGON = 0, AC3D_SURF_CLOSEDLINE = 1, AC3D_SURF_LINE = 2, AC3D_SURF_SHADED = 1<<4, AC3D_SURF_TWOSIDE = 1<<5, AC3D_SURF_TYPE_MASK = 7, } Ac3dSurfaceType; typedef struct { char *name; float rgb[3]; float amb[3]; float ems[3]; float spc[3]; int shi; float trans; } Ac3dMaterial; typedef struct { int ref; float s, t; } Ac3dRef; typedef struct { Ac3dSurfaceType type; int mat; int num_refs; Ac3dRef *refs; } Ac3dSurface; typedef struct Ac3dObject { Ac3dObjectType type; unsigned long options; char *name; /* optional */ int data_size; unsigned char *data; char *tex_name; float texrep[2]; float rot[3][3]; float loc[3]; char *url; int num_verts; float *verts; int num_surfs; Ac3dSurface **surfs; int num_kids; struct Ac3dObject **kids; } Ac3dObject; typedef struct { int num_mats; Ac3dMaterial **mats; int num_objs; Ac3dObject **objs; } Ac3dScene; #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if 0 } #endif Ac3dScene* ac3d_scene_new_from_file (FILE *file); Ac3dScene* ac3d_scene_new_from_data (char *data); void ac3d_scene_free (Ac3dScene *scene); void ac3d_scene_write (FILE *file, Ac3dScene *scene); Ac3dObject* ac3d_scene_find_object (Ac3dScene *scene, char *name, Ac3dObject *from); void ac3d_object_absolute_coord (Ac3dObject *object, float *origin); void ac3d_object_scale (Ac3dObject *object, float *scale); void ac3d_object_convert_coord (Ac3dObject *object); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __GRACER_AC3D_H__ */