Merge branch 'master' into obj-pbr-explicit
commit
6943e59886
|
@ -150,6 +150,21 @@ IF (WIN32)
|
||||||
# Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
|
# Multibyte character set is deprecated since at least MSVC2015 (possibly earlier)
|
||||||
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
|
ADD_DEFINITIONS( -DUNICODE -D_UNICODE )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Link statically against c/c++ lib to avoid missing redistriburable such as
|
||||||
|
# "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users
|
||||||
|
# a choice to opt for the shared runtime if they want.
|
||||||
|
option(USE_STATIC_CRT "Link against the static runtime libraries." OFF)
|
||||||
|
|
||||||
|
# The CMAKE_CXX_FLAGS vars can be overriden by some Visual Studio generators, so we use an alternative
|
||||||
|
# global method here:
|
||||||
|
if (${USE_STATIC_CRT})
|
||||||
|
add_compile_options(
|
||||||
|
$<$<CONFIG:>:/MT>
|
||||||
|
$<$<CONFIG:Debug>:/MTd>
|
||||||
|
$<$<CONFIG:Release>:/MT>
|
||||||
|
)
|
||||||
|
endif()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
|
@ -2161,6 +2161,9 @@ void FBXConverter::SetShadingPropertiesCommon(aiMaterial *out_mat, const Propert
|
||||||
const float ShininessExponent = PropertyGet<float>(props, "ShininessExponent", ok);
|
const float ShininessExponent = PropertyGet<float>(props, "ShininessExponent", ok);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
out_mat->AddProperty(&ShininessExponent, 1, AI_MATKEY_SHININESS);
|
out_mat->AddProperty(&ShininessExponent, 1, AI_MATKEY_SHININESS);
|
||||||
|
// Match Blender behavior to extract roughness when only shininess is present
|
||||||
|
const float roughness = 1.0 - (sqrt(ShininessExponent) / 10.0);
|
||||||
|
out_mat->AddProperty(&roughness, 1, AI_MATKEY_ROUGHNESS_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TransparentColor / TransparencyFactor... gee thanks FBX :rolleyes:
|
// TransparentColor / TransparencyFactor... gee thanks FBX :rolleyes:
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ std::vector<IfcVector2> GetContourInPlane2D(std::shared_ptr<TempMesh> mesh,IfcMa
|
||||||
return contour;
|
return contour;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float close{ ai_epsilon };
|
const ai_real close{ ai_epsilon };
|
||||||
|
|
||||||
static bool isClose(IfcVector2 first,IfcVector2 second) {
|
static bool isClose(IfcVector2 first,IfcVector2 second) {
|
||||||
auto diff = (second - first);
|
auto diff = (second - first);
|
||||||
|
|
|
@ -857,6 +857,9 @@ void MDLImporter::CalculateUVCoordinates_MDL5() {
|
||||||
const float fHeight = (float)iHeight;
|
const float fHeight = (float)iHeight;
|
||||||
aiMesh *pcMesh = this->pScene->mMeshes[0];
|
aiMesh *pcMesh = this->pScene->mMeshes[0];
|
||||||
for (unsigned int i = 0; i < pcMesh->mNumVertices; ++i) {
|
for (unsigned int i = 0; i < pcMesh->mNumVertices; ++i) {
|
||||||
|
if (!pcMesh->HasTextureCoords(0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
pcMesh->mTextureCoords[0][i].x /= fWidth;
|
pcMesh->mTextureCoords[0][i].x /= fWidth;
|
||||||
pcMesh->mTextureCoords[0][i].y /= fHeight;
|
pcMesh->mTextureCoords[0][i].y /= fHeight;
|
||||||
pcMesh->mTextureCoords[0][i].y = 1.0f - pcMesh->mTextureCoords[0][i].y; // DX to OGL
|
pcMesh->mTextureCoords[0][i].y = 1.0f - pcMesh->mTextureCoords[0][i].y; // DX to OGL
|
||||||
|
|
|
@ -493,7 +493,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7(
|
||||||
size_t iLen2 = iLen + 1;
|
size_t iLen2 = iLen + 1;
|
||||||
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
iLen2 = iLen2 > MAXLEN ? MAXLEN : iLen2;
|
||||||
memcpy(szFile.data, (const char *)szCurrent, iLen2);
|
memcpy(szFile.data, (const char *)szCurrent, iLen2);
|
||||||
szFile.length = (ai_uint32)iLen;
|
szFile.length = static_cast<ai_uint32>(iLen2);
|
||||||
|
|
||||||
szCurrent += iLen2;
|
szCurrent += iLen2;
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace Assimp {
|
namespace Assimp {
|
||||||
|
|
||||||
constexpr char ObjFileParser::DEFAULT_MATERIAL[];
|
constexpr const char ObjFileParser::DEFAULT_MATERIAL[];
|
||||||
|
|
||||||
ObjFileParser::ObjFileParser() :
|
ObjFileParser::ObjFileParser() :
|
||||||
m_DataIt(),
|
m_DataIt(),
|
||||||
|
|
|
@ -141,7 +141,7 @@ private:
|
||||||
// because the class contains pointer to allocated memory
|
// because the class contains pointer to allocated memory
|
||||||
|
|
||||||
/// Default material name
|
/// Default material name
|
||||||
static constexpr char DEFAULT_MATERIAL[] = AI_DEFAULT_MATERIAL_NAME;
|
static constexpr const char DEFAULT_MATERIAL[] = AI_DEFAULT_MATERIAL_NAME;
|
||||||
//! Iterator to current position in buffer
|
//! Iterator to current position in buffer
|
||||||
DataArrayIt m_DataIt;
|
DataArrayIt m_DataIt;
|
||||||
//! Iterator to end position of buffer
|
//! Iterator to end position of buffer
|
||||||
|
|
|
@ -53,9 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace glTFCommon;
|
|
||||||
|
|
||||||
namespace glTF {
|
namespace glTF {
|
||||||
|
using namespace glTFCommon;
|
||||||
|
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -82,9 +82,21 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
using namespace glTFCommon;
|
|
||||||
|
|
||||||
namespace glTF2 {
|
namespace glTF2 {
|
||||||
|
using glTFCommon::FindStringInContext;
|
||||||
|
using glTFCommon::FindNumberInContext;
|
||||||
|
using glTFCommon::FindUIntInContext;
|
||||||
|
using glTFCommon::FindArrayInContext;
|
||||||
|
using glTFCommon::FindObjectInContext;
|
||||||
|
using glTFCommon::FindExtensionInContext;
|
||||||
|
using glTFCommon::MemberOrDefault;
|
||||||
|
using glTFCommon::ReadMember;
|
||||||
|
using glTFCommon::FindMember;
|
||||||
|
using glTFCommon::FindObject;
|
||||||
|
using glTFCommon::FindUInt;
|
||||||
|
using glTFCommon::FindArray;
|
||||||
|
using glTFCommon::FindArray;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -179,11 +191,11 @@ inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::Accessor
|
||||||
v = &(p.attributes.texcoord);
|
v = &(p.attributes.texcoord);
|
||||||
} else if ((pos = Compare(attr, "COLOR"))) {
|
} else if ((pos = Compare(attr, "COLOR"))) {
|
||||||
v = &(p.attributes.color);
|
v = &(p.attributes.color);
|
||||||
} else if ((pos = Compare(attr, "JOINT"))) {
|
} else if ((pos = Compare(attr, "JOINTS"))) {
|
||||||
v = &(p.attributes.joint);
|
v = &(p.attributes.joint);
|
||||||
} else if ((pos = Compare(attr, "JOINTMATRIX"))) {
|
} else if ((pos = Compare(attr, "JOINTMATRIX"))) {
|
||||||
v = &(p.attributes.jointmatrix);
|
v = &(p.attributes.jointmatrix);
|
||||||
} else if ((pos = Compare(attr, "WEIGHT"))) {
|
} else if ((pos = Compare(attr, "WEIGHTS"))) {
|
||||||
v = &(p.attributes.weight);
|
v = &(p.attributes.weight);
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -78,11 +78,11 @@ protected:
|
||||||
|
|
||||||
// We define the struct size because sizeof(Header) might return a wrong result because of structure padding.
|
// We define the struct size because sizeof(Header) might return a wrong result because of structure padding.
|
||||||
static constexpr std::size_t header_size =
|
static constexpr std::size_t header_size =
|
||||||
sizeof(type) +
|
sizeof(uint16_t) +
|
||||||
sizeof(size) +
|
sizeof(uint32_t) +
|
||||||
sizeof(reserved1) +
|
sizeof(uint16_t) +
|
||||||
sizeof(reserved2) +
|
sizeof(uint16_t) +
|
||||||
sizeof(offset);
|
sizeof(uint32_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DIB {
|
struct DIB {
|
||||||
|
@ -100,17 +100,17 @@ protected:
|
||||||
|
|
||||||
// We define the struct size because sizeof(DIB) might return a wrong result because of structure padding.
|
// We define the struct size because sizeof(DIB) might return a wrong result because of structure padding.
|
||||||
static constexpr std::size_t dib_size =
|
static constexpr std::size_t dib_size =
|
||||||
sizeof(size) +
|
sizeof(uint32_t) +
|
||||||
sizeof(width) +
|
sizeof(int32_t) +
|
||||||
sizeof(height) +
|
sizeof(int32_t) +
|
||||||
sizeof(planes) +
|
sizeof(uint16_t) +
|
||||||
sizeof(bits_per_pixel) +
|
sizeof(uint16_t) +
|
||||||
sizeof(compression) +
|
sizeof(uint32_t) +
|
||||||
sizeof(image_size) +
|
sizeof(uint32_t) +
|
||||||
sizeof(x_resolution) +
|
sizeof(int32_t) +
|
||||||
sizeof(y_resolution) +
|
sizeof(int32_t) +
|
||||||
sizeof(nb_colors) +
|
sizeof(uint32_t) +
|
||||||
sizeof(nb_important_colors);
|
sizeof(uint32_t);
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::size_t mBytesPerPixel = 4;
|
static constexpr std::size_t mBytesPerPixel = 4;
|
||||||
|
|
|
@ -157,7 +157,7 @@ AI_FORCE_INLINE
|
||||||
case aiPTI_Float:
|
case aiPTI_Float:
|
||||||
case aiPTI_Double: {
|
case aiPTI_Double: {
|
||||||
// Read as float and cast to bool
|
// Read as float and cast to bool
|
||||||
float value = 0.0f;
|
ai_real value = 0.0f;
|
||||||
if (AI_SUCCESS == ::aiGetMaterialFloat(this, pKey, type, idx, &value)) {
|
if (AI_SUCCESS == ::aiGetMaterialFloat(this, pKey, type, idx, &value)) {
|
||||||
pOut = static_cast<bool>(value);
|
pOut = static_cast<bool>(value);
|
||||||
return AI_SUCCESS;
|
return AI_SUCCESS;
|
||||||
|
|
Loading…
Reference in New Issue