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

Revision 10076, 6.7 kB (checked in by robert, 5 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_TRACKS_H
3#define INCLUDED_LIB3DS_TRACKS_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_TCB_H
[1563]27#include "tcb.h"
[8]28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*!
35 * Track flags
36 * \ingroup tracks
37 */
38typedef enum {
39  LIB3DS_REPEAT    =0x0001,
40  LIB3DS_SMOOTH    =0x0002,
41  LIB3DS_LOCK_X    =0x0008,
42  LIB3DS_LOCK_Y    =0x0010,
43  LIB3DS_LOCK_Z    =0x0020,
44  LIB3DS_UNLINK_X  =0x0100,
45  LIB3DS_UNLINK_Y  =0x0200,
46  LIB3DS_UNLINK_Z  =0x0400
47} Lib3dsTrackFlags;
48
49/*!
50 * Boolean track key
51 * \ingroup tracks
52 */
53struct _Lib3dsBoolKey {
54    Lib3dsTcb tcb;
55    Lib3dsBoolKey *next;
56};
57
58/*!
59 * Boolean track
60 * \ingroup tracks
61 */
62struct _Lib3dsBoolTrack {
63    Lib3dsDword flags;
64    Lib3dsBoolKey *keyL;
65};
66
67/*!
68 * Floating-point track key
69 * \ingroup tracks
70 */
71struct _Lib3dsLin1Key {
72    Lib3dsTcb tcb;
73    Lib3dsLin1Key *next;
74    Lib3dsFloat value;
75    Lib3dsFloat dd;
76    Lib3dsFloat ds;
77};
78 
79/*!
80 * Floating-point track
81 * \ingroup tracks
82 */
83struct _Lib3dsLin1Track {
84    Lib3dsDword flags;
85    Lib3dsLin1Key *keyL;
86};
87
88/*!
89 * Vector track key
90 * \ingroup tracks
91 */
92struct _Lib3dsLin3Key {
93    Lib3dsTcb tcb;
94    Lib3dsLin3Key *next; 
95    Lib3dsVector value;
96    Lib3dsVector dd;
97    Lib3dsVector ds;
98};
99 
100/*!
101 * Vector track
102 * \ingroup tracks
103 */
104struct _Lib3dsLin3Track {
105    Lib3dsDword flags;
106    Lib3dsLin3Key *keyL;
107};
108
109/*!
110 * Rotation track key
111 * \ingroup tracks
112 */
113struct _Lib3dsQuatKey {
114    Lib3dsTcb tcb;
115    Lib3dsQuatKey *next; 
116    Lib3dsVector axis;
117    Lib3dsFloat angle;
118    Lib3dsQuat q;
119    Lib3dsQuat dd;
120    Lib3dsQuat ds;
121};
122 
123/*!
124 * Rotation track
125 * \ingroup tracks
126 */
127struct _Lib3dsQuatTrack {
128    Lib3dsDword flags;
129    Lib3dsQuatKey *keyL;
130};
131
132/*!
133 * Morph track key
134 * \ingroup tracks
135 */
136struct _Lib3dsMorphKey {
137    Lib3dsTcb tcb;
138    Lib3dsMorphKey *next; 
139    char name[64];
140};
141 
142/*!
143 * Morph track
144 * \ingroup tracks
145 */
146struct _Lib3dsMorphTrack {
147    Lib3dsDword flags;
148    Lib3dsMorphKey *keyL;
149};
150
151extern LIB3DSAPI Lib3dsBoolKey* lib3ds_bool_key_new();
152extern LIB3DSAPI void lib3ds_bool_key_free(Lib3dsBoolKey* key);
153extern LIB3DSAPI void lib3ds_bool_track_free_keys(Lib3dsBoolTrack *track);
154extern LIB3DSAPI void lib3ds_bool_track_insert(Lib3dsBoolTrack *track, Lib3dsBoolKey* key);
155extern LIB3DSAPI void lib3ds_bool_track_remove(Lib3dsBoolTrack *track, Lib3dsIntd frame);
156extern LIB3DSAPI void lib3ds_bool_track_eval(Lib3dsBoolTrack *track, Lib3dsBool *p, Lib3dsFloat t);
[10076]157extern LIB3DSAPI Lib3dsBool lib3ds_bool_track_read(Lib3dsBoolTrack *track, iostream *strm);
158extern LIB3DSAPI Lib3dsBool lib3ds_bool_track_write(Lib3dsBoolTrack *track, iostream *strm);
[8]159
160extern LIB3DSAPI Lib3dsLin1Key* lib3ds_lin1_key_new();
161extern LIB3DSAPI void lib3ds_lin1_key_free(Lib3dsLin1Key* key);
162extern LIB3DSAPI void lib3ds_lin1_track_free_keys(Lib3dsLin1Track *track);
163extern LIB3DSAPI void lib3ds_lin1_key_setup(Lib3dsLin1Key *p, Lib3dsLin1Key *cp, Lib3dsLin1Key *c,
164  Lib3dsLin1Key *cn, Lib3dsLin1Key *n);
165extern LIB3DSAPI void lib3ds_lin1_track_setup(Lib3dsLin1Track *track);
166extern LIB3DSAPI void lib3ds_lin1_track_insert(Lib3dsLin1Track *track, Lib3dsLin1Key *key);
167extern LIB3DSAPI void lib3ds_lin1_track_remove(Lib3dsLin1Track *track, Lib3dsIntd frame);
168extern LIB3DSAPI void lib3ds_lin1_track_eval(Lib3dsLin1Track *track, Lib3dsFloat *p, Lib3dsFloat t);
[10076]169extern LIB3DSAPI Lib3dsBool lib3ds_lin1_track_read(Lib3dsLin1Track *track, iostream *strm);
170extern LIB3DSAPI Lib3dsBool lib3ds_lin1_track_write(Lib3dsLin1Track *track, iostream *strm);
[8]171
172extern LIB3DSAPI Lib3dsLin3Key* lib3ds_lin3_key_new();
173extern LIB3DSAPI void lib3ds_lin3_key_free(Lib3dsLin3Key* key);
174extern LIB3DSAPI void lib3ds_lin3_track_free_keys(Lib3dsLin3Track *track);
175extern LIB3DSAPI void lib3ds_lin3_key_setup(Lib3dsLin3Key *p, Lib3dsLin3Key *cp, Lib3dsLin3Key *c,
176  Lib3dsLin3Key *cn, Lib3dsLin3Key *n);
177extern LIB3DSAPI void lib3ds_lin3_track_setup(Lib3dsLin3Track *track);
178extern LIB3DSAPI void lib3ds_lin3_track_insert(Lib3dsLin3Track *track, Lib3dsLin3Key *key);
179extern LIB3DSAPI void lib3ds_lin3_track_remove(Lib3dsLin3Track *track, Lib3dsIntd frame);
180extern LIB3DSAPI void lib3ds_lin3_track_eval(Lib3dsLin3Track *track, Lib3dsVector p, Lib3dsFloat t);
[10076]181extern LIB3DSAPI Lib3dsBool lib3ds_lin3_track_read(Lib3dsLin3Track *track, iostream *strm);
182extern LIB3DSAPI Lib3dsBool lib3ds_lin3_track_write(Lib3dsLin3Track *track, iostream *strm);
[8]183
184extern LIB3DSAPI Lib3dsQuatKey* lib3ds_quat_key_new();
185extern LIB3DSAPI void lib3ds_quat_key_free(Lib3dsQuatKey* key);
186extern LIB3DSAPI void lib3ds_quat_track_free_keys(Lib3dsQuatTrack *track);
187extern LIB3DSAPI void lib3ds_quat_key_setup(Lib3dsQuatKey *p, Lib3dsQuatKey *cp, Lib3dsQuatKey *c,
188  Lib3dsQuatKey *cn, Lib3dsQuatKey *n);
189extern LIB3DSAPI void lib3ds_quat_track_setup(Lib3dsQuatTrack *track);
190extern LIB3DSAPI void lib3ds_quat_track_insert(Lib3dsQuatTrack *track, Lib3dsQuatKey *key);
191extern LIB3DSAPI void lib3ds_quat_track_remove(Lib3dsQuatTrack *track, Lib3dsIntd frame);
192extern LIB3DSAPI void lib3ds_quat_track_eval(Lib3dsQuatTrack *track, Lib3dsQuat p, Lib3dsFloat t);
[10076]193extern LIB3DSAPI Lib3dsBool lib3ds_quat_track_read(Lib3dsQuatTrack *track, iostream *strm);
194extern LIB3DSAPI Lib3dsBool lib3ds_quat_track_write(Lib3dsQuatTrack *track, iostream *strm);
[8]195
196extern LIB3DSAPI Lib3dsMorphKey* lib3ds_morph_key_new();
197extern LIB3DSAPI void lib3ds_morph_key_free(Lib3dsMorphKey* key);
198extern LIB3DSAPI void lib3ds_morph_track_free_keys(Lib3dsMorphTrack *track);
199extern LIB3DSAPI void lib3ds_morph_track_insert(Lib3dsMorphTrack *track, Lib3dsMorphKey *key);
200extern LIB3DSAPI void lib3ds_morph_track_remove(Lib3dsMorphTrack *track, Lib3dsIntd frame);
201extern LIB3DSAPI void lib3ds_morph_track_eval(Lib3dsMorphTrack *track, char *p, Lib3dsFloat t);
[10076]202extern LIB3DSAPI Lib3dsBool lib3ds_morph_track_read(Lib3dsMorphTrack *track, iostream *strm);
203extern LIB3DSAPI Lib3dsBool lib3ds_morph_track_write(Lib3dsMorphTrack *track, iostream *strm);
[8]204
205#ifdef __cplusplus
[6461]206}
[8]207#endif
208#endif
Note: See TracBrowser for help on using the browser.