mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +02:00
ka
This commit is contained in:
parent
3d02955c5d
commit
c3801fee7e
2 changed files with 16 additions and 8 deletions
|
@ -256,7 +256,13 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
default:
|
default:
|
||||||
materials[matName] = currentMaterial;
|
materials[matName] = currentMaterial;
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
qCDebug(modelformat) << "OBJ Reader Last material shininess:" << currentMaterial.shininess << " opacity:" << currentMaterial.opacity << " diffuse color:" << currentMaterial.diffuseColor << " specular color:" << currentMaterial.specularColor << " diffuse texture:" << currentMaterial.diffuseTextureFilename << " specular texture:" << currentMaterial.specularTextureFilename;
|
qCDebug(modelformat) << "OBJ Reader Last material shininess:" << currentMaterial.shininess << " opacity:" <<
|
||||||
|
currentMaterial.opacity << " diffuse color:" << currentMaterial.diffuseColor <<
|
||||||
|
" specular color:" << currentMaterial.specularColor << " emissive color:" <<
|
||||||
|
currentMaterial.emissiveColor << " diffuse texture:" <<
|
||||||
|
currentMaterial.diffuseTextureFilename << " specular texture:" <<
|
||||||
|
currentMaterial.specularTextureFilename << " emissive texture:" <<
|
||||||
|
currentMaterial.emissiveTextureFilename;
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -277,14 +283,12 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
} else if ((token == "d") || (token == "Tr")) {
|
} else if ((token == "d") || (token == "Tr")) {
|
||||||
currentMaterial.opacity = tokenizer.getFloat();
|
currentMaterial.opacity = tokenizer.getFloat();
|
||||||
} else if (token == "Ka") {
|
} else if (token == "Ka") {
|
||||||
#ifdef WANT_DEBUG
|
currentMaterial.emissiveColor = tokenizer.getVec3();
|
||||||
qCDebug(modelformat) << "OBJ Reader Ignoring material Ka " << tokenizer.getVec3();
|
|
||||||
#endif
|
|
||||||
} else if (token == "Kd") {
|
} else if (token == "Kd") {
|
||||||
currentMaterial.diffuseColor = tokenizer.getVec3();
|
currentMaterial.diffuseColor = 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_Ks")) {
|
} else if ((token == "map_Ka") || (token == "map_Kd") || (token == "map_Ks")) {
|
||||||
QByteArray filename = QUrl(tokenizer.getLineAsDatum()).fileName().toUtf8();
|
QByteArray filename = QUrl(tokenizer.getLineAsDatum()).fileName().toUtf8();
|
||||||
if (filename.endsWith(".tga")) {
|
if (filename.endsWith(".tga")) {
|
||||||
#ifdef WANT_DEBUG
|
#ifdef WANT_DEBUG
|
||||||
|
@ -292,7 +296,9 @@ void OBJReader::parseMaterialLibrary(QIODevice* device) {
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (token == "map_Kd") {
|
if (token == "map_Ka") {
|
||||||
|
currentMaterial.emissiveTextureFilename = filename;
|
||||||
|
} else if (token == "map_Kd") {
|
||||||
currentMaterial.diffuseTextureFilename = filename;
|
currentMaterial.diffuseTextureFilename = filename;
|
||||||
} else if( token == "map_Ks" ) {
|
} else if( token == "map_Ks" ) {
|
||||||
currentMaterial.specularTextureFilename = filename;
|
currentMaterial.specularTextureFilename = filename;
|
||||||
|
@ -725,7 +731,7 @@ FBXGeometry* OBJReader::readOBJ(QByteArray& model, const QVariantHash& mapping,
|
||||||
}
|
}
|
||||||
geometry.materials[materialID] = FBXMaterial(objMaterial.diffuseColor,
|
geometry.materials[materialID] = FBXMaterial(objMaterial.diffuseColor,
|
||||||
objMaterial.specularColor,
|
objMaterial.specularColor,
|
||||||
glm::vec3(0.0f),
|
objMaterial.emissiveColor,
|
||||||
objMaterial.shininess,
|
objMaterial.shininess,
|
||||||
objMaterial.opacity);
|
objMaterial.opacity);
|
||||||
FBXMaterial& fbxMaterial = geometry.materials[materialID];
|
FBXMaterial& fbxMaterial = geometry.materials[materialID];
|
||||||
|
|
|
@ -56,11 +56,13 @@ public:
|
||||||
float opacity;
|
float opacity;
|
||||||
glm::vec3 diffuseColor;
|
glm::vec3 diffuseColor;
|
||||||
glm::vec3 specularColor;
|
glm::vec3 specularColor;
|
||||||
|
glm::vec3 emissiveColor;
|
||||||
QByteArray diffuseTextureFilename;
|
QByteArray diffuseTextureFilename;
|
||||||
QByteArray specularTextureFilename;
|
QByteArray specularTextureFilename;
|
||||||
|
QByteArray emissiveTextureFilename;
|
||||||
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) {}
|
OBJMaterial() : shininess(0.0f), opacity(1.0f), diffuseColor(0.9f), specularColor(0.9f), emissiveColor(0.9f) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OBJReader: public QObject { // QObject so we can make network requests.
|
class OBJReader: public QObject { // QObject so we can make network requests.
|
||||||
|
|
Loading…
Reference in a new issue