From d4566bb1d7cd848d1c9bc15bf09c8d62fb5c727f Mon Sep 17 00:00:00 2001 From: Sam Gateau Date: Fri, 6 Feb 2015 15:51:57 -0800 Subject: [PATCH] Adding support for hifi_global light intensity & COlor and use it to adjust the lighmap parameters --- libraries/fbx/src/FBXReader.cpp | 6 +++++- libraries/fbx/src/FBXReader.h | 2 ++ libraries/gpu/src/gpu/Texture.h | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 94e2f0ba00..dce5ecca65 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1219,7 +1219,7 @@ int matchTextureUVSetToAttributeChannel(const QString& texUVSetName, const QHash FBXLight extractLight(const FBXNode& object) { FBXLight light; - + int unkwnon = 0; foreach (const FBXNode& subobject, object.children) { QString childname = QString(subobject.name); if (subobject.name == "Properties70") { @@ -1230,6 +1230,8 @@ FBXLight extractLight(const FBXNode& object) { QString propname = property.properties.at(0).toString(); if (propname == "Intensity") { light.intensity = 0.01f * property.properties.at(valIndex).value(); + } else if (propname == "Color") { + light.color = getVec3(property.properties, valIndex); } } } @@ -1817,6 +1819,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, if (lightmapLevel <= 0.0f) { loadLightmaps = false; } + lightmapOffset = glm::clamp((*lit).second.color.x, 0.f, 1.f); } } } @@ -2127,6 +2130,7 @@ FBXGeometry extractFBXGeometry(const FBXNode& node, const QVariantHash& mapping, glm::vec2 emissiveParams(0.f, 1.f); emissiveParams.x = lightmapOffset; emissiveParams.y = lightmapLevel; + QString emissiveTextureID = emissiveTextures.value(childID); QString ambientTextureID = ambientTextures.value(childID); if (loadLightmaps && (!emissiveTextureID.isNull() || !ambientTextureID.isNull())) { diff --git a/libraries/fbx/src/FBXReader.h b/libraries/fbx/src/FBXReader.h index d94af5b4a3..dd67ce22d5 100644 --- a/libraries/fbx/src/FBXReader.h +++ b/libraries/fbx/src/FBXReader.h @@ -179,12 +179,14 @@ public: QString name; Transform transform; float intensity; + float fogValue; glm::vec3 color; FBXLight() : name(), transform(), intensity(1.0f), + fogValue(0.0f), color(1.0f) {} }; diff --git a/libraries/gpu/src/gpu/Texture.h b/libraries/gpu/src/gpu/Texture.h index 084a9360b5..61923999b9 100755 --- a/libraries/gpu/src/gpu/Texture.h +++ b/libraries/gpu/src/gpu/Texture.h @@ -26,9 +26,9 @@ public: Pixels(const Element& format, Size size, const Byte* bytes); ~Pixels(); - mutable Sysmem _sysmem; + Sysmem _sysmem; Element _format; - mutable bool _isGPULoaded; + bool _isGPULoaded; }; typedef QSharedPointer< Pixels > PixelsPointer;