Minor fixes to the way the specular color is interpreted

This commit is contained in:
samcake 2015-09-28 12:43:15 -07:00
parent a820682816
commit 95ea874d43
5 changed files with 10 additions and 4 deletions

View file

@ -934,7 +934,7 @@ FBXGeometry* FBXReader::extractFBXGeometry(const QVariantHash& mapping, const QS
_textureContent.insert(filename, content);
}
} else if (object.name == "Material") {
FBXMaterial material(glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(1.0f), glm::vec3(), glm::vec2(0.f, 1.0f), 96.0f, 1.0f);
FBXMaterial material(glm::vec3(1.0f, 1.0f, 1.0f), glm::vec3(0.02f), glm::vec3(), glm::vec2(0.f, 1.0f), 96.0f, 1.0f);
foreach (const FBXNode& subobject, object.children) {
bool properties = false;
QByteArray propertyName;

View file

@ -139,7 +139,9 @@ void FBXReader::consolidateFBXMaterials() {
} else {
material._material->setDiffuse(material.diffuseColor);
}
material._material->setMetallic(glm::length(material.specularColor));
float metallic = std::max(material.specularColor.x, std::max(material.specularColor.y, material.specularColor.z));
material._material->setMetallic(metallic);
material._material->setGloss(material.shininess);
if (material.opacity <= 0.0f) {

View file

@ -418,8 +418,10 @@ void GLBackend::resetStages() {
#define DO_IT_NOW(call, offset)
void Batch::_glActiveBindTexture(GLenum unit, GLenum target, GLuint texture) {
ADD_COMMAND_GL(glActiveBindTexture);
// clean the cache on the texture unit we are going to use
setResourceTexture(unit - GL_TEXTURE0, nullptr);
ADD_COMMAND_GL(glActiveBindTexture);
_params.push_back(texture);
_params.push_back(target);
_params.push_back(unit);
@ -432,6 +434,7 @@ void GLBackend::do_glActiveBindTexture(Batch& batch, uint32 paramOffset) {
glBindTexture(
batch._params[paramOffset + 1]._uint,
batch._params[paramOffset + 0]._uint);
(void) CHECK_GL_ERROR();
}

View file

@ -189,6 +189,7 @@ void Model::RenderPipelineLib::initLocations(gpu::ShaderPointer& program, Model:
locations.emissiveParams = program->getUniforms().findLocation("emissiveParams");
locations.glowIntensity = program->getUniforms().findLocation("glowIntensity");
locations.normalFittingMapUnit = program->getTextures().findLocation("normalFittingMap");
locations.diffuseTextureUnit = program->getTextures().findLocation("diffuseMap");
locations.normalTextureUnit = program->getTextures().findLocation("normalMap");
locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
@ -1625,7 +1626,6 @@ void Model::renderPart(RenderArgs* args, int meshIndex, int partIndex, int shape
// Diffuse
if (materialKey.isDiffuseMap()) {
auto diffuseMap = textureMaps[model::MaterialKey::DIFFUSE_MAP];
if (diffuseMap && diffuseMap->isDefined()) {
batch.setResourceTexture(DIFFUSE_MAP_SLOT, diffuseMap->getTextureView());

View file

@ -344,6 +344,7 @@ private:
int tangent;
int alphaThreshold;
int texcoordMatrices;
int diffuseTextureUnit;
int normalTextureUnit;
int specularTextureUnit;
int emissiveTextureUnit;