mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 07:31:23 +02:00
CR changes
This commit is contained in:
parent
0145b770da
commit
514eea5477
3 changed files with 13 additions and 24 deletions
|
@ -179,7 +179,7 @@ public:
|
||||||
float emissiveIntensity{ 1.0f };
|
float emissiveIntensity{ 1.0f };
|
||||||
float ambientFactor{ 1.0f };
|
float ambientFactor{ 1.0f };
|
||||||
|
|
||||||
float bumpMultiplier{ 1.0f }; // TODO: to be implemented
|
float bumpMultiplier { 1.0f }; // TODO: to be implemented
|
||||||
|
|
||||||
QString materialID;
|
QString materialID;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
|
@ -389,10 +389,8 @@ void OBJReader::parseTextureLine(const QByteArray& textureLine, QByteArray& file
|
||||||
QString parser = textureLine;
|
QString parser = textureLine;
|
||||||
while (parser.length() > 0) {
|
while (parser.length() > 0) {
|
||||||
if (parser.startsWith("-blend")) { // -blendu/-blendv
|
if (parser.startsWith("-blend")) { // -blendu/-blendv
|
||||||
parser.remove(0, 11); // remove through "-blendu on " or "-blendu off"
|
int removeLength = parser[10] == 'f' ? 12 : 11;
|
||||||
if (parser[0] == ' ') { // extra character for space after off
|
parser.remove(0, removeLength); // remove through "-blendu on " or "-blendu off"
|
||||||
parser.remove(0, 1);
|
|
||||||
}
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -blendu/-blendv";
|
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -blendu/-blendv";
|
||||||
#endif
|
#endif
|
||||||
|
@ -407,18 +405,14 @@ void OBJReader::parseTextureLine(const QByteArray& textureLine, QByteArray& file
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -boost";
|
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -boost";
|
||||||
#endif
|
#endif
|
||||||
} else if (parser.startsWith("-cc")) {
|
} else if (parser.startsWith("-cc")) {
|
||||||
parser.remove(0, 7); // remove through "-cc on " or "-cc off"
|
int removeLength = parser[6] == 'f' ? 8 : 7;
|
||||||
if (parser[0] == ' ') { // extra character for space after off
|
parser.remove(0, removeLength); // remove through "-cc on " or "-cc off"
|
||||||
parser.remove(0, 1);
|
|
||||||
}
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -cc";
|
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -cc";
|
||||||
#endif
|
#endif
|
||||||
} else if (parser.startsWith("-clamp")) {
|
} else if (parser.startsWith("-clamp")) {
|
||||||
parser.remove(0, 10); // remove through "-clamp on " or "-clamp off"
|
int removeLength = parser[9] == 'f' ? 11 : 10;
|
||||||
if (parser[0] == ' ') { // extra character for space after off
|
parser.remove(0, removeLength); // remove through "-clamp on " or "-clamp off"
|
||||||
parser.remove(0, 1);
|
|
||||||
}
|
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -clamp";
|
qCDebug(modelformat) << "OBJ Reader WARNING: Ignoring texture option -clamp";
|
||||||
#endif
|
#endif
|
||||||
|
@ -941,18 +935,17 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
bool applyRoughness = false;
|
bool applyRoughness = false;
|
||||||
bool applyNonMetallic = false;
|
bool applyNonMetallic = false;
|
||||||
bool fresnelOn = false;
|
bool fresnelOn = false;
|
||||||
bool fresnelOff = false;
|
|
||||||
|
|
||||||
// Illumination model reference http://paulbourke.net/dataformats/mtl/
|
// Illumination model reference http://paulbourke.net/dataformats/mtl/
|
||||||
switch (objMaterial.illuminationModel) {
|
switch (objMaterial.illuminationModel) {
|
||||||
case 0: // Color on and Ambient off
|
case 0: // Color on and Ambient off
|
||||||
// We don't support ambient - do nothing?
|
// We don't support ambient = do nothing?
|
||||||
break;
|
break;
|
||||||
case 1: // Color on and Ambient on
|
case 1: // Color on and Ambient on
|
||||||
// We don't support ambient - do nothing?
|
// We don't support ambient = do nothing?
|
||||||
break;
|
break;
|
||||||
case 2: // Highlight on
|
case 2: // Highlight on
|
||||||
// Change specular intensity?
|
// Change specular intensity = do nothing for now?
|
||||||
break;
|
break;
|
||||||
case 3: // Reflection on and Ray trace on
|
case 3: // Reflection on and Ray trace on
|
||||||
applyShininess = true;
|
applyShininess = true;
|
||||||
|
@ -969,7 +962,6 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
applyTransparency = true;
|
applyTransparency = true;
|
||||||
applyNonMetallic = true;
|
applyNonMetallic = true;
|
||||||
applyShininess = true;
|
applyShininess = true;
|
||||||
fresnelOff = true;
|
|
||||||
break;
|
break;
|
||||||
case 7: // Transparency: Refraction on and Reflection: Fresnel on and Ray trace on
|
case 7: // Transparency: Refraction on and Reflection: Fresnel on and Ray trace on
|
||||||
applyTransparency = true;
|
applyTransparency = true;
|
||||||
|
@ -990,8 +982,8 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applyTransparency && fbxMaterial.opacity <= ILLUMINATION_MODEL_MIN_OPACITY) {
|
if (applyTransparency) {
|
||||||
fbxMaterial.opacity = ILLUMINATION_MODEL_MIN_OPACITY;
|
fbxMaterial.opacity = std::max(fbxMaterial.opacity, ILLUMINATION_MODEL_MIN_OPACITY);
|
||||||
}
|
}
|
||||||
if (applyShininess) {
|
if (applyShininess) {
|
||||||
modelMaterial->setRoughness(ILLUMINATION_MODEL_APPLY_SHININESS);
|
modelMaterial->setRoughness(ILLUMINATION_MODEL_APPLY_SHININESS);
|
||||||
|
@ -1003,8 +995,6 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
}
|
}
|
||||||
if (fresnelOn) {
|
if (fresnelOn) {
|
||||||
modelMaterial->setFresnel(glm::vec3(1.0f));
|
modelMaterial->setFresnel(glm::vec3(1.0f));
|
||||||
} else if (fresnelOff) {
|
|
||||||
modelMaterial->setFresnel(glm::vec3(0.0f));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modelMaterial->setOpacity(fbxMaterial.opacity);
|
modelMaterial->setOpacity(fbxMaterial.opacity);
|
||||||
|
|
|
@ -50,8 +50,7 @@ private:
|
||||||
|
|
||||||
class OBJMaterialTextureOptions {
|
class OBJMaterialTextureOptions {
|
||||||
public:
|
public:
|
||||||
float bumpMultiplier;
|
float bumpMultiplier { 1.0f };
|
||||||
OBJMaterialTextureOptions() : bumpMultiplier(1.0f) {}
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
// Materials and references to material names can come in any order, and different mesh parts can refer to the same material.
|
// Materials and references to material names can come in any order, and different mesh parts can refer to the same material.
|
||||||
|
|
Loading…
Reference in a new issue