vrshoot

view libs/assimp/MS3DLoader.h @ 1:e7ca128b8713

looks nice :)
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 00:35:22 +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 */
41 /** @file MS3DLoader.h
42 * @brief Declaration of the MS3D importer class.
43 */
44 #ifndef AI_MS3DLOADER_H_INCLUDED
45 #define AI_MS3DLOADER_H_INCLUDED
47 #include "BaseImporter.h"
48 namespace Assimp {
50 // ----------------------------------------------------------------------------------------------
51 /** Milkshape 3D importer implementation */
52 // ----------------------------------------------------------------------------------------------
53 class MS3DImporter
54 : public BaseImporter
55 {
57 public:
59 MS3DImporter();
60 ~MS3DImporter();
62 public:
64 // -------------------------------------------------------------------
65 /** Returns whether the class can handle the format of the given file.
66 * See BaseImporter::CanRead() for details. */
67 bool CanRead( const std::string& pFile, IOSystem* pIOHandler,
68 bool checkSig) const;
70 protected:
72 // -------------------------------------------------------------------
73 /** Return importer meta information.
74 * See #BaseImporter::GetInfo for the details */
75 const aiImporterDesc* GetInfo () const;
78 // -------------------------------------------------------------------
79 /** Imports the given file into the given scene structure.
80 * See BaseImporter::InternReadFile() for details */
81 void InternReadFile( const std::string& pFile, aiScene* pScene,
82 IOSystem* pIOHandler);
85 private:
87 struct TempJoint;
88 void CollectChildJoints(const std::vector<TempJoint>& joints, std::vector<bool>& hadit, aiNode* nd,const aiMatrix4x4& absTrafo);
89 void CollectChildJoints(const std::vector<TempJoint>& joints, aiNode* nd);
91 template<typename T> void ReadComments(StreamReaderLE& stream, std::vector<T>& outp);
92 private:
94 aiScene* mScene;
96 private:
98 struct TempVertex
99 {
100 aiVector3D pos;
101 unsigned int bone_id[4], ref_cnt;
102 float weights[4];
103 };
105 struct TempTriangle
106 {
107 unsigned int indices[3];
108 aiVector3D normals[3];
109 aiVector2D uv[3];
111 unsigned int sg, group;
112 };
114 struct TempGroup
115 {
116 char name[33]; // +0
117 std::vector<unsigned int> triangles;
118 unsigned int mat; // 0xff is no material
119 std::string comment;
120 };
122 struct TempMaterial
123 {
124 // again, add an extra 0 character to all strings -
125 char name[33];
126 char texture[129];
127 char alphamap[129];
129 aiColor4D diffuse,specular,ambient,emissive;
130 float shininess,transparency;
131 std::string comment;
132 };
134 struct TempKeyFrame
135 {
136 float time;
137 aiVector3D value;
138 };
140 struct TempJoint
141 {
142 char name[33];
143 char parentName[33];
144 aiVector3D rotation, position;
146 std::vector<TempKeyFrame> rotFrames;
147 std::vector<TempKeyFrame> posFrames;
148 std::string comment;
149 };
151 //struct TempModel {
152 // std::string comment;
153 //};
154 };
156 }
157 #endif