mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-05 06:42:57 +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 ambientFactor{ 1.0f };
|
||||
|
||||
float bumpMultiplier{ 1.0f };
|
||||
|
||||
QString materialID;
|
||||
QString name;
|
||||
QString shadingModel;
|
||||
|
|
|
@ -302,7 +302,7 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
|||
currentMaterial.emissiveColor = tokenizer.getVec3();
|
||||
} else if (token == "Ks") {
|
||||
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();
|
||||
QByteArray filename;
|
||||
OBJMaterialTextureOptions textureOptions;
|
||||
|
@ -319,8 +319,9 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
|||
currentMaterial.emissiveTextureFilename = filename;
|
||||
} else if (token == "map_Ks" ) {
|
||||
currentMaterial.specularTextureFilename = filename;
|
||||
} else if (token == "map_bump") {
|
||||
} else if ((token == "map_bump") || (token == "bump")) {
|
||||
currentMaterial.bumpTextureFilename = filename;
|
||||
currentMaterial.bumpMultiplier = textureOptions.bumpMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -338,6 +339,8 @@ void OBJReader::parseTextureLine(const QByteArray& textureLine, QByteArray& file
|
|||
QString multiplier = parser.left(multiplierEnd);
|
||||
textureOptions.bumpMultiplier = std::stof(multiplier.toStdString());
|
||||
parser.remove(0, multiplier.length() + 1);
|
||||
} else if (parser[0] == '-') {
|
||||
// TO DO
|
||||
} else {
|
||||
int fileEnd = parser.indexOf(' ');
|
||||
if (fileEnd < 0) {
|
||||
|
@ -813,6 +816,7 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
|||
if (!objMaterial.bumpTextureFilename.isEmpty()) {
|
||||
fbxMaterial.normalTexture.filename = objMaterial.bumpTextureFilename;
|
||||
fbxMaterial.normalTexture.isBumpmap = true;
|
||||
fbxMaterial.bumpMultiplier = objMaterial.bumpMultiplier;
|
||||
}
|
||||
|
||||
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
|
||||
|
|
|
@ -61,9 +61,10 @@ public:
|
|||
QByteArray specularTextureFilename;
|
||||
QByteArray emissiveTextureFilename;
|
||||
QByteArray bumpTextureFilename;
|
||||
float bumpMultiplier;
|
||||
bool used { 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 {
|
||||
|
|
Loading…
Reference in a new issue