vrshoot

view libs/assimp/ObjFileMtlImporter.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line source
1 /*
2 Open Asset Import Library (assimp)
3 ----------------------------------------------------------------------
5 Copyright (c) 2006-2012, assimp team
6 All rights reserved.
8 Redistribution and use of this software in source and binary forms,
9 with or without modification, are permitted provided that the
10 following conditions are met:
12 * Redistributions of source code must retain the above
13 copyright notice, this list of conditions and the
14 following disclaimer.
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the
18 following disclaimer in the documentation and/or other
19 materials provided with the distribution.
21 * Neither the name of the assimp team, nor the names of its
22 contributors may be used to endorse or promote products
23 derived from this software without specific prior
24 written permission of the assimp team.
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ----------------------------------------------------------------------*/
39 #ifndef OBJFILEMTLIMPORTER_H_INC
40 #define OBJFILEMTLIMPORTER_H_INC
42 #include <vector>
43 #include <string>
45 struct aiColor3D;
47 namespace Assimp
48 {
50 namespace ObjFile
51 {
52 struct Model;
53 struct Material;
55 }
58 /**
59 * @class ObjFileMtlImporter
60 * @brief Loads the material description from a mtl file.
61 */
62 class ObjFileMtlImporter
63 {
64 public:
65 static const size_t BUFFERSIZE = 2048;
66 typedef std::vector<char> DataArray;
67 typedef std::vector<char>::iterator DataArrayIt;
68 typedef std::vector<char>::const_iterator ConstDataArrayIt;
70 public:
71 //! \brief Default constructor
72 ObjFileMtlImporter( std::vector<char> &buffer, const std::string &strAbsPath,
73 ObjFile::Model *pModel );
75 //! \brief DEstructor
76 ~ObjFileMtlImporter();
78 private:
79 /// Copy constructor, empty.
80 ObjFileMtlImporter(const ObjFileMtlImporter &rOther);
81 /// \brief Assignment operator, returns only a reference of this instance.
82 ObjFileMtlImporter &operator = (const ObjFileMtlImporter &rOther);
83 /// Load the whole material description
84 void load();
85 /// Get color data.
86 void getColorRGBA( aiColor3D *pColor);
87 /// Get illumination model from loaded data
88 void getIlluminationModel( int &illum_model );
89 /// Gets a float value from data.
90 void getFloatValue( float &value );
91 /// Creates a new material from loaded data.
92 void createMaterial();
93 /// Get texture name from loaded data.
94 void getTexture();
96 private:
97 //! Absolute pathname
98 std::string m_strAbsPath;
99 //! Data iterator showing to the current position in data buffer
100 DataArrayIt m_DataIt;
101 //! Data iterator to end of buffer
102 DataArrayIt m_DataItEnd;
103 //! USed model instance
104 ObjFile::Model *m_pModel;
105 //! Current line in file
106 unsigned int m_uiLine;
107 //! Helper buffer
108 char m_buffer[BUFFERSIZE];
109 };
111 // ------------------------------------------------------------------------------------------------
113 } // Namespace Assimp
115 #endif