Merge branch 'master' of https://github.com/assimp/assimp
commit
3859cd692f
|
@ -350,27 +350,32 @@ inline size_t WriteArray(IOStream * stream, const T* in, unsigned int size)
|
||||||
Write<uint16_t>(&chunk, type);
|
Write<uint16_t>(&chunk, type);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case AI_BOOL:
|
case AI_BOOL:
|
||||||
Write<bool>(&chunk, *((bool*) value));
|
Write<bool>(&chunk, *((bool*) value));
|
||||||
break;
|
break;
|
||||||
case AI_INT32:
|
case AI_INT32:
|
||||||
Write<int32_t>(&chunk, *((int32_t*) value));
|
Write<int32_t>(&chunk, *((int32_t*) value));
|
||||||
break;
|
break;
|
||||||
case AI_UINT64:
|
case AI_UINT64:
|
||||||
Write<uint64_t>(&chunk, *((uint64_t*) value));
|
Write<uint64_t>(&chunk, *((uint64_t*) value));
|
||||||
break;
|
break;
|
||||||
case AI_FLOAT:
|
case AI_FLOAT:
|
||||||
Write<float>(&chunk, *((float*) value));
|
Write<float>(&chunk, *((float*) value));
|
||||||
break;
|
break;
|
||||||
case AI_DOUBLE:
|
case AI_DOUBLE:
|
||||||
Write<double>(&chunk, *((double*) value));
|
Write<double>(&chunk, *((double*) value));
|
||||||
break;
|
break;
|
||||||
case AI_AISTRING:
|
case AI_AISTRING:
|
||||||
Write<aiString>(&chunk, *((aiString*) value));
|
Write<aiString>(&chunk, *((aiString*) value));
|
||||||
break;
|
break;
|
||||||
case AI_AIVECTOR3D:
|
case AI_AIVECTOR3D:
|
||||||
Write<aiVector3D>(&chunk, *((aiVector3D*) value));
|
Write<aiVector3D>(&chunk, *((aiVector3D*) value));
|
||||||
break;
|
break;
|
||||||
|
#ifdef SWIG
|
||||||
|
case FORCE_32BIT:
|
||||||
|
#endif // SWIG
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,8 +198,7 @@ template <typename T> void ReadBounds( IOStream * stream, T* /*p*/, unsigned int
|
||||||
stream->Seek( sizeof(T) * n, aiOrigin_CUR );
|
stream->Seek( sizeof(T) * n, aiOrigin_CUR );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* parent )
|
void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* parent ) {
|
||||||
{
|
|
||||||
uint32_t chunkID = Read<uint32_t>(stream);
|
uint32_t chunkID = Read<uint32_t>(stream);
|
||||||
ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
|
ai_assert(chunkID == ASSBIN_CHUNK_AINODE);
|
||||||
/*uint32_t size =*/ Read<uint32_t>(stream);
|
/*uint32_t size =*/ Read<uint32_t>(stream);
|
||||||
|
@ -212,58 +211,59 @@ void AssbinImporter::ReadBinaryNode( IOStream * stream, aiNode** node, aiNode* p
|
||||||
(*node)->mNumMeshes = Read<unsigned int>(stream);
|
(*node)->mNumMeshes = Read<unsigned int>(stream);
|
||||||
unsigned int nb_metadata = Read<unsigned int>(stream);
|
unsigned int nb_metadata = Read<unsigned int>(stream);
|
||||||
|
|
||||||
if(parent)
|
if(parent) {
|
||||||
{
|
|
||||||
(*node)->mParent = parent;
|
(*node)->mParent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*node)->mNumMeshes)
|
if ((*node)->mNumMeshes) {
|
||||||
{
|
|
||||||
(*node)->mMeshes = new unsigned int[(*node)->mNumMeshes];
|
(*node)->mMeshes = new unsigned int[(*node)->mNumMeshes];
|
||||||
for (unsigned int i = 0; i < (*node)->mNumMeshes; ++i) {
|
for (unsigned int i = 0; i < (*node)->mNumMeshes; ++i) {
|
||||||
(*node)->mMeshes[i] = Read<unsigned int>(stream);
|
(*node)->mMeshes[i] = Read<unsigned int>(stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*node)->mNumChildren)
|
if ((*node)->mNumChildren) {
|
||||||
{
|
|
||||||
(*node)->mChildren = new aiNode*[(*node)->mNumChildren];
|
(*node)->mChildren = new aiNode*[(*node)->mNumChildren];
|
||||||
for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) {
|
for (unsigned int i = 0; i < (*node)->mNumChildren; ++i) {
|
||||||
ReadBinaryNode( stream, &(*node)->mChildren[i], *node );
|
ReadBinaryNode( stream, &(*node)->mChildren[i], *node );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nb_metadata)
|
if ( nb_metadata > 0 ) {
|
||||||
{
|
(*node)->mMetaData = aiMetadata::Alloc(nb_metadata);
|
||||||
(*node)->mMetaData = aiMetadata::Alloc(nb_metadata);
|
for (unsigned int i = 0; i < nb_metadata; ++i) {
|
||||||
for (unsigned int i = 0; i < nb_metadata; ++i) {
|
(*node)->mMetaData->mKeys[i] = Read<aiString>(stream);
|
||||||
(*node)->mMetaData->mKeys[i] = Read<aiString>(stream);
|
(*node)->mMetaData->mValues[i].mType = (aiMetadataType) Read<uint16_t>(stream);
|
||||||
(*node)->mMetaData->mValues[i].mType = (aiMetadataType) Read<uint16_t>(stream);
|
void* data( nullptr );
|
||||||
void* data = NULL;
|
|
||||||
|
|
||||||
switch ((*node)->mMetaData->mValues[i].mType) {
|
switch ((*node)->mMetaData->mValues[i].mType) {
|
||||||
case AI_BOOL:
|
case AI_BOOL:
|
||||||
data = new bool(Read<bool>(stream));
|
data = new bool(Read<bool>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_INT32:
|
case AI_INT32:
|
||||||
data = new int32_t(Read<int32_t>(stream));
|
data = new int32_t(Read<int32_t>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_UINT64:
|
case AI_UINT64:
|
||||||
data = new uint64_t(Read<uint64_t>(stream));
|
data = new uint64_t(Read<uint64_t>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_FLOAT:
|
case AI_FLOAT:
|
||||||
data = new float(Read<float>(stream));
|
data = new float(Read<float>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_DOUBLE:
|
case AI_DOUBLE:
|
||||||
data = new double(Read<double>(stream));
|
data = new double(Read<double>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_AISTRING:
|
case AI_AISTRING:
|
||||||
data = new aiString(Read<aiString>(stream));
|
data = new aiString(Read<aiString>(stream));
|
||||||
break;
|
break;
|
||||||
case AI_AIVECTOR3D:
|
case AI_AIVECTOR3D:
|
||||||
data = new aiVector3D(Read<aiVector3D>(stream));
|
data = new aiVector3D(Read<aiVector3D>(stream));
|
||||||
break;
|
break;
|
||||||
}
|
#ifndef SWIG
|
||||||
|
case FORCE_32BIT:
|
||||||
|
#endif // SWIG
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
(*node)->mMetaData->mValues[i].mData = data;
|
(*node)->mMetaData->mValues[i].mData = data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -552,7 +552,7 @@ void ColladaExporter::WriteImageEntry( const Surface& pSurface, const std::strin
|
||||||
std::stringstream imageUrlEncoded;
|
std::stringstream imageUrlEncoded;
|
||||||
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
|
for( std::string::const_iterator it = pSurface.texture.begin(); it != pSurface.texture.end(); ++it )
|
||||||
{
|
{
|
||||||
if( isalnum_C( (unsigned char) *it) || *it == ':' || *it == '_' || *it == '.' || *it == '/' || *it == '\\' )
|
if( isalnum_C( (unsigned char) *it) || *it == ':' || *it == '_' || *it == '-' || *it == '.' || *it == '/' || *it == '\\' )
|
||||||
imageUrlEncoded << *it;
|
imageUrlEncoded << *it;
|
||||||
else
|
else
|
||||||
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
|
imageUrlEncoded << '%' << std::hex << size_t( (unsigned char) *it) << std::dec;
|
||||||
|
|
|
@ -155,7 +155,7 @@ void IFCImporter::SetupProperties(const Importer* pImp)
|
||||||
{
|
{
|
||||||
settings.skipSpaceRepresentations = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS,true);
|
settings.skipSpaceRepresentations = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_SKIP_SPACE_REPRESENTATIONS,true);
|
||||||
settings.useCustomTriangulation = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION,true);
|
settings.useCustomTriangulation = pImp->GetPropertyBool(AI_CONFIG_IMPORT_IFC_CUSTOM_TRIANGULATION,true);
|
||||||
settings.conicSamplingAngle = std::min(std::max(pImp->GetPropertyFloat(AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE, AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE), 5.0f), 120.0f);
|
settings.conicSamplingAngle = std::min(std::max((float) pImp->GetPropertyFloat(AI_CONFIG_IMPORT_IFC_SMOOTHING_ANGLE, AI_IMPORT_IFC_DEFAULT_SMOOTHING_ANGLE), 5.0f), 120.0f);
|
||||||
settings.cylindricalTessellation = std::min(std::max(pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION, AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION), 3), 180);
|
settings.cylindricalTessellation = std::min(std::max(pImp->GetPropertyInteger(AI_CONFIG_IMPORT_IFC_CYLINDRICAL_TESSELLATION, AI_IMPORT_IFC_DEFAULT_CYLINDRICAL_TESSELLATION), 3), 180);
|
||||||
settings.skipAnnotations = true;
|
settings.skipAnnotations = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -761,7 +761,7 @@ void PLYImporter::LoadFace(const PLY::Element* pcElement, const PLY::ElementInst
|
||||||
mGeneratedMesh->mFaces[pos].mIndices = new unsigned int[3];
|
mGeneratedMesh->mFaces[pos].mIndices = new unsigned int[3];
|
||||||
mGeneratedMesh->mFaces[pos].mIndices[0] = aiTable[0];
|
mGeneratedMesh->mFaces[pos].mIndices[0] = aiTable[0];
|
||||||
mGeneratedMesh->mFaces[pos].mIndices[1] = aiTable[1];
|
mGeneratedMesh->mFaces[pos].mIndices[1] = aiTable[1];
|
||||||
mGeneratedMesh->mFaces[pos].mIndices[2] = aiTable[2];
|
mGeneratedMesh->mFaces[pos].mIndices[2] = p;
|
||||||
|
|
||||||
if ((flip = !flip)) {
|
if ((flip = !flip)) {
|
||||||
std::swap(mGeneratedMesh->mFaces[pos].mIndices[0], mGeneratedMesh->mFaces[pos].mIndices[1]);
|
std::swap(mGeneratedMesh->mFaces[pos].mIndices[0], mGeneratedMesh->mFaces[pos].mIndices[1]);
|
||||||
|
|
|
@ -949,7 +949,7 @@ void X3DImporter::ParseNode_Geometry3D_IndexedFaceSet()
|
||||||
void X3DImporter::ParseNode_Geometry3D_Sphere()
|
void X3DImporter::ParseNode_Geometry3D_Sphere()
|
||||||
{
|
{
|
||||||
std::string use, def;
|
std::string use, def;
|
||||||
float radius = 1;
|
ai_real radius = 1;
|
||||||
bool solid = true;
|
bool solid = true;
|
||||||
CX3DImporter_NodeElement* ne( nullptr );
|
CX3DImporter_NodeElement* ne( nullptr );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue