vrshoot

diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/assimp/B3DImporter.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,126 @@
     1.4 +
     1.5 +/*
     1.6 +Open Asset Import Library (assimp)
     1.7 +----------------------------------------------------------------------
     1.8 +
     1.9 +Copyright (c) 2006-2012, assimp team
    1.10 +All rights reserved.
    1.11 +
    1.12 +Redistribution and use of this software in source and binary forms, 
    1.13 +with or without modification, are permitted provided that the 
    1.14 +following conditions are met:
    1.15 +
    1.16 +* Redistributions of source code must retain the above
    1.17 +  copyright notice, this list of conditions and the
    1.18 +  following disclaimer.
    1.19 +
    1.20 +* Redistributions in binary form must reproduce the above
    1.21 +  copyright notice, this list of conditions and the
    1.22 +  following disclaimer in the documentation and/or other
    1.23 +  materials provided with the distribution.
    1.24 +
    1.25 +* Neither the name of the assimp team, nor the names of its
    1.26 +  contributors may be used to endorse or promote products
    1.27 +  derived from this software without specific prior
    1.28 +  written permission of the assimp team.
    1.29 +
    1.30 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    1.31 +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    1.32 +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.33 +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    1.34 +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.35 +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    1.36 +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.37 +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
    1.38 +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    1.39 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    1.40 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.41 +
    1.42 +----------------------------------------------------------------------
    1.43 +*/
    1.44 +
    1.45 +/** @file Definition of the .b3d importer class. */
    1.46 +
    1.47 +#ifndef AI_B3DIMPORTER_H_INC
    1.48 +#define AI_B3DIMPORTER_H_INC
    1.49 +
    1.50 +#include "assimp/types.h"
    1.51 +#include "assimp/mesh.h"
    1.52 +#include "assimp/material.h"
    1.53 +
    1.54 +#include <string>
    1.55 +#include <vector>
    1.56 +
    1.57 +namespace Assimp{
    1.58 +
    1.59 +class B3DImporter : public BaseImporter{
    1.60 +public:
    1.61 +
    1.62 +	virtual bool CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const;
    1.63 +
    1.64 +protected:
    1.65 +
    1.66 +	virtual const aiImporterDesc* GetInfo () const;
    1.67 +	virtual void InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler);
    1.68 +
    1.69 +private:
    1.70 +
    1.71 +	int ReadByte();
    1.72 +	int ReadInt();
    1.73 +	float ReadFloat();
    1.74 +	aiVector2D ReadVec2();
    1.75 +	aiVector3D ReadVec3();
    1.76 +	aiQuaternion ReadQuat();
    1.77 +	std::string ReadString();
    1.78 +	std::string ReadChunk();
    1.79 +	void ExitChunk();
    1.80 +	unsigned ChunkSize();
    1.81 +
    1.82 +	template<class T>
    1.83 +	T *to_array( const std::vector<T> &v );
    1.84 +
    1.85 +	struct Vertex{
    1.86 +		aiVector3D vertex;
    1.87 +		aiVector3D normal;
    1.88 +		aiVector3D texcoords;
    1.89 +		unsigned char bones[4];
    1.90 +		float weights[4];
    1.91 +	};
    1.92 +
    1.93 +	void Oops();
    1.94 +	void Fail( std::string str );
    1.95 +
    1.96 +	void ReadTEXS();
    1.97 +	void ReadBRUS();
    1.98 +
    1.99 +	void ReadVRTS();
   1.100 +	void ReadTRIS( int v0 );
   1.101 +	void ReadMESH();
   1.102 +	void ReadBONE( int id );
   1.103 +	void ReadKEYS( aiNodeAnim *nodeAnim );
   1.104 +	void ReadANIM();
   1.105 +
   1.106 +	aiNode *ReadNODE( aiNode *parent );
   1.107 +
   1.108 +	void ReadBB3D( aiScene *scene );
   1.109 +
   1.110 +	unsigned _pos;
   1.111 +//	unsigned _size;
   1.112 +	std::vector<unsigned char> _buf;
   1.113 +	std::vector<unsigned> _stack;
   1.114 +	
   1.115 +	std::vector<std::string> _textures;
   1.116 +	std::vector<aiMaterial*> _materials;
   1.117 +
   1.118 +	int _vflags,_tcsets,_tcsize;
   1.119 +	std::vector<Vertex> _vertices;
   1.120 +
   1.121 +	std::vector<aiNode*> _nodes;
   1.122 +	std::vector<aiMesh*> _meshes;
   1.123 +	std::vector<aiNodeAnim*> _nodeAnims;
   1.124 +	std::vector<aiAnimation*> _animations;
   1.125 +};
   1.126 +
   1.127 +}
   1.128 +
   1.129 +#endif