- changing Assimp's coordinate system from RH z-up to RH y-up
 - fixing coordinate system for LWO, 3DS, ASE, MD5, MDL, B3D, IRR, IRRMESH 
 - converttolh moved to three separate steps -> flipuv, flipwinding, makelh

LWO 
 - fixing texture coordinate generation -> mapping axis is correct now 
 - fixing z-fighting bug

ASE 
 - fixing crash due to invalid normal setup 
 - fixing parenting bug 
 - code cleanup

IRR 
 - code cleanup
 - fixing placement of externally loaded meshes 

MDL 
 - fixing texture coordinate space

PLY 
 - cleanup 
 - two-sided maat property is now set 

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@366 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2009-03-15 00:40:30 +00:00
parent 68d7e43056
commit c2d8881549
48 changed files with 1518 additions and 1802 deletions

View File

@@ -54,6 +54,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StreamReader.h"
#include "ParsingUtils.h"
#include "fast_atof.h"
#include "ConvertToLHProcess.h"
using namespace Assimp;
@@ -107,14 +108,10 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// For any of the 3 files being passed get the three correct paths
// First of all, determine file extension
std::string::size_type pos = pFile.find_last_of('.');
std::string extension = pFile.substr( pos);
for( std::string::iterator it = extension.begin(); it != extension.end(); ++it)
*it = tolower( *it);
std::string extension = GetExtension(pFile);
std::string d_path,a_path,uc_path;
if (extension == ".3d")
{
if (extension == "3d") {
// jjjj_d.3d
// jjjj_a.3d
pos = pFile.find_last_of('_');
@@ -123,8 +120,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
}
extension = pFile.substr(0,pos);
}
else // if (extension == ".uc")
{
else {
extension = pFile.substr(0,pos);
}
@@ -154,16 +150,13 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// collect triangles
std::vector<Unreal::Triangle> triangles(numTris);
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();
it != end; ++it)
{
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) {
Unreal::Triangle& tri = *it;
for (unsigned int i = 0; i < 3;++i)
{
for (unsigned int i = 0; i < 3;++i) {
tri.mVertex[i] = d_reader.GetI2();
if (tri.mVertex[i] >= numTris)
{
if (tri.mVertex[i] >= numTris) {
DefaultLogger::get()->warn("UNREAL: vertex index out of range");
tri.mVertex[i] = 0;
}
@@ -208,9 +201,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// collect vertices
std::vector<aiVector3D> vertices(numVert);
for (std::vector<aiVector3D>::iterator it = vertices.begin(), end = vertices.end();
it != end; ++it)
{
for (std::vector<aiVector3D>::iterator it = vertices.begin(), end = vertices.end(); it != end; ++it) {
int32_t val = a_reader.GetI4();
Unreal::DecompressVertex(*it,val);
}
@@ -236,8 +227,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
std::vector< std::pair< std::string,std::string > > tempTextures;
// do a quick search in the UC file for some known, usually texture-related, tags
for (;*data;++data)
{
for (;*data;++data) {
if (TokenMatchI(data,"#exec",5)) {
SkipSpacesAndLineEnd(&data);
@@ -245,20 +235,16 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
if (TokenMatchI(data,"TEXTURE",7)) {
SkipSpacesAndLineEnd(&data);
if (TokenMatchI(data,"IMPORT",6))
{
if (TokenMatchI(data,"IMPORT",6)) {
tempTextures.push_back(std::pair< std::string,std::string >());
std::pair< std::string,std::string >& me = tempTextures.back();
for (;!IsLineEnd(*data);++data)
{
if (!::ASSIMP_strincmp(data,"NAME=",5))
{
for (;!IsLineEnd(*data);++data) {
if (!::ASSIMP_strincmp(data,"NAME=",5)) {
const char *d = data+=5;
for (;!IsSpaceOrNewLine(*data);++data);
me.first = std::string(d,(size_t)(data-d));
}
else if (!::ASSIMP_strincmp(data,"FILE=",5))
{
else if (!::ASSIMP_strincmp(data,"FILE=",5)) {
const char *d = data+=5;
for (;!IsSpaceOrNewLine(*data);++data);
me.second = std::string(d,(size_t)(data-d));
@@ -279,13 +265,11 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
std::pair<unsigned int, std::string>& me = textures.back();
for (;!IsLineEnd(*data);++data) {
if (!::ASSIMP_strincmp(data,"NUM=",4))
{
if (!::ASSIMP_strincmp(data,"NUM=",4)) {
data += 4;
me.first = strtol10(data,&data);
}
else if (!::ASSIMP_strincmp(data,"TEXTURE=",8))
{
else if (!::ASSIMP_strincmp(data,"TEXTURE=",8)) {
data += 8;
const char *d = data;
for (;!IsSpaceOrNewLine(*data);++data);
@@ -293,10 +277,8 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// try to find matching path names, doesn't care if we don't find them
for (std::vector< std::pair< std::string,std::string > >::const_iterator it = tempTextures.begin();
it != tempTextures.end(); ++it)
{
if ((*it).first == me.second)
{
it != tempTextures.end(); ++it) {
if ((*it).first == me.second) {
me.second = (*it).second;
break;
}
@@ -330,9 +312,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
materials.reserve(textures.size()*2+5);
// find out how many output meshes and materials we'll have and build material indices
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();
it != end; ++it)
{
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) {
Unreal::Triangle& tri = *it;
Unreal::TempMat mat(tri);
std::vector<Unreal::TempMat>::iterator nt = std::find(materials.begin(),materials.end(),mat);
@@ -389,8 +369,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
else ::strcat(s.data,"os_");
// make TRANS faces 90% opaque that RemRedundantMaterials won't catch us
if (materials[i].type == Unreal::MF_NORMAL_TRANS_TS)
{
if (materials[i].type == Unreal::MF_NORMAL_TRANS_TS) {
const float opac = 0.9f;
mat->AddProperty(&opac,1,AI_MATKEY_OPACITY);
::strcat(s.data,"tran_");
@@ -398,8 +377,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
else ::strcat(s.data,"opaq_");
// a special name for the weapon attachment point
if (materials[i].type == Unreal::MF_WEAPON_PLACEHOLDER)
{
if (materials[i].type == Unreal::MF_WEAPON_PLACEHOLDER) {
s.length = ::sprintf(s.data,"$WeaponTag$");
color = aiColor3D(0.f,0.f,0.f);
}
@@ -411,11 +389,8 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
// set texture, if any
const unsigned int tex = materials[i].tex;
for (std::vector< std::pair< unsigned int, std::string > >::const_iterator it = textures.begin();
it != textures.end();++it)
{
if ((*it).first == tex)
{
for (std::vector< std::pair< unsigned int, std::string > >::const_iterator it = textures.begin();it != textures.end();++it) {
if ((*it).first == tex) {
s.Set((*it).second);
mat->AddProperty(&s,AI_MATKEY_TEXTURE_DIFFUSE(0));
break;
@@ -424,9 +399,7 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
}
// fill them.
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();
it != end; ++it)
{
for (std::vector<Unreal::Triangle>::iterator it = triangles.begin(), end = triangles.end();it != end; ++it) {
Unreal::Triangle& tri = *it;
Unreal::TempMat mat(tri);
std::vector<Unreal::TempMat>::iterator nt = std::find(materials.begin(),materials.end(),mat);
@@ -435,14 +408,17 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
aiFace& f = mesh->mFaces[mesh->mNumFaces++];
f.mIndices = new unsigned int[f.mNumIndices = 3];
for (unsigned int i = 0; i < 3;++i,mesh->mNumVertices++)
{
for (unsigned int i = 0; i < 3;++i,mesh->mNumVertices++) {
f.mIndices[i] = mesh->mNumVertices;
mesh->mVertices[mesh->mNumVertices] = vertices[ tri.mVertex[i] ];
mesh->mTextureCoords[0][mesh->mNumVertices] = aiVector3D( tri.mTex[i][0] / 255.f, 1.f - tri.mTex[i][1] / 255.f, 0.f);
}
}
// convert to RH
MakeLeftHandedProcess hero;
hero.Execute(pScene);
}
#endif // !! AI_BUILD_NO_3D_IMPORTER