Merge branch 'master' of https://github.com/assimp/assimp
commit
5160975138
|
@ -113,7 +113,9 @@ If the docs don't solve your problem, ask on [StackOverflow](http://stackoverflo
|
||||||
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
|
For development discussions, there is also a (very low-volume) mailing list, _assimp-discussions_
|
||||||
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
|
[(subscribe here)]( https://lists.sourceforge.net/lists/listinfo/assimp-discussions)
|
||||||
|
|
||||||
And we also have an IRC-channel at freenode: #assetimporterlib .
|
And we also have an IRC-channel at freenode: #assetimporterlib . You can easily join us via: [KiwiIRC/freenote](https://kiwiirc.com/client/irc.freenode.net), choose your nickname and type
|
||||||
|
> /join #assetimporterlib
|
||||||
|
|
||||||
### Contributing ###
|
### Contributing ###
|
||||||
|
|
||||||
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
|
Contributions to assimp are highly appreciated. The easiest way to get involved is to submit
|
||||||
|
@ -126,4 +128,3 @@ Our license is based on the modified, __3-clause BSD__-License.
|
||||||
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
|
An _informal_ summary is: do whatever you want, but include Assimp's license text with your product -
|
||||||
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
|
and don't sue us if our code doesn't work. Note that, unlike LGPLed code, you may link statically to Assimp.
|
||||||
For the legal details, see the `LICENSE` file.
|
For the legal details, see the `LICENSE` file.
|
||||||
|
|
||||||
|
|
|
@ -285,9 +285,6 @@ void MD5Importer::AttachChilds_Mesh(int iParentID,aiNode* piParent, BoneList& bo
|
||||||
aiQuaternion quat;
|
aiQuaternion quat;
|
||||||
MD5::ConvertQuaternion ( bones[i].mRotationQuat, quat );
|
MD5::ConvertQuaternion ( bones[i].mRotationQuat, quat );
|
||||||
|
|
||||||
// FIX to get to Assimp's quaternion conventions
|
|
||||||
quat.w *= -1.f;
|
|
||||||
|
|
||||||
bones[i].mTransform = aiMatrix4x4 ( quat.GetMatrix());
|
bones[i].mTransform = aiMatrix4x4 ( quat.GetMatrix());
|
||||||
bones[i].mTransform.a4 = bones[i].mPositionXYZ.x;
|
bones[i].mTransform.a4 = bones[i].mPositionXYZ.x;
|
||||||
bones[i].mTransform.b4 = bones[i].mPositionXYZ.y;
|
bones[i].mTransform.b4 = bones[i].mPositionXYZ.y;
|
||||||
|
@ -656,9 +653,6 @@ void MD5Importer::LoadMD5AnimFile ()
|
||||||
|
|
||||||
MD5::ConvertQuaternion(vTemp, qKey->mValue);
|
MD5::ConvertQuaternion(vTemp, qKey->mValue);
|
||||||
qKey->mTime = vKey->mTime = dTime;
|
qKey->mTime = vKey->mTime = dTime;
|
||||||
|
|
||||||
// we need this to get to Assimp quaternion conventions
|
|
||||||
qKey->mValue.w *= -1.f;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,6 +262,9 @@ inline void ConvertQuaternion (const aiVector3D& in, aiQuaternion& out) {
|
||||||
if (t < 0.0f)
|
if (t < 0.0f)
|
||||||
out.w = 0.0f;
|
out.w = 0.0f;
|
||||||
else out.w = std::sqrt (t);
|
else out.w = std::sqrt (t);
|
||||||
|
|
||||||
|
// Assimp convention.
|
||||||
|
out.w *= -1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -156,6 +156,7 @@ struct Material
|
||||||
aiString textureEmissive;
|
aiString textureEmissive;
|
||||||
aiString textureBump;
|
aiString textureBump;
|
||||||
aiString textureNormal;
|
aiString textureNormal;
|
||||||
|
aiString textureReflection[6];
|
||||||
aiString textureSpecularity;
|
aiString textureSpecularity;
|
||||||
aiString textureOpacity;
|
aiString textureOpacity;
|
||||||
aiString textureDisp;
|
aiString textureDisp;
|
||||||
|
@ -167,6 +168,13 @@ struct Material
|
||||||
TextureEmissiveType,
|
TextureEmissiveType,
|
||||||
TextureBumpType,
|
TextureBumpType,
|
||||||
TextureNormalType,
|
TextureNormalType,
|
||||||
|
TextureReflectionSphereType,
|
||||||
|
TextureReflectionCubeTopType,
|
||||||
|
TextureReflectionCubeBottomType,
|
||||||
|
TextureReflectionCubeFrontType,
|
||||||
|
TextureReflectionCubeBackType,
|
||||||
|
TextureReflectionCubeLeftType,
|
||||||
|
TextureReflectionCubeRightType,
|
||||||
TextureSpecularityType,
|
TextureSpecularityType,
|
||||||
TextureOpacityType,
|
TextureOpacityType,
|
||||||
TextureDispType,
|
TextureDispType,
|
||||||
|
|
|
@ -138,7 +138,7 @@ void ObjFileImporter::InternReadFile( const std::string& pFile, aiScene* pScene,
|
||||||
if ( pos != std::string::npos ) {
|
if ( pos != std::string::npos ) {
|
||||||
modelName = pFile.substr(pos+1, pFile.size() - pos - 1);
|
modelName = pFile.substr(pos+1, pFile.size() - pos - 1);
|
||||||
folderName = pFile.substr( 0, pos );
|
folderName = pFile.substr( 0, pos );
|
||||||
if ( folderName.empty() ) {
|
if ( !folderName.empty() ) {
|
||||||
pIOHandler->PushDirectory( folderName );
|
pIOHandler->PushDirectory( folderName );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -636,6 +636,22 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( 0 != pCurrentMaterial->textureReflection[0].length )
|
||||||
|
{
|
||||||
|
ObjFile::Material::TextureType type = 0 != pCurrentMaterial->textureReflection[1].length ?
|
||||||
|
ObjFile::Material::TextureReflectionCubeTopType :
|
||||||
|
ObjFile::Material::TextureReflectionSphereType;
|
||||||
|
|
||||||
|
unsigned count = type == ObjFile::Material::TextureReflectionSphereType ? 1 : 6;
|
||||||
|
for( unsigned i = 0; i < count; i++ )
|
||||||
|
mat->AddProperty(&pCurrentMaterial->textureReflection[i], AI_MATKEY_TEXTURE_REFLECTION(i));
|
||||||
|
|
||||||
|
if(pCurrentMaterial->clamp[type])
|
||||||
|
//TODO addTextureMappingModeProperty should accept an index to handle clamp option for each
|
||||||
|
//texture of a cubemap
|
||||||
|
addTextureMappingModeProperty(mat, aiTextureType_REFLECTION);
|
||||||
|
}
|
||||||
|
|
||||||
if ( 0 != pCurrentMaterial->textureDisp.length )
|
if ( 0 != pCurrentMaterial->textureDisp.length )
|
||||||
{
|
{
|
||||||
mat->AddProperty( &pCurrentMaterial->textureDisp, AI_MATKEY_TEXTURE_DISPLACEMENT(0) );
|
mat->AddProperty( &pCurrentMaterial->textureDisp, AI_MATKEY_TEXTURE_DISPLACEMENT(0) );
|
||||||
|
|
|
@ -64,6 +64,7 @@ static const std::string BumpTexture1 = "map_bump";
|
||||||
static const std::string BumpTexture2 = "map_Bump";
|
static const std::string BumpTexture2 = "map_Bump";
|
||||||
static const std::string BumpTexture3 = "bump";
|
static const std::string BumpTexture3 = "bump";
|
||||||
static const std::string NormalTexture = "map_Kn";
|
static const std::string NormalTexture = "map_Kn";
|
||||||
|
static const std::string ReflectionTexture = "refl";
|
||||||
static const std::string DisplacementTexture = "disp";
|
static const std::string DisplacementTexture = "disp";
|
||||||
static const std::string SpecularityTexture = "map_ns";
|
static const std::string SpecularityTexture = "map_ns";
|
||||||
|
|
||||||
|
@ -200,6 +201,7 @@ void ObjFileMtlImporter::load()
|
||||||
|
|
||||||
case 'm': // Texture
|
case 'm': // Texture
|
||||||
case 'b': // quick'n'dirty - for 'bump' sections
|
case 'b': // quick'n'dirty - for 'bump' sections
|
||||||
|
case 'r': // quick'n'dirty - for 'refl' sections
|
||||||
{
|
{
|
||||||
getTexture();
|
getTexture();
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
|
@ -332,6 +334,9 @@ void ObjFileMtlImporter::getTexture() {
|
||||||
// Normal map
|
// Normal map
|
||||||
out = & m_pModel->m_pCurrentMaterial->textureNormal;
|
out = & m_pModel->m_pCurrentMaterial->textureNormal;
|
||||||
clampIndex = ObjFile::Material::TextureNormalType;
|
clampIndex = ObjFile::Material::TextureNormalType;
|
||||||
|
} else if(!ASSIMP_strincmp( pPtr, ReflectionTexture.c_str(), ReflectionTexture.size() ) ) {
|
||||||
|
// Reflection texture(s)
|
||||||
|
//Do nothing here
|
||||||
} else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), DisplacementTexture.size() ) ) {
|
} else if (!ASSIMP_strincmp( pPtr, DisplacementTexture.c_str(), DisplacementTexture.size() ) ) {
|
||||||
// Displacement texture
|
// Displacement texture
|
||||||
out = &m_pModel->m_pCurrentMaterial->textureDisp;
|
out = &m_pModel->m_pCurrentMaterial->textureDisp;
|
||||||
|
@ -346,7 +351,7 @@ void ObjFileMtlImporter::getTexture() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool clamp = false;
|
bool clamp = false;
|
||||||
getTextureOption(clamp);
|
getTextureOption(clamp, clampIndex, out);
|
||||||
m_pModel->m_pCurrentMaterial->clamp[clampIndex] = clamp;
|
m_pModel->m_pCurrentMaterial->clamp[clampIndex] = clamp;
|
||||||
|
|
||||||
std::string texture;
|
std::string texture;
|
||||||
|
@ -369,7 +374,7 @@ void ObjFileMtlImporter::getTexture() {
|
||||||
* Because aiMaterial supports clamp option, so we also want to return it
|
* Because aiMaterial supports clamp option, so we also want to return it
|
||||||
* /////////////////////////////////////////////////////////////////////////////
|
* /////////////////////////////////////////////////////////////////////////////
|
||||||
*/
|
*/
|
||||||
void ObjFileMtlImporter::getTextureOption(bool &clamp)
|
void ObjFileMtlImporter::getTextureOption(bool &clamp, int &clampIndex, aiString *&out)
|
||||||
{
|
{
|
||||||
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
m_DataIt = getNextToken<DataArrayIt>(m_DataIt, m_DataItEnd);
|
||||||
|
|
||||||
|
@ -392,13 +397,55 @@ void ObjFileMtlImporter::getTextureOption(bool &clamp)
|
||||||
|
|
||||||
skipToken = 2;
|
skipToken = 2;
|
||||||
}
|
}
|
||||||
else if ( !ASSIMP_strincmp(pPtr, BlendUOption.c_str(), BlendUOption.size())
|
else if( !ASSIMP_strincmp( pPtr, TypeOption.c_str(), TypeOption.size() ) )
|
||||||
|
{
|
||||||
|
DataArrayIt it = getNextToken<DataArrayIt>( m_DataIt, m_DataItEnd );
|
||||||
|
char value[ 12 ];
|
||||||
|
CopyNextWord( it, m_DataItEnd, value, sizeof( value ) / sizeof( *value ) );
|
||||||
|
if( !ASSIMP_strincmp( value, "cube_top", 8 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeTopType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[0];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "cube_bottom", 11 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeBottomType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[1];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "cube_front", 10 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeFrontType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[2];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "cube_back", 9 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeBackType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[3];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "cube_left", 9 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeLeftType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[4];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "cube_right", 10 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionCubeRightType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[5];
|
||||||
|
}
|
||||||
|
else if( !ASSIMP_strincmp( value, "sphere", 6 ) )
|
||||||
|
{
|
||||||
|
clampIndex = ObjFile::Material::TextureReflectionSphereType;
|
||||||
|
out = &m_pModel->m_pCurrentMaterial->textureReflection[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
skipToken = 2;
|
||||||
|
}
|
||||||
|
else if (!ASSIMP_strincmp(pPtr, BlendUOption.c_str(), BlendUOption.size())
|
||||||
|| !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), BlendVOption.size())
|
|| !ASSIMP_strincmp(pPtr, BlendVOption.c_str(), BlendVOption.size())
|
||||||
|| !ASSIMP_strincmp(pPtr, BoostOption.c_str(), BoostOption.size())
|
|| !ASSIMP_strincmp(pPtr, BoostOption.c_str(), BoostOption.size())
|
||||||
|| !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), ResolutionOption.size())
|
|| !ASSIMP_strincmp(pPtr, ResolutionOption.c_str(), ResolutionOption.size())
|
||||||
|| !ASSIMP_strincmp(pPtr, BumpOption.c_str(), BumpOption.size())
|
|| !ASSIMP_strincmp(pPtr, BumpOption.c_str(), BumpOption.size())
|
||||||
|| !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), ChannelOption.size())
|
|| !ASSIMP_strincmp(pPtr, ChannelOption.c_str(), ChannelOption.size()))
|
||||||
|| !ASSIMP_strincmp(pPtr, TypeOption.c_str(), TypeOption.size()) )
|
|
||||||
{
|
{
|
||||||
skipToken = 2;
|
skipToken = 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
struct aiColor3D;
|
struct aiColor3D;
|
||||||
|
struct aiString;
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
|
@ -89,7 +90,7 @@ private:
|
||||||
void createMaterial();
|
void createMaterial();
|
||||||
/// Get texture name from loaded data.
|
/// Get texture name from loaded data.
|
||||||
void getTexture();
|
void getTexture();
|
||||||
void getTextureOption(bool &clamp);
|
void getTextureOption(bool &clamp, int &clampIndex, aiString *&out);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//! Absolute pathname
|
//! Absolute pathname
|
||||||
|
|
|
@ -414,7 +414,7 @@ void ObjFileParser::getFace(aiPrimitiveType type)
|
||||||
|
|
||||||
if ( pIndices->empty() ) {
|
if ( pIndices->empty() ) {
|
||||||
DefaultLogger::get()->error("Obj: Ignoring empty face");
|
DefaultLogger::get()->error("Obj: Ignoring empty face");
|
||||||
// skip line and clean up
|
// skip line and clean up
|
||||||
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
m_DataIt = skipLine<DataArrayIt>( m_DataIt, m_DataItEnd, m_uiLine );
|
||||||
delete pNormalID;
|
delete pNormalID;
|
||||||
delete pTexID;
|
delete pTexID;
|
||||||
|
@ -539,7 +539,10 @@ void ObjFileParser::getMaterialLib()
|
||||||
const std::string strMatName(pStart, &(*m_DataIt));
|
const std::string strMatName(pStart, &(*m_DataIt));
|
||||||
std::string absName;
|
std::string absName;
|
||||||
if ( m_pIO->StackSize() > 0 ) {
|
if ( m_pIO->StackSize() > 0 ) {
|
||||||
const std::string &path = m_pIO->CurrentDirectory();
|
std::string path = m_pIO->CurrentDirectory();
|
||||||
|
if ( '/' != *path.rbegin() ) {
|
||||||
|
path += '/';
|
||||||
|
}
|
||||||
absName = path + strMatName;
|
absName = path + strMatName;
|
||||||
} else {
|
} else {
|
||||||
absName = strMatName;
|
absName = strMatName;
|
||||||
|
|
|
@ -857,7 +857,7 @@ bool PLY::PropertyInstance::ParseValueBinary(
|
||||||
|
|
||||||
case EDT_UShort:
|
case EDT_UShort:
|
||||||
{
|
{
|
||||||
int16_t i = *((uint16_t*)pCur);
|
uint16_t i = *((uint16_t*)pCur);
|
||||||
|
|
||||||
// Swap endianess
|
// Swap endianess
|
||||||
if (p_bBE)ByteSwap::Swap(&i);
|
if (p_bBE)ByteSwap::Swap(&i);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue