RhinoParser.h

Go to the documentation of this file.
00001 /* $Id: RhinoParser.h,v 1.4 2002/12/05 15:30:41 cvs Exp $ */
00002 
00003 #ifndef __RHINO_PARSER_H
00004 #define __RHINO_PARSER_H
00005 
00006 #include <esg/parser/Parser.h>
00007 #include <esg/Definitions.h>
00008 #include <esg/SceneGraphObject.h>
00009 #include <esg/Shape.h>
00010 #include <esg/Group.h>
00011 #include <esg/geometry/Surface.h>
00012 #include <esg/List.h>
00013 #include <esg/AutoPtr.h>
00014 #include <esg/AutoArray.h>
00015 #include <opennurbs.h>
00016 
00017 #include <stdio.h>
00018 
00019 namespace esg {
00020 
00021 class RhinoParser : public Parser {
00022 protected:
00023     // arrays of shared materials
00024     int                 _matTableSize;
00025     AutoPtr<Material>** _specularMatTable;
00026     AutoPtr<Material>** _diffuseMatTable;
00027     AutoPtr<Material>** _ambientMatTable;
00028     //    AutoPtr<Material>** _emissiveMatTable;
00029     AutoPtr<Material>** _roughnessMatTable;
00030 
00031     // default shared materials
00032     AutoPtr<Material>*  _pDefSpecularMat;
00033     AutoPtr<Material>*  _pDefDiffuseMat;
00034     AutoPtr<Material>*  _pDefAmbientMat;
00035     //    AutoPtr<Material>*  _pDefEmissiveMat;
00036     AutoPtr<Material>*  _pDefRoughnessMat;
00037 
00038     static const int _objectFilter;    // which objects are accepted
00039     bool             _continueReading;
00040     ON_Workspace     _workspace;
00041     ON_BinaryFile *  _pFile;            // actually parsed file
00042 
00043     
00044 protected:
00045     bool _read_bitmap_table   (ON_BinaryFile&);
00046     bool _read_material_table (ON_BinaryFile&);
00047     bool _read_layer_table    (ON_BinaryFile&);
00048     bool _read_group_table    (ON_BinaryFile&);
00049     bool _read_lights_table   (ON_BinaryFile&);
00050 
00051     Vertex3* _get_vertices       (const ON_Mesh&);
00052     Vector3* _get_normals        (const ON_Mesh&);
00053     Vector2* _get_texture_coords (const ON_Mesh&);
00054     
00055     void   _set_material (SceneGraphObject&,
00056                           const ON_3dmObjectAttributes&) const;
00057     Shape* _parse_mesh   (const ON_Mesh&);
00058     Shape* _parse_brep   (const ON_Brep&, int);
00059     void   _parse_object (const ON_Geometry&,const ON_3dmObjectAttributes&);
00060 
00061 public:
00062     ON_String                        startComments;
00063     ON_3dmProperties                 properties;
00064     ON_3dmSettings                   settings;
00065     int                              version;
00066     ON_SimpleArray<ON_Bitmap*>       bitmapTable;
00067     //ON_ClassArray<ON_Material>       materialTable;
00068     ON_ClassArray<ON_Layer>          layerTable;
00069     ON_ClassArray<ON_Group>          groupTable;
00070 
00071 public:
00072     RhinoParser (const char            * /* path */,
00073                  const SDS             & /* prototype */,
00074                  SceneGraphObject::OID   firstOID = 1,
00075                  Parser::Statistics    * pStat    = NULL  /* statistics */);
00076     
00077     virtual ~RhinoParser();
00078     
00079     virtual bool parseObject (void);
00080 };
00081 
00082 }; // namespace
00083 
00084 #endif // __RHINO_PARSER_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6