Skip to content
Snippets Groups Projects
Commit 6ae74f21 authored by Richard Gustavsen's avatar Richard Gustavsen
Browse files

Revert "Add support for scoped lights"

This reverts commit 12877ec3.
parent ced9a3bf
No related branches found
No related tags found
No related merge requests found
......@@ -908,7 +908,6 @@ Module {
Property { name: "shadowMapFar"; type: "float" }
Property { name: "shadowMapFieldOfView"; type: "float" }
Property { name: "shadowFilter"; type: "float" }
Property { name: "scope"; type: "QDemonNode"; isPointer: true }
Signal {
name: "lightTypeChanged"
Parameter { name: "lightType"; type: "QDemonRenderLightTypes" }
......@@ -973,10 +972,6 @@ Module {
name: "shadowFilterChanged"
Parameter { name: "shadowFilter"; type: "float" }
}
Signal {
name: "scopeChanged"
Parameter { name: "scope"; type: "QDemonNode"; isPointer: true }
}
Method {
name: "setLightType"
Parameter { name: "lightType"; type: "QDemonRenderLightTypes" }
......@@ -1041,10 +1036,6 @@ Module {
name: "setShadowFilter"
Parameter { name: "shadowFilter"; type: "float" }
}
Method {
name: "setScope"
Parameter { name: "scope"; type: "QDemonNode"; isPointer: true }
}
}
Component {
name: "QDemonMaterial"
......
#include "qdemonlight.h"
#include "qdemonobject_p.h"
#include <QtDemonRuntimeRender/qdemonrenderlight.h>
......@@ -94,11 +93,6 @@ float QDemonLight::shadowFilter() const
return m_shadowFilter;
}
QDemonNode *QDemonLight::scope() const
{
return m_scope;
}
void QDemonLight::setLightType(QDemonLight::QDemonRenderLightTypes lightType)
{
if (m_lightType == lightType)
......@@ -259,16 +253,6 @@ void QDemonLight::setShadowFilter(float shadowFilter)
update();
}
void QDemonLight::setScope(QDemonNode *scope)
{
if (m_scope == scope)
return;
m_scope = scope;
emit scopeChanged(m_scope);
update();
}
QDemonRenderGraphObject *QDemonLight::updateSpatialNode(QDemonRenderGraphObject *node)
{
if (!node)
......@@ -298,10 +282,7 @@ QDemonRenderGraphObject *QDemonLight::updateSpatialNode(QDemonRenderGraphObject
light->m_shadowMapFov = m_shadowMapFieldOfView;
light->m_shadowFilter = m_shadowFilter;
if (m_scope)
light->m_scope = static_cast<QDemonRenderNode*>(QDemonObjectPrivate::get(m_scope)->spatialNode);
else
light->m_scope = nullptr;
// ### TODO: Get light Scope Node
return node;
}
......
......@@ -25,7 +25,6 @@ class Q_QUICK3D_EXPORT QDemonLight : public QDemonNode
Q_PROPERTY(float shadowMapFar READ shadowMapFar WRITE setShadowMapFar NOTIFY shadowMapFarChanged)
Q_PROPERTY(float shadowMapFieldOfView READ shadowMapFieldOfView WRITE setShadowMapFieldOfView NOTIFY shadowMapFieldOfViewChanged)
Q_PROPERTY(float shadowFilter READ shadowFilter WRITE setShadowFilter NOTIFY shadowFilterChanged)
Q_PROPERTY(QDemonNode *scope READ scope WRITE setScope NOTIFY scopeChanged)
public:
enum QDemonRenderLightTypes {
......@@ -56,7 +55,6 @@ public:
float shadowMapFar() const;
float shadowMapFieldOfView() const;
float shadowFilter() const;
QDemonNode *scope() const;
public Q_SLOTS:
void setLightType(QDemonRenderLightTypes lightType);
......@@ -75,7 +73,6 @@ public Q_SLOTS:
void setShadowMapFar(float shadowMapFar);
void setShadowMapFieldOfView(float shadowMapFieldOfView);
void setShadowFilter(float shadowFilter);
void setScope(QDemonNode * scope);
Q_SIGNALS:
void lightTypeChanged(QDemonRenderLightTypes lightType);
......@@ -94,7 +91,6 @@ Q_SIGNALS:
void shadowMapFarChanged(float shadowMapFar);
void shadowMapFieldOfViewChanged(float shadowMapFieldOfView);
void shadowFilterChanged(float shadowFilter);
void scopeChanged(QDemonNode *scope);
protected:
QDemonRenderGraphObject *updateSpatialNode(QDemonRenderGraphObject *node) override;
......@@ -116,7 +112,6 @@ private:
float m_shadowMapFar = 5000.0f;
float m_shadowMapFieldOfView = 90.0f;
float m_shadowFilter = 35.0f;
QDemonNode *m_scope = nullptr;
};
QT_END_NAMESPACE
......
......@@ -580,20 +580,11 @@ void QDemonObjectPrivate::addToDirtyList()
sceneManager->dirtyResourceList = q;
}
} else {
if (q->type() == QDemonObject::Light) {
// needed for scoped lights
nextDirtyItem = sceneManager->dirtyLightList;
if (nextDirtyItem)
QDemonObjectPrivate::get(nextDirtyItem)->prevDirtyItem = &nextDirtyItem;
prevDirtyItem = &sceneManager->dirtyLightList;
sceneManager->dirtyLightList = q;
} else {
nextDirtyItem = sceneManager->dirtySpatialNodeList;
if (nextDirtyItem)
QDemonObjectPrivate::get(nextDirtyItem)->prevDirtyItem = &nextDirtyItem;
prevDirtyItem = &sceneManager->dirtySpatialNodeList;
sceneManager->dirtySpatialNodeList = q;
}
nextDirtyItem = sceneManager->dirtySpatialNodeList;
if (nextDirtyItem)
QDemonObjectPrivate::get(nextDirtyItem)->prevDirtyItem = &nextDirtyItem;
prevDirtyItem = &sceneManager->dirtySpatialNodeList;
sceneManager->dirtySpatialNodeList = q;
}
sceneManager->dirtyItem(q);
......
......@@ -11,7 +11,6 @@ QDemonSceneManager::QDemonSceneManager(QObject *parent)
, dirtySpatialNodeList(nullptr)
, dirtyResourceList(nullptr)
, dirtyImageList(nullptr)
, dirtyLightList(nullptr)
{
}
......@@ -62,21 +61,23 @@ void QDemonSceneManager::updateDirtyNodes()
updateNodes(dirtyImageList);
updateNodes(dirtyResourceList);
updateNodes(dirtySpatialNodeList);
// Lights have to be last because of scoped lights
updateNodes(dirtyLightList);
dirtyImageList = nullptr;
dirtyResourceList = nullptr;
dirtySpatialNodeList = nullptr;
dirtyLightList = nullptr;
}
void QDemonSceneManager::updateDirtyNode(QDemonObject *object)
{
// Different processing for resource nodes vs hierarchical nodes
switch (object->type()) {
case QDemonObject::Light:
// case QDemonObject::Layer: {
// QDemonLayer *layerNode = qobject_cast<QDemonLayer *>(object);
// if (layerNode)
// updateDirtyLayer(layerNode);
// } break;
case QDemonObject::Node:
case QDemonObject::Light:
case QDemonObject::Camera:
case QDemonObject::Model:
case QDemonObject::Text:
......@@ -143,12 +144,31 @@ void QDemonSceneManager::updateDirtySpatialNode(QDemonNode *spatialNode)
}
}
//void QDemonSceneRenderer::updateDirtyLayer(QDemonLayer *layerNode)
//{
// QDemonObjectPrivate *itemPriv = QDemonObjectPrivate::get(layerNode);
// quint32 dirty = itemPriv->dirtyAttributes;
// itemPriv->dirtyAttributes = 0;
// itemPriv->spatialNode = layerNode->updateSpatialNode(itemPriv->spatialNode);
// QDemonRenderLayer *layer = static_cast<QDemonRenderLayer *>(itemPriv->spatialNode);
// if (!layer->scene)
// m_scene->addChild(*layer);
//}
void QDemonSceneManager::cleanupNodes()
{
for (int ii = 0; ii < cleanupNodeList.count(); ++ii) {
QDemonRenderGraphObject *node = cleanupNodeList.at(ii);
// Different processing for resource nodes vs hierarchical nodes
switch (node->type) {
// case QDemonRenderGraphObject::Type::Layer: {
// QDemonRenderLayer *layerNode = static_cast<QDemonRenderLayer *>(node);
// // remove layer from scene
// m_scene->removeChild(*layerNode);
// } break;
case QDemonRenderGraphObject::Type::Node:
case QDemonRenderGraphObject::Type::Light:
case QDemonRenderGraphObject::Type::Camera:
......
......@@ -46,7 +46,6 @@ public:
QDemonObject *dirtySpatialNodeList;
QDemonObject *dirtyResourceList;
QDemonObject *dirtyImageList;
QDemonObject *dirtyLightList;
QList<QDemonRenderGraphObject *> cleanupNodeList;
QSet<QDemonObject *> parentlessItems;
friend QDemonObject;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment