- Major update to the viewer. A little bit buggy now, but I'll fix that

- 2/3 of the viewer code are no wrapped in helper classes
- ByteSwap.h header added 
- Bugfix in the 3DS loader: Texture blend mode was read incorrectly
- Bugfix in the X-Loader. Assets with specular_exp == 0 use gouraud lighting now
- Added new helper functions to MaterialHelper 
- Added aiMaterialGetTexture() function to allow easy access to all properties of a texture

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@16 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2008-05-13 23:26:52 +00:00
parent 7144737824
commit 2eb6fca408
60 changed files with 7502 additions and 2613 deletions

View File

@@ -47,6 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assert.h>
#include "JoinVerticesProcess.h"
#include "SpatialSort.h"
#include "DefaultLogger.h"
#include "../include/aiPostProcess.h"
#include "../include/aiMesh.h"
#include "../include/aiScene.h"
@@ -78,13 +79,21 @@ bool JoinVerticesProcess::IsActive( unsigned int pFlags) const
// Executes the post processing step on the given imported data.
void JoinVerticesProcess::Execute( aiScene* pScene)
{
DefaultLogger::get()->debug("JoinVerticesProcess begin");
bool bHas = false;
for( unsigned int a = 0; a < pScene->mNumMeshes; a++)
ProcessMesh( pScene->mMeshes[a]);
{
if( this->ProcessMesh( pScene->mMeshes[a]))
bHas = true;
}
if (bHas)DefaultLogger::get()->info("JoinVerticesProcess finished. Found vertices to join");
else DefaultLogger::get()->debug("JoinVerticesProcess finished. There was nothing to do.");
}
// ------------------------------------------------------------------------------------------------
// Unites identical vertices in the given mesh
void JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
bool JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
{
// helper structure to hold all the data a single vertex can possibly have
typedef struct Vertex vertex;
@@ -100,6 +109,8 @@ void JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
std::vector<Vertex> uniqueVertices;
uniqueVertices.reserve( pMesh->mNumVertices);
unsigned int iOldVerts = pMesh->mNumVertices;
// For each vertex the index of the vertex it was replaced by.
std::vector<unsigned int> replaceIndex( pMesh->mNumVertices, 0xffffffff);
// for each vertex whether it was replaced by an existing unique vertex (true) or a new vertex was created for it (false)
@@ -300,4 +311,5 @@ void JoinVerticesProcess::ProcessMesh( aiMesh* pMesh)
bone->mWeights = new aiVertexWeight[bone->mNumWeights];
memcpy( bone->mWeights, &newWeights[0], bone->mNumWeights * sizeof( aiVertexWeight));
}
return (iOldVerts != pMesh->mNumVertices);
}