Merge branch 'master' into master
commit
925be5e983
|
@ -181,12 +181,16 @@ namespace glTF2
|
||||||
#define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid"
|
#define _AI_MATKEY_GLTF_MAPPINGID_BASE "$tex.mappingid"
|
||||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag"
|
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MAG_BASE "$tex.mappingfiltermag"
|
||||||
#define _AI_MATKEY_GLTF_MAPPINGFILTER_MIN_BASE "$tex.mappingfiltermin"
|
#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_TEXTURE_TEXCOORD _AI_MATKEY_GLTF_TEXTURE_TEXCOORD_BASE, type, N
|
#define AI_MATKEY_GLTF_TEXTURE_TEXCOORD _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_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_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_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_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
|
||||||
|
|
||||||
#ifdef ASSIMP_API
|
#ifdef ASSIMP_API
|
||||||
#include "./../include/assimp/Compiler/pushpack1.h"
|
#include "./../include/assimp/Compiler/pushpack1.h"
|
||||||
|
|
|
@ -584,7 +584,7 @@ namespace glTF2 {
|
||||||
if (bodyBuffer->byteLength > 0) {
|
if (bodyBuffer->byteLength > 0) {
|
||||||
rapidjson::Value glbBodyBuffer;
|
rapidjson::Value glbBodyBuffer;
|
||||||
glbBodyBuffer.SetObject();
|
glbBodyBuffer.SetObject();
|
||||||
glbBodyBuffer.AddMember("byteLength", bodyBuffer->byteLength, mAl);
|
glbBodyBuffer.AddMember("byteLength", static_cast<uint64_t>(bodyBuffer->byteLength), mAl);
|
||||||
mDoc["buffers"].PushBack(glbBodyBuffer, mAl);
|
mDoc["buffers"].PushBack(glbBodyBuffer, mAl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,14 +99,14 @@ const aiImporterDesc* glTF2Importer::GetInfo() const
|
||||||
return &desc;
|
return &desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool /* checkSig */) const
|
||||||
{
|
{
|
||||||
const std::string &extension = GetExtension(pFile);
|
const std::string &extension = GetExtension(pFile);
|
||||||
|
|
||||||
if (extension != "gltf" && extension != "glb")
|
if (extension != "gltf" && extension != "glb")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (checkSig && pIOHandler) {
|
if (pIOHandler) {
|
||||||
glTF2::Asset asset(pIOHandler);
|
glTF2::Asset asset(pIOHandler);
|
||||||
try {
|
try {
|
||||||
asset.Load(pFile, extension == "glb");
|
asset.Load(pFile, extension == "glb");
|
||||||
|
@ -211,6 +211,24 @@ inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset&
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset& r, glTF2::NormalTextureInfo& prop, aiMaterial* mat, aiTextureType texType, unsigned int texSlot = 0)
|
||||||
|
{
|
||||||
|
SetMaterialTextureProperty( embeddedTexIdxs, r, (glTF2::TextureInfo) prop, mat, texType, texSlot );
|
||||||
|
|
||||||
|
if (prop.texture && prop.texture->source) {
|
||||||
|
mat->AddProperty(&prop.scale, 1, AI_MATKEY_GLTF_TEXTURE_SCALE(texType, texSlot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void SetMaterialTextureProperty(std::vector<int>& embeddedTexIdxs, Asset& r, glTF2::OcclusionTextureInfo& prop, aiMaterial* mat, aiTextureType texType, unsigned int texSlot = 0)
|
||||||
|
{
|
||||||
|
SetMaterialTextureProperty( embeddedTexIdxs, r, (glTF2::TextureInfo) prop, mat, texType, texSlot );
|
||||||
|
|
||||||
|
if (prop.texture && prop.texture->source) {
|
||||||
|
mat->AddProperty(&prop.strength, 1, AI_MATKEY_GLTF_TEXTURE_STRENGTH(texType, texSlot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static aiMaterial* ImportMaterial(std::vector<int>& embeddedTexIdxs, Asset& r, Material& mat)
|
static aiMaterial* ImportMaterial(std::vector<int>& embeddedTexIdxs, Asset& r, Material& mat)
|
||||||
{
|
{
|
||||||
aiMaterial* aimat = new aiMaterial();
|
aiMaterial* aimat = new aiMaterial();
|
||||||
|
|
|
@ -98,14 +98,14 @@ const aiImporterDesc* glTFImporter::GetInfo() const
|
||||||
return &desc;
|
return &desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool glTFImporter::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
bool glTFImporter::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool /* checkSig */) const
|
||||||
{
|
{
|
||||||
const std::string &extension = GetExtension(pFile);
|
const std::string &extension = GetExtension(pFile);
|
||||||
|
|
||||||
if (extension != "gltf" && extension != "glb")
|
if (extension != "gltf" && extension != "glb")
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (checkSig && pIOHandler) {
|
if (pIOHandler) {
|
||||||
glTF::Asset asset(pIOHandler);
|
glTF::Asset asset(pIOHandler);
|
||||||
try {
|
try {
|
||||||
asset.Load(pFile, extension == "glb");
|
asset.Load(pFile, extension == "glb");
|
||||||
|
|
Loading…
Reference in New Issue