Просмотр исходного кода

Removed MDR loader - too unimportant and would need much more work to work properly.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@259 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
aramis_acg 17 лет назад
Родитель
Сommit
d320a4bc64

+ 9 - 9
code/ACLoader.cpp

@@ -180,16 +180,11 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
 	{
 		obj.type = Object::Group;
 	}
-	else if (!ASSIMP_strincmp(buffer,"poly",4))
-	{
-		obj.type = Object::Poly;
-	}
 	else if (!ASSIMP_strincmp(buffer,"world",5))
 	{
 		obj.type = Object::World;
 	}
-
-
+	else obj.type = Object::Poly;
 	while (GetNextLine())
 	{
 		if (TokenMatch(buffer,"kids",4))
@@ -227,6 +222,8 @@ void AC3DImporter::LoadObjectSection(std::vector<Object>& objects)
 		{
 			SkipSpaces(&buffer);
 			AI_AC_CHECKED_LOAD_FLOAT_ARRAY("",0,2,&obj.texRepeat);
+			if (!obj.texRepeat.x || !obj.texRepeat.y)
+				obj.texRepeat = aiVector2D (1.f,1.f);
 		}
 		else if (TokenMatch(buffer,"texoff",6))
 		{
@@ -685,9 +682,12 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object,
 	// compute the transformation offset to the parent node
 	node->mTransformation = aiMatrix4x4 ( object.rotation );
 
-	node->mTransformation.a4 = object.translation.x;
-	node->mTransformation.b4 = object.translation.y;
-	node->mTransformation.c4 = object.translation.z;
+	if (object.type == Object::Group || !object.numRefs)
+	{
+		node->mTransformation.a4 = object.translation.x;
+		node->mTransformation.b4 = object.translation.y;
+		node->mTransformation.c4 = object.translation.z;
+	}
 
 	// add children to the object
 	if (object.children.size())

+ 0 - 6
code/Importer.cpp

@@ -84,9 +84,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #ifndef AI_BUILD_NO_SMD_IMPORTER
 #	include "SMDLoader.h"
 #endif
-#ifndef AI_BUILD_NO_MDR_IMPORTER
-#	include "MDRLoader.h"
-#endif
 #ifndef AI_BUILD_NO_MDC_IMPORTER
 #	include "MDCLoader.h"
 #endif
@@ -248,9 +245,6 @@ Importer::Importer() :
 #if (!defined AI_BUILD_NO_SMD_IMPORTER)
 	mImporter.push_back( new SMDImporter());
 #endif
-#if (!defined AI_BUILD_NO_MDR_IMPORTER)
-	mImporter.push_back( new MDRImporter());
-#endif
 #if (!defined AI_BUILD_NO_MDC_IMPORTER)
 	mImporter.push_back( new MDCImporter());
 #endif

+ 0 - 227
code/MDRFileData.h

@@ -1,227 +0,0 @@
-/*
-Open Asset Import Library (ASSIMP)
-----------------------------------------------------------------------
-
-Copyright (c) 2006-2008, ASSIMP Development Team
-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.
-
-* Neither the name of the ASSIMP team, nor the names of its
-  contributors may be used to endorse or promote products
-  derived from this software without specific prior
-  written permission of the ASSIMP Development Team.
-
-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.
-
-----------------------------------------------------------------------
-*/
-
-/** @file Defines the helper data structures for importing MDR files  */
-#ifndef AI_MDRFILEHELPER_H_INC
-#define AI_MDRFILEHELPER_H_INC
-
-#include "../include/aiTypes.h"
-#include "../include/aiMesh.h"
-#include "../include/aiAnim.h"
-
-#include "./../include/Compiler/pushpack1.h"
-
-namespace Assimp {
-namespace MDR {
-
-// to make it easier for ourselfes, we test the magic word against both "endianesses"
-#define MDR_MAKE(string) ((uint32_t)((string[0] << 24) + (string[1] << 16) + (string[2] << 8) + string[3]))
-
-#define AI_MDR_MAGIC_NUMBER_BE	MDR_MAKE("RDM5")
-#define AI_MDR_MAGIC_NUMBER_LE	MDR_MAKE("5MDR")
-
-// common limitations for MDR - not validated for the moment
-#define AI_MDR_VERSION			2
-#define AI_MDR_MAXQPATH			64
-#define	AI_MDR_MAX_BONES		128
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a vertex weight in a MDR file
- */
-struct  Weight
-{
-	//! these are indexes into the boneReferences
-	//! not the global per-frame bone list
-	uint32_t	boneIndex;	
-
-	//! weight of this bone
-	float		boneWeight;
-
-	//! offset of this bone
-	aiVector3D	offset;
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a vertex in a MDR file
- */
-struct Vertex
-{
-	aiVector3D		normal;
-	aiVector2D		texCoords;
-	uint32_t		numWeights;
-} PACK_STRUCT;
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a triangle in a MDR file
- */
-struct Triangle
-{
-	uint32_t			indexes[3];
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a surface in a MDR file
- */
-struct Surface
-{
-	uint32_t	ident;
-
-	char		name[AI_MDR_MAXQPATH];	// polyset name
-	char		shader[AI_MDR_MAXQPATH];
-	uint32_t	shaderIndex;	
-
-	int32_t		ofsHeader;	// this will be a negative number
-
-	uint32_t	numVerts;
-	uint32_t	ofsVerts;
-
-	uint32_t	numTriangles;
-	uint32_t	ofsTriangles;
-
-	// Bone references are a set of ints representing all the bones
-	// present in any vertex weights for this surface.  This is
-	// needed because a model may have surfaces that need to be
-	// drawn at different sort times, and we don't want to have
-	// to re-interpolate all the bones for each surface.
-	uint32_t	numBoneReferences;
-	uint32_t	ofsBoneReferences;
-
-	uint32_t	ofsEnd;		// next surface follows
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a bone in a MDR file
- */
-struct Bone
-{
-	float		matrix[3][4];
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a frame in a MDR file
- */
-struct Frame {
-	aiVector3D	bounds0,bounds1;	// bounds of all surfaces of all LOD's for this frame
-	aiVector3D	localOrigin;		// midpoint of bounds, used for sphere cull
-	float		radius;				// dist from localOrigin to corner
-	char		name[16];
-
-	// bones follow here
-
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a compressed bone in a MDR file
- */
-struct CompBone
-{
-        unsigned char Comp[24]; // MC_COMP_BYTES is in MatComp.h, but don't want to couple
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a compressed frame in a MDR file
- */
-struct CompFrame
-{
-        aiVector3D  bounds0,bounds1;	// bounds of all surfaces of all LOD's for this frame
-        aiVector3D  localOrigin;		// midpoint of bounds, used for sphere cull
-        float      radius;				// dist from localOrigin to corner
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a LOD in a MDR file
- */
-struct LOD
-{
-	uint32_t			numSurfaces;
-	uint32_t			ofsSurfaces;		// first surface, others follow
-	uint32_t			ofsEnd;				// next lod follows
-} ;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Data structure for a tag (= attachment) in a MDR file
- */
-struct Tag
-{
-        uint32_t                     boneIndex;
-        char            name[32];
-} PACK_STRUCT;
-
-
-// ---------------------------------------------------------------------------
-/** \brief Header data structure for a MDR file
- */
-struct Header
-{
-	int32_t	ident;
-	int32_t	version;
-
-	char		name[AI_MDR_MAXQPATH];	
-
-	// frames and bones are shared by all levels of detail
-	int32_t	numFrames;
-	int32_t	numBones;
-	int32_t	ofsFrames;			
-
-	// each level of detail has completely separate sets of surfaces
-	int32_t	numLODs;
-	int32_t	ofsLODs;
-
-    int32_t    numTags;
-	int32_t    ofsTags;
-
-	int32_t	ofsEnd;				
-} PACK_STRUCT;
-
-
-#include "./../include/Compiler/poppack1.h"
-
-}}
-
-#endif // !! AI_MDRFILEHELPER_H_INC

+ 0 - 371
code/MDRLoader.cpp

@@ -1,371 +0,0 @@
-/*
----------------------------------------------------------------------------
-Open Asset Import Library (ASSIMP)
----------------------------------------------------------------------------
-
-Copyright (c) 2006-2008, ASSIMP Development Team
-
-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.
-
-* Neither the name of the ASSIMP team, nor the names of its
-  contributors may be used to endorse or promote products
-  derived from this software without specific prior
-  written permission of the ASSIMP Development Team.
-
-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.
----------------------------------------------------------------------------
-*/
-
-/** @file Implementation of the MDR importer class */
-
-#include "AssimpPCH.h"
-#include "MDRLoader.h"
-
-using namespace Assimp;
-using namespace Assimp::MDR;
-
-
-// ------------------------------------------------------------------------------------------------
-// Constructor to be privately used by Importer
-MDRImporter::MDRImporter()
-{
-}
-
-// ------------------------------------------------------------------------------------------------
-// Destructor, private as well 
-MDRImporter::~MDRImporter()
-{
-}
-
-// ------------------------------------------------------------------------------------------------
-// Returns whether the class can handle the format of the given file. 
-bool MDRImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler) const
-{
-	// simple check of file extension is enough for the moment
-	std::string::size_type pos = pFile.find_last_of('.');
-	// no file extension - can't read
-	if( pos == std::string::npos)
-		return false;
-	std::string extension = pFile.substr( pos);
-
-	return !(extension.length() != 4 || extension[0] != '.' ||
-			 extension[1] != 'm' && extension[1] != 'M' ||
-			 extension[2] != 'd' && extension[2] != 'D' ||
-			 extension[3] != 'r' && extension[3] != 'R');
-}
-
-// ------------------------------------------------------------------------------------------------
-// Uncompress a matrix
-void MDRImporter::MatrixUncompress(aiMatrix4x4& mat,const uint8_t * compressed)
-{
-	int value;
-
-	// First decompress the translation part
-	for (unsigned int n = 0; n < 3;++n)
-	{
-		value     = (int)((uint16_t *)(compressed))[n];
-		mat[0][n] = ((float)(value-(1<<15)))/64.f;
-	}
-
-	// Then decompress the rotation matrix
-	for (unsigned int n = 0, p = 3; n < 3;++n)
-	{
-		for (unsigned int m = 0; m < 3;++m,++p)
-		{
-			value =  (int)((uint16_t *)(compressed))[p];
-			mat[n][m]=((float)(value-(1<<15)))*(1.0f/(float)((1<<(15))-2));
-		}
-	}
-
-	// now zero the final row of the matrix
-	mat[3][0] = mat[3][1] = mat[3][2] = 0.f;
-	mat[3][3] = 1.f;
-}
-
-// ------------------------------------------------------------------------------------------------
-// Validate the header of the given MDR file
-void MDRImporter::ValidateHeader()
-{
-	// Check the magic word - '5MDR'
-	if (pcHeader->ident != AI_MDR_MAGIC_NUMBER_BE &&
-		pcHeader->ident != AI_MDR_MAGIC_NUMBER_LE)
-	{
-		char szBuffer[5];
-		szBuffer[0] = ((char*)&pcHeader->ident)[0];
-		szBuffer[1] = ((char*)&pcHeader->ident)[1];
-		szBuffer[2] = ((char*)&pcHeader->ident)[2];
-		szBuffer[3] = ((char*)&pcHeader->ident)[3];
-		szBuffer[4] = '\0';
-
-		throw new ImportErrorException("Invalid MDR magic word: should be 5MDR, the "
-			"magic word found is " + std::string( szBuffer ));
-	}
-
-	// Big endian - swap the fields in the header
-	AI_SWAP4(pcHeader->numBones);
-	AI_SWAP4(pcHeader->numFrames);
-	AI_SWAP4(pcHeader->ofsFrames);
-	AI_SWAP4(pcHeader->ofsLODs);
-	AI_SWAP4(pcHeader->ofsTags);
-	AI_SWAP4(pcHeader->version);
-	AI_SWAP4(pcHeader->numTags);
-	AI_SWAP4(pcHeader->numLODs);
-
-	// MDR file version should always be 2
-	if (pcHeader->version != AI_MDR_VERSION)
-		DefaultLogger::get()->warn("Unsupported MDR file version (2 was expected)");
-
-	// We compute the vertex positions from the bones,
-	// so we need at least one bone.
-	if (!pcHeader->numBones)
-		DefaultLogger::get()->warn("MDR: At least one bone must be there");
-
-	// We should have at least the first LOD in the valid range
-	if (pcHeader->ofsLODs > (int)fileSize) 
-		throw new ImportErrorException("MDR: header is invalid - LOD out of range");
-
-	// header::ofsFrames is negative if the frames are compressed
-	if (pcHeader->ofsFrames < 0)
-	{
-		// Ugly, but it will be our only change to make further
-		// reading easier
-		int32_t* p = const_cast<int32_t*>(&pcHeader->ofsFrames);
-		*p = -pcHeader->ofsFrames;
-		compressed = true;
-		DefaultLogger::get()->info("MDR: Compressed frames");
-	}
-	else compressed = false;
-
-	// validate all frames
-	if ( pcHeader->ofsFrames +    sizeof(MDR::Frame) * 
-		(pcHeader->numBones -1) * sizeof(MDR::Bone)  * 
-		 pcHeader->numFrames > fileSize)
-	{
-		throw new ImportErrorException("MDR: header is invalid - frame out of range");
-	}
-
-	// Check whether the requested frame is existing
-	if (configFrameID >= (unsigned int) pcHeader->numFrames)
-		throw new ImportErrorException("The requested frame is not available");
-}
-
-// ------------------------------------------------------------------------------------------------
-// Validate the surface header of a given MDR file LOD
-void MDRImporter::ValidateLODHeader(BE_NCONST MDR::LOD* pcLOD)
-{
-	AI_SWAP4(pcLOD->ofsSurfaces);
-	AI_SWAP4(pcLOD->numSurfaces);
-	AI_SWAP4(pcLOD->ofsEnd);
-
-    const unsigned int iMax = fileSize - (unsigned int)((int8_t*)pcLOD-(int8_t*)pcHeader);
-
-	// We should have at least one surface here
-	if (!pcLOD->numSurfaces)
-		throw new ImportErrorException("MDR: LOD has zero surfaces assigned");
-
-	if (pcLOD->ofsSurfaces > iMax)
-		throw new ImportErrorException("MDR: LOD header is invalid - surface out of range");
-}
-
-// ------------------------------------------------------------------------------------------------
-// Validate the header of a given MDR file surface
-void MDRImporter::ValidateSurfaceHeader(BE_NCONST MDR::Surface* pcSurf)
-{
-	AI_SWAP4(pcSurf->ident);
-	AI_SWAP4(pcSurf->numBoneReferences);
-	AI_SWAP4(pcSurf->numTriangles);
-	AI_SWAP4(pcSurf->numVerts);
-	AI_SWAP4(pcSurf->ofsBoneReferences);
-	AI_SWAP4(pcSurf->ofsEnd);
-	AI_SWAP4(pcSurf->ofsTriangles);
-	AI_SWAP4(pcSurf->ofsVerts);
-	AI_SWAP4(pcSurf->shaderIndex);
-
-	// Find out how many bytes
-    const unsigned int iMax = fileSize - (unsigned int)((int8_t*)pcSurf-(int8_t*)pcHeader);
-
-	// Not exact - there could be extra data in the vertices.
-	if (pcSurf->ofsTriangles + pcSurf->numTriangles*sizeof(MDR::Triangle) > iMax ||
-		pcSurf->ofsVerts + pcSurf->numVerts*sizeof(MDR::Vertex) > iMax)
-    {
-		throw new ImportErrorException("MDR: Surface header is invalid");
-    }
-}
-
-// ------------------------------------------------------------------------------------------------
-// Setup configuration properties
-void MDRImporter::SetupProperties(const Importer* pImp)
-{
-	// **************************************************************
-	// The AI_CONFIG_IMPORT_MDR_KEYFRAME    option overrides the
-	//     AI_CONFIG_IMPORT_GLOBAL_KEYFRAME option.
-	// **************************************************************
-	configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_MDR_KEYFRAME,0xffffffff);
-
-	if(0xffffffff == configFrameID)
-		configFrameID = pImp->GetPropertyInteger(AI_CONFIG_IMPORT_GLOBAL_KEYFRAME,0);
-}
-
-// ------------------------------------------------------------------------------------------------
-// Imports the given file into the given scene structure. 
-void MDRImporter::InternReadFile( const std::string& pFile, 
-	aiScene* pScene, IOSystem* pIOHandler)
-{
-	boost::scoped_ptr<IOStream> file( pIOHandler->Open( pFile, "rb"));
-
-	// Check whether we can read from the file
-	if( file.get() == NULL)
-		throw new ImportErrorException( "Failed to open MDR file " + pFile + ".");
-
-	// Check whether the mdr file is large enough to contain the file header
-	fileSize = (unsigned int)file->FileSize();
-	if( fileSize < sizeof(MDR::Header))
-		throw new ImportErrorException( "MDR File is too small.");
-
-	// Copy the contents of the file to a buffer
-	std::vector<unsigned char> mBuffer2(fileSize);
-	file->Read( &mBuffer2[0], 1, fileSize);
-	mBuffer = &mBuffer2[0];
-
-	// Validate the file header and do BigEndian byte swapping for all sub headers
-	pcHeader = (BE_NCONST MDR::Header*)mBuffer;
-	ValidateHeader();
-
-	// Go to the first LOD
-	LE_NCONST MDR::LOD* lod = (LE_NCONST MDR::LOD*)((uint8_t*)pcHeader+pcHeader->ofsLODs);
-	std::vector<aiMesh*> outMeshes;
-	outMeshes.reserve(lod->numSurfaces);
-
-	// Get a pointer to the first surface and continue processing them all
-	LE_NCONST MDR::Surface* surf = (LE_NCONST MDR::Surface*)((uint8_t*)lod+lod->ofsSurfaces);
-	for (uint32_t i = 0; i < lod->numSurfaces; ++i)
-	{
-		// The surface must have a) faces b) vertices and c) bone references
-		if (surf->numTriangles && surf->numVerts && surf->numBoneReferences)
-		{
-			outMeshes.push_back(new aiMesh());
-			aiMesh* mesh = outMeshes.back();
-
-			mesh->mNumFaces = surf->numTriangles;
-			mesh->mNumVertices = mesh->mNumFaces*3;
-			mesh->mNumBones = surf->numBoneReferences;
-
-			mesh->mFaces = new aiFace[mesh->mNumFaces];
-			mesh->mVertices = new aiVector3D[mesh->mNumVertices];
-			mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices];
-			mesh->mBones = new aiBone*[mesh->mNumBones];
-
-			// Allocate output bones and generate proper names for them
-			for (unsigned int p = 0; p < mesh->mNumBones;++p)
-			{
-				aiBone* bone = mesh->mBones[p] = new aiBone();
-				bone->mName.length = ::sprintf(  bone->mName.data, "B_%i",p);
-			}
-
-			std::vector<BoneWeightInfo> mWeights;
-			mWeights.reserve(surf->numVerts << 1);
-
-			std::vector<VertexInfo> mVertices(surf->numVerts);
-
-			// get a pointer to the first vertex
-			LE_NCONST MDR::Vertex* v = (LE_NCONST MDR::Vertex*)((uint8_t*)surf+surf->ofsVerts);
-			for (unsigned int m = 0; m < surf->numVerts; ++m)
-			{
-				// get a pointer to the next vertex
-				v = (LE_NCONST MDR::Vertex*)((uint8_t*)(v+1) + v->numWeights*sizeof(MDR::Weight));
-
-				// Big Endian - swap the vertex data structure
-#ifndef AI_BUILD_BIG_ENDIAN
-				AI_SWAP4(v->numWeights);
-				AI_SWAP4(v->normal.x);
-				AI_SWAP4(v->normal.y);
-				AI_SWAP4(v->normal.z);
-				AI_SWAP4(v->texCoords.x);
-				AI_SWAP4(v->texCoords.y);
-#endif        
-
-				// Fill out output structure
-				VertexInfo& vert = mVertices[m];
-
-				vert.uv.x = v->texCoords.x;  vert.uv.y = v->texCoords.y; 
-				vert.normal = v->normal;
-				vert.start  = (unsigned int)mWeights.size();
-				vert.num    = v->numWeights;
-
-				// Now compute the final vertex position by averaging
-				// the positions affecting this vertex, weighting by
-				// the given vertex weights.
-				for (unsigned int l = 0; l < vert.num; ++l)
-				{
-				}
-			}
-
-			// Find out how large the output weight buffers must be
-			LE_NCONST MDR::Triangle* tri = (LE_NCONST MDR::Triangle*)((uint8_t*)surf+surf->ofsTriangles);
-			LE_NCONST MDR::Triangle* const triEnd = tri + surf->numTriangles;
-			for (; tri != triEnd; ++tri)
-			{
-				for (unsigned int o = 0; o < 3;++o)
-				{
-					// Big endian: swap the 32 Bit index
-#ifndef AI_BUILD_BIG_ENDIAN        
-					AI_SWAP4(tri->indexes[o]);
-#endif          
-					register unsigned int temp = tri->indexes[o];
-					if (temp >= surf->numVerts)
-						throw new ImportErrorException("MDR: Vertex index is out of range");
-
-					VertexInfo& vert = mVertices[temp];
-					for (unsigned int l = vert.start; l < vert.start + vert.num; ++l)
-					{
-						if (mWeights[l].first >= surf->numBoneReferences)
-							throw new ImportErrorException("MDR: Bone index is out of range");
-
-						++mesh->mBones[mWeights[l].first]->mNumWeights;
-					}
-				}
-			}
-
-			// Allocate storage for output bone weights
-			for (unsigned int p = 0; p < mesh->mNumBones;++p)
-			{
-				aiBone* bone = mesh->mBones[p];
-				ai_assert(0 != bone->mNumWeights);
-				bone->mWeights = new aiVertexWeight[bone->mNumWeights];
-			}
-
-			// and build the final output buffers
-		}
-
-		// Get a pointer to the next surface and continue
-		surf = (LE_NCONST MDR::Surface*)((uint8_t*)surf + surf->ofsEnd);	
-	}
-
-	// Copy the vector to the C-style output array
-	pScene->mNumMeshes = (unsigned int) outMeshes.size();
-	pScene->mMeshes = new aiMesh*[pScene->mNumMeshes];
-	::memcpy(pScene->mMeshes,&outMeshes[0],sizeof(void*)*pScene->mNumMeshes);
-}

+ 0 - 160
code/MDRLoader.h

@@ -1,160 +0,0 @@
-/*
-Open Asset Import Library (ASSIMP)
-----------------------------------------------------------------------
-
-Copyright (c) 2006-2008, ASSIMP Development Team
-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.
-
-* Neither the name of the ASSIMP team, nor the names of its
-  contributors may be used to endorse or promote products
-  derived from this software without specific prior
-  written permission of the ASSIMP Development Team.
-
-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.
-
-----------------------------------------------------------------------
-*/
-
-/** @file Definition of the MDR importer class. */
-#ifndef AI_MDRLOADER_H_INCLUDED
-#define AI_MDRLOADER_H_INCLUDED
-
-#include "../include/aiTypes.h"
-
-#include "BaseImporter.h"
-#include "MDRFileData.h"
-#include "ByteSwap.h"
-
-namespace Assimp	{
-using namespace MDR;
-
-// ---------------------------------------------------------------------------
-/** Importer class for the MDR file format (Ravensoft)
-*/
-class MDRImporter : public BaseImporter
-{
-	friend class Importer;
-
-protected:
-	/** Constructor to be privately used by Importer */
-	MDRImporter();
-
-	/** Destructor, private as well */
-	~MDRImporter();
-
-public:
-
-	// -------------------------------------------------------------------
-	/** Returns whether the class can handle the format of the given file. 
-	* See BaseImporter::CanRead() for details.	*/
-	bool CanRead( const std::string& pFile, IOSystem* pIOHandler) const;
-
-	// -------------------------------------------------------------------
-	/** Called prior to ReadFile().
-	* The function is a request to the importer to update its configuration
-	* basing on the Importer's configuration property list.
-	*/
-	void SetupProperties(const Importer* pImp);
-
-protected:
-
-	// -------------------------------------------------------------------
-	/** Called by Importer::GetExtensionList() for each loaded importer.
-	 * See BaseImporter::GetExtensionList() for details
-	 */
-	void GetExtensionList(std::string& append)
-	{
-		append.append("*.mdr");
-	}
-
-	// -------------------------------------------------------------------
-	/** Imports the given file into the given scene structure. 
-	* See BaseImporter::InternReadFile() for details
-	*/
-	void InternReadFile( const std::string& pFile, aiScene* pScene,
-		IOSystem* pIOHandler);
-
-protected:
-
-
-	// -------------------------------------------------------------------
-	/** Validate the header of the file
-	*/
-	void ValidateHeader();
-
-	// -------------------------------------------------------------------
-	/** Validate the header of a MDR surface
-	 *  @param pcSurf Surface to be validated
-	*/
-	void ValidateSurfaceHeader(BE_NCONST MDR::Surface* pcSurf);
-
-	// -------------------------------------------------------------------
-	/** Validate the header of a MDR LOD
-	 *  @param pcLOD LOD to be validated
-	*/
-	void ValidateLODHeader(BE_NCONST MDR::LOD* pcLOD);
-
-	// -------------------------------------------------------------------
-	/** Uncompress a matrix
-	 *
-	 *  @param mat Destination matrix
-	 *  @param compressed Pointer to 24 bytesof compressed data
-	*/
-	void MatrixUncompress(aiMatrix4x4& mat,const uint8_t * compressed);
-
-protected:
-
-
-	struct VertexInfo
-	{
-		aiVector3D xyz;
-		aiVector3D normal;
-		aiVector3D uv;
-		unsigned int start,num;
-	};
-	typedef std::pair<uint32_t,float> BoneWeightInfo;
-
-
-	/** Configuration option: frame to be loaded */
-	unsigned int configFrameID;
-
-	/** Header of the MDR file */
-	BE_NCONST MDR::Header* pcHeader;
-
-	/** Buffer to hold the loaded file */
-	unsigned char* mBuffer;
-
-	/** size of the file, in bytes */
-	unsigned int fileSize;
-
-	/** compressed frames? */
-	bool compressed;
-};
-
-} // end of namespace Assimp
-
-#endif // AI_MDRIMPORTER_H_INC
-

+ 0 - 1
code/makefile

@@ -56,7 +56,6 @@ SOURCES = AssimpPCH.cpp \
 	ValidateDataStructure.cpp \
 	VertexTriangleAdjacency.cpp \
 	XFileImporter.cpp \
-	MDRLoader.cpp \
 	RawLoader.cpp \
 	OFFLoader.cpp \
 	SortByPTypeProcess.cpp \

+ 0 - 1
code/makefile.mingw

@@ -56,7 +56,6 @@ SOURCES = AssimpPCH.cpp \
 	ValidateDataStructure.cpp \
 	VertexTriangleAdjacency.cpp \
 	XFileImporter.cpp \
-	MDRLoader.cpp \
 	RawLoader.cpp \
 	OFFLoader.cpp \
 	SortByPTypeProcess.cpp \

+ 30 - 0
test/ObjFiles/box.obj

@@ -0,0 +1,30 @@
+#	                Vertices: 8
+#	                  Points: 0
+#	                   Lines: 0
+#	                   Faces: 6
+#	               Materials: 1
+
+o 1
+
+# Vertex list
+
+v -0.5 -0.5 0.5
+v -0.5 -0.5 -0.5
+v -0.5 0.5 -0.5
+v -0.5 0.5 0.5
+v 0.5 -0.5 0.5
+v 0.5 -0.5 -0.5
+v 0.5 0.5 -0.5
+v 0.5 0.5 0.5
+
+# Point/Line/Face list
+
+usemtl Default
+f 4 3 2 1
+f 2 6 5 1
+f 3 7 6 2
+f 8 7 3 4
+f 5 8 4 1
+f 6 7 8 5
+
+# End of file

+ 1 - 1
tools/assimp_view/assimp_view.cpp

@@ -141,7 +141,7 @@ DWORD WINAPI LoadThreadProc(LPVOID lpParameter)
 		aiProcess_ValidateDataStructure | aiProcess_ImproveCacheLocality 
 		| aiProcess_RemoveRedundantMaterials | aiProcess_SortByPType |
 		aiProcess_FindDegenerates | aiProcess_FindInvalidData |
-		aiProcess_GenUVCoords | aiProcess_TransformUVCoords ); // validate the output data structure
+		aiProcess_GenUVCoords | aiProcess_TransformUVCoords); // validate the output data structure
 
 	// get the end time of zje operation, calculate delta t
 	double fEnd = (double)timeGetTime();

+ 0 - 16
workspaces/vc8/assimp.vcproj

@@ -1611,22 +1611,6 @@
 						>
 					</File>
 				</Filter>
-				<Filter
-					Name="MDR"
-					>
-					<File
-						RelativePath="..\..\code\MDRFileData.h"
-						>
-					</File>
-					<File
-						RelativePath="..\..\code\MDRLoader.cpp"
-						>
-					</File>
-					<File
-						RelativePath="..\..\code\MDRLoader.h"
-						>
-					</File>
-				</Filter>
 				<Filter
 					Name="VRML97"
 					>