mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 13:28:16 +02:00
bump multiplier
This commit is contained in:
parent
a44e00142d
commit
88b034aa78
3 changed files with 10 additions and 3 deletions
|
@ -178,6 +178,8 @@ public:
|
||||||
float emissiveIntensity{ 1.0f };
|
float emissiveIntensity{ 1.0f };
|
||||||
float ambientFactor{ 1.0f };
|
float ambientFactor{ 1.0f };
|
||||||
|
|
||||||
|
float bumpMultiplier{ 1.0f };
|
||||||
|
|
||||||
QString materialID;
|
QString materialID;
|
||||||
QString name;
|
QString name;
|
||||||
QString shadingModel;
|
QString shadingModel;
|
||||||
|
|
|
@ -302,7 +302,7 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
currentMaterial.emissiveColor = tokenizer.getVec3();
|
currentMaterial.emissiveColor = tokenizer.getVec3();
|
||||||
} else if (token == "Ks") {
|
} else if (token == "Ks") {
|
||||||
currentMaterial.specularColor = tokenizer.getVec3();
|
currentMaterial.specularColor = tokenizer.getVec3();
|
||||||
} else if ((token == "map_Kd") || (token == "map_Ke") || (token == "map_Ks") || (token == "map_bump")) {
|
} else if ((token == "map_Kd") || (token == "map_Ke") || (token == "map_Ks") || (token == "map_bump") || (token == "bump")) {
|
||||||
const QByteArray textureLine = tokenizer.getLineAsDatum();
|
const QByteArray textureLine = tokenizer.getLineAsDatum();
|
||||||
QByteArray filename;
|
QByteArray filename;
|
||||||
OBJMaterialTextureOptions textureOptions;
|
OBJMaterialTextureOptions textureOptions;
|
||||||
|
@ -319,8 +319,9 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
currentMaterial.emissiveTextureFilename = filename;
|
currentMaterial.emissiveTextureFilename = filename;
|
||||||
} else if (token == "map_Ks" ) {
|
} else if (token == "map_Ks" ) {
|
||||||
currentMaterial.specularTextureFilename = filename;
|
currentMaterial.specularTextureFilename = filename;
|
||||||
} else if (token == "map_bump") {
|
} else if ((token == "map_bump") || (token == "bump")) {
|
||||||
currentMaterial.bumpTextureFilename = filename;
|
currentMaterial.bumpTextureFilename = filename;
|
||||||
|
currentMaterial.bumpMultiplier = textureOptions.bumpMultiplier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,6 +339,8 @@ void OBJReader::parseTextureLine(const QByteArray& textureLine, QByteArray& file
|
||||||
QString multiplier = parser.left(multiplierEnd);
|
QString multiplier = parser.left(multiplierEnd);
|
||||||
textureOptions.bumpMultiplier = std::stof(multiplier.toStdString());
|
textureOptions.bumpMultiplier = std::stof(multiplier.toStdString());
|
||||||
parser.remove(0, multiplier.length() + 1);
|
parser.remove(0, multiplier.length() + 1);
|
||||||
|
} else if (parser[0] == '-') {
|
||||||
|
// TO DO
|
||||||
} else {
|
} else {
|
||||||
int fileEnd = parser.indexOf(' ');
|
int fileEnd = parser.indexOf(' ');
|
||||||
if (fileEnd < 0) {
|
if (fileEnd < 0) {
|
||||||
|
@ -813,6 +816,7 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
if (!objMaterial.bumpTextureFilename.isEmpty()) {
|
if (!objMaterial.bumpTextureFilename.isEmpty()) {
|
||||||
fbxMaterial.normalTexture.filename = objMaterial.bumpTextureFilename;
|
fbxMaterial.normalTexture.filename = objMaterial.bumpTextureFilename;
|
||||||
fbxMaterial.normalTexture.isBumpmap = true;
|
fbxMaterial.normalTexture.isBumpmap = true;
|
||||||
|
fbxMaterial.bumpMultiplier = objMaterial.bumpMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
|
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
|
||||||
|
|
|
@ -61,9 +61,10 @@ public:
|
||||||
QByteArray specularTextureFilename;
|
QByteArray specularTextureFilename;
|
||||||
QByteArray emissiveTextureFilename;
|
QByteArray emissiveTextureFilename;
|
||||||
QByteArray bumpTextureFilename;
|
QByteArray bumpTextureFilename;
|
||||||
|
float bumpMultiplier;
|
||||||
bool used { false };
|
bool used { false };
|
||||||
bool userSpecifiesUV { false };
|
bool userSpecifiesUV { false };
|
||||||
OBJMaterial() : shininess(0.0f), opacity(1.0f), diffuseColor(0.9f), specularColor(0.9f), emissiveColor(0.0f) {}
|
OBJMaterial() : shininess(0.0f), opacity(1.0f), diffuseColor(0.9f), specularColor(0.9f), emissiveColor(0.0f), bumpMultiplier(1.0f) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OBJMaterialTextureOptions {
|
class OBJMaterialTextureOptions {
|
||||||
|
|
Loading…
Reference in a new issue