Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeba7a43a0 | ||
|
|
9ebd74bd26 | ||
|
|
9267f4c5b8 | ||
|
|
0d857bcf9f | ||
|
|
2ceb18746b | ||
|
|
3db1592f7e | ||
|
|
74b3be194d | ||
|
|
bab8b8dbab | ||
|
|
33845cd019 | ||
|
|
b1c83f437f | ||
|
|
ce3101ea4e | ||
|
|
c24f99cd0e | ||
|
|
c174575cf8 | ||
|
|
1ee8c1b51f | ||
|
|
595799b1bc | ||
|
|
a5a091c138 | ||
|
|
e8732341f4 | ||
|
|
b0d564467e | ||
|
|
78d72bff59 | ||
|
|
c3ac5569c5 | ||
|
|
57d22e4dbf | ||
|
|
cedf1819c3 |
@@ -924,6 +924,8 @@ void ColladaParser::ReadMaterial(XmlNode &node, Collada::Material &pMaterial) {
|
||||
void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
|
||||
XmlNodeIterator xmlIt(node, XmlNodeIterator::PreOrderMode);
|
||||
XmlNode currentNode;
|
||||
// TODO: Check the current technique and skip over unsupported extra techniques
|
||||
|
||||
while (xmlIt.getNext(currentNode)) {
|
||||
const std::string ¤tName = currentNode.name();
|
||||
if (currentName == "spot") {
|
||||
@@ -949,33 +951,34 @@ void ColladaParser::ReadLight(XmlNode &node, Collada::Light &pLight) {
|
||||
content = fast_atoreal_move<ai_real>(content, (ai_real &)pLight.mColor.b);
|
||||
SkipSpacesAndLineEnd(&content);
|
||||
} else if (currentName == "constant_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "constant_attenuation", pLight.mAttConstant);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttConstant);
|
||||
} else if (currentName == "linear_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "linear_attenuation", pLight.mAttLinear);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttLinear);
|
||||
} else if (currentName == "quadratic_attenuation") {
|
||||
XmlParser::getRealAttribute(currentNode, "quadratic_attenuation", pLight.mAttQuadratic);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mAttQuadratic);
|
||||
} else if (currentName == "falloff_angle") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff_angle", pLight.mFalloffAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
|
||||
} else if (currentName == "falloff_exponent") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff_exponent", pLight.mFalloffExponent);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffExponent);
|
||||
}
|
||||
// FCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "outer_cone") {
|
||||
XmlParser::getRealAttribute(currentNode, "outer_cone", pLight.mOuterAngle);
|
||||
} else if (currentName == "penumbra_angle") { // ... and this one is even deprecated
|
||||
XmlParser::getRealAttribute(currentNode, "penumbra_angle", pLight.mPenumbraAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
} else if (currentName == "penumbra_angle") { // this one is deprecated, now calculated using outer_cone
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mPenumbraAngle);
|
||||
} else if (currentName == "intensity") {
|
||||
XmlParser::getRealAttribute(currentNode, "intensity", pLight.mIntensity);
|
||||
} else if (currentName == "falloff") {
|
||||
XmlParser::getRealAttribute(currentNode, "falloff", pLight.mOuterAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mIntensity);
|
||||
}
|
||||
else if (currentName == "falloff") {
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
} else if (currentName == "hotspot_beam") {
|
||||
XmlParser::getRealAttribute(currentNode, "hotspot_beam", pLight.mFalloffAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mFalloffAngle);
|
||||
}
|
||||
// OpenCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "decay_falloff") {
|
||||
XmlParser::getRealAttribute(currentNode, "decay_falloff", pLight.mOuterAngle);
|
||||
XmlParser::getValueAsFloat(currentNode, pLight.mOuterAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1109,7 +1112,7 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
|
||||
// GOOGLEEARTH/OKINO extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "double_sided")
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mDoubleSided);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mDoubleSided);
|
||||
|
||||
// FCOLLADA extensions
|
||||
// -------------------------------------------------------
|
||||
@@ -1121,9 +1124,9 @@ void ColladaParser::ReadEffectProfileCommon(XmlNode &node, Collada::Effect &pEff
|
||||
// MAX3D extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "wireframe") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mWireframe);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mWireframe);
|
||||
} else if (currentName == "faceted") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), pEffect.mFaceted);
|
||||
XmlParser::getValueAsBool(currentNode, pEffect.mFaceted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1142,23 +1145,23 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||
// MAYA extensions
|
||||
// -------------------------------------------------------
|
||||
if (currentName == "wrapU") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mWrapU);
|
||||
XmlParser::getValueAsBool(currentNode, out.mWrapU);
|
||||
} else if (currentName == "wrapV") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mWrapV);
|
||||
XmlParser::getValueAsBool(currentNode, out.mWrapV);
|
||||
} else if (currentName == "mirrorU") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorU);
|
||||
XmlParser::getValueAsBool(currentNode, out.mMirrorU);
|
||||
} else if (currentName == "mirrorV") {
|
||||
XmlParser::getBoolAttribute(currentNode, currentName.c_str(), out.mMirrorV);
|
||||
XmlParser::getValueAsBool(currentNode, out.mMirrorV);
|
||||
} else if (currentName == "repeatU") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.x);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.x);
|
||||
} else if (currentName == "repeatV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mScaling.y);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mScaling.y);
|
||||
} else if (currentName == "offsetU") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.x);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.x);
|
||||
} else if (currentName == "offsetV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mTranslation.y);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mTranslation.y);
|
||||
} else if (currentName == "rotateUV") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mTransform.mRotation);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mTransform.mRotation);
|
||||
} else if (currentName == "blend_mode") {
|
||||
std::string v;
|
||||
XmlParser::getValueAsString(currentNode, v);
|
||||
@@ -1178,14 +1181,14 @@ void ColladaParser::ReadSamplerProperties(XmlNode &node, Sampler &out) {
|
||||
// OKINO extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "weighting") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
|
||||
} else if (currentName == "mix_with_previous_layer") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mMixWithPrevious);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mMixWithPrevious);
|
||||
}
|
||||
// MAX3D extensions
|
||||
// -------------------------------------------------------
|
||||
else if (currentName == "amount") {
|
||||
XmlParser::getRealAttribute(currentNode, currentName.c_str(), out.mWeighting);
|
||||
XmlParser::getValueAsFloat(currentNode, out.mWeighting);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2204,7 +2207,7 @@ void ColladaParser::ReadMaterialVertexInputBinding(XmlNode &node, Collada::Seman
|
||||
|
||||
void ColladaParser::ReadEmbeddedTextures(ZipArchiveIOSystem &zip_archive) {
|
||||
// Attempt to load any undefined Collada::Image in ImageLibrary
|
||||
for (auto & it : mImageLibrary) {
|
||||
for (auto &it : mImageLibrary) {
|
||||
Collada::Image &image = it.second;
|
||||
|
||||
if (image.mImageData.empty()) {
|
||||
|
||||
@@ -113,6 +113,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
// clang-format on
|
||||
|
||||
#include <assimp/StringUtils.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/GltfMaterial.h>
|
||||
|
||||
#include "AssetLib/glTF/glTFCommon.h"
|
||||
|
||||
@@ -140,7 +142,6 @@ using glTFCommon::vec4;
|
||||
|
||||
//! Magic number for GLB files
|
||||
#define AI_GLB_MAGIC_NUMBER "glTF"
|
||||
#include <assimp/pbrmaterial.h>
|
||||
|
||||
#ifdef ASSIMP_API
|
||||
#include <assimp/Compiler/pushpack1.h>
|
||||
|
||||
@@ -299,6 +299,7 @@ static aiMaterial *ImportMaterial(std::vector<int> &embeddedTexIdxs, Asset &r, M
|
||||
// glTFv2 is either PBR or Unlit
|
||||
aiShadingMode shadingMode = aiShadingMode_PBR_BRDF;
|
||||
if (mat.unlit) {
|
||||
aimat->AddProperty(&mat.unlit, 1, "$mat.gltf.unlit", 0, 0); // TODO: Remove this property, it is kept for backwards compatibility with assimp 5.0.1
|
||||
shadingMode = aiShadingMode_Unlit;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ SET( PUBLIC_HEADERS
|
||||
${HEADER_PATH}/matrix4x4.inl
|
||||
${HEADER_PATH}/mesh.h
|
||||
${HEADER_PATH}/pbrmaterial.h
|
||||
${HEADER_PATH}/GltfMaterial.h
|
||||
${HEADER_PATH}/postprocess.h
|
||||
${HEADER_PATH}/quaternion.h
|
||||
${HEADER_PATH}/quaternion.inl
|
||||
@@ -953,24 +954,27 @@ ELSE()
|
||||
ENDIF()
|
||||
|
||||
# zip (https://github.com/kuba--/zip)
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
hunter_add_package(zip)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
ELSE()
|
||||
SET( ziplib_SRCS
|
||||
../contrib/zip/src/miniz.h
|
||||
../contrib/zip/src/zip.c
|
||||
../contrib/zip/src/zip.h
|
||||
)
|
||||
separate_arguments(ASSIMP_EXPORTERS_LIST UNIX_COMMAND ${ASSIMP_EXPORTERS_ENABLED})
|
||||
IF(3MF IN_LIST ASSIMP_EXPORTERS_LIST)
|
||||
IF(ASSIMP_HUNTER_ENABLED)
|
||||
hunter_add_package(zip)
|
||||
find_package(zip CONFIG REQUIRED)
|
||||
ELSE()
|
||||
SET( ziplib_SRCS
|
||||
../contrib/zip/src/miniz.h
|
||||
../contrib/zip/src/zip.c
|
||||
../contrib/zip/src/zip.h
|
||||
)
|
||||
|
||||
# TODO if cmake required version has been updated to >3.12.0, collapse this to the second case only
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||
add_definitions(-DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
else()
|
||||
add_compile_definitions(MINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
endif()
|
||||
# TODO if cmake required version has been updated to >3.12.0, collapse this to the second case only
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
|
||||
add_definitions(-DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
else()
|
||||
add_compile_definitions(MINIZ_USE_UNALIGNED_LOADS_AND_STORES=0)
|
||||
endif()
|
||||
|
||||
SOURCE_GROUP( ziplib FILES ${ziplib_SRCS} )
|
||||
SOURCE_GROUP( ziplib FILES ${ziplib_SRCS} )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# openddlparser
|
||||
@@ -1186,10 +1190,12 @@ IF(ASSIMP_HUNTER_ENABLED)
|
||||
ZLIB::zlib
|
||||
RapidJSON::rapidjson
|
||||
utf8cpp
|
||||
zip::zip
|
||||
pugixml
|
||||
stb::stb
|
||||
)
|
||||
if(TARGET zip::zip)
|
||||
target_link_libraries(assimp PUBLIC zip::zip)
|
||||
endif()
|
||||
|
||||
if (ASSIMP_BUILD_DRACO)
|
||||
target_link_libraries(assimp PUBLIC ${draco_LIBRARIES})
|
||||
@@ -1256,6 +1262,12 @@ SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||
OUTPUT_NAME assimp${LIBRARY_SUFFIX}
|
||||
)
|
||||
|
||||
if (WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS)
|
||||
set_target_properties(assimp PROPERTIES
|
||||
SUFFIX "-${ASSIMP_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
if (ASSIMP_BUILD_FRAMEWORK)
|
||||
SET_TARGET_PROPERTIES( assimp PROPERTIES
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
|
||||
IrrXML
|
||||
Downloaded September 2008
|
||||
|
||||
- fixed a minor compiler warning (vs 2005, shift too large)
|
||||
- fixed an issue regarding wchar_t/unsigned short
|
||||
74
include/assimp/GltfMaterial.h
Normal file
74
include/assimp/GltfMaterial.h
Normal file
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
Open Asset Import Library (assimp)
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2021, assimp team
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the following
|
||||
conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the assimp team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the assimp team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
---------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file GltfMaterial.h
|
||||
* @brief glTF-specific material macros
|
||||
* These will be made generic at some future date
|
||||
*/
|
||||
|
||||
#ifndef AI_GLTFMATERIAL_H_INC
|
||||
#define AI_GLTFMATERIAL_H_INC
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <assimp/material.h>
|
||||
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 0
|
||||
#define AI_MATKEY_GLTF_ALPHAMODE "$mat.gltf.alphaMode", 0, 0
|
||||
#define AI_MATKEY_GLTF_ALPHACUTOFF "$mat.gltf.alphaCutoff", 0, 0
|
||||
|
||||
#define _AI_MATKEY_GLTF_MAPPINGNAME_BASE "$tex.mappingname"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE "$tex.mappingfiltermin"
|
||||
#define _AI_MATKEY_GLTF_SCALE_BASE "$tex.scale"
|
||||
#define _AI_MATKEY_GLTF_STRENGTH_BASE "$tex.strength"
|
||||
|
||||
#define AI_MATKEY_GLTF_MAPPINGNAME(type, N) _AI_MATKEY_GLTF_MAPPINGNAME_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGID(type, N) _AI_MATKEY_GLTF_MAPPINGID_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGFILTER_MAG(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGFILTER_MIN(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_TEXTURE_SCALE(type, N) _AI_MATKEY_GLTF_SCALE_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_TEXTURE_STRENGTH(type, N) _AI_MATKEY_GLTF_STRENGTH_BASE, type, N
|
||||
|
||||
#endif
|
||||
@@ -42,8 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#ifndef INCLUDED_AI_IRRXML_WRAPPER
|
||||
#define INCLUDED_AI_IRRXML_WRAPPER
|
||||
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
#include <assimp/ai_assert.h>
|
||||
#include <assimp/DefaultLogger.hpp>
|
||||
|
||||
#include "BaseImporter.h"
|
||||
#include "IOStream.hpp"
|
||||
@@ -112,7 +112,7 @@ public:
|
||||
|
||||
/// @brief Will clear the parsed xml-file.
|
||||
void clear() {
|
||||
if(mData.empty()) {
|
||||
if (mData.empty()) {
|
||||
mDoc = nullptr;
|
||||
return;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
/// @param name [in] The attribute name to look for.
|
||||
/// @param val [out] The int value from the attribute.
|
||||
/// @return true, if the node contains an attribute with the given name and if the value is an int.
|
||||
static inline bool getIntAttribute(XmlNode &xmlNode, const char *name, int &val ) {
|
||||
static inline bool getIntAttribute(XmlNode &xmlNode, const char *name, int &val) {
|
||||
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||
if (attr.empty()) {
|
||||
return false;
|
||||
@@ -258,7 +258,7 @@ public:
|
||||
/// @param name [in] The attribute name to look for.
|
||||
/// @param val [out] The real value from the attribute.
|
||||
/// @return true, if the node contains an attribute with the given name and if the value is a real.
|
||||
static inline bool getRealAttribute( XmlNode &xmlNode, const char *name, ai_real &val ) {
|
||||
static inline bool getRealAttribute(XmlNode &xmlNode, const char *name, ai_real &val) {
|
||||
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||
if (attr.empty()) {
|
||||
return false;
|
||||
@@ -284,7 +284,6 @@ public:
|
||||
|
||||
val = attr.as_float();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// @brief Will try to get a double attribute value.
|
||||
@@ -322,7 +321,7 @@ public:
|
||||
/// @param name [in] The attribute name to look for.
|
||||
/// @param val [out] The bool value from the attribute.
|
||||
/// @return true, if the node contains an attribute with the given name and if the value is a bool.
|
||||
static inline bool getBoolAttribute( XmlNode &xmlNode, const char *name, bool &val ) {
|
||||
static inline bool getBoolAttribute(XmlNode &xmlNode, const char *name, bool &val) {
|
||||
pugi::xml_attribute attr = xmlNode.attribute(name);
|
||||
if (attr.empty()) {
|
||||
return false;
|
||||
@@ -330,14 +329,13 @@ public:
|
||||
|
||||
val = attr.as_bool();
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/// @brief Will try to get the value of the node as a string.
|
||||
/// @param node [in] The node to search in.
|
||||
/// @param text [out] The value as a text.
|
||||
/// @return true, if the value can be read out.
|
||||
static inline bool getValueAsString( XmlNode &node, std::string &text ) {
|
||||
static inline bool getValueAsString(XmlNode &node, std::string &text) {
|
||||
text = std::string();
|
||||
if (node.empty()) {
|
||||
return false;
|
||||
@@ -352,7 +350,7 @@ public:
|
||||
/// @param node [in] The node to search in.
|
||||
/// @param text [out] The value as a float.
|
||||
/// @return true, if the value can be read out.
|
||||
static inline bool getValueAsFloat( XmlNode &node, ai_real &v ) {
|
||||
static inline bool getValueAsFloat(XmlNode &node, ai_real &v) {
|
||||
if (node.empty()) {
|
||||
return false;
|
||||
}
|
||||
@@ -360,10 +358,38 @@ public:
|
||||
v = node.text().as_float();
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
/// @brief Will try to get the value of the node as an integer.
|
||||
/// @param node [in] The node to search in.
|
||||
/// @param text [out] The value as a int.
|
||||
/// @return true, if the value can be read out.
|
||||
static inline bool getValueAsInt(XmlNode &node, int &v) {
|
||||
if (node.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
v = node.text().as_int();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// @brief Will try to get the value of the node as an bool.
|
||||
/// @param node [in] The node to search in.
|
||||
/// @param text [out] The value as a bool.
|
||||
/// @return true, if the value can be read out.
|
||||
static inline bool getValueAsBool(XmlNode& node, bool& v)
|
||||
{
|
||||
if (node.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
v = node.text().as_bool();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
pugi::xml_document *mDoc;
|
||||
TNodeType mCurrent;
|
||||
std::vector<char> mData;
|
||||
@@ -376,8 +402,8 @@ class XmlNodeIterator {
|
||||
public:
|
||||
/// @brief The iteration mode.
|
||||
enum IterationMode {
|
||||
PreOrderMode, ///< Pre-ordering, get the values, continue the iteration.
|
||||
PostOrderMode ///< Post-ordering, continue the iteration, get the values.
|
||||
PreOrderMode, ///< Pre-ordering, get the values, continue the iteration.
|
||||
PostOrderMode ///< Post-ordering, continue the iteration, get the values.
|
||||
};
|
||||
/// @brief The class constructor
|
||||
/// @param parent [in] The xml parent to to iterate through.
|
||||
@@ -400,7 +426,7 @@ public:
|
||||
|
||||
/// @brief Will iterate through all children in pre-order iteration.
|
||||
/// @param node [in] The nod to iterate through.
|
||||
void collectChildrenPreOrder( XmlNode &node ) {
|
||||
void collectChildrenPreOrder(XmlNode &node) {
|
||||
if (node != mParent && node.type() == pugi::node_element) {
|
||||
mNodes.push_back(node);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/** @file pbrmaterial.h
|
||||
* @brief Defines the material system of the library
|
||||
* @brief Deprecated GLTF_PBR macros
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef AI_PBRMATERIAL_H_INC
|
||||
@@ -48,47 +48,42 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifdef __GNUC__
|
||||
# pragma GCC system_header
|
||||
# warning pbrmaterial.h is deprecated. Please update to PBR materials in materials.h and glTF-specific items in GltfMaterial.h
|
||||
#else if defined(_MSC_VER)
|
||||
# pragma message("pbrmaterial.h is deprecated. Please update to PBR materials in materials.h and glTF-specific items in GltfMaterial.h")
|
||||
#endif
|
||||
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR "$mat.gltf.pbrMetallicRoughness.baseColorFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR "$mat.gltf.pbrMetallicRoughness.metallicFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR "$mat.gltf.pbrMetallicRoughness.roughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE aiTextureType_DIFFUSE, 1
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLICROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 0
|
||||
#define AI_MATKEY_GLTF_ALPHAMODE "$mat.gltf.alphaMode", 0, 0
|
||||
#define AI_MATKEY_GLTF_ALPHACUTOFF "$mat.gltf.alphaCutoff", 0, 0
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/GltfMaterial.h>
|
||||
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_FACTOR AI_MATKEY_BASE_COLOR
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_BASE_COLOR_TEXTURE AI_MATKEY_BASE_COLOR_TEXTURE
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_METALLIC_FACTOR AI_MATKEY_METALLIC_FACTOR
|
||||
#define AI_MATKEY_GLTF_PBRMETALLICROUGHNESS_ROUGHNESS_FACTOR AI_MATKEY_ROUGHNESS_FACTOR
|
||||
|
||||
//#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS "$mat.gltf.pbrSpecularGlossiness", 0, 0
|
||||
//#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR "$mat.gltf.pbrMetallicRoughness.glossinessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN "$mat.gltf.materialSheen", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_FACTOR "$mat.gltf.materialSheen.sheenColorFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_FACTOR "$mat.gltf.materialSheen.sheenRoughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_TEXTURE aiTextureType_UNKNOWN, 1
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 2
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT "$mat.gltf.materialClearcoat", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_FACTOR "$mat.gltf.materialClearcoat.clearcoatFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_FACTOR "$mat.gltf.materialClearcoat.clearcoatRoughnessFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_TEXTURE aiTextureType_UNKNOWN, 3
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_TEXTURE aiTextureType_UNKNOWN, 4
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_NORMAL_TEXTURE aiTextureType_NORMALS, 1
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION "$mat.gltf.materialTransmission", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_FACTOR "$mat.gltf.materialTransmission.transmissionFactor", 0, 0
|
||||
//#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_TEXTURE aiTextureType_UNKNOWN, 5
|
||||
#define AI_MATKEY_GLTF_PBRSPECULARGLOSSINESS_GLOSSINESS_FACTOR AI_MATKEY_GLOSSINESS_FACTOR
|
||||
|
||||
//#define _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE "$tex.file.texCoord"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGNAME_BASE "$tex.mappingname"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag"
|
||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE "$tex.mappingfiltermin"
|
||||
#define _AI_MATKEY_GLTF_SCALE_BASE "$tex.scale"
|
||||
#define _AI_MATKEY_GLTF_STRENGTH_BASE "$tex.strength"
|
||||
// Use AI_MATKEY_SHADING_MODEL == aiShadingMode_Unlit instead
|
||||
#define AI_MATKEY_GLTF_UNLIT "$mat.gltf.unlit", 0, 0
|
||||
|
||||
//#define AI_MATKEY_GLTF_TEXTURE_TEXCOORD(type, N) _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGNAME(type, N) _AI_MATKEY_GLTF_MAPPINGNAME_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGID(type, N) _AI_MATKEY_GLTF_MAPPINGID_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGFILTER_MAG(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_MAPPINGFILTER_MIN(type, N) _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_TEXTURE_SCALE(type, N) _AI_MATKEY_GLTF_SCALE_BASE, type, N
|
||||
#define AI_MATKEY_GLTF_TEXTURE_STRENGTH(type, N) _AI_MATKEY_GLTF_STRENGTH_BASE, type, N
|
||||
//AI_MATKEY_GLTF_MATERIAL_SHEEN
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_FACTOR AI_MATKEY_SHEEN_COLOR_FACTOR
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_FACTOR AI_MATKEY_SHEEN_ROUGHNESS_FACTOR
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_COLOR_TEXTURE AI_MATKEY_SHEEN_COLOR_TEXTURE
|
||||
#define AI_MATKEY_GLTF_MATERIAL_SHEEN_ROUGHNESS_TEXTURE AI_MATKEY_SHEEN_ROUGHNESS_TEXTURE
|
||||
|
||||
//AI_MATKEY_GLTF_MATERIAL_CLEARCOAT
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_FACTOR AI_MATKEY_CLEARCOAT_FACTOR
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_FACTOR AI_MATKEY_CLEARCOAT_ROUGHNESS_FACTOR
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_TEXTURE AI_MATKEY_CLEARCOAT_TEXTURE
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_ROUGHNESS_TEXTURE AI_MATKEY_CLEARCOAT_ROUGHNESS_TEXTURE
|
||||
#define AI_MATKEY_GLTF_MATERIAL_CLEARCOAT_NORMAL_TEXTURE AI_MATKEY_CLEARCOAT_NORMAL_TEXTURE
|
||||
|
||||
//AI_MATKEY_GLTF_MATERIAL_TRANSMISSION
|
||||
#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_FACTOR AI_MATKEY_TRANSMISSION_FACTOR
|
||||
#define AI_MATKEY_GLTF_MATERIAL_TRANSMISSION_TEXTURE AI_MATKEY_TRANSMISSION_TEXTURE
|
||||
|
||||
#define AI_MATKEY_GLTF_TEXTURE_TEXCOORD(type, N) AI_MATKEY_UVWSRC(type, N)
|
||||
|
||||
#endif //!!AI_PBRMATERIAL_H_INC
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[Setup]
|
||||
AppName=Open Asset Import Library - SDK
|
||||
AppVerName=Open Asset Import Library - SDK (v5.0.1)
|
||||
AppVerName=Open Asset Import Library - SDK (v5.1.0)
|
||||
DefaultDirName={pf}\Assimp
|
||||
DefaultGroupName=Assimp
|
||||
UninstallDisplayIcon={app}\bin\x64\assimp.exe
|
||||
@@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||
LicenseFile=License.rtf
|
||||
OutputBaseFileName=assimp-sdk-5.0.1-setup
|
||||
VersionInfoVersion=5.0.1.0
|
||||
VersionInfoTextVersion=5.0.1
|
||||
OutputBaseFileName=assimp-sdk-5.1.0-setup
|
||||
VersionInfoVersion=5.1.0.0
|
||||
VersionInfoTextVersion=5.1.0
|
||||
VersionInfoCompany=Assimp Development Team
|
||||
ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
[Setup]
|
||||
AppName=Open Asset Import Library - SDK
|
||||
AppVerName=Open Asset Import Library - SDK (v5.0.1)
|
||||
AppVerName=Open Asset Import Library - SDK (v5.1.0)
|
||||
DefaultDirName={pf}\Assimp
|
||||
DefaultGroupName=Assimp
|
||||
UninstallDisplayIcon={app}\bin\x86\assimp.exe
|
||||
@@ -12,9 +12,9 @@ SetupIconFile=..\..\tools\shared\assimp_tools_icon.ico
|
||||
WizardImageFile=compiler:WizModernImage-IS.BMP
|
||||
WizardSmallImageFile=compiler:WizModernSmallImage-IS.BMP
|
||||
LicenseFile=License.rtf
|
||||
OutputBaseFileName=assimp-sdk-5.0.1-setup
|
||||
VersionInfoVersion=5.0.1.0
|
||||
VersionInfoTextVersion=5.0.1
|
||||
OutputBaseFileName=assimp-sdk-5.1.0-setup
|
||||
VersionInfoVersion=5.1.0.0
|
||||
VersionInfoTextVersion=5.1.0
|
||||
VersionInfoCompany=Assimp Development Team
|
||||
;ArchitecturesInstallIn64BitMode=x64
|
||||
|
||||
@@ -49,11 +49,11 @@ Source: "WEB"; DestDir: "{app}"
|
||||
Source: "..\..\scripts\*"; DestDir: "{app}\scripts"; Flags: recursesubdirs
|
||||
|
||||
; x86 binaries
|
||||
Source: "..\..\bin\release\assimp-vc141-mt.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\release\assimp_viewer.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\assimp-vc141-mt.dll"; DestDir: "{app}\bin\x86"
|
||||
Source: "..\..\bin\release\assimp_viewer.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DCompiler_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "C:\Windows\SysWOW64\D3DX9_42.dll"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
Source: "..\..\bin\release\assimp.exe"; DestDir: "{app}\bin\x86"; Components: tools
|
||||
|
||||
|
||||
; Import libraries
|
||||
|
||||
@@ -125,13 +125,21 @@ TEST_F(utColladaExport, testExportLight) {
|
||||
ASSERT_TRUE(pTest->HasLights());
|
||||
|
||||
const unsigned int origNumLights(pTest->mNumLights);
|
||||
std::unique_ptr<aiLight[]> origLights(new aiLight[origNumLights]);
|
||||
std::vector<std::string> origNames;
|
||||
// There are FIVE!!! LIGHTS!!!
|
||||
EXPECT_EQ(5, origNumLights) << "lights.dae should contain five lights";
|
||||
|
||||
std::vector<aiLight> origLights(5);
|
||||
for (size_t i = 0; i < origNumLights; i++) {
|
||||
origNames.push_back(pTest->mLights[i]->mName.C_Str());
|
||||
origLights[i] = *(pTest->mLights[i]);
|
||||
}
|
||||
|
||||
// Check loaded first light properly
|
||||
EXPECT_STREQ("Lamp", origLights[0].mName.C_Str());
|
||||
EXPECT_EQ(aiLightSource_POINT, origLights[0].mType);
|
||||
EXPECT_FLOAT_EQ(1.0f, origLights[0].mAttenuationConstant);
|
||||
EXPECT_FLOAT_EQ(0.0f, origLights[0].mAttenuationLinear);
|
||||
EXPECT_FLOAT_EQ(0.00111109f, origLights[0].mAttenuationQuadratic);
|
||||
|
||||
// Common metadata
|
||||
// Confirm was loaded by the Collada importer
|
||||
aiString origImporter;
|
||||
@@ -191,7 +199,7 @@ TEST_F(utColladaExport, testExportLight) {
|
||||
for (size_t i = 0; i < origNumLights; i++) {
|
||||
const aiLight *orig = &origLights[i];
|
||||
const aiLight *read = imported->mLights[i];
|
||||
EXPECT_EQ(0, strncmp(origNames[i].c_str(), read->mName.C_Str(), origNames[i].size()));
|
||||
EXPECT_EQ(0, strcmp(orig->mName.C_Str(), read->mName.C_Str()));
|
||||
EXPECT_EQ(orig->mType, read->mType);
|
||||
EXPECT_FLOAT_EQ(orig->mAttenuationConstant, read->mAttenuationConstant);
|
||||
EXPECT_FLOAT_EQ(orig->mAttenuationLinear, read->mAttenuationLinear);
|
||||
|
||||
@@ -53,7 +53,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include <array>
|
||||
|
||||
#include <assimp/pbrmaterial.h>
|
||||
#include <assimp/material.h>
|
||||
#include <assimp/GltfMaterial.h>
|
||||
|
||||
using namespace Assimp;
|
||||
|
||||
class utglTF2ImportExport : public AbstractImportExportBase {
|
||||
|
||||
Reference in New Issue
Block a user