commit
5bf096ab6d
|
@ -77,19 +77,19 @@ namespace Assimp {
|
|||
#define CONVERT_FBX_TIME(time) static_cast<double>(time) / 46186158000L
|
||||
|
||||
FBXConverter::FBXConverter(aiScene* out, const Document& doc)
|
||||
: defaultMaterialIndex()
|
||||
, lights()
|
||||
, cameras()
|
||||
, textures()
|
||||
, materials_converted()
|
||||
, textures_converted()
|
||||
, meshes_converted()
|
||||
, node_anim_chain_bits()
|
||||
, mNodeNameInstances()
|
||||
, mNodeNames()
|
||||
, anim_fps()
|
||||
, out(out)
|
||||
, doc(doc) {
|
||||
: defaultMaterialIndex()
|
||||
, lights()
|
||||
, cameras()
|
||||
, textures()
|
||||
, materials_converted()
|
||||
, textures_converted()
|
||||
, meshes_converted()
|
||||
, node_anim_chain_bits()
|
||||
, mNodeNameInstances()
|
||||
, mNodeNames()
|
||||
, anim_fps()
|
||||
, 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.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
ply
|
||||
format ascii 1.0
|
||||
comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.4208963464)
|
||||
comment Created by Open Asset Import Library - http://assimp.sf.net (v4.1.412856994)
|
||||
element vertex 8
|
||||
property float x
|
||||
property float y
|
||||
|
|
|
@ -52,18 +52,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
class ColladaExportCamera : public ::testing::Test {
|
||||
public:
|
||||
|
||||
virtual void SetUp()
|
||||
{
|
||||
void SetUp() override{
|
||||
ex = new Assimp::Exporter();
|
||||
im = new Assimp::Importer();
|
||||
|
||||
}
|
||||
|
||||
virtual void TearDown()
|
||||
{
|
||||
void TearDown() override {
|
||||
delete ex;
|
||||
ex = nullptr;
|
||||
delete im;
|
||||
im = nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
@ -71,16 +70,15 @@ protected:
|
|||
Assimp::Importer* im;
|
||||
};
|
||||
|
||||
TEST_F(ColladaExportCamera, testExportCamera)
|
||||
{
|
||||
TEST_F(ColladaExportCamera, testExportCamera) {
|
||||
const char* file = "cameraExp.dae";
|
||||
|
||||
const aiScene* pTest = im->ReadFile(ASSIMP_TEST_MODELS_DIR "/Collada/cameras.dae", aiProcess_ValidateDataStructure);
|
||||
ASSERT_TRUE(pTest!=NULL);
|
||||
ASSERT_NE( nullptr, pTest );
|
||||
ASSERT_TRUE(pTest->HasCameras());
|
||||
|
||||
|
||||
EXPECT_EQ(AI_SUCCESS,ex->Export(pTest,"collada",file));
|
||||
EXPECT_EQ( AI_SUCCESS, ex->Export(pTest,"collada",file));
|
||||
const unsigned int origNumCams( pTest->mNumCameras );
|
||||
std::unique_ptr<float[]> origFOV( new float[ origNumCams ] );
|
||||
std::unique_ptr<float[]> orifClipPlaneNear( new float[ origNumCams ] );
|
||||
|
@ -89,7 +87,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
|||
std::unique_ptr<aiVector3D[]> pos( new aiVector3D[ origNumCams ] );
|
||||
for (size_t i = 0; i < origNumCams; i++) {
|
||||
const aiCamera *orig = pTest->mCameras[ i ];
|
||||
ASSERT_TRUE( orig != nullptr );
|
||||
ASSERT_NE(nullptr, orig );
|
||||
|
||||
origFOV[ i ] = orig->mHorizontalFOV;
|
||||
orifClipPlaneNear[ i ] = orig->mClipPlaneNear;
|
||||
|
@ -99,7 +97,7 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
|||
}
|
||||
const aiScene* imported = im->ReadFile(file, aiProcess_ValidateDataStructure);
|
||||
|
||||
ASSERT_TRUE(imported!=NULL);
|
||||
ASSERT_NE(nullptr, imported );
|
||||
|
||||
EXPECT_TRUE( imported->HasCameras() );
|
||||
EXPECT_EQ( origNumCams, imported->mNumCameras );
|
||||
|
@ -119,5 +117,3 @@ TEST_F(ColladaExportCamera, testExportCamera)
|
|||
}
|
||||
|
||||
#endif // ASSIMP_BUILD_NO_EXPORT
|
||||
|
||||
|
||||
|
|
|
@ -114,3 +114,18 @@ TEST_F(utFBXImporterExporter, importUnitScaleFactor) {
|
|||
scene->mMetaData->Get("UnitScaleFactor", factor);
|
||||
EXPECT_DOUBLE_EQ(500.0, factor);
|
||||
}
|
||||
|
||||
TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
||||
// see https://github.com/assimp/assimp/issues/1957
|
||||
Assimp::Importer importer;
|
||||
const aiScene *scene = importer.ReadFile(ASSIMP_TEST_MODELS_DIR "/FBX/embedded_ascii/box.FBX", aiProcess_ValidateDataStructure);
|
||||
EXPECT_NE(nullptr, scene);
|
||||
|
||||
EXPECT_EQ(1, scene->mNumMaterials);
|
||||
aiMaterial *mat = scene->mMaterials[0];
|
||||
ASSERT_NE(nullptr, mat);
|
||||
|
||||
aiString path;
|
||||
aiTextureMapMode modes[2];
|
||||
EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue