vrshoot

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