diff options
author | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-05-19 10:16:11 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@digia.com> | 2014-05-19 10:17:15 +0300 |
commit | 806fd8ab43dd59da89d04651b22c5c0440032b94 (patch) | |
tree | 41ff37fcebbe02d6c22209935b758ba7ddd59fd9 /src/datavisualization/engine | |
parent | 92ee7767f81f7a15b8773ed97356f01ecac68d0c (diff) |
Added property for disabling shadows on custom items
Task-number: QTRD-3093
Change-Id: Ia24a1bc657af1bb1a528581e1f65fb50277e6874
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Diffstat (limited to 'src/datavisualization/engine')
-rw-r--r-- | src/datavisualization/engine/abstract3drenderer.cpp | 7 | ||||
-rw-r--r-- | src/datavisualization/engine/qabstract3dgraph.cpp | 5 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/datavisualization/engine/abstract3drenderer.cpp b/src/datavisualization/engine/abstract3drenderer.cpp index a2181271..82952a26 100644 --- a/src/datavisualization/engine/abstract3drenderer.cpp +++ b/src/datavisualization/engine/abstract3drenderer.cpp @@ -582,6 +582,7 @@ CustomRenderItem *Abstract3DRenderer::addCustomItem(QCustom3DItem *item) QVector3D translation = convertPositionToTranslation(item->position()); newItem->setTranslation(translation); newItem->setVisible(item->isVisible()); + newItem->setShadowCasting(item->isShadowCasting()); m_customRenderCache.insert(item, newItem); return newItem; } @@ -620,6 +621,10 @@ void Abstract3DRenderer::updateCustomItem(CustomRenderItem *renderItem) renderItem->setVisible(item->isVisible()); item->d_ptr->m_dirtyBits.visibleDirty = false; } + if (item->d_ptr->m_dirtyBits.shadowCastingDirty) { + renderItem->setShadowCasting(item->isShadowCasting()); + item->d_ptr->m_dirtyBits.shadowCastingDirty = false; + } } void Abstract3DRenderer::drawCustomItems(RenderingState state, @@ -700,7 +705,7 @@ void Abstract3DRenderer::drawCustomItems(RenderingState state, itemColor /= 255.0f; shader->setUniformValue(shader->color(), itemColor); m_drawer->drawObject(shader, item->mesh()); - } else { + } else if (item->isShadowCasting()) { // Depth render shader->setUniformValue(shader->MVP(), depthProjectionViewMatrix * modelMatrix); m_drawer->drawObject(shader, item->mesh()); diff --git a/src/datavisualization/engine/qabstract3dgraph.cpp b/src/datavisualization/engine/qabstract3dgraph.cpp index 9818d176..196460da 100644 --- a/src/datavisualization/engine/qabstract3dgraph.cpp +++ b/src/datavisualization/engine/qabstract3dgraph.cpp @@ -430,6 +430,11 @@ void QAbstract3DGraph::removeCustomItemAt(const QVector3D &position) * Gets ownership of given \a item back and removes the \a item from the graph. * * \since Qt Data Visualization 1.1 + * + * \note If the same item is added back to the graph, the texture or the texture file needs to be + * re-set. + * + * \sa QCustom3DItem::setTextureImage(), QCustom3DItem::setTextureFile() */ void QAbstract3DGraph::releaseCustomItem(QCustom3DItem *item) { |