Merge branch 'master' into assimpview_unicode
commit
00f1fd6f7c
|
@ -99,7 +99,7 @@ __Importers__:
|
|||
|
||||
Additionally, some formats are supported by dependency on non-free code or external SDKs (not built by default):
|
||||
|
||||
- [C4D](https://en.wikipedia.org/wiki/Cinema_4D) (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange)
|
||||
- [C4D](https://en.wikipedia.org/wiki/Cinema_4D) (https://github.com/assimp/assimp/wiki/Cinema4D-&-Melange) IMporting geometry + node hierarchy are currently supported
|
||||
|
||||
__Exporters__:
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -630,10 +630,11 @@ void MeshGeometry::ReadVertexDataMaterials(std::vector<int>& materials_out, cons
|
|||
materials_out.clear();
|
||||
}
|
||||
|
||||
m_materials.assign(m_vertices.size(),materials_out[0]);
|
||||
materials_out.resize(m_vertices.size());
|
||||
std::fill(materials_out.begin(), materials_out.end(), materials_out.at(0));
|
||||
}
|
||||
else if (MappingInformationType == "ByPolygon" && ReferenceInformationType == "IndexToDirect") {
|
||||
m_materials.resize(face_count);
|
||||
materials_out.resize(face_count);
|
||||
|
||||
if(materials_out.size() != face_count) {
|
||||
FBXImporter::LogError(Formatter::format("length of input data unexpected for ByPolygon mapping: ")
|
||||
|
|
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