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

Revision 10076, 4.4 kB (checked in by robert, 8 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
[8]1/* -*- c -*- */
5 * The 3D Studio File Format Library
6 * Copyright (C) 1996-2001 by J.E. Hoffmann <>
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 */
[1531]27#include "background.h"
[1531]30#include "atmosphere.h"
[1531]33#include "shadow.h"
[1531]36#include "viewport.h"
[10076]38#include <osgDB/Registry>
39#include <iostream>
40using namespace std;
42#ifdef __cplusplus
43extern "C" {
49 * 3ds file structure
50 * \ingroup file
51 */
52struct _Lib3dsFile {
53    Lib3dsDword mesh_version;
54    Lib3dsWord keyf_revision;
[151]55    char name[12+1];
[8]56    Lib3dsFloat master_scale;
57    Lib3dsVector construction_plane;
58    Lib3dsRgb ambient;
59    Lib3dsShadow shadow;
60    Lib3dsBackground background;
61    Lib3dsAtmosphere atmosphere;
62    Lib3dsViewport viewport;
63    Lib3dsViewport viewport_keyf;
64    Lib3dsIntd frames;
65    Lib3dsIntd segment_from;
66    Lib3dsIntd segment_to;
67    Lib3dsIntd current_frame;
68    Lib3dsMaterial *materials;
69    Lib3dsMesh *meshes;
70    Lib3dsCamera *cameras;
71    Lib3dsLight *lights;
72    Lib3dsNode *nodes;
[10076]75extern LIB3DSAPI Lib3dsFile* lib3ds_file_load(const char *filename, const osgDB::ReaderWriter::Options* options);
76extern LIB3DSAPI Lib3dsFile* lib3ds_stream_load(iostream * strm);
[151]77extern LIB3DSAPI Lib3dsBool lib3ds_file_save(Lib3dsFile *file, const char *filename);
[8]78extern LIB3DSAPI Lib3dsFile* lib3ds_file_new();
79extern LIB3DSAPI void lib3ds_file_free(Lib3dsFile *file);
80extern LIB3DSAPI void lib3ds_file_eval(Lib3dsFile *file, Lib3dsFloat t);
[10076]81extern LIB3DSAPI Lib3dsBool lib3ds_file_read(Lib3dsFile *file, iostream *strm);
82extern LIB3DSAPI Lib3dsBool lib3ds_file_write(Lib3dsFile *file, iostream *strm);
[8]83extern LIB3DSAPI void lib3ds_file_insert_material(Lib3dsFile *file, Lib3dsMaterial *material);
84extern LIB3DSAPI void lib3ds_file_remove_material(Lib3dsFile *file, Lib3dsMaterial *material);
85extern LIB3DSAPI Lib3dsMaterial* lib3ds_file_material_by_name(Lib3dsFile *file, const char *name);
86extern LIB3DSAPI void lib3ds_file_dump_materials(Lib3dsFile *file);
87extern LIB3DSAPI void lib3ds_file_insert_mesh(Lib3dsFile *file, Lib3dsMesh *mesh);
88extern LIB3DSAPI void lib3ds_file_remove_mesh(Lib3dsFile *file, Lib3dsMesh *mesh);
89extern LIB3DSAPI Lib3dsMesh* lib3ds_file_mesh_by_name(Lib3dsFile *file, const char *name);
90extern LIB3DSAPI void lib3ds_file_dump_meshes(Lib3dsFile *file);
91extern LIB3DSAPI void lib3ds_file_dump_instances(Lib3dsFile *file);
92extern LIB3DSAPI void lib3ds_file_insert_camera(Lib3dsFile *file, Lib3dsCamera *camera);
93extern LIB3DSAPI void lib3ds_file_remove_camera(Lib3dsFile *file, Lib3dsCamera *camera);
94extern LIB3DSAPI Lib3dsCamera* lib3ds_file_camera_by_name(Lib3dsFile *file, const char *name);
95extern LIB3DSAPI void lib3ds_file_dump_cameras(Lib3dsFile *file);
96extern LIB3DSAPI void lib3ds_file_insert_light(Lib3dsFile *file, Lib3dsLight *light);
97extern LIB3DSAPI void lib3ds_file_remove_light(Lib3dsFile *file, Lib3dsLight *light);
98extern LIB3DSAPI Lib3dsLight* lib3ds_file_light_by_name(Lib3dsFile *file, const char *name);
99extern LIB3DSAPI void lib3ds_file_dump_lights(Lib3dsFile *file);
100extern LIB3DSAPI Lib3dsNode* lib3ds_file_node_by_name(Lib3dsFile *file, const char* name,
101  Lib3dsNodeTypes type);
[151]102extern LIB3DSAPI Lib3dsNode* lib3ds_file_node_by_id(Lib3dsFile *file, Lib3dsWord node_id);
[8]103extern LIB3DSAPI void lib3ds_file_insert_node(Lib3dsFile *file, Lib3dsNode *node);
104extern LIB3DSAPI Lib3dsBool lib3ds_file_remove_node(Lib3dsFile *file, Lib3dsNode *node);
105extern LIB3DSAPI void lib3ds_file_dump_nodes(Lib3dsFile *file);
107#ifdef __cplusplus
Note: See TracBrowser for help on using the browser.