2011-07-15 11:13:42 +00:00
|
|
|
/*
|
2012-02-03 03:38:30 +00:00
|
|
|
Open Asset Import Library (assimp)
|
2011-07-15 11:13:42 +00:00
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
Copyright (c) 2006-2012, assimp team
|
2011-07-15 11:13:42 +00:00
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Redistribution and use of this software in source and binary forms,
|
|
|
|
with or without modification, are permitted provided that the
|
|
|
|
following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2012-02-03 03:38:30 +00:00
|
|
|
* Neither the name of the assimp team, nor the names of its
|
2011-07-15 11:13:42 +00:00
|
|
|
contributors may be used to endorse or promote products
|
|
|
|
derived from this software without specific prior
|
2012-02-03 03:38:30 +00:00
|
|
|
written permission of the assimp team.
|
2011-07-15 11:13:42 +00:00
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "AssimpPCH.h"
|
2011-10-31 08:34:55 +00:00
|
|
|
#ifndef ASSIMP_BUILD_NO_M3_IMPORTER
|
|
|
|
|
2011-07-15 11:13:42 +00:00
|
|
|
#include "M3Importer.h"
|
2011-10-31 08:34:55 +00:00
|
|
|
#include <sstream>
|
2011-07-15 11:13:42 +00:00
|
|
|
|
|
|
|
namespace Assimp {
|
|
|
|
namespace M3 {
|
|
|
|
|
2012-04-22 22:26:26 +00:00
|
|
|
static const aiImporterDesc desc = {
|
|
|
|
"StarCraft M3 Importer",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
aiImporterFlags_SupportBinaryFlavour,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
"m3"
|
|
|
|
};
|
2011-07-15 11:13:42 +00:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Constructor.
|
|
|
|
M3Importer::M3Importer() :
|
|
|
|
m_pHead( NULL ),
|
2012-02-04 21:08:20 +00:00
|
|
|
m_pRefs( NULL ),
|
|
|
|
m_Buffer()
|
2011-07-15 11:13:42 +00:00
|
|
|
{
|
2012-01-25 18:42:14 +00:00
|
|
|
// empty
|
2011-07-15 11:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Destructor.
|
|
|
|
M3Importer::~M3Importer()
|
|
|
|
{
|
|
|
|
m_pHead = NULL;
|
|
|
|
m_pRefs = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
// Check for readable file format.
|
|
|
|
bool M3Importer::CanRead( const std::string &rFile, IOSystem* /*pIOHandler*/, bool checkSig ) const
|
|
|
|
{
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( !checkSig ) {
|
2012-04-22 22:26:26 +00:00
|
|
|
return SimpleExtensionCheck( rFile, "m3" );
|
2012-02-04 21:08:20 +00:00
|
|
|
}
|
2011-07-15 11:13:42 +00:00
|
|
|
|
2012-02-18 18:03:39 +00:00
|
|
|
return false;
|
2011-07-15 11:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
2012-04-22 22:26:26 +00:00
|
|
|
const aiImporterDesc* M3Importer::GetInfo () const
|
2011-07-15 11:13:42 +00:00
|
|
|
{
|
2012-04-22 22:26:26 +00:00
|
|
|
return &desc;
|
2011-07-15 11:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
void M3Importer::InternReadFile( const std::string& pFile, aiScene* pScene, IOSystem* pIOHandler )
|
|
|
|
{
|
2012-02-04 21:08:20 +00:00
|
|
|
ai_assert( !pFile.empty() );
|
|
|
|
|
2011-10-31 08:34:55 +00:00
|
|
|
const std::string mode = "rb";
|
|
|
|
boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, mode ) );
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( NULL == file.get() ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
2012-02-04 21:08:20 +00:00
|
|
|
}
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
// Get the file-size and validate it, throwing an exception when it fails
|
2012-02-04 21:08:20 +00:00
|
|
|
const size_t filesize = file->FileSize();
|
|
|
|
if( filesize < 1 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
throw DeadlyImportError( "M3-file is too small.");
|
2012-02-04 21:08:20 +00:00
|
|
|
}
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
m_Buffer.resize( filesize );
|
2012-07-08 01:28:14 +00:00
|
|
|
file->Read( &m_Buffer[ 0 ], sizeof( unsigned char ), filesize );
|
2011-10-31 08:34:55 +00:00
|
|
|
|
2012-02-04 21:08:20 +00:00
|
|
|
m_pHead = reinterpret_cast<MD33*>( &m_Buffer[ 0 ] );
|
|
|
|
m_pRefs = reinterpret_cast<ReferenceEntry*>( &m_Buffer[ 0 ] + m_pHead->ofsRefs );
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
MODL20* pMODL20( NULL );
|
|
|
|
MODL23* pMODL23( NULL );
|
|
|
|
|
|
|
|
VertexExt* pVerts1( NULL );
|
|
|
|
Vertex* pVerts2( NULL );
|
|
|
|
|
|
|
|
DIV *pViews( NULL );
|
|
|
|
Region* regions( NULL );
|
|
|
|
uint16* faces( NULL );
|
|
|
|
|
|
|
|
uint32 nVertices = 0;
|
|
|
|
|
|
|
|
bool ok = true;
|
2012-02-04 21:08:20 +00:00
|
|
|
switch( m_pRefs[ m_pHead->MODL.ref ].type ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
case 20:
|
|
|
|
pMODL20 = GetEntries<MODL20>( m_pHead->MODL );
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( ( pMODL20->flags & 0x20000) != 0 ) { // Has vertices
|
|
|
|
if( (pMODL20->flags & 0x40000) != 0 ) { // Has extra 4 byte
|
2011-10-31 08:34:55 +00:00
|
|
|
pVerts1 = GetEntries<VertexExt>( pMODL20->vertexData );
|
|
|
|
nVertices = pMODL20->vertexData.nEntries/sizeof(VertexExt);
|
|
|
|
}
|
2012-02-04 21:08:20 +00:00
|
|
|
else {
|
|
|
|
pVerts2 = GetEntries<Vertex>( pMODL20->vertexData );
|
|
|
|
nVertices = pMODL20->vertexData.nEntries / sizeof( Vertex );
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pViews = GetEntries<DIV>( pMODL20->views );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 23:
|
|
|
|
pMODL23 = GetEntries<MODL23>(m_pHead->MODL );
|
2012-02-04 21:08:20 +00:00
|
|
|
if( (pMODL23->flags & 0x20000) != 0 ) { // Has vertices
|
|
|
|
if( (pMODL23->flags & 0x40000) != 0 ) { // Has extra 4 byte
|
|
|
|
pVerts1 = GetEntries<VertexExt>( pMODL23->vertexData );
|
|
|
|
nVertices = pMODL23->vertexData.nEntries/sizeof( VertexExt );
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
2012-02-04 21:08:20 +00:00
|
|
|
else {
|
|
|
|
pVerts2 = GetEntries<Vertex>( pMODL23->vertexData );
|
|
|
|
nVertices = pMODL23->vertexData.nEntries/sizeof( Vertex );
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
pViews = GetEntries<DIV>( pMODL23->views );
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ok = false;
|
2012-02-04 21:08:20 +00:00
|
|
|
break;
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
2012-02-19 09:10:04 +00:00
|
|
|
|
|
|
|
// Everything ok, if not throw an exception
|
|
|
|
if ( !ok ) {
|
|
|
|
throw DeadlyImportError( "Failed to open file " + pFile + ".");
|
|
|
|
}
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
// Get all region data
|
|
|
|
regions = GetEntries<Region>( pViews->regions );
|
|
|
|
|
|
|
|
// Get the face data
|
|
|
|
faces = GetEntries<uint16>( pViews->faces );
|
|
|
|
|
|
|
|
// Convert the vertices
|
|
|
|
std::vector<aiVector3D> vertices;
|
|
|
|
vertices.resize( nVertices );
|
|
|
|
unsigned int offset = 0;
|
2012-02-04 21:08:20 +00:00
|
|
|
for ( unsigned int i = 0; i < nVertices; i++ ) {
|
|
|
|
if ( pVerts1 ) {
|
|
|
|
vertices[ offset ].Set( pVerts1[ i ].pos.x, pVerts1[ i ].pos.y, pVerts1[ i ].pos.z );
|
|
|
|
++offset;
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( pVerts2 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
vertices[ offset ].Set( pVerts2[ i ].pos.x, pVerts2[ i ].pos.y, pVerts2[ i ].pos.z );
|
2012-02-04 21:08:20 +00:00
|
|
|
++offset;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-02-19 09:10:04 +00:00
|
|
|
// Write the UV coordinates
|
2012-02-04 21:08:20 +00:00
|
|
|
offset = 0;
|
|
|
|
std::vector<aiVector3D> uvCoords;
|
|
|
|
uvCoords.resize( nVertices );
|
|
|
|
for( unsigned int i = 0; i < nVertices; ++i ) {
|
|
|
|
if( pVerts1 ) {
|
2012-02-19 09:10:04 +00:00
|
|
|
float u = (float) pVerts1[ i ].uv[ 0 ] / 2048;
|
|
|
|
float v = (float) pVerts1[ i ].uv[ 1 ] / 2048;
|
2012-02-04 21:08:20 +00:00
|
|
|
uvCoords[ offset ].Set( u, v, 0.0f );
|
|
|
|
++offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pVerts2 ) {
|
2012-02-19 09:10:04 +00:00
|
|
|
float u = (float) pVerts2[ i ].uv[ 0 ] / 2048;
|
|
|
|
float v = (float) pVerts2[ i ].uv[ 1 ] / 2048;
|
2012-02-04 21:08:20 +00:00
|
|
|
uvCoords[ offset ].Set( u, v, 0.0f );
|
|
|
|
++offset;
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Compute the normals
|
|
|
|
std::vector<aiVector3D> normals;
|
|
|
|
normals.resize( nVertices );
|
|
|
|
float w = 0.0f;
|
|
|
|
Vec3D norm;
|
2012-02-04 21:08:20 +00:00
|
|
|
offset = 0;
|
|
|
|
for( unsigned int i = 0; i < nVertices; i++ ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
w = 0.0f;
|
2012-02-04 21:08:20 +00:00
|
|
|
if( pVerts1 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
norm.x = (float) 2*pVerts1[ i ].normal[ 0 ]/255.0f - 1;
|
|
|
|
norm.y = (float) 2*pVerts1[ i ].normal[ 1 ]/255.0f - 1;
|
|
|
|
norm.z = (float) 2*pVerts1[ i ].normal[ 2 ]/255.0f - 1;
|
|
|
|
w = (float) pVerts1[ i ].normal[ 3 ]/255.0f;
|
|
|
|
}
|
|
|
|
|
2012-02-04 21:08:20 +00:00
|
|
|
if( pVerts2 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
norm.x = (float) 2*pVerts2[ i ].normal[ 0 ]/255.0f - 1;
|
|
|
|
norm.y = (float) 2*pVerts2[ i ].normal[ 1 ]/255.0f - 1;
|
|
|
|
norm.z = (float) 2*pVerts2[ i ].normal[ 2 ]/255.0f - 1;
|
|
|
|
w = (float) pVerts2[ i ].normal[ 3 ] / 255.0f;
|
|
|
|
}
|
|
|
|
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( w ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
const float invW = 1.0f / w;
|
|
|
|
norm.x = norm.x * invW;
|
|
|
|
norm.y = norm.y * invW;
|
|
|
|
norm.z = norm.z * invW;
|
2012-02-04 21:08:20 +00:00
|
|
|
normals[ offset ].Set( norm.x, norm.y, norm.z );
|
|
|
|
++offset;
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Convert the data into the assimp specific data structures
|
2012-02-04 21:08:20 +00:00
|
|
|
convertToAssimp( pFile, pScene, pViews, regions, faces, vertices, uvCoords, normals );
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
void M3Importer::convertToAssimp( const std::string& pFile, aiScene* pScene, DIV *pViews,
|
|
|
|
Region *pRegions, uint16 *pFaces,
|
|
|
|
const std::vector<aiVector3D> &vertices,
|
2012-02-04 21:08:20 +00:00
|
|
|
const std::vector<aiVector3D> &uvCoords,
|
2011-10-31 08:34:55 +00:00
|
|
|
const std::vector<aiVector3D> &normals )
|
|
|
|
{
|
|
|
|
std::vector<aiMesh*> MeshArray;
|
|
|
|
|
|
|
|
// Create the root node
|
|
|
|
pScene->mRootNode = createNode( NULL );
|
|
|
|
|
|
|
|
// Set the name of the scene
|
|
|
|
pScene->mRootNode->mName.Set( pFile );
|
|
|
|
|
|
|
|
aiNode *pRootNode = pScene->mRootNode;
|
|
|
|
aiNode *pCurrentNode = NULL;
|
|
|
|
|
|
|
|
// Lets create the nodes
|
|
|
|
pRootNode->mNumChildren = pViews->regions.nEntries;
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( pRootNode->mNumChildren > 0 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
pRootNode->mChildren = new aiNode*[ pRootNode->mNumChildren ];
|
2012-02-04 21:08:20 +00:00
|
|
|
}
|
2011-10-31 08:34:55 +00:00
|
|
|
|
2012-02-19 09:10:04 +00:00
|
|
|
for ( unsigned int i=0; i<pRootNode->mNumChildren; ++i ) {
|
2012-02-26 13:36:29 +00:00
|
|
|
//pRegions[ i ].
|
2011-10-31 08:34:55 +00:00
|
|
|
// Create a new node
|
|
|
|
pCurrentNode = createNode( pRootNode );
|
|
|
|
std::stringstream stream;
|
|
|
|
stream << "Node_" << i;
|
|
|
|
pCurrentNode->mName.Set( stream.str().c_str() );
|
|
|
|
pRootNode->mChildren[ i ] = pCurrentNode;
|
|
|
|
|
|
|
|
// Loop over the faces of the nodes
|
2012-02-19 09:10:04 +00:00
|
|
|
unsigned int numFaces = ( ( pRegions[ i ].ofsIndices + pRegions[ i ].nIndices ) - pRegions[ i ].ofsIndices ) / 3;
|
2011-10-31 08:34:55 +00:00
|
|
|
aiMesh *pMesh = new aiMesh;
|
|
|
|
MeshArray.push_back( pMesh );
|
2012-02-19 09:10:04 +00:00
|
|
|
pMesh->mPrimitiveTypes = aiPrimitiveType_TRIANGLE;
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
pMesh->mNumFaces = numFaces;
|
|
|
|
pMesh->mFaces = new aiFace[ pMesh->mNumFaces ];
|
|
|
|
aiFace *pCurrentFace = NULL;
|
|
|
|
unsigned int faceIdx = 0;
|
2012-02-04 21:08:20 +00:00
|
|
|
for ( unsigned int j = pRegions[ i ].ofsIndices; j < ( pRegions[ i ].ofsIndices + pRegions[ i ].nIndices ); j += 3 ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
pCurrentFace = &( pMesh->mFaces[ faceIdx ] );
|
|
|
|
faceIdx++;
|
|
|
|
pCurrentFace->mNumIndices = 3;
|
|
|
|
pCurrentFace->mIndices = new unsigned int[ 3 ];
|
2012-02-04 21:08:20 +00:00
|
|
|
pCurrentFace->mIndices[ 0 ] = pFaces[ j ];
|
|
|
|
pCurrentFace->mIndices[ 1 ] = pFaces[ j+1 ];
|
|
|
|
pCurrentFace->mIndices[ 2 ] = pFaces[ j+2 ];
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
// Now we can create the vertex data itself
|
|
|
|
pCurrentNode->mNumMeshes = 1;
|
|
|
|
pCurrentNode->mMeshes = new unsigned int[ 1 ];
|
2012-02-04 21:08:20 +00:00
|
|
|
const unsigned int meshIdx = MeshArray.size() - 1;
|
|
|
|
pCurrentNode->mMeshes[ 0 ] = meshIdx;
|
2012-02-19 09:10:04 +00:00
|
|
|
createVertexData( pMesh, vertices, uvCoords, normals );
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Copy the meshes into the scene
|
|
|
|
pScene->mNumMeshes = MeshArray.size();
|
|
|
|
pScene->mMeshes = new aiMesh*[ MeshArray.size() ];
|
|
|
|
unsigned int pos = 0;
|
2012-02-04 21:08:20 +00:00
|
|
|
for ( std::vector<aiMesh*>::iterator it = MeshArray.begin(); it != MeshArray.end(); ++it ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
pScene->mMeshes[ pos ] = *it;
|
2012-02-26 13:36:29 +00:00
|
|
|
++pos;
|
2011-10-31 08:34:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
void M3Importer::createVertexData( aiMesh *pMesh, const std::vector<aiVector3D> &vertices,
|
2012-02-19 09:10:04 +00:00
|
|
|
const std::vector<aiVector3D> &uvCoords,
|
2011-10-31 08:34:55 +00:00
|
|
|
const std::vector<aiVector3D> &normals )
|
|
|
|
{
|
|
|
|
pMesh->mNumVertices = pMesh->mNumFaces * 3;
|
|
|
|
pMesh->mVertices = new aiVector3D[ pMesh->mNumVertices ];
|
2012-02-26 13:36:29 +00:00
|
|
|
pMesh->mNumUVComponents[ 0 ] = 2;
|
|
|
|
pMesh->mTextureCoords[ 0 ] = new aiVector3D[ pMesh->mNumVertices ];
|
2011-10-31 08:34:55 +00:00
|
|
|
pMesh->mNormals = new aiVector3D[ pMesh->mNumVertices ];
|
|
|
|
unsigned int pos = 0;
|
2012-02-04 21:08:20 +00:00
|
|
|
for ( unsigned int currentFace = 0; currentFace < pMesh->mNumFaces; currentFace++ ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
aiFace *pFace = &( pMesh->mFaces[ currentFace ] );
|
2012-02-04 21:08:20 +00:00
|
|
|
for ( unsigned int currentIdx=0; currentIdx<pFace->mNumIndices; currentIdx++ ) {
|
2012-01-25 18:42:14 +00:00
|
|
|
const unsigned int idx = pFace->mIndices[ currentIdx ];
|
2012-02-04 21:08:20 +00:00
|
|
|
if ( vertices.size() > idx ) {
|
2011-10-31 08:34:55 +00:00
|
|
|
pMesh->mVertices[ pos ] = vertices[ idx ];
|
|
|
|
pMesh->mNormals[ pos ] = normals[ idx ];
|
2012-02-26 13:36:29 +00:00
|
|
|
pMesh->mTextureCoords[ 0 ]->x = uvCoords[ idx ].x;
|
|
|
|
pMesh->mTextureCoords[ 0 ]->y = uvCoords[ idx ].y;
|
2011-10-31 08:34:55 +00:00
|
|
|
pFace->mIndices[ currentIdx ] = pos;
|
|
|
|
pos++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
aiNode *M3Importer::createNode( aiNode *pParent )
|
|
|
|
{
|
|
|
|
aiNode *pNode = new aiNode;
|
|
|
|
if ( pParent )
|
|
|
|
pNode->mParent = pParent;
|
|
|
|
else
|
|
|
|
pNode->mParent = NULL;
|
|
|
|
|
|
|
|
return pNode;
|
2011-07-15 11:13:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
} // Namespace M3
|
|
|
|
} // Namespace Assimp
|
2011-10-31 08:34:55 +00:00
|
|
|
|
|
|
|
#endif // ASSIMP_BUILD_NO_M3_IMPORTER
|