00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtk3DSOurImporter.h,v $ 00005 Language: C++ 00006 Date: $Date: 2001/10/11 13:37:22 $ 00007 Version: $Revision: 1.16 $ 00008 00009 00010 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 00011 All rights reserved. 00012 00013 Redistribution and use in source and binary forms, with or without 00014 modification, are permitted provided that the following conditions are met: 00015 00016 * Redistributions of source code must retain the above copyright notice, 00017 this list of conditions and the following disclaimer. 00018 00019 * Redistributions in binary form must reproduce the above copyright notice, 00020 this list of conditions and the following disclaimer in the documentation 00021 and/or other materials provided with the distribution. 00022 00023 * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names 00024 of any contributors may be used to endorse or promote products derived 00025 from this software without specific prior written permission. 00026 00027 * Modified source versions must be plainly marked as such, and must not be 00028 misrepresented as being the original software. 00029 00030 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' 00031 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00032 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00033 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR 00034 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00035 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00036 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00037 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00038 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00039 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00040 00041 =========================================================================*/ 00042 // .NAME vtk3DSOurImporter - imports 3D Studio files. 00043 // .SECTION Description 00044 // vtk3DSOurImporter imports 3D Studio files into vtk. 00045 00046 // .SECTION See Also 00047 // vtkOurImporter 00048 00049 00050 #ifndef __vtk3DSOurImporter_h 00051 #define __vtk3DSOurImporter_h 00052 00053 #include <stdio.h> 00054 #include "vtkImporter.h" 00055 #include "vtk3DS.h" 00056 #include "vtkPolyData.h" 00057 00058 typedef vtk3DSMesh Mesh; 00059 typedef vtk3DSOmniLight OmniLight; 00060 typedef vtk3DSSpotLight SpotLight; 00061 typedef vtk3DSCamera Camera; 00062 typedef vtk3DSMaterial Material; 00063 typedef vtk3DSMatProp MatProp; 00064 00065 typedef vtk3DSColour Colour; 00066 typedef vtk3DSColour_24 Colour_24; 00067 typedef vtk3DSVector Vector; 00068 typedef vtk3DSList List; 00069 typedef vtk3DSChunk Chunk; 00070 typedef vtk3DSFace Face; 00071 00072 class /*VTK_HYBRID_EXPORT*/ vtk3DSOurImporter : public vtkImporter 00073 { 00074 protected: 00075 vtk3DSOurImporter(); 00076 ~vtk3DSOurImporter(); 00077 00078 virtual int ImportBegin (); 00079 virtual void ImportEnd (); 00080 virtual void ImportActors (vtkRenderer *renderer); 00081 virtual void ImportCameras (vtkRenderer *renderer); 00082 virtual void ImportLights (vtkRenderer *renderer); 00083 virtual void ImportProperties (vtkRenderer *renderer); 00084 vtkPolyData *GeneratePolyData (Mesh *meshPtr); 00085 int Read3DS (); 00086 00087 char *FileName; 00088 FILE *FileFD; 00089 int ComputeNormals; 00090 int flag3; 00091 00092 public: 00093 static vtk3DSOurImporter *New(); 00094 00095 void vtk3DSOurImporter::SetPolys (char* f); 00096 vtkTypeMacro(vtk3DSOurImporter,vtkImporter); 00097 void PrintSelf(ostream& os, vtkIndent indent); 00098 00099 // Description: 00100 // Specify the name of the file to read. 00101 vtkSetStringMacro(FileName); 00102 vtkGetStringMacro(FileName); 00103 00104 // Description: 00105 // Set/Get the computation of normals. If on, imported geometry will 00106 // be run through vtkPolyDataNormals. 00107 vtkSetMacro(ComputeNormals,int); 00108 vtkGetMacro(ComputeNormals,int); 00109 vtkBooleanMacro(ComputeNormals,int); 00110 00111 // Description: 00112 // Return the file pointer to the open file. 00113 FILE *GetFileFD() {return FileFD;}; 00114 00115 OmniLight *OmniList; 00116 SpotLight *SpotLightList; 00117 Camera *CameraList; 00118 Mesh *MeshList; 00119 Material *MaterialList; 00120 MatProp *MatPropList; 00121 00122 00123 private: 00124 vtk3DSOurImporter(const vtk3DSOurImporter&); // Not implemented. 00125 void operator=(const vtk3DSOurImporter&); // Not implemented. 00126 }; 00127 00128 #endif 00129