From 200bf8df7a6879b5c0840cba0b9d620f6b4221b1 Mon Sep 17 00:00:00 2001 From: diharaw Date: Wed, 29 Sep 2021 17:05:17 +0100 Subject: [PATCH 01/20] Added gltf2 KHR_materials_volume import support. --- code/AssetLib/glTF2/glTF2Asset.h | 16 ++++++++++++++++ code/AssetLib/glTF2/glTF2Asset.inl | 21 +++++++++++++++++++++ code/AssetLib/glTF2/glTF2Importer.cpp | 10 ++++++++++ include/assimp/material.h | 17 +++++++++++++++++ 4 files changed, 64 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index 9a50ede99..fb3100b2c 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_sheen full * KHR_materials_clearcoat full * KHR_materials_transmission full + * KHR_materials_volume full */ #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC @@ -713,6 +714,7 @@ const vec3 defaultEmissiveFactor = { 0, 0, 0 }; const vec4 defaultDiffuseFactor = { 1, 1, 1, 1 }; const vec3 defaultSpecularFactor = { 1, 1, 1 }; const vec3 defaultSheenFactor = { 0, 0, 0 }; +const vec3 defaultAttenuationColor = { 1, 1, 1 }; struct TextureInfo { Ref texture; @@ -777,6 +779,16 @@ struct MaterialTransmission { float transmissionFactor = 0.f; }; +struct MaterialVolume { + float thicknessFactor = 0.f; + TextureInfo thicknessTexture; + float attenuationDistance = 0.f; + vec3 attenuationColor; + + MaterialVolume() { SetDefaults(); } + void SetDefaults(); +}; + //! The material appearance of a primitive. struct Material : public Object { //PBR metallic roughness properties @@ -803,6 +815,9 @@ struct Material : public Object { //extension: KHR_materials_transmission Nullable materialTransmission; + //extension: KHR_materials_volume + Nullable materialVolume; + //extension: KHR_materials_unlit bool unlit; @@ -1091,6 +1106,7 @@ public: bool KHR_materials_sheen; bool KHR_materials_clearcoat; bool KHR_materials_transmission; + bool KHR_materials_volume; bool KHR_draco_mesh_compression; bool FB_ngon_encoding; bool KHR_texture_basisu; diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index 4832995cc..ff71ff53b 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -1215,6 +1215,19 @@ inline void Material::Read(Value &material, Asset &r) { } } + if (r.extensionsUsed.KHR_materials_volume) { + if (Value *curMaterialVolume = FindObject(*extensions, "KHR_materials_volume")) { + MaterialVolume volume; + + ReadMember(*curMaterialVolume, "thicknessFactor", volume.thicknessFactor); + ReadTextureProperty(r, *curMaterialVolume, "thicknessTexture", volume.thicknessTexture); + ReadMember(*curMaterialVolume, "attenuationDistance", volume.attenuationDistance); + ReadMember(*curMaterialVolume, "attenuationColor", volume.attenuationColor); + + this->materialVolume = Nullable(volume); + } + } + unlit = nullptr != FindObject(*extensions, "KHR_materials_unlit"); } } @@ -1260,6 +1273,13 @@ inline void MaterialSheen::SetDefaults() { sheenRoughnessFactor = 0.f; } +inline void MaterialVolume::SetDefaults() { + //KHR_materials_volume properties + thicknessFactor = 0.f; + attenuationDistance = INFINITY; + SetVector(attenuationColor, defaultAttenuationColor); +} + namespace { template @@ -1931,6 +1951,7 @@ inline void Asset::ReadExtensionsUsed(Document &doc) { CHECK_EXT(KHR_materials_sheen); CHECK_EXT(KHR_materials_clearcoat); CHECK_EXT(KHR_materials_transmission); + CHECK_EXT(KHR_materials_volume); CHECK_EXT(KHR_draco_mesh_compression); CHECK_EXT(KHR_texture_basisu); diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 6c92bdc87..136b01d07 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -341,6 +341,16 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M SetMaterialTextureProperty(embeddedTexIdxs, r, transmission.transmissionTexture, aimat, AI_MATKEY_TRANSMISSION_TEXTURE); } + // KHR_materials_volume + if (mat.materialVolume.isPresent) { + MaterialVolume &volume = mat.materialVolume.value; + + aimat->AddProperty(&volume.thicknessFactor, 1, AI_MATKEY_VOLUME_THICKNESS_FACTOR); + SetMaterialTextureProperty(embeddedTexIdxs, r, volume.thicknessTexture, aimat, AI_MATKEY_VOLUME_THICKNESS_TEXTURE); + aimat->AddProperty(&volume.attenuationDistance, 1, AI_MATKEY_VOLUME_ATTENUATION_DISTANCE); + SetMaterialColorProperty(r, volume.attenuationColor, aimat, AI_MATKEY_VOLUME_ATTENUATION_COLOR); + } + return aimat; } catch (...) { delete aimat; diff --git a/include/assimp/material.h b/include/assimp/material.h index 250ad90d5..2373185fc 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -318,6 +318,12 @@ enum aiTextureType { */ aiTextureType_TRANSMISSION = 21, + /** Volume + * Simulates transmission through the surface + * May include further information such as wall thickness + */ + aiTextureType_VOLUME = 22, + /** Unknown texture * * A texture reference that does not match any of the definitions @@ -1028,6 +1034,17 @@ extern "C" { // Multiplied by AI_MATKEY_TRANSMISSION_FACTOR #define AI_MATKEY_TRANSMISSION_TEXTURE aiTextureType_TRANSMISSION, 0 +// Volume +// ------------ +// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume +// Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent +#define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0 +// Texture defining percentage of light transmitted through the surface. +// Multiplied by AI_MATKEY_THICKNESS_FACTOR +#define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_VOLUME, 0 +#define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0 +#define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 + // Emissive // -------- #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 From d3276de47da869417b1a619640f534d90e66a6dc Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 30 Sep 2021 08:10:02 +0100 Subject: [PATCH 02/20] Added gltf2 KHR_materials_volume write support. --- code/AssetLib/glTF2/glTF2AssetWriter.h | 1 + code/AssetLib/glTF2/glTF2AssetWriter.inl | 26 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index 8244a14b9..9be3fdf0c 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -49,6 +49,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_sheen: full * KHR_materials_clearcoat: full * KHR_materials_transmission: full + * KHR_materials_volume: full */ #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index 115cdf903..03b8476dc 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -474,6 +474,28 @@ namespace glTF2 { } } + if (m.materialVolume.isPresent) { + Value materialVolume(rapidjson::Type::kObjectType); + + MaterialVolume &volume = m.materialVolume.value; + + if (volume.thicknessFactor != 0.f) { + WriteFloat(materialVolume, volume.thicknessFactor, "thicknessFactor", w.mAl); + } + + WriteTex(materialVolume, volume.thicknessTexture, "thicknessTexture", w.mAl); + + if (volume.attenuationDistance != INFINITY) { + WriteFloat(materialVolume, volume.attenuationDistance, "attenuationDistance", w.mAl); + } + + WriteVec(materialVolume, volume.attenuationColor, "attenuationColor", defaultAttenuationColor, w.mAl); + + if (!materialVolume.ObjectEmpty()) { + exts.AddMember("KHR_materials_volume", materialVolume, w.mAl); + } + } + if (!exts.ObjectEmpty()) { obj.AddMember("extensions", exts, w.mAl); } @@ -890,6 +912,10 @@ namespace glTF2 { exts.PushBack(StringRef("KHR_materials_transmission"), mAl); } + if (this->mAsset.extensionsUsed.KHR_materials_volume) { + exts.PushBack(StringRef("KHR_materials_volume"), mAl); + } + if (this->mAsset.extensionsUsed.FB_ngon_encoding) { exts.PushBack(StringRef("FB_ngon_encoding"), mAl); } From addd54125133c590bcf1dda68ca78f9952651f33 Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 30 Sep 2021 08:47:53 +0100 Subject: [PATCH 03/20] Added gltf2 KHR_materials_ior support. --- code/AssetLib/glTF2/glTF2Asset.h | 12 ++++++++++ code/AssetLib/glTF2/glTF2Asset.inl | 16 ++++++++++++++ code/AssetLib/glTF2/glTF2AssetWriter.h | 1 + code/AssetLib/glTF2/glTF2AssetWriter.inl | 18 +++++++++++++++ code/AssetLib/glTF2/glTF2Exporter.cpp | 28 ++++++++++++++++++++++++ code/AssetLib/glTF2/glTF2Exporter.h | 4 ++++ code/AssetLib/glTF2/glTF2Importer.cpp | 7 ++++++ include/assimp/material.h | 12 ++++++++-- 8 files changed, 96 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index fb3100b2c..c790a1374 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat full * KHR_materials_transmission full * KHR_materials_volume full + * KHR_materials_ior full */ #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC @@ -789,6 +790,13 @@ struct MaterialVolume { void SetDefaults(); }; +struct MaterialIOR { + float ior = 0.f; + + MaterialIOR() { SetDefaults(); } + void SetDefaults(); +}; + //! The material appearance of a primitive. struct Material : public Object { //PBR metallic roughness properties @@ -817,6 +825,9 @@ struct Material : public Object { //extension: KHR_materials_volume Nullable materialVolume; + + //extension: KHR_materials_ior + Nullable materialIOR; //extension: KHR_materials_unlit bool unlit; @@ -1107,6 +1118,7 @@ public: bool KHR_materials_clearcoat; bool KHR_materials_transmission; bool KHR_materials_volume; + bool KHR_materials_ior; bool KHR_draco_mesh_compression; bool FB_ngon_encoding; bool KHR_texture_basisu; diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index ff71ff53b..d65b4132b 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -1228,6 +1228,16 @@ inline void Material::Read(Value &material, Asset &r) { } } + if (r.extensionsUsed.KHR_materials_ior) { + if (Value *curMaterialIOR = FindObject(*extensions, "KHR_materials_ior")) { + MaterialIOR ior; + + ReadMember(*curMaterialIOR, "ior", ior.ior); + + this->materialIOR = Nullable(ior); + } + } + unlit = nullptr != FindObject(*extensions, "KHR_materials_unlit"); } } @@ -1280,6 +1290,11 @@ inline void MaterialVolume::SetDefaults() { SetVector(attenuationColor, defaultAttenuationColor); } +inline void MaterialIOR::SetDefaults() { + //KHR_materials_ior properties + ior = 1.5f; +} + namespace { template @@ -1952,6 +1967,7 @@ inline void Asset::ReadExtensionsUsed(Document &doc) { CHECK_EXT(KHR_materials_clearcoat); CHECK_EXT(KHR_materials_transmission); CHECK_EXT(KHR_materials_volume); + CHECK_EXT(KHR_materials_ior); CHECK_EXT(KHR_draco_mesh_compression); CHECK_EXT(KHR_texture_basisu); diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index 9be3fdf0c..ce8b4d65e 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat: full * KHR_materials_transmission: full * KHR_materials_volume: full + * KHR_materials_ior: full */ #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index 03b8476dc..b91553fbe 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -496,6 +496,20 @@ namespace glTF2 { } } + if (m.materialIOR.isPresent) { + Value materialIOR(rapidjson::Type::kObjectType); + + MaterialIOR &ior = m.materialIOR.value; + + if (ior.ior != 1.5f) { + WriteFloat(materialIOR, ior.ior, "ior", w.mAl); + } + + if (!materialIOR.ObjectEmpty()) { + exts.AddMember("KHR_materials_ior", materialIOR, w.mAl); + } + } + if (!exts.ObjectEmpty()) { obj.AddMember("extensions", exts, w.mAl); } @@ -916,6 +930,10 @@ namespace glTF2 { exts.PushBack(StringRef("KHR_materials_volume"), mAl); } + if (this->mAsset.extensionsUsed.KHR_materials_ior) { + exts.PushBack(StringRef("KHR_materials_ior"), mAl); + } + if (this->mAsset.extensionsUsed.FB_ngon_encoding) { exts.PushBack(StringRef("FB_ngon_encoding"), mAl); } diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 22db4b26d..8327f8c54 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -704,6 +704,22 @@ bool glTF2Exporter::GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTra return result || transmission.transmissionTexture.texture; } +bool glTF2Exporter::GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &volume) { + bool result = mat.Get(AI_MATKEY_VOLUME_THICKNESS_FACTOR, volume.thicknessFactor) != aiReturn_SUCCESS; + + GetMatTex(mat, volume.thicknessTexture, AI_MATKEY_VOLUME_THICKNESS_TEXTURE); + + result = result || mat.Get(AI_MATKEY_VOLUME_ATTENUATION_DISTANCE, volume.attenuationDistance); + result = result || GetMatColor(mat, volume.attenuationColor, AI_MATKEY_VOLUME_ATTENUATION_COLOR) != aiReturn_SUCCESS; + + // Valid if any of these properties are available + return result || volume.thicknessTexture.texture; +} + +bool glTF2Exporter::GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior) { + return mat.Get(AI_MATKEY_IOR, ior.ior) == aiReturn_SUCCESS; +} + void glTF2Exporter::ExportMaterials() { aiString aiName; for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) { @@ -824,6 +840,18 @@ void glTF2Exporter::ExportMaterials() { mAsset->extensionsUsed.KHR_materials_transmission = true; m->materialTransmission = Nullable(transmission); } + + MaterialVolume volume; + if (GetMatVolume(mat, volume)) { + mAsset->extensionsUsed.KHR_materials_volume = true; + m->materialVolume = Nullable(volume); + } + + MaterialIOR ior; + if (GetMatIOR(mat, ior)) { + mAsset->extensionsUsed.KHR_materials_ior = true; + m->materialIOR = Nullable(ior); + } } } } diff --git a/code/AssetLib/glTF2/glTF2Exporter.h b/code/AssetLib/glTF2/glTF2Exporter.h index 842d29815..6d70d915e 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.h +++ b/code/AssetLib/glTF2/glTF2Exporter.h @@ -77,6 +77,8 @@ struct PbrSpecularGlossiness; struct MaterialSheen; struct MaterialClearcoat; struct MaterialTransmission; +struct MaterialVolume; +struct MaterialIOR; // Vec/matrix types, as raw float arrays typedef float(vec2)[2]; @@ -114,6 +116,8 @@ protected: bool GetMatSheen(const aiMaterial &mat, glTF2::MaterialSheen &sheen); bool GetMatClearcoat(const aiMaterial &mat, glTF2::MaterialClearcoat &clearcoat); bool GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTransmission &transmission); + bool GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &volume); + bool GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior); void ExportMetadata(); void ExportMaterials(); void ExportMeshes(); diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 136b01d07..c7de2af4f 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -351,6 +351,13 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M SetMaterialColorProperty(r, volume.attenuationColor, aimat, AI_MATKEY_VOLUME_ATTENUATION_COLOR); } + // KHR_materials_ior + if (mat.materialIOR.isPresent) { + MaterialIOR &ior = mat.materialIOR.value; + + aimat->AddProperty(&ior.ior, 1, AI_MATKEY_IOR); + } + return aimat; } catch (...) { delete aimat; diff --git a/include/assimp/material.h b/include/assimp/material.h index 2373185fc..c86848993 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1037,14 +1037,22 @@ extern "C" { // Volume // ------------ // https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_volume -// Base percentage of light transmitted through the surface. 0.0 = Opaque, 1.0 = Fully transparent +// The thickness of the volume beneath the surface. If the value is 0 the material is thin-walled. Otherwise the material is a volume boundary. #define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0 -// Texture defining percentage of light transmitted through the surface. +// Texture that defines the thickness. // Multiplied by AI_MATKEY_THICKNESS_FACTOR #define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_VOLUME, 0 +// Density of the medium given as the average distance that light travels in the medium before interacting with a particle. #define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0 +// The color that white light turns into due to absorption when reaching the attenuation distance. #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 +// IOR +// ------------ +// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior +// Index of Refraction. +#define AI_MATKEY_IOR "$mat.ior", 0, 0 + // Emissive // -------- #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 From 46a7de7a0b21ebf03c8128fb3952db4c4d670228 Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 30 Sep 2021 08:56:16 +0100 Subject: [PATCH 04/20] Moved KHR_material_volume thickness texture under aiTextureType_TRANSMISSION. --- include/assimp/material.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/include/assimp/material.h b/include/assimp/material.h index c86848993..5499bd916 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -318,12 +318,6 @@ enum aiTextureType { */ aiTextureType_TRANSMISSION = 21, - /** Volume - * Simulates transmission through the surface - * May include further information such as wall thickness - */ - aiTextureType_VOLUME = 22, - /** Unknown texture * * A texture reference that does not match any of the definitions @@ -1041,7 +1035,7 @@ extern "C" { #define AI_MATKEY_VOLUME_THICKNESS_FACTOR "$mat.volume.thicknessFactor", 0, 0 // Texture that defines the thickness. // Multiplied by AI_MATKEY_THICKNESS_FACTOR -#define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_VOLUME, 0 +#define AI_MATKEY_VOLUME_THICKNESS_TEXTURE aiTextureType_TRANSMISSION, 1 // Density of the medium given as the average distance that light travels in the medium before interacting with a particle. #define AI_MATKEY_VOLUME_ATTENUATION_DISTANCE "$mat.volume.attenuationDistance", 0, 0 // The color that white light turns into due to absorption when reaching the attenuation distance. From 656b0b25d869d2fe243b3fadfb422b3b6475e559 Mon Sep 17 00:00:00 2001 From: Marc Date: Tue, 5 Oct 2021 19:24:42 +0200 Subject: [PATCH 05/20] Fix warning for array comparison The code previously compared two float arrays with the != operator. This is deprecated in Visual Studio 2019 and results in a warning that leads to an error when compiling with warnings as errors. Small fix to make the build work. --- code/AssetLib/glTF2/glTF2Importer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 6c92bdc87..dca32f22b 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -312,7 +312,7 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M if (mat.materialSheen.isPresent) { MaterialSheen &sheen = mat.materialSheen.value; // Default value {0,0,0} disables Sheen - if (sheen.sheenColorFactor != defaultSheenFactor) { + if (std::memcmp(sheen.sheenColorFactor, defaultSheenFactor, sizeof(glTFCommon::vec3)) != 0) { SetMaterialColorProperty(r, sheen.sheenColorFactor, aimat, AI_MATKEY_SHEEN_COLOR_FACTOR); aimat->AddProperty(&sheen.sheenRoughnessFactor, 1, AI_MATKEY_SHEEN_ROUGHNESS_FACTOR); SetMaterialTextureProperty(embeddedTexIdxs, r, sheen.sheenColorTexture, aimat, AI_MATKEY_SHEEN_COLOR_TEXTURE); From 0738742611dba94d9adef998e59df963ba8c4115 Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 7 Oct 2021 09:30:22 +0100 Subject: [PATCH 06/20] Removed KHR_materials_ior support. --- code/AssetLib/glTF2/glTF2Asset.h | 12 ------------ code/AssetLib/glTF2/glTF2Asset.inl | 16 ---------------- code/AssetLib/glTF2/glTF2AssetWriter.h | 1 - code/AssetLib/glTF2/glTF2AssetWriter.inl | 18 ------------------ code/AssetLib/glTF2/glTF2Exporter.cpp | 10 ---------- code/AssetLib/glTF2/glTF2Exporter.h | 2 -- code/AssetLib/glTF2/glTF2Importer.cpp | 7 ------- include/assimp/material.h | 6 ------ 8 files changed, 72 deletions(-) diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index c790a1374..e97523bbe 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -50,7 +50,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat full * KHR_materials_transmission full * KHR_materials_volume full - * KHR_materials_ior full */ #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC @@ -790,13 +789,6 @@ struct MaterialVolume { void SetDefaults(); }; -struct MaterialIOR { - float ior = 0.f; - - MaterialIOR() { SetDefaults(); } - void SetDefaults(); -}; - //! The material appearance of a primitive. struct Material : public Object { //PBR metallic roughness properties @@ -826,9 +818,6 @@ struct Material : public Object { //extension: KHR_materials_volume Nullable materialVolume; - //extension: KHR_materials_ior - Nullable materialIOR; - //extension: KHR_materials_unlit bool unlit; @@ -1118,7 +1107,6 @@ public: bool KHR_materials_clearcoat; bool KHR_materials_transmission; bool KHR_materials_volume; - bool KHR_materials_ior; bool KHR_draco_mesh_compression; bool FB_ngon_encoding; bool KHR_texture_basisu; diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index d65b4132b..ff71ff53b 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -1228,16 +1228,6 @@ inline void Material::Read(Value &material, Asset &r) { } } - if (r.extensionsUsed.KHR_materials_ior) { - if (Value *curMaterialIOR = FindObject(*extensions, "KHR_materials_ior")) { - MaterialIOR ior; - - ReadMember(*curMaterialIOR, "ior", ior.ior); - - this->materialIOR = Nullable(ior); - } - } - unlit = nullptr != FindObject(*extensions, "KHR_materials_unlit"); } } @@ -1290,11 +1280,6 @@ inline void MaterialVolume::SetDefaults() { SetVector(attenuationColor, defaultAttenuationColor); } -inline void MaterialIOR::SetDefaults() { - //KHR_materials_ior properties - ior = 1.5f; -} - namespace { template @@ -1967,7 +1952,6 @@ inline void Asset::ReadExtensionsUsed(Document &doc) { CHECK_EXT(KHR_materials_clearcoat); CHECK_EXT(KHR_materials_transmission); CHECK_EXT(KHR_materials_volume); - CHECK_EXT(KHR_materials_ior); CHECK_EXT(KHR_draco_mesh_compression); CHECK_EXT(KHR_texture_basisu); diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index ce8b4d65e..9be3fdf0c 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -50,7 +50,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat: full * KHR_materials_transmission: full * KHR_materials_volume: full - * KHR_materials_ior: full */ #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index b91553fbe..03b8476dc 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -496,20 +496,6 @@ namespace glTF2 { } } - if (m.materialIOR.isPresent) { - Value materialIOR(rapidjson::Type::kObjectType); - - MaterialIOR &ior = m.materialIOR.value; - - if (ior.ior != 1.5f) { - WriteFloat(materialIOR, ior.ior, "ior", w.mAl); - } - - if (!materialIOR.ObjectEmpty()) { - exts.AddMember("KHR_materials_ior", materialIOR, w.mAl); - } - } - if (!exts.ObjectEmpty()) { obj.AddMember("extensions", exts, w.mAl); } @@ -930,10 +916,6 @@ namespace glTF2 { exts.PushBack(StringRef("KHR_materials_volume"), mAl); } - if (this->mAsset.extensionsUsed.KHR_materials_ior) { - exts.PushBack(StringRef("KHR_materials_ior"), mAl); - } - if (this->mAsset.extensionsUsed.FB_ngon_encoding) { exts.PushBack(StringRef("FB_ngon_encoding"), mAl); } diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 8327f8c54..46433fc95 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -716,10 +716,6 @@ bool glTF2Exporter::GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &v return result || volume.thicknessTexture.texture; } -bool glTF2Exporter::GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior) { - return mat.Get(AI_MATKEY_IOR, ior.ior) == aiReturn_SUCCESS; -} - void glTF2Exporter::ExportMaterials() { aiString aiName; for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) { @@ -846,12 +842,6 @@ void glTF2Exporter::ExportMaterials() { mAsset->extensionsUsed.KHR_materials_volume = true; m->materialVolume = Nullable(volume); } - - MaterialIOR ior; - if (GetMatIOR(mat, ior)) { - mAsset->extensionsUsed.KHR_materials_ior = true; - m->materialIOR = Nullable(ior); - } } } } diff --git a/code/AssetLib/glTF2/glTF2Exporter.h b/code/AssetLib/glTF2/glTF2Exporter.h index 6d70d915e..c00faafb9 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.h +++ b/code/AssetLib/glTF2/glTF2Exporter.h @@ -78,7 +78,6 @@ struct MaterialSheen; struct MaterialClearcoat; struct MaterialTransmission; struct MaterialVolume; -struct MaterialIOR; // Vec/matrix types, as raw float arrays typedef float(vec2)[2]; @@ -117,7 +116,6 @@ protected: bool GetMatClearcoat(const aiMaterial &mat, glTF2::MaterialClearcoat &clearcoat); bool GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTransmission &transmission); bool GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &volume); - bool GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior); void ExportMetadata(); void ExportMaterials(); void ExportMeshes(); diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index c7de2af4f..136b01d07 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -351,13 +351,6 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M SetMaterialColorProperty(r, volume.attenuationColor, aimat, AI_MATKEY_VOLUME_ATTENUATION_COLOR); } - // KHR_materials_ior - if (mat.materialIOR.isPresent) { - MaterialIOR &ior = mat.materialIOR.value; - - aimat->AddProperty(&ior.ior, 1, AI_MATKEY_IOR); - } - return aimat; } catch (...) { delete aimat; diff --git a/include/assimp/material.h b/include/assimp/material.h index 5499bd916..4e55e4894 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1041,12 +1041,6 @@ extern "C" { // The color that white light turns into due to absorption when reaching the attenuation distance. #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 -// IOR -// ------------ -// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior -// Index of Refraction. -#define AI_MATKEY_IOR "$mat.ior", 0, 0 - // Emissive // -------- #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 From b01d008bc0d8042bd2395be4b0a8b0bb2eaaa0c6 Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 7 Oct 2021 09:36:53 +0100 Subject: [PATCH 07/20] Revert "Removed KHR_materials_ior support." This reverts commit 0738742611dba94d9adef998e59df963ba8c4115. --- code/AssetLib/glTF2/glTF2Asset.h | 12 ++++++++++++ code/AssetLib/glTF2/glTF2Asset.inl | 16 ++++++++++++++++ code/AssetLib/glTF2/glTF2AssetWriter.h | 1 + code/AssetLib/glTF2/glTF2AssetWriter.inl | 18 ++++++++++++++++++ code/AssetLib/glTF2/glTF2Exporter.cpp | 10 ++++++++++ code/AssetLib/glTF2/glTF2Exporter.h | 2 ++ code/AssetLib/glTF2/glTF2Importer.cpp | 7 +++++++ include/assimp/material.h | 6 ++++++ 8 files changed, 72 insertions(+) diff --git a/code/AssetLib/glTF2/glTF2Asset.h b/code/AssetLib/glTF2/glTF2Asset.h index e97523bbe..c790a1374 100644 --- a/code/AssetLib/glTF2/glTF2Asset.h +++ b/code/AssetLib/glTF2/glTF2Asset.h @@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat full * KHR_materials_transmission full * KHR_materials_volume full + * KHR_materials_ior full */ #ifndef GLTF2ASSET_H_INC #define GLTF2ASSET_H_INC @@ -789,6 +790,13 @@ struct MaterialVolume { void SetDefaults(); }; +struct MaterialIOR { + float ior = 0.f; + + MaterialIOR() { SetDefaults(); } + void SetDefaults(); +}; + //! The material appearance of a primitive. struct Material : public Object { //PBR metallic roughness properties @@ -818,6 +826,9 @@ struct Material : public Object { //extension: KHR_materials_volume Nullable materialVolume; + //extension: KHR_materials_ior + Nullable materialIOR; + //extension: KHR_materials_unlit bool unlit; @@ -1107,6 +1118,7 @@ public: bool KHR_materials_clearcoat; bool KHR_materials_transmission; bool KHR_materials_volume; + bool KHR_materials_ior; bool KHR_draco_mesh_compression; bool FB_ngon_encoding; bool KHR_texture_basisu; diff --git a/code/AssetLib/glTF2/glTF2Asset.inl b/code/AssetLib/glTF2/glTF2Asset.inl index ff71ff53b..d65b4132b 100644 --- a/code/AssetLib/glTF2/glTF2Asset.inl +++ b/code/AssetLib/glTF2/glTF2Asset.inl @@ -1228,6 +1228,16 @@ inline void Material::Read(Value &material, Asset &r) { } } + if (r.extensionsUsed.KHR_materials_ior) { + if (Value *curMaterialIOR = FindObject(*extensions, "KHR_materials_ior")) { + MaterialIOR ior; + + ReadMember(*curMaterialIOR, "ior", ior.ior); + + this->materialIOR = Nullable(ior); + } + } + unlit = nullptr != FindObject(*extensions, "KHR_materials_unlit"); } } @@ -1280,6 +1290,11 @@ inline void MaterialVolume::SetDefaults() { SetVector(attenuationColor, defaultAttenuationColor); } +inline void MaterialIOR::SetDefaults() { + //KHR_materials_ior properties + ior = 1.5f; +} + namespace { template @@ -1952,6 +1967,7 @@ inline void Asset::ReadExtensionsUsed(Document &doc) { CHECK_EXT(KHR_materials_clearcoat); CHECK_EXT(KHR_materials_transmission); CHECK_EXT(KHR_materials_volume); + CHECK_EXT(KHR_materials_ior); CHECK_EXT(KHR_draco_mesh_compression); CHECK_EXT(KHR_texture_basisu); diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.h b/code/AssetLib/glTF2/glTF2AssetWriter.h index 9be3fdf0c..ce8b4d65e 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.h +++ b/code/AssetLib/glTF2/glTF2AssetWriter.h @@ -50,6 +50,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * KHR_materials_clearcoat: full * KHR_materials_transmission: full * KHR_materials_volume: full + * KHR_materials_ior: full */ #ifndef GLTF2ASSETWRITER_H_INC #define GLTF2ASSETWRITER_H_INC diff --git a/code/AssetLib/glTF2/glTF2AssetWriter.inl b/code/AssetLib/glTF2/glTF2AssetWriter.inl index 03b8476dc..b91553fbe 100644 --- a/code/AssetLib/glTF2/glTF2AssetWriter.inl +++ b/code/AssetLib/glTF2/glTF2AssetWriter.inl @@ -496,6 +496,20 @@ namespace glTF2 { } } + if (m.materialIOR.isPresent) { + Value materialIOR(rapidjson::Type::kObjectType); + + MaterialIOR &ior = m.materialIOR.value; + + if (ior.ior != 1.5f) { + WriteFloat(materialIOR, ior.ior, "ior", w.mAl); + } + + if (!materialIOR.ObjectEmpty()) { + exts.AddMember("KHR_materials_ior", materialIOR, w.mAl); + } + } + if (!exts.ObjectEmpty()) { obj.AddMember("extensions", exts, w.mAl); } @@ -916,6 +930,10 @@ namespace glTF2 { exts.PushBack(StringRef("KHR_materials_volume"), mAl); } + if (this->mAsset.extensionsUsed.KHR_materials_ior) { + exts.PushBack(StringRef("KHR_materials_ior"), mAl); + } + if (this->mAsset.extensionsUsed.FB_ngon_encoding) { exts.PushBack(StringRef("FB_ngon_encoding"), mAl); } diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 46433fc95..8327f8c54 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -716,6 +716,10 @@ bool glTF2Exporter::GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &v return result || volume.thicknessTexture.texture; } +bool glTF2Exporter::GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior) { + return mat.Get(AI_MATKEY_IOR, ior.ior) == aiReturn_SUCCESS; +} + void glTF2Exporter::ExportMaterials() { aiString aiName; for (unsigned int i = 0; i < mScene->mNumMaterials; ++i) { @@ -842,6 +846,12 @@ void glTF2Exporter::ExportMaterials() { mAsset->extensionsUsed.KHR_materials_volume = true; m->materialVolume = Nullable(volume); } + + MaterialIOR ior; + if (GetMatIOR(mat, ior)) { + mAsset->extensionsUsed.KHR_materials_ior = true; + m->materialIOR = Nullable(ior); + } } } } diff --git a/code/AssetLib/glTF2/glTF2Exporter.h b/code/AssetLib/glTF2/glTF2Exporter.h index c00faafb9..6d70d915e 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.h +++ b/code/AssetLib/glTF2/glTF2Exporter.h @@ -78,6 +78,7 @@ struct MaterialSheen; struct MaterialClearcoat; struct MaterialTransmission; struct MaterialVolume; +struct MaterialIOR; // Vec/matrix types, as raw float arrays typedef float(vec2)[2]; @@ -116,6 +117,7 @@ protected: bool GetMatClearcoat(const aiMaterial &mat, glTF2::MaterialClearcoat &clearcoat); bool GetMatTransmission(const aiMaterial &mat, glTF2::MaterialTransmission &transmission); bool GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &volume); + bool GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior); void ExportMetadata(); void ExportMaterials(); void ExportMeshes(); diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index 136b01d07..c7de2af4f 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -351,6 +351,13 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M SetMaterialColorProperty(r, volume.attenuationColor, aimat, AI_MATKEY_VOLUME_ATTENUATION_COLOR); } + // KHR_materials_ior + if (mat.materialIOR.isPresent) { + MaterialIOR &ior = mat.materialIOR.value; + + aimat->AddProperty(&ior.ior, 1, AI_MATKEY_IOR); + } + return aimat; } catch (...) { delete aimat; diff --git a/include/assimp/material.h b/include/assimp/material.h index 4e55e4894..5499bd916 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1041,6 +1041,12 @@ extern "C" { // The color that white light turns into due to absorption when reaching the attenuation distance. #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 +// IOR +// ------------ +// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior +// Index of Refraction. +#define AI_MATKEY_IOR "$mat.ior", 0, 0 + // Emissive // -------- #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 From 0fb66f84378ef441977fd552b6cda2ff3dd7216d Mon Sep 17 00:00:00 2001 From: diharaw Date: Thu, 7 Oct 2021 09:39:08 +0100 Subject: [PATCH 08/20] Replaced AI_MATKEY_IOR with AI_MATKEY_REFRACTI. --- code/AssetLib/glTF2/glTF2Exporter.cpp | 2 +- code/AssetLib/glTF2/glTF2Importer.cpp | 2 +- include/assimp/material.h | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/code/AssetLib/glTF2/glTF2Exporter.cpp b/code/AssetLib/glTF2/glTF2Exporter.cpp index 8327f8c54..572c61f2b 100644 --- a/code/AssetLib/glTF2/glTF2Exporter.cpp +++ b/code/AssetLib/glTF2/glTF2Exporter.cpp @@ -717,7 +717,7 @@ bool glTF2Exporter::GetMatVolume(const aiMaterial &mat, glTF2::MaterialVolume &v } bool glTF2Exporter::GetMatIOR(const aiMaterial &mat, glTF2::MaterialIOR &ior) { - return mat.Get(AI_MATKEY_IOR, ior.ior) == aiReturn_SUCCESS; + return mat.Get(AI_MATKEY_REFRACTI, ior.ior) == aiReturn_SUCCESS; } void glTF2Exporter::ExportMaterials() { diff --git a/code/AssetLib/glTF2/glTF2Importer.cpp b/code/AssetLib/glTF2/glTF2Importer.cpp index c7de2af4f..87f2604ca 100644 --- a/code/AssetLib/glTF2/glTF2Importer.cpp +++ b/code/AssetLib/glTF2/glTF2Importer.cpp @@ -355,7 +355,7 @@ static aiMaterial *ImportMaterial(std::vector &embeddedTexIdxs, Asset &r, M if (mat.materialIOR.isPresent) { MaterialIOR &ior = mat.materialIOR.value; - aimat->AddProperty(&ior.ior, 1, AI_MATKEY_IOR); + aimat->AddProperty(&ior.ior, 1, AI_MATKEY_REFRACTI); } return aimat; diff --git a/include/assimp/material.h b/include/assimp/material.h index 5499bd916..4e55e4894 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -1041,12 +1041,6 @@ extern "C" { // The color that white light turns into due to absorption when reaching the attenuation distance. #define AI_MATKEY_VOLUME_ATTENUATION_COLOR "$mat.volume.attenuationColor", 0, 0 -// IOR -// ------------ -// https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_ior -// Index of Refraction. -#define AI_MATKEY_IOR "$mat.ior", 0, 0 - // Emissive // -------- #define AI_MATKEY_USE_EMISSIVE_MAP "$mat.useEmissiveMap", 0, 0 From 3b8126d26a9015f0d9557fa1e3377e14ec458c13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 5 Oct 2021 10:59:43 +0200 Subject: [PATCH 09/20] Fix spelling mistake --- code/AssetLib/3DS/3DSHelper.h | 2 +- code/AssetLib/AMF/AMFImporter_Postprocess.cpp | 2 +- code/AssetLib/ASE/ASELoader.cpp | 2 +- code/AssetLib/Assbin/AssbinLoader.cpp | 2 +- code/AssetLib/Assxml/AssxmlFileWriter.cpp | 2 +- code/AssetLib/BVH/BVHLoader.cpp | 2 +- code/AssetLib/BVH/BVHLoader.h | 2 +- code/AssetLib/Blender/BlenderDNA.h | 2 +- code/AssetLib/COB/COBLoader.cpp | 6 +++--- code/AssetLib/FBX/FBXConverter.cpp | 2 +- code/AssetLib/FBX/FBXDocument.h | 2 +- code/AssetLib/FBX/FBXExporter.cpp | 4 ++-- code/AssetLib/Irr/IRRLoader.cpp | 2 +- code/AssetLib/M3D/M3DExporter.cpp | 2 +- code/AssetLib/M3D/M3DImporter.cpp | 6 +++--- code/AssetLib/M3D/m3d.h | 10 +++++----- code/AssetLib/MD3/MD3FileData.h | 2 +- code/AssetLib/MD5/MD5Parser.cpp | 2 +- code/AssetLib/MDL/MDLMaterialLoader.cpp | 4 ++-- code/AssetLib/MMD/MMDPmdParser.h | 4 ++-- code/AssetLib/MMD/MMDVmdParser.h | 2 +- code/AssetLib/OFF/OFFLoader.cpp | 2 +- code/AssetLib/Obj/ObjFileData.h | 2 +- code/AssetLib/Ogre/OgreStructs.h | 2 +- code/AssetLib/OpenGEX/OpenGEXImporter.cpp | 4 ++-- code/AssetLib/Q3BSP/Q3BSPFileData.h | 2 +- code/AssetLib/SMD/SMDLoader.cpp | 2 +- code/AssetLib/X/XFileImporter.cpp | 2 +- code/AssetLib/X3D/X3DExporter.cpp | 6 +++--- code/Common/BaseImporter.cpp | 2 +- code/Common/SGSpatialSort.cpp | 4 ++-- code/Common/SpatialSort.cpp | 4 ++-- code/PostProcessing/RemoveVCProcess.cpp | 2 +- code/PostProcessing/ScaleProcess.cpp | 2 +- code/PostProcessing/SplitLargeMeshes.cpp | 2 +- code/PostProcessing/TextureTransform.cpp | 4 ++-- doc/dox.h | 10 +++++----- include/assimp/ByteSwapper.h | 2 +- include/assimp/LogAux.h | 2 +- include/assimp/MemoryIOWrapper.h | 2 +- include/assimp/StreamReader.h | 2 +- include/assimp/Vertex.h | 6 +++--- include/assimp/cexport.h | 2 +- include/assimp/postprocess.h | 2 +- samples/SimpleAssimpViewX/MyDocument.h | 2 +- samples/SimpleOpenGL/Sample_SimpleOpenGL.c | 2 +- .../SimpleTexturedDirectx11/main.cpp | 2 +- .../SimpleTexturedOpenGL/src/model_loading.cpp | 2 +- test/unit/ImportExport/MDL/utMDLImporter_HL1_Nodes.cpp | 2 +- test/unit/utTriangulate.cpp | 2 +- tools/assimp_cmd/Info.cpp | 2 +- tools/assimp_view/Display.cpp | 4 ++-- tools/assimp_view/Material.cpp | 2 +- tools/assimp_view/MessageProc.cpp | 4 ++-- tools/assimp_view/SceneAnimator.h | 2 +- tools/assimp_view/assimp_view.cpp | 2 +- 56 files changed, 81 insertions(+), 81 deletions(-) diff --git a/code/AssetLib/3DS/3DSHelper.h b/code/AssetLib/3DS/3DSHelper.h index 933795f65..3a5479de2 100644 --- a/code/AssetLib/3DS/3DSHelper.h +++ b/code/AssetLib/3DS/3DSHelper.h @@ -259,7 +259,7 @@ namespace Discreet3DS { // Specifies the file name of a texture CHUNK_MAPFILE = 0xA300, - // Specifies whether a materail requires two-sided rendering + // Specifies whether a material requires two-sided rendering CHUNK_MAT_TWO_SIDE = 0xA081, // ******************************************************************** diff --git a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp index d56d6681d..3674f3d25 100644 --- a/code/AssetLib/AMF/AMFImporter_Postprocess.cpp +++ b/code/AssetLib/AMF/AMFImporter_Postprocess.cpp @@ -690,7 +690,7 @@ void AMFImporter::Postprocess_BuildConstellation(AMFConstellation &pConstellatio if (ne->Type == AMFNodeElementBase::ENET_Metadata) continue; if (ne->Type != AMFNodeElementBase::ENET_Instance) throw DeadlyImportError("Only nodes can be in ."); - // create alias for conveniance + // create alias for convenience AMFInstance &als = *((AMFInstance *)ne); // find referenced object if (!Find_ConvertedNode(als.ObjectID, nodeArray, &found_node)) Throw_ID_NotFound(als.ObjectID); diff --git a/code/AssetLib/ASE/ASELoader.cpp b/code/AssetLib/ASE/ASELoader.cpp index 2be103321..fae441f57 100644 --- a/code/AssetLib/ASE/ASELoader.cpp +++ b/code/AssetLib/ASE/ASELoader.cpp @@ -681,7 +681,7 @@ void ASEImporter::BuildNodes(std::vector &nodes) { } } - // Are there ane orphaned nodes? + // Are there any orphaned nodes? if (!aiList.empty()) { std::vector apcNodes; apcNodes.reserve(aiList.size() + pcScene->mRootNode->mNumChildren); diff --git a/code/AssetLib/Assbin/AssbinLoader.cpp b/code/AssetLib/Assbin/AssbinLoader.cpp index d94407e03..5ca4b3e11 100644 --- a/code/AssetLib/Assbin/AssbinLoader.cpp +++ b/code/AssetLib/Assbin/AssbinLoader.cpp @@ -406,7 +406,7 @@ void AssbinImporter::ReadBinaryMesh(IOStream *stream, aiMesh *mesh) { f.mIndices = new unsigned int[f.mNumIndices]; for (unsigned int a = 0; a < f.mNumIndices; ++a) { - // Check if unsigned short ( 16 bit ) are big enought for the indices + // Check if unsigned short ( 16 bit ) are big enough for the indices if (fitsIntoUI16(mesh->mNumVertices)) { f.mIndices[a] = Read(stream); } else { diff --git a/code/AssetLib/Assxml/AssxmlFileWriter.cpp b/code/AssetLib/Assxml/AssxmlFileWriter.cpp index 24fda5955..d16580a2e 100644 --- a/code/AssetLib/Assxml/AssxmlFileWriter.cpp +++ b/code/AssetLib/Assxml/AssxmlFileWriter.cpp @@ -168,7 +168,7 @@ static void WriteNode(const aiNode *node, IOStream *io, unsigned int depth) { } // ----------------------------------------------------------------------------------- -// Some chuncks of text will need to be encoded for XML +// Some chunks of text will need to be encoded for XML // http://stackoverflow.com/questions/5665231/most-efficient-way-to-escape-xml-html-in-c-string#5665377 static std::string encodeXML(const std::string &data) { std::string buffer; diff --git a/code/AssetLib/BVH/BVHLoader.cpp b/code/AssetLib/BVH/BVHLoader.cpp index 6d9069021..6dc824e2f 100644 --- a/code/AssetLib/BVH/BVHLoader.cpp +++ b/code/AssetLib/BVH/BVHLoader.cpp @@ -178,7 +178,7 @@ void BVHLoader::ReadHierarchy(aiScene *pScene) { } // ------------------------------------------------------------------------------------------------ -// Reads a node and recursively its childs and returns the created node; +// Reads a node and recursively its children and returns the created node; aiNode *BVHLoader::ReadNode() { // first token is name std::string nodeName = GetNextToken(); diff --git a/code/AssetLib/BVH/BVHLoader.h b/code/AssetLib/BVH/BVHLoader.h index a66a20275..70511483d 100644 --- a/code/AssetLib/BVH/BVHLoader.h +++ b/code/AssetLib/BVH/BVHLoader.h @@ -112,7 +112,7 @@ protected: /** Reads the hierarchy */ void ReadHierarchy(aiScene *pScene); - /** Reads a node and recursively its childs and returns the created node. */ + /** Reads a node and recursively its children and returns the created node. */ aiNode *ReadNode(); /** Reads an end node and returns the created node. */ diff --git a/code/AssetLib/Blender/BlenderDNA.h b/code/AssetLib/Blender/BlenderDNA.h index f566554b8..871ee71a1 100644 --- a/code/AssetLib/Blender/BlenderDNA.h +++ b/code/AssetLib/Blender/BlenderDNA.h @@ -476,7 +476,7 @@ public: * in BlenderScene.cpp and is machine-generated. * Converters are used to quickly handle objects whose * exact data type is a runtime-property and not yet - * known at compile time (consier Object::data).*/ + * known at compile time (consider Object::data).*/ void RegisterConverters(); // -------------------------------------------------------- diff --git a/code/AssetLib/COB/COBLoader.cpp b/code/AssetLib/COB/COBLoader.cpp index 88aa88773..647f49052 100644 --- a/code/AssetLib/COB/COBLoader.cpp +++ b/code/AssetLib/COB/COBLoader.cpp @@ -586,7 +586,7 @@ void COBImporter::ReadUnit_Ascii(Scene &out, LineSplitter &splitter, const Chunk return; } - // parent chunks preceede their childs, so we should have the + // parent chunks preceede their children, so we should have the // corresponding chunk already. for (std::shared_ptr &nd : out.nodes) { if (nd->id == nfo.parent_id) { @@ -668,7 +668,7 @@ void COBImporter::ReadCame_Ascii(Scene &out, LineSplitter &splitter, const Chunk ReadBasicNodeInfo_Ascii(msh, ++splitter, nfo); - // skip the next line, we don't know this differenciation between a + // skip the next line, we don't know this differentiation between a // standard camera and a panoramic camera. ++splitter; } @@ -1169,7 +1169,7 @@ void COBImporter::ReadUnit_Binary(COB::Scene &out, StreamReaderLE &reader, const const chunk_guard cn(nfo, reader); - // parent chunks preceede their childs, so we should have the + // parent chunks preceede their children, so we should have the // corresponding chunk already. for (std::shared_ptr &nd : out.nodes) { if (nd->id == nfo.parent_id) { diff --git a/code/AssetLib/FBX/FBXConverter.cpp b/code/AssetLib/FBX/FBXConverter.cpp index fa7ee3986..c025e8954 100644 --- a/code/AssetLib/FBX/FBXConverter.cpp +++ b/code/AssetLib/FBX/FBXConverter.cpp @@ -1595,7 +1595,7 @@ void FBXConverter::ConvertCluster(std::vector &local_mesh_bones, const bone_map.insert(std::pair(deformer_name, bone)); } - ASSIMP_LOG_DEBUG("bone research: Indicies size: ", out_indices.size()); + ASSIMP_LOG_DEBUG("bone research: Indices size: ", out_indices.size()); // lookup must be populated in case something goes wrong // this also allocates bones to mesh instance outside diff --git a/code/AssetLib/FBX/FBXDocument.h b/code/AssetLib/FBX/FBXDocument.h index 1ee526368..eeb173cd0 100644 --- a/code/AssetLib/FBX/FBXDocument.h +++ b/code/AssetLib/FBX/FBXDocument.h @@ -693,7 +693,7 @@ private: typedef std::vector KeyTimeList; typedef std::vector KeyValueList; -/** Represents a FBX animation curve (i.e. a 1-dimensional set of keyframes and values therefor) */ +/** Represents a FBX animation curve (i.e. a 1-dimensional set of keyframes and values therefore) */ class AnimationCurve : public Object { public: AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc); diff --git a/code/AssetLib/FBX/FBXExporter.cpp b/code/AssetLib/FBX/FBXExporter.cpp index f4a3017d8..66e14c75c 100644 --- a/code/AssetLib/FBX/FBXExporter.cpp +++ b/code/AssetLib/FBX/FBXExporter.cpp @@ -1709,7 +1709,7 @@ void FBXExporter::WriteObjects () //p.AddP70string("UVSet", ""); // TODO: how should this work? p.AddP70bool("UseMaterial", 1); tnode.AddChild(p); - // can't easily detrmine which texture path will be correct, + // can't easily determine which texture path will be correct, // so just store what we have in every field. // these being incorrect is a common problem with FBX anyway. tnode.AddChild("FileName", texture_path); @@ -1915,7 +1915,7 @@ void FBXExporter::WriteObjects () // mark all parent nodes as skeleton as well, // up until we find the root node, // or else the node containing the mesh, - // or else the parent of a node containig the mesh. + // or else the parent of a node containing the mesh. for ( const aiNode* parent = n->mParent; parent && parent != mScene->mRootNode; diff --git a/code/AssetLib/Irr/IRRLoader.cpp b/code/AssetLib/Irr/IRRLoader.cpp index c741159f6..b68671e0d 100644 --- a/code/AssetLib/Irr/IRRLoader.cpp +++ b/code/AssetLib/Irr/IRRLoader.cpp @@ -132,7 +132,7 @@ void IRRImporter::SetupProperties(const Importer *pImp) { } // ------------------------------------------------------------------------------------------------ -// Build a mesh tha consists of a single squad (a side of a skybox) +// Build a mesh that consists of a single squad (a side of a skybox) aiMesh *IRRImporter::BuildSingleQuadMesh(const SkyboxVertex &v1, const SkyboxVertex &v2, const SkyboxVertex &v3, diff --git a/code/AssetLib/M3D/M3DExporter.cpp b/code/AssetLib/M3D/M3DExporter.cpp index bcac1d98a..fdcf9c321 100644 --- a/code/AssetLib/M3D/M3DExporter.cpp +++ b/code/AssetLib/M3D/M3DExporter.cpp @@ -76,7 +76,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * Currently supports static meshes, vertex colors, materials, textures * * For animation, it would require the following conversions: - * - aiNode (bones) -> m3d_t.bone (with parent id, position vector and oriantation quaternion) + * - aiNode (bones) -> m3d_t.bone (with parent id, position vector and orientation quaternion) * - aiMesh.aiBone -> m3d_t.skin (per vertex, with bone id, weight pairs) * - aiAnimation -> m3d_action (frame with timestamp and list of bone id, position, orientation * triplets, instead of per bone timestamp + lists) diff --git a/code/AssetLib/M3D/M3DImporter.cpp b/code/AssetLib/M3D/M3DImporter.cpp index efa1d5475..d87944456 100644 --- a/code/AssetLib/M3D/M3DImporter.cpp +++ b/code/AssetLib/M3D/M3DImporter.cpp @@ -296,7 +296,7 @@ void M3DImporter::importMaterials(const M3DWrapper &m3d) { } // texture map properties if (m->prop[j].type >= 128 && aiTxProps[k].pKey && - // extra check, should never happen, do we have the refered texture? + // extra check, should never happen, do we have the referred texture? m->prop[j].value.textureid < m3d->numtexture && m3d->texture[m->prop[j].value.textureid].name) { name.Set(std::string(std::string(m3d->texture[m->prop[j].value.textureid].name) + ".png")); @@ -474,7 +474,7 @@ void M3DImporter::importMeshes(const M3DWrapper &m3d) { mScene->mMeshes = new aiMesh *[mScene->mNumMeshes]; std::copy(meshes->begin(), meshes->end(), mScene->mMeshes); - // create mesh indeces in root node + // create mesh indices in root node mScene->mRootNode->mNumMeshes = static_cast(meshes->size()); mScene->mRootNode->mMeshes = new unsigned int[meshes->size()]; for (i = 0; i < meshes->size(); i++) { @@ -688,7 +688,7 @@ void M3DImporter::calculateOffsetMatrix(aiNode *pNode, aiMatrix4x4 *m) { // ------------------------------------------------------------------------------------------------ // because M3D has a global mesh, global vertex ids and stores materialid on the face, we need -// temporary lists to collect data for an aiMesh, which requires local arrays and local indeces +// temporary lists to collect data for an aiMesh, which requires local arrays and local indices // this function fills up an aiMesh with those temporary lists void M3DImporter::populateMesh(const M3DWrapper &m3d, aiMesh *pMesh, std::vector *faces, std::vector *vertices, std::vector *normals, std::vector *texcoords, std::vector *colors, diff --git a/code/AssetLib/M3D/m3d.h b/code/AssetLib/M3D/m3d.h index 3adcd5bef..b148c11d7 100644 --- a/code/AssetLib/M3D/m3d.h +++ b/code/AssetLib/M3D/m3d.h @@ -59,7 +59,7 @@ extern "C" { #ifndef M3D_DOUBLE typedef float M3D_FLOAT; #ifndef M3D_EPSILON -/* carefully choosen for IEEE 754 don't change */ +/* carefully chosen for IEEE 754 don't change */ #define M3D_EPSILON ((M3D_FLOAT)1e-7) #endif #else @@ -121,7 +121,7 @@ typedef uint16_t M3D_INDEX; * TMAP texture map chunk (optional) * VRTS vertex data chunk (optional if it's a material library) * BONE bind-pose skeleton, bone hierarchy chunk (optional) - * n x m3db_t contains propably more, but at least one bone + * n x m3db_t contains probably more, but at least one bone * n x m3ds_t skin group records * MTRL* material chunk(s), can be more (optional) * n x m3dp_t each material contains propapbly more, but at least one property @@ -1109,7 +1109,7 @@ void _m3d_inv(M3D_FLOAT *m) { r[15] = det * (m[0] * (m[5] * m[10] - m[6] * m[9]) + m[1] * (m[6] * m[8] - m[4] * m[10]) + m[2] * (m[4] * m[9] - m[5] * m[8])); memcpy(m, &r, sizeof(r)); } -/* compose a coloumn major 4 x 4 matrix from vec3 position and vec4 orientation/rotation quaternion */ +/* compose a column major 4 x 4 matrix from vec3 position and vec4 orientation/rotation quaternion */ void _m3d_mat(M3D_FLOAT *r, m3dv_t *p, m3dv_t *q) { if (q->x == (M3D_FLOAT)0.0 && q->y == (M3D_FLOAT)0.0 && q->z >= (M3D_FLOAT)0.7071065 && q->z <= (M3D_FLOAT)0.7071075 && q->w == (M3D_FLOAT)0.0) { @@ -4033,7 +4033,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size out[len] = 0; } else { - /* stricly only use LF (newline) in binary */ + /* strictly only use LF (newline) in binary */ sd = _m3d_safestr(model->desc, 3); if (!sd) goto memerr; /* header */ @@ -4608,7 +4608,7 @@ unsigned char *m3d_save(m3d_t *model, int quality, int flags, unsigned int *size h = (m3dhdr_t *)z; } } - /* add file header at the begining */ + /* add file header at the beginning */ len += 8; out = (unsigned char *)M3D_MALLOC(len); if (!out) goto memerr; diff --git a/code/AssetLib/MD3/MD3FileData.h b/code/AssetLib/MD3/MD3FileData.h index a44f688f9..62b5fb706 100644 --- a/code/AssetLib/MD3/MD3FileData.h +++ b/code/AssetLib/MD3/MD3FileData.h @@ -271,7 +271,7 @@ inline void LatLngNormalToVec3(uint16_t p_iNormal, ai_real* p_afOut) // ------------------------------------------------------------------------------- -/** @brief Pack a Q3 normal into 16bit latitute/longitude representation +/** @brief Pack a Q3 normal into 16bit latitude/longitude representation * @param p_vIn Input vector * @param p_iOut Output normal * diff --git a/code/AssetLib/MD5/MD5Parser.cpp b/code/AssetLib/MD5/MD5Parser.cpp index a69275507..802c9becd 100644 --- a/code/AssetLib/MD5/MD5Parser.cpp +++ b/code/AssetLib/MD5/MD5Parser.cpp @@ -59,7 +59,7 @@ using namespace Assimp; using namespace Assimp::MD5; // ------------------------------------------------------------------------------------------------ -// Parse the segment structure fo a MD5 file +// Parse the segment structure for an MD5 file MD5Parser::MD5Parser(char *_buffer, unsigned int _fileSize) { ai_assert(nullptr != _buffer); ai_assert(0 != _fileSize); diff --git a/code/AssetLib/MDL/MDLMaterialLoader.cpp b/code/AssetLib/MDL/MDLMaterialLoader.cpp index fd287430b..f44896819 100644 --- a/code/AssetLib/MDL/MDLMaterialLoader.cpp +++ b/code/AssetLib/MDL/MDLMaterialLoader.cpp @@ -387,7 +387,7 @@ void MDLImporter::CreateTexture_3DGS_MDL5(const unsigned char *szData, // this should not occur - at least the docs say it shouldn't. // however, one can easily try out what MED does if you have // a model with a DDS texture and export it to MDL5 ... - // yeah, it embedds the DDS file. + // yeah, it embeds the DDS file. if (6 == iType) { // this is a compressed texture in DDS format *piSkip = pcNew->mWidth; @@ -524,7 +524,7 @@ void MDLImporter::ParseSkinLump_3DGS_MDL7( } // sometimes there are MDL7 files which have a monochrome - // texture instead of material colors ... posssible they have + // texture instead of material colors ... possible they have // been converted to MDL7 from other formats, such as MDL5 aiColor4D clrTexture; if (pcNew) diff --git a/code/AssetLib/MMD/MMDPmdParser.h b/code/AssetLib/MMD/MMDPmdParser.h index be8dad5c3..f9f555c6a 100644 --- a/code/AssetLib/MMD/MMDPmdParser.h +++ b/code/AssetLib/MMD/MMDPmdParser.h @@ -195,7 +195,7 @@ namespace pmd public: uint16_t ik_bone_index; uint16_t target_bone_index; - uint16_t interations; + uint16_t iterations; float angle_limit; std::vector ik_child_bone_index; @@ -205,7 +205,7 @@ namespace pmd stream->read((char *) &target_bone_index, sizeof(uint16_t)); uint8_t ik_chain_length; stream->read((char*) &ik_chain_length, sizeof(uint8_t)); - stream->read((char *) &interations, sizeof(uint16_t)); + stream->read((char *) &iterations, sizeof(uint16_t)); stream->read((char *) &angle_limit, sizeof(float)); ik_child_bone_index.resize(ik_chain_length); for (int i = 0; i < ik_chain_length; i++) diff --git a/code/AssetLib/MMD/MMDVmdParser.h b/code/AssetLib/MMD/MMDVmdParser.h index 53f1922b5..0ce24a48f 100644 --- a/code/AssetLib/MMD/MMDVmdParser.h +++ b/code/AssetLib/MMD/MMDVmdParser.h @@ -358,7 +358,7 @@ namespace vmd light_frames[i].Write(stream); } - // self shadow datas + // self shadow data const int self_shadow_num = 0; stream->write(reinterpret_cast(&self_shadow_num), sizeof(int)); diff --git a/code/AssetLib/OFF/OFFLoader.cpp b/code/AssetLib/OFF/OFFLoader.cpp index 8509d0c4d..644579bce 100644 --- a/code/AssetLib/OFF/OFFLoader.cpp +++ b/code/AssetLib/OFF/OFFLoader.cpp @@ -233,7 +233,7 @@ void OFFImporter::InternReadFile( const std::string& pFile, aiScene* pScene, IOS sz = fast_atoreal_move(sz, *vec[dim]); } - // if has homogenous coordinate, divide others by this one + // if has homogeneous coordinate, divide others by this one if (hasHomogenous) { SkipSpaces(&sz); ai_real w = 1.; diff --git a/code/AssetLib/Obj/ObjFileData.h b/code/AssetLib/Obj/ObjFileData.h index 92fe3a261..b14250020 100644 --- a/code/AssetLib/Obj/ObjFileData.h +++ b/code/AssetLib/Obj/ObjFileData.h @@ -233,7 +233,7 @@ struct Mesh { // ------------------------------------------------------------------------------------------------ //! \struct Model -//! \brief Data structure to store all obj-specific model datas +//! \brief Data structure to store all obj-specific model data // ------------------------------------------------------------------------------------------------ struct Model { using GroupMap = std::map *>; diff --git a/code/AssetLib/Ogre/OgreStructs.h b/code/AssetLib/Ogre/OgreStructs.h index c34546a74..1d43b09e9 100644 --- a/code/AssetLib/Ogre/OgreStructs.h +++ b/code/AssetLib/Ogre/OgreStructs.h @@ -555,7 +555,7 @@ public: should be 0 after this reset. */ void Reset(); - /// Covert to Assimp mesh. + /// Convert to Assimp mesh. aiMesh *ConvertToAssimpMesh(Mesh *parent); /// Vertex data. diff --git a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp index bbf689b60..94cf47e73 100644 --- a/code/AssetLib/OpenGEX/OpenGEXImporter.cpp +++ b/code/AssetLib/OpenGEX/OpenGEXImporter.cpp @@ -351,8 +351,8 @@ void OpenGEXImporter::handleNodes(DDLNode *node, aiScene *pScene) { return; } - DDLNode::DllNodeList childs = node->getChildNodeList(); - for (DDLNode::DllNodeList::iterator it = childs.begin(); it != childs.end(); ++it) { + DDLNode::DllNodeList children = node->getChildNodeList(); + for (DDLNode::DllNodeList::iterator it = children.begin(); it != children.end(); ++it) { Grammar::TokenType tokenType(Grammar::matchTokenType((*it)->getType().c_str())); switch (tokenType) { case Grammar::MetricToken: diff --git a/code/AssetLib/Q3BSP/Q3BSPFileData.h b/code/AssetLib/Q3BSP/Q3BSPFileData.h index a121cdbcd..c288af2fc 100644 --- a/code/AssetLib/Q3BSP/Q3BSPFileData.h +++ b/code/AssetLib/Q3BSP/Q3BSPFileData.h @@ -95,7 +95,7 @@ struct sQ3BSPVertex { vec3f vPosition; ///< Position of vertex vec2f vTexCoord; ///< (u,v) Texturecoordinate of detailtexture vec2f vLightmap; ///< (u,v) Texturecoordinate of lightmap - vec3f vNormal; ///< vertex normale + vec3f vNormal; ///< vertex normal unsigned char bColor[ 4 ]; ///< Color in RGBA }; diff --git a/code/AssetLib/SMD/SMDLoader.cpp b/code/AssetLib/SMD/SMDLoader.cpp index 90f0b7697..8d9c745b1 100644 --- a/code/AssetLib/SMD/SMDLoader.cpp +++ b/code/AssetLib/SMD/SMDLoader.cpp @@ -868,7 +868,7 @@ void SMDImporter::ParseNodeInfo(const char* szCurrent, const char** szCurrentOut bool bQuota = true; if ('\"' != *szCurrent) { - LogWarning("Bone name is expcted to be enclosed in " + LogWarning("Bone name is expected to be enclosed in " "double quotation marks. "); bQuota = false; } else { diff --git a/code/AssetLib/X/XFileImporter.cpp b/code/AssetLib/X/XFileImporter.cpp index 111bd0886..8a3047915 100644 --- a/code/AssetLib/X/XFileImporter.cpp +++ b/code/AssetLib/X/XFileImporter.cpp @@ -219,7 +219,7 @@ aiNode* XFileImporter::CreateNodes( aiScene* pScene, aiNode* pParent, const XFil // convert meshes from the source node CreateMeshes( pScene, node, pNode->mMeshes); - // handle childs + // handle children if( !pNode->mChildren.empty() ) { node->mNumChildren = (unsigned int)pNode->mChildren.size(); node->mChildren = new aiNode* [node->mNumChildren]; diff --git a/code/AssetLib/X3D/X3DExporter.cpp b/code/AssetLib/X3D/X3DExporter.cpp index 7404bc760..b3278a528 100644 --- a/code/AssetLib/X3D/X3DExporter.cpp +++ b/code/AssetLib/X3D/X3DExporter.cpp @@ -279,7 +279,7 @@ void X3DExporter::Export_Mesh(const size_t pIdxMesh, const size_t pTabLevel) { const char *NodeName_Shape = "Shape"; list attr_list; - aiMesh &mesh = *mScene->mMeshes[pIdxMesh]; // create alias for conveniance. + aiMesh &mesh = *mScene->mMeshes[pIdxMesh]; // create alias for convenience. // Check if mesh already defined early. if (mDEF_Map_Mesh.find(pIdxMesh) != mDEF_Map_Mesh.end()) { @@ -375,7 +375,7 @@ void X3DExporter::Export_Material(const size_t pIdxMaterial, const size_t pTabLe const char *NodeName_A = "Appearance"; list attr_list; - aiMaterial &material = *mScene->mMaterials[pIdxMaterial]; // create alias for conveniance. + aiMaterial &material = *mScene->mMaterials[pIdxMaterial]; // create alias for convenience. // Check if material already defined early. if (mDEF_Map_Material.find(pIdxMaterial) != mDEF_Map_Material.end()) { @@ -586,7 +586,7 @@ bool X3DExporter::CheckAndExport_Light(const aiNode &pNode, const size_t pTabLev if (!found) return false; // Light source is found. - const aiLight &light = *mScene->mLights[idx_light]; // Alias for conveniance. + const aiLight &light = *mScene->mLights[idx_light]; // Alias for convenience. aiMatrix4x4 trafo_mat = Matrix_GlobalToCurrent(pNode).Inverse(); diff --git a/code/Common/BaseImporter.cpp b/code/Common/BaseImporter.cpp index fa6cac938..d7e24afab 100644 --- a/code/Common/BaseImporter.cpp +++ b/code/Common/BaseImporter.cpp @@ -207,7 +207,7 @@ void BaseImporter::GetExtensionList(std::set &extensions) { if (!r) { continue; } - // We need to make sure that we didn't accidentially identify the end of another token as our token, + // We need to make sure that we didn't accidentally identify the end of another token as our token, // e.g. in a previous version the "gltf " present in some gltf files was detected as "f " if (noAlphaBeforeTokens && (r != buffer && isalpha(static_cast(r[-1])))) { continue; diff --git a/code/Common/SGSpatialSort.cpp b/code/Common/SGSpatialSort.cpp index 0475bce6e..78b869260 100644 --- a/code/Common/SGSpatialSort.cpp +++ b/code/Common/SGSpatialSort.cpp @@ -52,7 +52,7 @@ using namespace Assimp; // ------------------------------------------------------------------------------------------------ SGSpatialSort::SGSpatialSort() { - // define the reference plane. We choose some arbitrary vector away from all basic axises + // define the reference plane. We choose some arbitrary vector away from all basic axes // in the hope that no model spreads all its vertices along this plane. mPlaneNormal.Set( 0.8523f, 0.34321f, 0.5736f); mPlaneNormal.Normalize(); @@ -121,7 +121,7 @@ void SGSpatialSort::FindPositions( const aiVector3D& pPosition, index++; // Mow start iterating from there until the first position lays outside of the distance range. - // Add all positions inside the distance range within the given radius to the result aray + // Add all positions inside the distance range within the given radius to the result array float squareEpsilon = pRadius * pRadius; std::vector::const_iterator it = mPositions.begin() + index; diff --git a/code/Common/SpatialSort.cpp b/code/Common/SpatialSort.cpp index 66ca2ffc6..2bd848164 100644 --- a/code/Common/SpatialSort.cpp +++ b/code/Common/SpatialSort.cpp @@ -55,7 +55,7 @@ const aiVector3D PlaneInit(0.8523f, 0.34321f, 0.5736f); // ------------------------------------------------------------------------------------------------ // Constructs a spatially sorted representation from the given position array. -// define the reference plane. We choose some arbitrary vector away from all basic axises +// define the reference plane. We choose some arbitrary vector away from all basic axes // in the hope that no model spreads all its vertices along this plane. SpatialSort::SpatialSort(const aiVector3D *pPositions, unsigned int pNumPositions, unsigned int pElementOffset) : mPlaneNormal(PlaneInit) { @@ -148,7 +148,7 @@ void SpatialSort::FindPositions(const aiVector3D &pPosition, index++; // Mow start iterating from there until the first position lays outside of the distance range. - // Add all positions inside the distance range within the given radius to the result aray + // Add all positions inside the distance range within the given radius to the result array std::vector::const_iterator it = mPositions.begin() + index; const ai_real pSquared = pRadius * pRadius; while (it->mDistance < maxDist) { diff --git a/code/PostProcessing/RemoveVCProcess.cpp b/code/PostProcessing/RemoveVCProcess.cpp index 43be09196..9ee1da15c 100644 --- a/code/PostProcessing/RemoveVCProcess.cpp +++ b/code/PostProcessing/RemoveVCProcess.cpp @@ -67,7 +67,7 @@ bool RemoveVCProcess::IsActive(unsigned int pFlags) const { } // ------------------------------------------------------------------------------------------------ -// Small helper function to delete all elements in a T** aray using delete +// Small helper function to delete all elements in a T** array using delete template inline void ArrayDelete(T **&in, unsigned int &num) { for (unsigned int i = 0; i < num; ++i) diff --git a/code/PostProcessing/ScaleProcess.cpp b/code/PostProcessing/ScaleProcess.cpp index 63dd0443d..8fb3dc903 100644 --- a/code/PostProcessing/ScaleProcess.cpp +++ b/code/PostProcessing/ScaleProcess.cpp @@ -118,7 +118,7 @@ void ScaleProcess::Execute( aiScene* pScene ) { { aiMesh *mesh = pScene->mMeshes[meshID]; - // Reconstruct mesh vertexes to the new unit system + // Reconstruct mesh vertices to the new unit system for( unsigned int vertexID = 0; vertexID < mesh->mNumVertices; vertexID++) { aiVector3D& vertex = mesh->mVertices[vertexID]; diff --git a/code/PostProcessing/SplitLargeMeshes.cpp b/code/PostProcessing/SplitLargeMeshes.cpp index cb614edaa..b601a1331 100644 --- a/code/PostProcessing/SplitLargeMeshes.cpp +++ b/code/PostProcessing/SplitLargeMeshes.cpp @@ -129,7 +129,7 @@ void SplitLargeMeshesProcess_Triangle::UpdateNode(aiNode* pcNode, pcNode->mMeshes[b] = aiEntries[b]; } - // recusively update all other nodes + // recursively update all other nodes for (unsigned int i = 0; i < pcNode->mNumChildren;++i) { UpdateNode ( pcNode->mChildren[i], avList ); } diff --git a/code/PostProcessing/TextureTransform.cpp b/code/PostProcessing/TextureTransform.cpp index 74b00d92c..1cb7f293e 100644 --- a/code/PostProcessing/TextureTransform.cpp +++ b/code/PostProcessing/TextureTransform.cpp @@ -178,7 +178,7 @@ void TextureTransformStep::PreProcessUVTransform(STransformVecInfo& info) } else if (aiTextureMapMode_Clamp == info.mapV || aiTextureMapMode_Decal == info.mapV) { // Clamp - translations beyond 1,1 are senseless - ::ai_snprintf(szTemp,512,"[c] UV V offset %f canbe clamped to 1.0f",info.mTranslation.y); + ::ai_snprintf(szTemp,512,"[c] UV V offset %f can be clamped to 1.0f",info.mTranslation.y); out = 1.f; } @@ -539,7 +539,7 @@ void TextureTransformStep::Execute( aiScene* pScene) m5.a3 += trl.x; m5.b3 += trl.y; matrix = m2 * m4 * matrix * m3 * m5; - for (src = dest; src != end; ++src) { /* manual homogenious divide */ + for (src = dest; src != end; ++src) { /* manual homogeneous divide */ src->z = 1.f; *src = matrix * *src; src->x /= src->z; diff --git a/doc/dox.h b/doc/dox.h index 409e775d4..1d5f59aa4 100644 --- a/doc/dox.h +++ b/doc/dox.h @@ -85,7 +85,7 @@ as long as you retain the license information and take own responsibility for wh the LICENSE file. You can find test models for almost all formats in the /test/models directory. Beware, they're *free*, -but not all of them are *open-source*. If there's an accompagning '\source.txt' file don't forget to read it. +but not all of them are *open-source*. If there's an accompanying '\source.txt' file don't forget to read it. @section main_install Installation @@ -687,7 +687,7 @@ There are two cases: format such as DDS or PNG. The term "compressed" does not mean that the texture data must actually be compressed, however the texture was found in the model file as if it was stored in a separate file on the harddisk. Appropriate decoders (such as libjpeg, libpng, D3DX, DevIL) are - required to load theses textures. aiTexture::mWidth specifies the size of the texture data in + required to load these textures. aiTexture::mWidth specifies the size of the texture data in bytes, aiTexture::pcData is a pointer to the raw image data and aiTexture::achFormatHint is either zeroed or contains the most common file extension of the embedded texture's format. This value is only set if assimp is able to determine the file format. @@ -1181,7 +1181,7 @@ You can get assigned shader sources by using the following material keys:
  • AI_MATKEY_SHADER_VERTEX
  • Assigned vertex shader code stored as a string.
  • AI_MATKEY_SHADER_FRAGMENT
  • Assigned fragment shader code stored as a string.
  • AI_MATKEY_SHADER_GEO
  • Assigned geometry shader code stored as a string. -
  • AI_MATKEY_SHADER_TESSELATION
  • Assigned tesselation shader code stored as a string. +
  • AI_MATKEY_SHADER_TESSELATION
  • Assigned tessellation shader code stored as a string.
  • AI_MATKEY_SHADER_PRIMITIVE
  • Assigned primitive shader code stored as a string.
  • AI_MATKEY_SHADER_COMPUTE
  • Assigned compute shader code stored as a string. @@ -1359,7 +1359,7 @@ When filing bugs on the Blender loader, always give the Blender version (or, eve This section contains implementation notes on the IFC-STEP importer. @subsection ifc_overview Overview -The library provides a partial implementation of the IFC2x3 industry standard for automatized exchange of CAE/architectural +The library provides a partial implementation of the IFC2x3 industry standard for automated exchange of CAE/architectural data sets. See http://en.wikipedia.org/wiki/Industry_Foundation_Classes for more information on the format. We aim at getting as much 3D data out of the files as possible. @@ -1503,7 +1503,7 @@ like Windows and Linux ( 32 bit and 64 bit ).
  • Provide some _free_ test models in <root>/test/models/<FormatName>/ and credit their authors. -Test files for a file format shouldn't be too large (~500 KiB in total), and not too repetive. Try to cover all format features with test data. +Test files for a file format shouldn't be too large (~500 KiB in total), and not too repetitive. Try to cover all format features with test data.
  • Done! Please, share your loader that everyone can profit from it! diff --git a/include/assimp/ByteSwapper.h b/include/assimp/ByteSwapper.h index 9e1eea10f..94df04b7f 100644 --- a/include/assimp/ByteSwapper.h +++ b/include/assimp/ByteSwapper.h @@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---------------------------------------------------------------------- */ -/** @file Helper class tp perform various byte oder swappings +/** @file Helper class tp perform various byte order swappings (e.g. little to big endian) */ #pragma once #ifndef AI_BYTESWAPPER_H_INC diff --git a/include/assimp/LogAux.h b/include/assimp/LogAux.h index 70e07790e..01a7d6375 100644 --- a/include/assimp/LogAux.h +++ b/include/assimp/LogAux.h @@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. namespace Assimp { -/// @brief Logger class, which will exten the class by log-functions. +/// @brief Logger class, which will extend the class by log-functions. /// @tparam TDeriving template class LogFunctions { diff --git a/include/assimp/MemoryIOWrapper.h b/include/assimp/MemoryIOWrapper.h index 24f6a85d1..0e509d997 100644 --- a/include/assimp/MemoryIOWrapper.h +++ b/include/assimp/MemoryIOWrapper.h @@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** @file MemoryIOWrapper.h - * Handy IOStream/IOSystem implemetation to read directly from a memory buffer */ + * Handy IOStream/IOSystem implementation to read directly from a memory buffer */ #pragma once #ifndef AI_MEMORYIOSTREAM_H_INC #define AI_MEMORYIOSTREAM_H_INC diff --git a/include/assimp/StreamReader.h b/include/assimp/StreamReader.h index 1880f66b6..c6c17762d 100644 --- a/include/assimp/StreamReader.h +++ b/include/assimp/StreamReader.h @@ -207,7 +207,7 @@ public: // --------------------------------------------------------------------- /** Set current file pointer (Get it from #GetPtr). This is if you - * prefer to do pointer arithmetics on your own or want to copy + * prefer to do pointer arithmetic on your own or want to copy * large chunks of data at once. * @param p The new pointer, which is validated against the size * limit and buffer boundaries. */ diff --git a/include/assimp/Vertex.h b/include/assimp/Vertex.h index e749e3633..ad5ff476c 100644 --- a/include/assimp/Vertex.h +++ b/include/assimp/Vertex.h @@ -93,7 +93,7 @@ namespace Assimp { // ------------------------------------------------------------------------------------------------ /** Intermediate description a vertex with all possible components. Defines a full set of - * operators, so you may use such a 'Vertex' in basic arithmetics. All operators are applied + * operators, so you may use such a 'Vertex' in basic arithmetic. All operators are applied * to *all* vertex components equally. This is useful for stuff like interpolation * or subdivision, but won't work if special handling is required for some vertex components. */ // ------------------------------------------------------------------------------------------------ @@ -222,7 +222,7 @@ private: } // ---------------------------------------------------------------------------- - /** This time binary arithmetics of v0 with a floating-point number */ + /** This time binary arithmetic of v0 with a floating-point number */ template