rev |
line source |
nuclear@0
|
1
|
nuclear@0
|
2 /*
|
nuclear@0
|
3 Open Asset Import Library (assimp)
|
nuclear@0
|
4 ----------------------------------------------------------------------
|
nuclear@0
|
5
|
nuclear@0
|
6 Copyright (c) 2006-2012, assimp team
|
nuclear@0
|
7 All rights reserved.
|
nuclear@0
|
8
|
nuclear@0
|
9 Redistribution and use of this software in source and binary forms,
|
nuclear@0
|
10 with or without modification, are permitted provided that the
|
nuclear@0
|
11 following conditions are met:
|
nuclear@0
|
12
|
nuclear@0
|
13 * Redistributions of source code must retain the above
|
nuclear@0
|
14 copyright notice, this list of conditions and the
|
nuclear@0
|
15 following disclaimer.
|
nuclear@0
|
16
|
nuclear@0
|
17 * Redistributions in binary form must reproduce the above
|
nuclear@0
|
18 copyright notice, this list of conditions and the
|
nuclear@0
|
19 following disclaimer in the documentation and/or other
|
nuclear@0
|
20 materials provided with the distribution.
|
nuclear@0
|
21
|
nuclear@0
|
22 * Neither the name of the assimp team, nor the names of its
|
nuclear@0
|
23 contributors may be used to endorse or promote products
|
nuclear@0
|
24 derived from this software without specific prior
|
nuclear@0
|
25 written permission of the assimp team.
|
nuclear@0
|
26
|
nuclear@0
|
27 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
nuclear@0
|
28 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
nuclear@0
|
29 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
nuclear@0
|
30 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
nuclear@0
|
31 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
nuclear@0
|
32 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
nuclear@0
|
33 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
nuclear@0
|
34 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
nuclear@0
|
35 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
nuclear@0
|
36 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
nuclear@0
|
37 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
nuclear@0
|
38
|
nuclear@0
|
39 ----------------------------------------------------------------------
|
nuclear@0
|
40 */
|
nuclear@0
|
41
|
nuclear@0
|
42 /** @file Definition of the .b3d importer class. */
|
nuclear@0
|
43
|
nuclear@0
|
44 #ifndef AI_B3DIMPORTER_H_INC
|
nuclear@0
|
45 #define AI_B3DIMPORTER_H_INC
|
nuclear@0
|
46
|
nuclear@0
|
47 #include "assimp/types.h"
|
nuclear@0
|
48 #include "assimp/mesh.h"
|
nuclear@0
|
49 #include "assimp/material.h"
|
nuclear@0
|
50
|
nuclear@0
|
51 #include <string>
|
nuclear@0
|
52 #include <vector>
|
nuclear@0
|
53
|
nuclear@0
|
54 namespace Assimp{
|
nuclear@0
|
55
|
nuclear@0
|
56 class B3DImporter : public BaseImporter{
|
nuclear@0
|
57 public:
|
nuclear@0
|
58
|
nuclear@0
|
59 virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
|
nuclear@0
|
60
|
nuclear@0
|
61 protected:
|
nuclear@0
|
62
|
nuclear@0
|
63 virtual const aiImporterDesc* GetInfo () const;
|
nuclear@0
|
64 virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
|
nuclear@0
|
65
|
nuclear@0
|
66 private:
|
nuclear@0
|
67
|
nuclear@0
|
68 int ReadByte();
|
nuclear@0
|
69 int ReadInt();
|
nuclear@0
|
70 float ReadFloat();
|
nuclear@0
|
71 aiVector2D ReadVec2();
|
nuclear@0
|
72 aiVector3D ReadVec3();
|
nuclear@0
|
73 aiQuaternion ReadQuat();
|
nuclear@0
|
74 std::string ReadString();
|
nuclear@0
|
75 std::string ReadChunk();
|
nuclear@0
|
76 void ExitChunk();
|
nuclear@0
|
77 unsigned ChunkSize();
|
nuclear@0
|
78
|
nuclear@0
|
79 template<class T>
|
nuclear@0
|
80 T *to_array( const std::vector<T> &v );
|
nuclear@0
|
81
|
nuclear@0
|
82 struct Vertex{
|
nuclear@0
|
83 aiVector3D vertex;
|
nuclear@0
|
84 aiVector3D normal;
|
nuclear@0
|
85 aiVector3D texcoords;
|
nuclear@0
|
86 unsigned char bones[4];
|
nuclear@0
|
87 float weights[4];
|
nuclear@0
|
88 };
|
nuclear@0
|
89
|
nuclear@0
|
90 void Oops();
|
nuclear@0
|
91 void Fail( std::string str );
|
nuclear@0
|
92
|
nuclear@0
|
93 void ReadTEXS();
|
nuclear@0
|
94 void ReadBRUS();
|
nuclear@0
|
95
|
nuclear@0
|
96 void ReadVRTS();
|
nuclear@0
|
97 void ReadTRIS( int v0 );
|
nuclear@0
|
98 void ReadMESH();
|
nuclear@0
|
99 void ReadBONE( int id );
|
nuclear@0
|
100 void ReadKEYS( aiNodeAnim *nodeAnim );
|
nuclear@0
|
101 void ReadANIM();
|
nuclear@0
|
102
|
nuclear@0
|
103 aiNode *ReadNODE( aiNode *parent );
|
nuclear@0
|
104
|
nuclear@0
|
105 void ReadBB3D( aiScene *scene );
|
nuclear@0
|
106
|
nuclear@0
|
107 unsigned _pos;
|
nuclear@0
|
108 // unsigned _size;
|
nuclear@0
|
109 std::vector<unsigned char> _buf;
|
nuclear@0
|
110 std::vector<unsigned> _stack;
|
nuclear@0
|
111
|
nuclear@0
|
112 std::vector<std::string> _textures;
|
nuclear@0
|
113 std::vector<aiMaterial*> _materials;
|
nuclear@0
|
114
|
nuclear@0
|
115 int _vflags,_tcsets,_tcsize;
|
nuclear@0
|
116 std::vector<Vertex> _vertices;
|
nuclear@0
|
117
|
nuclear@0
|
118 std::vector<aiNode*> _nodes;
|
nuclear@0
|
119 std::vector<aiMesh*> _meshes;
|
nuclear@0
|
120 std::vector<aiNodeAnim*> _nodeAnims;
|
nuclear@0
|
121 std::vector<aiAnimation*> _animations;
|
nuclear@0
|
122 };
|
nuclear@0
|
123
|
nuclear@0
|
124 }
|
nuclear@0
|
125
|
nuclear@0
|
126 #endif
|