Merge branch 'master' into master

pull/4247/head
Kim Kulling 2021-12-12 21:12:37 +01:00 committed by GitHub
commit 54e60b031e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 5 deletions

View File

@ -378,6 +378,11 @@ void DXFImporter::ExpandBlockReferences(DXF::Block& bl,const DXF::BlockMap& bloc
const DXF::Block& bl_src = *(*it).second; const DXF::Block& bl_src = *(*it).second;
for (std::shared_ptr<const DXF::PolyLine> pl_in : bl_src.lines) { for (std::shared_ptr<const DXF::PolyLine> pl_in : bl_src.lines) {
if (!pl_in) {
ASSIMP_LOG_ERROR("DXF: PolyLine instance is nullptr, skipping.");
continue;
}
std::shared_ptr<DXF::PolyLine> pl_out = std::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in)); std::shared_ptr<DXF::PolyLine> pl_out = std::shared_ptr<DXF::PolyLine>(new DXF::PolyLine(*pl_in));
if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) { if (bl_src.base.Length() || insert.scale.x!=1.f || insert.scale.y!=1.f || insert.scale.z!=1.f || insert.angle || insert.pos.Length()) {

View File

@ -473,16 +473,22 @@ void HMPImporter::ReadFirstSkin(unsigned int iNumSkins, const unsigned char *szC
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// Generate proepr texture coords // Generate proepr texture coords
void HMPImporter::GenerateTextureCoords( void HMPImporter::GenerateTextureCoords(const unsigned int width, const unsigned int height) {
const unsigned int width, const unsigned int height) {
ai_assert(nullptr != pScene->mMeshes); ai_assert(nullptr != pScene->mMeshes);
ai_assert(nullptr != pScene->mMeshes[0]); ai_assert(nullptr != pScene->mMeshes[0]);
ai_assert(nullptr != pScene->mMeshes[0]->mTextureCoords[0]); ai_assert(nullptr != pScene->mMeshes[0]->mTextureCoords[0]);
aiVector3D *uv = pScene->mMeshes[0]->mTextureCoords[0]; aiVector3D *uv = pScene->mMeshes[0]->mTextureCoords[0];
if (uv == nullptr) {
return;
}
const float fY = (1.0f / height) + (1.0f / height) / (height - 1); if (height == 0.0f || width == 0.0) {
const float fX = (1.0f / width) + (1.0f / width) / (width - 1); return;
}
const float fY = (1.0f / height) + (1.0f / height) / height;
const float fX = (1.0f / width) + (1.0f / width) / width;
for (unsigned int y = 0; y < height; ++y) { for (unsigned int y = 0; y < height; ++y) {
for (unsigned int x = 0; x < width; ++x, ++uv) { for (unsigned int x = 0; x < width; ++x, ++uv) {