Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# node.h

Go to the documentation of this file.

    00001 /* -*- c -*- */
    00002 #ifndef INCLUDED_LIB3DS_NODE_H
    00003 #define INCLUDED_LIB3DS_NODE_H
    00004 /*
    00005  * The 3D Studio File Format Library
    00006  * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
    00007  * All rights reserved.
    00008  *
    00009  * This program is  free  software;  you can redistribute it and/or modify it
    00010  * under the terms of the  GNU Lesser General Public License  as published by
    00011  * the  Free Software Foundation;  either version 2.1 of the License,  or (at
    00012  * your option) any later version.
    00013  *
    00014  * This  program  is  distributed in  the  hope that it will  be useful,  but
    00015  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
    00016  * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public
    00017  * License for more details.
    00018  *
    00019  * You should  have received  a copy of the GNU Lesser General Public License
    00020  * along with  this program;  if not, write to the  Free Software Foundation,
    00021  * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00022  *
    00023  * $Id: node.h,v 1.1 2005/03/07 11:16:26 Assassin Exp $
    00024  */
    00025
    00026 #ifndef INCLUDED_LIB3DS_TRACKS_H
    00027 #include <lib3ds/tracks.h>
    00028 #endif
    00029
    00030 #ifdef __cplusplus
    00031 extern "C" {
    00032 #endif
    00033
    00034 /*!
    00035  * Scene graph ambient color node data
    00036  * \ingroup node
    00037  */
    00038 typedef struct _Lib3dsAmbientData {
    00039     Lib3dsRgb col;
    00040     Lib3dsLin3Track col_track;
    00041 } Lib3dsAmbientData;
    00042
    00043 /*!
    00044  * Scene graph object instance node data
    00045  * \ingroup node
    00046  */
    00047 typedef struct _Lib3dsObjectData {
    00048     Lib3dsVector pivot;
    00049     char instance[64];
    00050     Lib3dsVector bbox_min;
    00051     Lib3dsVector bbox_max;
    00052     Lib3dsVector pos;
    00053     Lib3dsLin3Track pos_track;
    00054     Lib3dsQuat rot;
    00055     Lib3dsQuatTrack rot_track;
    00056     Lib3dsVector scl;
    00057     Lib3dsLin3Track scl_track;
    00058     Lib3dsFloat morph_smooth;
    00059     char morph[64];
    00060     Lib3dsMorphTrack morph_track;
    00061     Lib3dsBool hide;
    00062     Lib3dsBoolTrack hide_track;
    00063 } Lib3dsObjectData;
    00064
    00065 /*!
    00066  * Scene graph camera node data
    00067  * \ingroup node
    00068  */
    00069 typedef struct _Lib3dsCameraData {
    00070     Lib3dsVector pos;
    00071     Lib3dsLin3Track pos_track;
    00072     Lib3dsFloat fov;
    00073     Lib3dsLin1Track fov_track;
    00074     Lib3dsFloat roll;
    00075     Lib3dsLin1Track roll_track;
    00076 } Lib3dsCameraData;
    00077
    00078 /*!
    00079  * Scene graph camera target node data
    00080  * \ingroup node
    00081  */
    00082 typedef struct _Lib3dsTargetData {
    00083     Lib3dsVector pos;
    00084     Lib3dsLin3Track pos_track;
    00085 } Lib3dsTargetData;
    00086
    00087 /*!
    00088  * Scene graph light node data
    00089  * \ingroup node
    00090  */
    00091 typedef struct _Lib3dsLightData {
    00092     Lib3dsVector pos;
    00093     Lib3dsLin3Track pos_track;
    00094     Lib3dsRgb col;
    00095     Lib3dsLin3Track col_track;
    00096     Lib3dsFloat hotspot;
    00097     Lib3dsLin1Track hotspot_track;
    00098     Lib3dsFloat falloff;
    00099     Lib3dsLin1Track falloff_track;
    00100     Lib3dsFloat roll;
    00101     Lib3dsLin1Track roll_track;
    00102 } Lib3dsLightData;
    00103
    00104 /*!
    00105  * Scene graph spotlight target node data
    00106  * \ingroup node
    00107  */
    00108 typedef struct _Lib3dsSpotData {
    00109     Lib3dsVector pos;
    00110     Lib3dsLin3Track pos_track;
    00111 } Lib3dsSpotData;
    00112
    00113 /*!
    00114  * Scene graph node data union
    00115  * \ingroup node
    00116  */
    00117 typedef union _Lib3dsNodeData {
    00118     Lib3dsAmbientData ambient;
    00119     Lib3dsObjectData object;
    00120     Lib3dsCameraData camera;
    00121     Lib3dsTargetData target;
    00122     Lib3dsLightData light;
    00123     Lib3dsSpotData spot;
    00124 } Lib3dsNodeData;
    00125
    00126 /*!
    00127  * \ingroup node
    00128  */
    00129 #define LIB3DS_NO_PARENT 65535
    00130
    00131 /*!
    00132  * Scene graph node
    00133  * \ingroup node
    00134  */
    00135 struct _Lib3dsNode {
    00136     Lib3dsUserData user;
    00137     Lib3dsNode *next;\
    00138     Lib3dsNode *childs;\
    00139     Lib3dsNode *parent;\
    00140     Lib3dsNodeTypes type;\
    00141     Lib3dsWord node_id;\
    00142     char name[64];\
    00143     Lib3dsWord flags1;\
    00144     Lib3dsWord flags2;\
    00145     Lib3dsWord parent_id;
    00146     Lib3dsMatrix matrix;
    00147     Lib3dsNodeData data;
    00148 };
    00149
    00150 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_ambient();
    00151 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_object();
    00152 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_camera();
    00153 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_target();
    00154 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_light();
    00155 extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_spot();
    00156 extern LIB3DSAPI void lib3ds_node_free(Lib3dsNode *node);
    00157 extern LIB3DSAPI void lib3ds_node_eval(Lib3dsNode *node, Lib3dsFloat t);
    00158 extern LIB3DSAPI Lib3dsNode* lib3ds_node_by_name(Lib3dsNode *node, const char* name,
    00159   Lib3dsNodeTypes type);
    00160 extern LIB3DSAPI Lib3dsNode* lib3ds_node_by_id(Lib3dsNode *node, Lib3dsWord node_id);
    00161 extern LIB3DSAPI void lib3ds_node_dump(Lib3dsNode *node, Lib3dsIntd level);
    00162 extern LIB3DSAPI Lib3dsBool lib3ds_node_read(Lib3dsNode *node, Lib3dsFile *file, Lib3dsIo *io);
    00163 extern LIB3DSAPI Lib3dsBool lib3ds_node_write(Lib3dsNode *node, Lib3dsFile *file, Lib3dsIo *io);
    00164
    00165 #ifdef __cplusplus
    00166 };
    00167 #endif
    00168 #endif
    00169