mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 14:58:03 +02:00
map_bump wip
This commit is contained in:
parent
cee6bd2700
commit
7531a2ef3b
3 changed files with 13 additions and 3 deletions
Binary file not shown.
|
@ -262,7 +262,8 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
currentMaterial.emissiveColor << " diffuse texture:" <<
|
currentMaterial.emissiveColor << " diffuse texture:" <<
|
||||||
currentMaterial.diffuseTextureFilename << " specular texture:" <<
|
currentMaterial.diffuseTextureFilename << " specular texture:" <<
|
||||||
currentMaterial.specularTextureFilename << " emissive texture:" <<
|
currentMaterial.specularTextureFilename << " emissive texture:" <<
|
||||||
currentMaterial.emissiveTextureFilename;
|
currentMaterial.emissiveTextureFilename << " bump texture:" <<
|
||||||
|
currentMaterial.bumpTextureFilename;
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -280,6 +281,7 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
currentMaterial.diffuseTextureFilename = "";
|
currentMaterial.diffuseTextureFilename = "";
|
||||||
currentMaterial.emissiveTextureFilename = "";
|
currentMaterial.emissiveTextureFilename = "";
|
||||||
currentMaterial.specularTextureFilename = "";
|
currentMaterial.specularTextureFilename = "";
|
||||||
|
currentMaterial.bumpTextureFilename = "";
|
||||||
} else if (token == "Ns") {
|
} else if (token == "Ns") {
|
||||||
currentMaterial.shininess = tokenizer.getFloat();
|
currentMaterial.shininess = tokenizer.getFloat();
|
||||||
} else if (token == "Ni") {
|
} else if (token == "Ni") {
|
||||||
|
@ -300,8 +302,9 @@ 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")) {
|
} else if ((token == "map_Kd") || (token == "map_Ke") || (token == "map_Ks") || (token == "map_bump")) {
|
||||||
QByteArray filename = QString(tokenizer.getLineAsDatum()).toUtf8();
|
QByteArray textureLine = QString(tokenizer.getLineAsDatum()).toUtf8();
|
||||||
|
QByteArray filename = textureLine; // TODO: parse texture options and filename from line
|
||||||
if (filename.endsWith(".tga")) {
|
if (filename.endsWith(".tga")) {
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader WARNING: currently ignoring tga texture " << filename << " in " << _url;
|
qCDebug(modelformat) << "OBJ Reader WARNING: currently ignoring tga texture " << filename << " in " << _url;
|
||||||
|
@ -314,6 +317,8 @@ 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") {
|
||||||
|
currentMaterial.bumpTextureFilename = filename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,6 +785,10 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
if (!objMaterial.emissiveTextureFilename.isEmpty()) {
|
if (!objMaterial.emissiveTextureFilename.isEmpty()) {
|
||||||
fbxMaterial.emissiveTexture.filename = objMaterial.emissiveTextureFilename;
|
fbxMaterial.emissiveTexture.filename = objMaterial.emissiveTextureFilename;
|
||||||
}
|
}
|
||||||
|
if (!objMaterial.bumpTextureFilename.isEmpty()) {
|
||||||
|
fbxMaterial.normalTexture.filename = objMaterial.bumpTextureFilename;
|
||||||
|
fbxMaterial.normalTexture.isBumpmap = true;
|
||||||
|
}
|
||||||
|
|
||||||
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
|
modelMaterial->setEmissive(fbxMaterial.emissiveColor);
|
||||||
modelMaterial->setAlbedo(fbxMaterial.diffuseColor);
|
modelMaterial->setAlbedo(fbxMaterial.diffuseColor);
|
||||||
|
|
|
@ -60,6 +60,7 @@ public:
|
||||||
QByteArray diffuseTextureFilename;
|
QByteArray diffuseTextureFilename;
|
||||||
QByteArray specularTextureFilename;
|
QByteArray specularTextureFilename;
|
||||||
QByteArray emissiveTextureFilename;
|
QByteArray emissiveTextureFilename;
|
||||||
|
QByteArray bumpTextureFilename;
|
||||||
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) {}
|
||||||
|
|
Loading…
Reference in a new issue