Adding support for hifi_global light intensity & COlor and use it to adjust the lighmap parameters

This commit is contained in:
Sam Gateau 2015-02-06 15:51:57 -08:00
parent e9add29af1
commit d4566bb1d7
3 changed files with 9 additions and 3 deletions

View file

@ -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<double>();
} 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())) {

View file

@ -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)
{}
};

View file

@ -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;