Removed aiProcess_FindDegenerates from the viewer. The step seems to cause some problems that have not yet been solved.

Added irrmesh (Irrlicht Mesh Format) loader to Assimp. Works quite stable, but no lightmapping support yet.
Removed tinyxml, replaced it with irrxml instead. Added an IOStreamToIrrXML wrapper.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@194 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
This commit is contained in:
aramis_acg
2008-10-24 20:37:54 +00:00
parent 44ea300651
commit ce6ce098e9
46 changed files with 4126 additions and 9756 deletions

View File

@@ -50,6 +50,31 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp
{
// ------------------------------------------------------------------------------------------------
// Add a prefix to a string
inline void PrefixString(aiString& string,const char* prefix, unsigned int len)
{
// Add the prefix
::memmove(string.data+len,string.data,string.length+1);
::memcpy (string.data, prefix, len);
// And update the string's length
string.length += len;
}
// ------------------------------------------------------------------------------------------------
// Add a name prefix to all nodes in a hierarchy
void SceneCombiner::AddNodePrefixes(aiNode* node, const char* prefix, unsigned int len)
{
ai_assert(NULL != prefix);
PrefixString(node->mName,prefix,len);
// Process all children recursively
for (unsigned int i = 0; i < node->mNumChildren;++i)
AddNodePrefixes(node->mChildren[i],prefix,len);
}
// ------------------------------------------------------------------------------------------------
// Merges two scenes. Currently only used by the LWS loader.
void SceneCombiner::MergeScenes(aiScene* dest,std::vector<aiScene*>& src,
@@ -88,7 +113,10 @@ void SceneCombiner::MergeScenes(aiScene* dest,std::vector<aiScene*>& src,
if ((*cur)->mNumAnimations > 0 ||
(*cur)->mNumCameras > 0 ||
(*cur)->mNumLights > 0)bNeedPrefix = true;
(*cur)->mNumLights > 0)
{
bNeedPrefix = true;
}
}
// generate the output texture list + an offset table
@@ -176,6 +204,17 @@ void SceneCombiner::MergeScenes(aiScene* dest,std::vector<aiScene*>& src,
if (bNeedPrefix)
{
// Allocate space for light sources, cameras and animations
aiLight** ppLights = dest->mLights = (dest->mNumLights
? new aiLight*[dest->mNumLights] : NULL);
aiCamera** ppCameras = dest->mCameras = (dest->mNumCameras
? new aiCamera*[dest->mNumCameras] : NULL);
aiAnimation** ppAnims = dest->mAnimations = (dest->mNumAnimations
? new aiAnimation*[dest->mNumAnimations] : NULL);
for (cur = begin, cnt = 0; cur != end; ++cur)
{
char buffer[10];
@@ -187,13 +226,31 @@ void SceneCombiner::MergeScenes(aiScene* dest,std::vector<aiScene*>& src,
*sz++ = '_';
*sz++ = '\0';
// AddNodePrefixes((*cur)->mRootNode,buffer,*cur);
/** CONTINUE WORK HERE **/
const unsigned int len = (unsigned int)::strlen(buffer);
AddNodePrefixes((*cur)->mRootNode,buffer,len);
// Copy light sources, add the prefix to them, too
for (unsigned int i = 0; i < (*cur)->mNumLights;++i,++ppLights)
{
*ppLights = (*cur)->mLights[i];
PrefixString((*ppLights)->mName,buffer,len);
}
// Copy cameras, add the prefix to them, too
for (unsigned int i = 0; i < (*cur)->mNumCameras;++i,++ppCameras)
{
*ppCameras = (*cur)->mCameras[i];
PrefixString((*ppCameras)->mName,buffer,len);
}
// Copy animations, add the prefix to them, too
for (unsigned int i = 0; i < (*cur)->mNumAnimations;++i,++ppAnims)
{
*ppAnims = (*cur)->mAnimations[i];
PrefixString((*ppAnims)->mName,buffer,len);
}
}
}
// now copy all cameras
// now delete all input scenes
for (cur = begin; cur != end; ++cur)
{