Updated B3D Loader, added Mark Sibly to the list of contributors.
git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@237 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
f7aa836330
commit
04ca1a72f7
5
CREDITS
5
CREDITS
|
@ -11,7 +11,7 @@ Thanks for your help!
|
|||
Configuration-Interface, AssImp-Viewer (Win32), Website (Admin and Design), admin.
|
||||
|
||||
-Thomas Schulze,
|
||||
X-Loader, Preprocessing framework. Data structure & Interface design, documentation.
|
||||
X-, BVH-Loader, Postprocessing framework. Data structure & Interface design, documentation.
|
||||
|
||||
-R.Schmidt,
|
||||
Linux build, eclipse support.
|
||||
|
@ -23,6 +23,9 @@ Obj-Loader, Logging, Scons-build environment.
|
|||
Assimp.net
|
||||
Visual Studio 9 support, bugfixes.
|
||||
|
||||
- Mark Sibly
|
||||
B3D-Loader, Assimp testing
|
||||
|
||||
- Sebastian Hempel,
|
||||
PyAssimp
|
||||
Compile-Bugfixes for mingw, add enviroment for static library support in make.
|
||||
|
|
|
@ -267,60 +267,36 @@ void B3DImporter::ReadVRTS(){
|
|||
void B3DImporter::ReadTRIS(){
|
||||
int matid=ReadInt();
|
||||
|
||||
for( vector<Vertex>::iterator it=_vertices.begin();it!=_vertices.end();++it ){
|
||||
it->index=-1;
|
||||
}
|
||||
|
||||
vector<int> verts,tris;
|
||||
|
||||
while( ChunkSize() ){
|
||||
int i=ReadInt();
|
||||
Vertex &vert=_vertices[i];
|
||||
if( vert.index==-1 ){
|
||||
vert.index=verts.size();
|
||||
verts.push_back( i );
|
||||
}
|
||||
tris.push_back( vert.index );
|
||||
}
|
||||
|
||||
if( verts.empty() || tris.empty() ) return;
|
||||
|
||||
unsigned n_verts=verts.size();
|
||||
unsigned n_tris=tris.size()/3;
|
||||
|
||||
//OK, we have a whole mesh...
|
||||
aiVector3D *mv=new aiVector3D[n_verts];
|
||||
aiVector3D *mn=new aiVector3D[n_verts];
|
||||
aiVector3D *mc=new aiVector3D[n_verts];
|
||||
for( unsigned i=0;i<n_verts;++i ){
|
||||
Vertex &v=_vertices[verts[i]];
|
||||
memcpy( &mv[i].x,&v.position.x,12 );
|
||||
memcpy( &mn[i].x,&v.normal.x,12 );
|
||||
memcpy( &mc[i].x,&v.texcoords.x,12 );
|
||||
}
|
||||
|
||||
aiFace *faces=new aiFace[n_tris];
|
||||
for( unsigned i=0;i<n_tris;++i ){
|
||||
faces[i].mNumIndices=3;
|
||||
unsigned *ip=faces[i].mIndices=new unsigned[3];
|
||||
ip[0]=tris[i*3];
|
||||
ip[1]=tris[i*3+1];
|
||||
ip[2]=tris[i*3+2];
|
||||
}
|
||||
|
||||
unsigned n_tris=ChunkSize()/12;
|
||||
unsigned n_verts=n_tris*3;
|
||||
|
||||
aiMesh *mesh=new aiMesh;
|
||||
_meshes.push_back( mesh );
|
||||
|
||||
mesh->mMaterialIndex=matid;
|
||||
|
||||
mesh->mNumVertices=n_verts;
|
||||
mesh->mVertices=mv;
|
||||
mesh->mNormals=mn;
|
||||
mesh->mTextureCoords[0]=mc;
|
||||
|
||||
mesh->mNumFaces=n_tris;
|
||||
mesh->mFaces=faces;
|
||||
mesh->mPrimitiveTypes=aiPrimitiveType_TRIANGLE;
|
||||
|
||||
_meshes.push_back( mesh );
|
||||
aiVector3D *mv=mesh->mVertices=new aiVector3D[n_verts];
|
||||
aiVector3D *mn=mesh->mNormals=new aiVector3D[n_verts];
|
||||
aiVector3D *mc=mesh->mTextureCoords[0]=new aiVector3D[n_verts];
|
||||
|
||||
aiFace *face=mesh->mFaces=new aiFace[n_tris];
|
||||
|
||||
for( unsigned i=0;i<n_verts;i+=3 ){
|
||||
face->mNumIndices=3;
|
||||
unsigned *ip=face->mIndices=new unsigned[3];
|
||||
for( unsigned j=0;j<3;++j ){
|
||||
int k=ReadInt();
|
||||
const Vertex &v=_vertices[k];
|
||||
memcpy( mv++,&v.position.x,12 );
|
||||
memcpy( mn++,&v.normal.x,12 );
|
||||
memcpy( mc++,&v.texcoords.x,12 );
|
||||
*ip++=i+j;
|
||||
}
|
||||
++face;
|
||||
}
|
||||
}
|
||||
|
||||
void B3DImporter::ReadMESH(){
|
||||
|
|
|
@ -69,7 +69,7 @@ private:
|
|||
struct Vec3{ float x,y,z; };
|
||||
struct Vec4{ float x,y,z,w; };
|
||||
struct Texture{ std::string name; };
|
||||
struct Vertex{ int index;Vec3 position,normal,texcoords; };
|
||||
struct Vertex{ Vec3 position,normal,texcoords; };
|
||||
|
||||
int ReadByte();
|
||||
int ReadInt();
|
||||
|
|
Loading…
Reference in New Issue