Merge branch 'master' into issue_1728
commit
2e7e16b52b
|
@ -75,10 +75,9 @@ using namespace Util;
|
|||
|
||||
|
||||
Converter::Converter( aiScene* out, const Document& doc )
|
||||
: defaultMaterialIndex()
|
||||
, out( out )
|
||||
, doc( doc )
|
||||
{
|
||||
: defaultMaterialIndex()
|
||||
, out( out )
|
||||
, doc( doc ) {
|
||||
// animations need to be converted first since this will
|
||||
// populate the node_anim_chain_bits map, which is needed
|
||||
// to determine which nodes need to be generated.
|
||||
|
@ -116,8 +115,7 @@ Converter::Converter( aiScene* out, const Document& doc )
|
|||
}
|
||||
|
||||
|
||||
Converter::~Converter()
|
||||
{
|
||||
Converter::~Converter() {
|
||||
std::for_each( meshes.begin(), meshes.end(), Util::delete_fun<aiMesh>() );
|
||||
std::for_each( materials.begin(), materials.end(), Util::delete_fun<aiMaterial>() );
|
||||
std::for_each( animations.begin(), animations.end(), Util::delete_fun<aiAnimation>() );
|
||||
|
@ -126,8 +124,7 @@ Converter::~Converter()
|
|||
std::for_each( textures.begin(), textures.end(), Util::delete_fun<aiTexture>() );
|
||||
}
|
||||
|
||||
void Converter::ConvertRootNode()
|
||||
{
|
||||
void Converter::ConvertRootNode() {
|
||||
out->mRootNode = new aiNode();
|
||||
out->mRootNode->mName.Set( "RootNode" );
|
||||
|
||||
|
@ -354,10 +351,12 @@ void Converter::ConvertCamera( const Model& model, const Camera& cam )
|
|||
out_camera->mName.Set( FixNodeName( model.Name() ) );
|
||||
|
||||
out_camera->mAspect = cam.AspectWidth() / cam.AspectHeight();
|
||||
|
||||
//cameras are defined along positive x direction
|
||||
out_camera->mPosition = aiVector3D(0.0f);
|
||||
out_camera->mLookAt = aiVector3D(1.0f, 0.0f, 0.0f);
|
||||
out_camera->mUp = aiVector3D(0.0f, 1.0f, 0.0f);
|
||||
out_camera->mPosition = cam.Position();
|
||||
out_camera->mLookAt = ( cam.InterestPosition() - out_camera->mPosition ).Normalize();
|
||||
out_camera->mUp = cam.UpVector();
|
||||
|
||||
out_camera->mHorizontalFOV = AI_DEG_TO_RAD( cam.FieldOfView() );
|
||||
out_camera->mClipPlaneNear = cam.NearPlane();
|
||||
out_camera->mClipPlaneFar = cam.FarPlane();
|
||||
|
|
|
@ -45,7 +45,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#ifndef ASSIMP_BUILD_NO_FBX_IMPORTER
|
||||
|
||||
|
||||
#ifdef ASSIMP_BUILD_NO_OWN_ZLIB
|
||||
# include <zlib.h>
|
||||
#else
|
||||
|
@ -67,7 +66,6 @@ using namespace Assimp::FBX;
|
|||
|
||||
namespace {
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// signal parse error, this is always unrecoverable. Throws DeadlyImportError.
|
||||
AI_WONT_RETURN void ParseError(const std::string& message, const Token& token) AI_WONT_RETURN_SUFFIX;
|
||||
|
@ -213,7 +211,6 @@ Scope::~Scope()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Parser::Parser (const TokenList& tokens, bool is_binary)
|
||||
: tokens(tokens)
|
||||
|
@ -537,18 +534,18 @@ void ReadBinaryDataArray(char type, uint32_t count, const char*& data, const cha
|
|||
uint32_t stride = 0;
|
||||
switch(type)
|
||||
{
|
||||
case 'f':
|
||||
case 'i':
|
||||
stride = 4;
|
||||
break;
|
||||
case 'f':
|
||||
case 'i':
|
||||
stride = 4;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
case 'l':
|
||||
stride = 8;
|
||||
break;
|
||||
case 'd':
|
||||
case 'l':
|
||||
stride = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
ai_assert(false);
|
||||
default:
|
||||
ai_assert(false);
|
||||
};
|
||||
|
||||
const uint32_t full_length = stride * count;
|
||||
|
|
|
@ -108,7 +108,7 @@ Property* ReadTypedProperty(const Element& element)
|
|||
ParseTokenAsFloat(*tok[6]))
|
||||
);
|
||||
}
|
||||
else if (!strcmp(cs,"double") || !strcmp(cs,"Number") || !strcmp(cs,"Float") || !strcmp(cs,"FieldOfView")) {
|
||||
else if (!strcmp(cs,"double") || !strcmp(cs,"Number") || !strcmp(cs,"Float") || !strcmp(cs,"FieldOfView") || !strcmp( cs, "UnitScaleFactor" ) ) {
|
||||
return new TypedProperty<float>(ParseTokenAsFloat(*tok[4]));
|
||||
}
|
||||
return NULL;
|
||||
|
@ -138,7 +138,6 @@ PropertyTable::PropertyTable()
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
PropertyTable::PropertyTable(const Element& element, std::shared_ptr<const PropertyTable> templateProps)
|
||||
: templateProps(templateProps)
|
||||
|
@ -229,8 +228,6 @@ DirectPropertyMap PropertyTable::GetUnparsedProperties() const
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} //! FBX
|
||||
} //! Assimp
|
||||
|
||||
|
|
|
@ -76,13 +76,11 @@ Token::Token(const char* sbegin, const char* send, TokenType type, unsigned int
|
|||
ai_assert(static_cast<size_t>(send-sbegin) > 0);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Token::~Token()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -340,9 +340,9 @@ void FlipQuakeHeader(BE_NCONST MDL::Header* pcHeader)
|
|||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Read a Quake 1 file
|
||||
void MDLImporter::InternReadFile_Quake1( )
|
||||
{
|
||||
void MDLImporter::InternReadFile_Quake1() {
|
||||
ai_assert(NULL != pScene);
|
||||
|
||||
BE_NCONST MDL::Header *pcHeader = (BE_NCONST MDL::Header*)this->mBuffer;
|
||||
|
||||
#ifdef AI_BUILD_BIG_ENDIAN
|
||||
|
@ -355,9 +355,11 @@ void MDLImporter::InternReadFile_Quake1( )
|
|||
const unsigned char* szCurrent = (const unsigned char*)(pcHeader+1);
|
||||
|
||||
// need to read all textures
|
||||
for (unsigned int i = 0; i < (unsigned int)pcHeader->num_skins;++i)
|
||||
{
|
||||
union{BE_NCONST MDL::Skin* pcSkin;BE_NCONST MDL::GroupSkin* pcGroupSkin;};
|
||||
for ( unsigned int i = 0; i < (unsigned int)pcHeader->num_skins; ++i) {
|
||||
union {
|
||||
BE_NCONST MDL::Skin* pcSkin;
|
||||
BE_NCONST MDL::GroupSkin* pcGroupSkin;
|
||||
};
|
||||
if (szCurrent + sizeof(MDL::Skin) > this->mBuffer + this->iFileSize) {
|
||||
throw DeadlyImportError("[Quake 1 MDL] Unexpected EOF");
|
||||
}
|
||||
|
@ -365,17 +367,15 @@ void MDLImporter::InternReadFile_Quake1( )
|
|||
|
||||
AI_SWAP4( pcSkin->group );
|
||||
|
||||
// Quake 1 groupskins
|
||||
if (1 == pcSkin->group)
|
||||
{
|
||||
// Quake 1 group-skins
|
||||
if (1 == pcSkin->group) {
|
||||
AI_SWAP4( pcGroupSkin->nb );
|
||||
|
||||
// need to skip multiple images
|
||||
const unsigned int iNumImages = (unsigned int)pcGroupSkin->nb;
|
||||
szCurrent += sizeof(uint32_t) * 2;
|
||||
|
||||
if (0 != iNumImages)
|
||||
{
|
||||
if (0 != iNumImages) {
|
||||
if (!i) {
|
||||
// however, create only one output image (the first)
|
||||
this->CreateTextureARGB8_3DGS_MDL3(szCurrent + iNumImages * sizeof(float));
|
||||
|
@ -384,10 +384,7 @@ void MDLImporter::InternReadFile_Quake1( )
|
|||
szCurrent += pcHeader->skinheight * pcHeader->skinwidth +
|
||||
sizeof(float) * iNumImages;
|
||||
}
|
||||
}
|
||||
// 3DGS has a few files that are using other 3DGS like texture formats here
|
||||
else
|
||||
{
|
||||
} else {
|
||||
szCurrent += sizeof(uint32_t);
|
||||
unsigned int iSkip = i ? UINT_MAX : 0;
|
||||
CreateTexture_3DGS_MDL4(szCurrent,pcSkin->group,&iSkip);
|
||||
|
@ -407,17 +404,14 @@ void MDLImporter::InternReadFile_Quake1( )
|
|||
BE_NCONST MDL::Frame* pcFrames = (BE_NCONST MDL::Frame*)szCurrent;
|
||||
BE_NCONST MDL::SimpleFrame* pcFirstFrame;
|
||||
|
||||
if (0 == pcFrames->type)
|
||||
{
|
||||
if (0 == pcFrames->type) {
|
||||
// get address of single frame
|
||||
pcFirstFrame = &pcFrames->frame;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// get the first frame in the group
|
||||
|
||||
#if 1
|
||||
// FIXME: the cast is wrong and causea a warning on clang 5.0
|
||||
// FIXME: the cast is wrong and cause a warning on clang 5.0
|
||||
// disable thi code for now, fix it later
|
||||
ai_assert(false && "Bad pointer cast");
|
||||
#else
|
||||
|
|
|
@ -70,7 +70,7 @@ class ASSIMP_API IOStream
|
|||
{
|
||||
protected:
|
||||
/** Constructor protected, use IOSystem::Open() to create an instance. */
|
||||
IOStream(void);
|
||||
IOStream();
|
||||
|
||||
public:
|
||||
// -------------------------------------------------------------------
|
||||
|
@ -124,17 +124,18 @@ public:
|
|||
}; //! class IOStream
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline IOStream::IOStream()
|
||||
{
|
||||
inline
|
||||
IOStream::IOStream() {
|
||||
// empty
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
inline IOStream::~IOStream()
|
||||
{
|
||||
inline
|
||||
IOStream::~IOStream() {
|
||||
// empty
|
||||
}
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
} //!namespace Assimp
|
||||
|
||||
#endif //!!AI_IOSTREAM_H_INC
|
||||
|
|
Loading…
Reference in New Issue