Merge pull request #6662 from AlessandroSigna/overlays

Exposing emmisive property of the Image3DOverlay
This commit is contained in:
Ryan Huffman 2015-12-16 10:29:34 -08:00
commit a422103e89
4 changed files with 18 additions and 7 deletions

View file

@ -26,14 +26,16 @@
QString const Image3DOverlay::TYPE = "image3d";
Image3DOverlay::Image3DOverlay() {
_isLoaded = false;
_isLoaded = false;
_emissive = false;
}
Image3DOverlay::Image3DOverlay(const Image3DOverlay* image3DOverlay) :
Billboard3DOverlay(image3DOverlay),
_url(image3DOverlay->_url),
_texture(image3DOverlay->_texture),
_fromImage(image3DOverlay->_fromImage)
_fromImage(image3DOverlay->_fromImage),
_emissive(image3DOverlay->_emissive)
{
}
@ -93,8 +95,8 @@ void Image3DOverlay::render(RenderArgs* args) {
batch->setModelTransform(transform);
batch->setResourceTexture(0, _texture->getGPUTexture());
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(*batch, true, false, false, true);
DependencyManager::get<DeferredLightingEffect>()->bindSimpleProgram(*batch, true, false, _emissive, true);
DependencyManager::get<GeometryCache>()->renderQuad(
*batch, topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight,
glm::vec4(color.red / MAX_COLOR, color.green / MAX_COLOR, color.blue / MAX_COLOR, alpha)
@ -144,6 +146,11 @@ void Image3DOverlay::setProperties(const QScriptValue &properties) {
setClipFromSource(subImageRect);
}
}
QScriptValue emissiveValue = properties.property("emissive");
if (emissiveValue.isValid()) {
_emissive = emissiveValue.toBool();
}
}
QScriptValue Image3DOverlay::getProperty(const QString& property) {
@ -156,6 +163,9 @@ QScriptValue Image3DOverlay::getProperty(const QString& property) {
if (property == "offsetPosition") {
return vec3toScriptValue(_scriptEngine, getOffsetPosition());
}
if (property == "emissive") {
return _emissive;
}
return Billboard3DOverlay::getProperty(property);
}

View file

@ -46,6 +46,7 @@ public:
private:
QString _url;
NetworkTexturePointer _texture;
bool _emissive;
QRect _fromImage; // where from in the image to sample
};

View file

@ -169,8 +169,8 @@ void DeferredLightingEffect::init(AbstractViewStateInterface* viewState) {
gpu::PipelinePointer DeferredLightingEffect::bindSimpleProgram(gpu::Batch& batch, bool textured, bool culled,
bool emmisive, bool depthBias) {
SimpleProgramKey config{textured, culled, emmisive, depthBias};
bool emissive, bool depthBias) {
SimpleProgramKey config{textured, culled, emissive, depthBias};
gpu::PipelinePointer pipeline = getPipeline(config);
batch.setPipeline(pipeline);

View file

@ -38,7 +38,7 @@ public:
/// Sets up the state necessary to render static untextured geometry with the simple program.
gpu::PipelinePointer bindSimpleProgram(gpu::Batch& batch, bool textured = false, bool culled = true,
bool emmisive = false, bool depthBias = false);
bool emissive = false, bool depthBias = false);
void renderSolidSphereInstance(gpu::Batch& batch, const Transform& xfm, const glm::vec4& color);
void renderSolidSphereInstance(gpu::Batch& batch, const Transform& xfm, const glm::vec3& color) {