root/OpenSceneGraph/trunk/src/osgPlugins/3ds/node.h @ 10076

Revision 10076, 4.4 kB (checked in by robert, 6 years ago)

From Neil Hughes, converted across to use istream for reading data from file to enable reading .3ds files over http (use OSG's libcurl plugin).

From Robert Osfield, ammendments of the above to better support reading of files from local directories.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[8]1/* -*- c -*- */
2#ifndef INCLUDED_LIB3DS_NODE_H
3#define INCLUDED_LIB3DS_NODE_H
4/*
5 * The 3D Studio File Format Library
6 * Copyright (C) 1996-2001 by J.E. Hoffmann <je-h@gmx.net>
7 * All rights reserved.
8 *
9 * This program is  free  software;  you can redistribute it and/or modify it
10 * under the terms of the  GNU Lesser General Public License  as published by
11 * the  Free Software Foundation;  either version 2.1 of the License,  or (at
12 * your option) any later version.
13 *
14 * This  program  is  distributed in  the  hope that it will  be useful,  but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16 * or  FITNESS FOR A  PARTICULAR PURPOSE.  See the  GNU Lesser General Public 
17 * License for more details.
18 *
19 * You should  have received  a copy of the GNU Lesser General Public License
20 * along with  this program;  if not, write to the  Free Software Foundation,
21 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * $Id$
24 */
25
26#ifndef INCLUDED_LIB3DS_TRACKS_H
[1563]27#include "tracks.h"
[8]28#endif
29
[10076]30#include <iostream>
31using namespace std;
32
[8]33#ifdef __cplusplus
34extern "C" {
35#endif
36
[10076]37
[8]38/*!
39 * Scene graph ambient color node data
40 * \ingroup node
41 */
42typedef struct _Lib3dsAmbientData {
43    Lib3dsRgb col;
44    Lib3dsLin3Track col_track;
45} Lib3dsAmbientData;
46
47/*!
48 * Scene graph object instance node data
49 * \ingroup node
50 */
51typedef struct _Lib3dsObjectData {
52    Lib3dsVector pivot;
53    char instance[64];
54    Lib3dsVector bbox_min;
55    Lib3dsVector bbox_max;
56    Lib3dsVector pos;
57    Lib3dsLin3Track pos_track;
58    Lib3dsQuat rot;
59    Lib3dsQuatTrack rot_track;
60    Lib3dsVector scl;
61    Lib3dsLin3Track scl_track;
62    Lib3dsFloat morph_smooth;
63    char morph[64];
64    Lib3dsMorphTrack morph_track;
65    Lib3dsBool hide;
66    Lib3dsBoolTrack hide_track;
67} Lib3dsObjectData;
68
69/*!
70 * Scene graph camera node data
71 * \ingroup node
72 */
73typedef struct _Lib3dsCameraData {
74    Lib3dsVector pos;
75    Lib3dsLin3Track pos_track;
76    Lib3dsFloat fov;
77    Lib3dsLin1Track fov_track;
78    Lib3dsFloat roll;
79    Lib3dsLin1Track roll_track;
80} Lib3dsCameraData;
81
82/*!
83 * Scene graph camera target node data
84 * \ingroup node
85 */
86typedef struct _Lib3dsTargetData {
87    Lib3dsVector pos;
88    Lib3dsLin3Track pos_track;
89} Lib3dsTargetData;
90
91/*!
92 * Scene graph light node data
93 * \ingroup node
94 */
95typedef struct _Lib3dsLightData {
96    Lib3dsVector pos;
97    Lib3dsLin3Track pos_track;
98    Lib3dsRgb col;
99    Lib3dsLin3Track col_track;
100    Lib3dsFloat hotspot;
101    Lib3dsLin1Track hotspot_track;
102    Lib3dsFloat falloff;
103    Lib3dsLin1Track falloff_track;
104    Lib3dsFloat roll;
105    Lib3dsLin1Track roll_track;
106} Lib3dsLightData;
107
108/*!
109 * Scene graph spotlight target node data
110 * \ingroup node
111 */
112typedef struct _Lib3dsSpotData {
113    Lib3dsVector pos;
114    Lib3dsLin3Track pos_track;
115} Lib3dsSpotData;
116
117/*!
118 * Scene graph node data union
119 * \ingroup node
120 */
121typedef union _Lib3dsNodeData {
122    Lib3dsAmbientData ambient;
123    Lib3dsObjectData object;
124    Lib3dsCameraData camera;
125    Lib3dsTargetData target;
126    Lib3dsLightData light;
127    Lib3dsSpotData spot;
128} Lib3dsNodeData;
129
130/*!
131 * \ingroup node
132 */
133#define LIB3DS_NO_PARENT 65535
134
135/*!
136 * Scene graph node
137 * \ingroup node
138 */
139struct _Lib3dsNode {
140    Lib3dsUserData user;
141    Lib3dsNode *next;\
142    Lib3dsNode *childs;\
143    Lib3dsNode *parent;\
144    Lib3dsNodeTypes type;\
[151]145    Lib3dsWord node_id;\
[8]146    char name[64];\
147    Lib3dsWord flags1;\
148    Lib3dsWord flags2;\
149    Lib3dsWord parent_id;
150    Lib3dsMatrix matrix;
151    Lib3dsNodeData data;
152};
153
154extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_ambient();
155extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_object();
156extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_camera();
157extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_target();
158extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_light();
159extern LIB3DSAPI Lib3dsNode* lib3ds_node_new_spot();
160extern LIB3DSAPI void lib3ds_node_free(Lib3dsNode *node);
161extern LIB3DSAPI void lib3ds_node_eval(Lib3dsNode *node, Lib3dsFloat t);
162extern LIB3DSAPI Lib3dsNode* lib3ds_node_by_name(Lib3dsNode *node, const char* name,
163  Lib3dsNodeTypes type);
[151]164extern LIB3DSAPI Lib3dsNode* lib3ds_node_by_id(Lib3dsNode *node, Lib3dsWord node_id);
[8]165extern LIB3DSAPI void lib3ds_node_dump(Lib3dsNode *node, Lib3dsIntd level);
[10076]166extern LIB3DSAPI Lib3dsBool lib3ds_node_read(Lib3dsNode *node, Lib3dsFile *file, iostream *strm);
167extern LIB3DSAPI Lib3dsBool lib3ds_node_write(Lib3dsNode *node, Lib3dsFile *file, iostream *strm);
[8]168
169#ifdef __cplusplus
[6461]170}
[8]171#endif
172#endif
Note: See TracBrowser for help on using the browser.