Consistent naming of unlit extension use.
This commit is contained in:
parent
8ab9459d6a
commit
a3989249f3
|
@ -909,8 +909,8 @@ ModelData *Raw2Gltf(
|
|||
simpleTex(RAW_TEXTURE_USAGE_SPECULAR).get(), specularFactor));
|
||||
}
|
||||
|
||||
std::shared_ptr<KHRCmnConstantMaterial> khrCmnConstantMat;
|
||||
if (options.useKHRMatCmnConstant) {
|
||||
std::shared_ptr<KHRCmnUnlitMaterial> khrCmnUnlitMat;
|
||||
if (options.useKHRMatUnlit) {
|
||||
normalTexture = nullptr;
|
||||
|
||||
emissiveTexture = nullptr;
|
||||
|
@ -931,7 +931,7 @@ ModelData *Raw2Gltf(
|
|||
|
||||
pbrMetRough.reset(new PBRMetallicRoughness(baseColorTex.get(), nullptr, diffuseFactor, 0.0f, 1.0f));
|
||||
|
||||
khrCmnConstantMat.reset(new KHRCmnConstantMaterial());
|
||||
khrCmnUnlitMat.reset(new KHRCmnUnlitMaterial());
|
||||
}
|
||||
|
||||
std::shared_ptr<MaterialData> mData = gltf->materials.hold(
|
||||
|
@ -939,7 +939,7 @@ ModelData *Raw2Gltf(
|
|||
material.name, isTransparent,
|
||||
normalTexture, emissiveTexture,
|
||||
emissiveFactor * emissiveIntensity,
|
||||
khrComMat, khrCmnConstantMat, pbrMetRough, pbrSpecGloss));
|
||||
khrComMat, khrCmnUnlitMat, pbrMetRough, pbrSpecGloss));
|
||||
materialsByName[materialHash(material)] = mData;
|
||||
}
|
||||
|
||||
|
@ -1216,8 +1216,8 @@ ModelData *Raw2Gltf(
|
|||
extensionsRequired.push_back(KHR_MATERIALS_COMMON);
|
||||
}
|
||||
}
|
||||
if (options.useKHRMatCmnConstant) {
|
||||
extensionsUsed.push_back(KHR_MATERIALS_CMN_CONSTANT);
|
||||
if (options.useKHRMatUnlit) {
|
||||
extensionsUsed.push_back(KHR_MATERIALS_CMN_UNLIT);
|
||||
}
|
||||
if (options.usePBRSpecGloss) {
|
||||
extensionsUsed.push_back(KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS);
|
||||
|
|
|
@ -30,7 +30,7 @@ using json = nlohmann::basic_json<workaround_fifo_map>;
|
|||
|
||||
static const std::string KHR_DRACO_MESH_COMPRESSION = "KHR_draco_mesh_compression";
|
||||
static const std::string KHR_MATERIALS_COMMON = "KHR_materials_common";
|
||||
static const std::string KHR_MATERIALS_CMN_CONSTANT = "KHR_materials_unlit";
|
||||
static const std::string KHR_MATERIALS_CMN_UNLIT = "KHR_materials_unlit";
|
||||
static const std::string KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS = "KHR_materials_pbrSpecularGlossiness";
|
||||
|
||||
static const std::string extBufferFilename = "buffer.bin";
|
||||
|
@ -55,8 +55,8 @@ struct GltfOptions
|
|||
bool useDraco;
|
||||
/** Whether to use KHR_materials_common to extend materials definitions. */
|
||||
bool useKHRMatCom;
|
||||
/** Whether to use KHR_materials_cmnConstant to extend materials definitions. */
|
||||
bool useKHRMatCmnConstant;
|
||||
/** Whether to use KHR_materials_unlit to extend materials definitions. */
|
||||
bool useKHRMatUnlit;
|
||||
/** Whether to populate the pbrMetallicRoughness substruct in materials. */
|
||||
bool usePBRMetRough;
|
||||
/** Whether to use KHR_materials_pbrSpecularGlossiness to extend material definitions. */
|
||||
|
|
|
@ -93,11 +93,11 @@ void to_json(json &j, const KHRCommonMats &d)
|
|||
}
|
||||
}
|
||||
|
||||
KHRCmnConstantMaterial::KHRCmnConstantMaterial()
|
||||
KHRCmnUnlitMaterial::KHRCmnUnlitMaterial()
|
||||
{
|
||||
}
|
||||
|
||||
void to_json(json &j, const KHRCmnConstantMaterial &d)
|
||||
void to_json(json &j, const KHRCmnUnlitMaterial &d)
|
||||
{
|
||||
j = json({});
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ MaterialData::MaterialData(
|
|||
std::string name, bool isTransparent, const TextureData *normalTexture,
|
||||
const TextureData *emissiveTexture, const Vec3f & emissiveFactor,
|
||||
std::shared_ptr<KHRCommonMats> const khrCommonMats,
|
||||
std::shared_ptr<KHRCmnConstantMaterial> const khrCmnConstantMaterial,
|
||||
std::shared_ptr<KHRCmnUnlitMaterial> const khrCmnConstantMaterial,
|
||||
std::shared_ptr<PBRMetallicRoughness> const pbrMetallicRoughness,
|
||||
std::shared_ptr<PBRSpecularGlossiness> const pbrSpecularGlossiness)
|
||||
: Holdable(),
|
||||
|
@ -209,7 +209,7 @@ json MaterialData::serialize() const
|
|||
extensions[KHR_MATERIALS_COMMON] = *khrCommonMats;
|
||||
}
|
||||
if (khrCmnConstantMaterial != nullptr) {
|
||||
extensions[KHR_MATERIALS_CMN_CONSTANT] = *khrCmnConstantMaterial;
|
||||
extensions[KHR_MATERIALS_CMN_UNLIT] = *khrCmnConstantMaterial;
|
||||
}
|
||||
if (pbrSpecularGlossiness != nullptr) {
|
||||
extensions[KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS] = *pbrSpecularGlossiness;
|
||||
|
|
|
@ -53,9 +53,9 @@ struct KHRCommonMats
|
|||
const Vec3f specularFactor;
|
||||
};
|
||||
|
||||
struct KHRCmnConstantMaterial
|
||||
struct KHRCmnUnlitMaterial
|
||||
{
|
||||
KHRCmnConstantMaterial();
|
||||
KHRCmnUnlitMaterial();
|
||||
};
|
||||
|
||||
struct PBRSpecularGlossiness
|
||||
|
@ -91,7 +91,7 @@ struct MaterialData : Holdable
|
|||
std::string name, bool isTransparent, const TextureData *normalTexture,
|
||||
const TextureData *emissiveTexture, const Vec3f &emissiveFactor,
|
||||
std::shared_ptr<KHRCommonMats> const khrCommonMats,
|
||||
std::shared_ptr<KHRCmnConstantMaterial> const khrCmnConstantMaterial,
|
||||
std::shared_ptr<KHRCmnUnlitMaterial> const khrCmnConstantMaterial,
|
||||
std::shared_ptr<PBRMetallicRoughness> const pbrMetallicRoughness,
|
||||
std::shared_ptr<PBRSpecularGlossiness> const pbrSpecularGlossiness);
|
||||
|
||||
|
@ -104,14 +104,14 @@ struct MaterialData : Holdable
|
|||
const Vec3f emissiveFactor;
|
||||
|
||||
const std::shared_ptr<const KHRCommonMats> khrCommonMats;
|
||||
const std::shared_ptr<const KHRCmnConstantMaterial> khrCmnConstantMaterial;
|
||||
const std::shared_ptr<const KHRCmnUnlitMaterial> khrCmnConstantMaterial;
|
||||
const std::shared_ptr<const PBRMetallicRoughness> pbrMetallicRoughness;
|
||||
const std::shared_ptr<const PBRSpecularGlossiness> pbrSpecularGlossiness;
|
||||
};
|
||||
|
||||
void to_json(json &j, const Tex &data);
|
||||
void to_json(json &j, const KHRCommonMats &d);
|
||||
void to_json(json &j, const KHRCmnConstantMaterial &d);
|
||||
void to_json(json &j, const KHRCmnUnlitMaterial &d);
|
||||
void to_json(json &j, const PBRSpecularGlossiness &d);
|
||||
void to_json(json &j, const PBRMetallicRoughness &d);
|
||||
|
||||
|
|
18
src/main.cpp
18
src/main.cpp
|
@ -48,7 +48,7 @@ int main(int argc, char *argv[])
|
|||
false, // embedResources
|
||||
false, // useDraco
|
||||
false, // useKHRMatCom
|
||||
false, // useKHRMatCmnConstant
|
||||
false, // useKHRMatUnlit
|
||||
false, // usePBRMetRough
|
||||
false, // usePBRSpecGloss
|
||||
false, // useBlendShapeNormals
|
||||
|
@ -76,14 +76,14 @@ int main(int argc, char *argv[])
|
|||
("flip-v", "Flip all V texture coordinates (default behaviour!)")
|
||||
("no-flip-v", "Suppress the default flipping of V texture coordinates")
|
||||
(
|
||||
"khr-materials-common", "(WIP) Use KHR_materials_common extensions to specify Unlit/Lambert/Blinn/Phong shaders.",
|
||||
cxxopts::value<bool>(gltfOptions.useKHRMatCom))
|
||||
(
|
||||
"khr-materials-cmnConstant", "(WIP) Use KHR_materials_cmnConstant extension to specify Unlit shader.",
|
||||
cxxopts::value<bool>(gltfOptions.useKHRMatCmnConstant))
|
||||
(
|
||||
"pbr-metallic-roughness", "(WIP) Try to glean glTF 2.0 native PBR attributes from the FBX.",
|
||||
"pbr-metallic-roughness", "Try to glean glTF 2.0 native PBR attributes from the FBX.",
|
||||
cxxopts::value<bool>(gltfOptions.usePBRMetRough))
|
||||
(
|
||||
"khr-materials-unlit", "Use KHR_materials_unlit extension to specify Unlit shader.",
|
||||
cxxopts::value<bool>(gltfOptions.useKHRMatUnlit))
|
||||
(
|
||||
"khr-materials-common", "(WIP) Use KHR_materials_common extensions to specify Lambert/Blinn/Phong shaders.",
|
||||
cxxopts::value<bool>(gltfOptions.useKHRMatCom))
|
||||
(
|
||||
"pbr-specular-glossiness", "(WIP) Experimentally fill in the KHR_materials_pbrSpecularGlossiness extension.",
|
||||
cxxopts::value<bool>(gltfOptions.usePBRSpecGloss))
|
||||
|
@ -133,7 +133,7 @@ Copyright (c) 2016-2017 Oculus VR, LLC.
|
|||
verboseOutput = true;
|
||||
}
|
||||
|
||||
if (!gltfOptions.useKHRMatCmnConstant && !gltfOptions.useKHRMatCom && !gltfOptions.usePBRSpecGloss && !gltfOptions.usePBRMetRough) {
|
||||
if (!gltfOptions.useKHRMatUnlit && !gltfOptions.useKHRMatCom && !gltfOptions.usePBRSpecGloss && !gltfOptions.usePBRMetRough) {
|
||||
if (verboseOutput) {
|
||||
fmt::printf("Defaulting to --pbr-metallic-roughness material support.\n");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue