Permalink
Browse files

qmlui: scattering setup optimization

Effects can be accessed directly in QML
  • Loading branch information...
mcallegari committed Nov 27, 2018
1 parent f8c8bbb commit f00dfdf43fb92f11e1670ae91027c68fad671223
@@ -881,11 +881,8 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad
QLayer *sceneDeferredLayer = m_sceneRootEntity->property("deferredLayer").value<QLayer *>();
QEffect *sceneEffect = m_sceneRootEntity->property("geometryPassEffect").value<QEffect *>();
QEffect *spotlightShadingEffect = m_sceneRootEntity->property("spotlightShadingEffect").value<QEffect *>();
QEffect *spotlightScatteringEffect = m_sceneRootEntity->property("spotlightScatteringEffect").value<QEffect *>();
QEffect *outputFrontDepthEffect = m_sceneRootEntity->property("outputFrontDepthEffect").value<QEffect *>();
qDebug() << sceneDeferredLayer << sceneEffect << spotlightShadingEffect << spotlightScatteringEffect << outputFrontDepthEffect;
qDebug() << sceneDeferredLayer << sceneEffect;
QVector3D translation;
SceneItem *meshRef = m_entitiesMap.value(itemID);
@@ -963,9 +960,6 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad
meshRef->m_rootItem->setProperty("focusMaxDegrees", focusMax);
QMetaObject::invokeMethod(meshRef->m_rootItem, "setupScattering",
Q_ARG(QVariant, QVariant::fromValue(spotlightShadingEffect)),
Q_ARG(QVariant, QVariant::fromValue(spotlightScatteringEffect)),
Q_ARG(QVariant, QVariant::fromValue(outputFrontDepthEffect)),
Q_ARG(QVariant, QVariant::fromValue(m_sceneRootEntity)));
}
@@ -979,7 +973,7 @@ void MainView3D::initializeFixture(quint32 itemID, QEntity *fxEntity, QSceneLoad
{
QSizeF size = FixtureUtils::item2DDimension(fxMode, MonitorProperties::TopView);
QPointF itemPos = FixtureUtils::available2DPosition(m_doc, MonitorProperties::TopView,
QRectF(0, 0, size.width(), size.height()));
QRectF(0, 0, size.width(), size.height()));
// add the new fixture to the Doc monitor properties
fxPos = QVector3D(itemPos.x(), 1000.0, itemPos.y());
m_monProps->setFixturePosition(fxID, headIndex, linkedIndex, fxPos);
@@ -199,20 +199,20 @@ Entity
cutoffAngle = (((((focusMaxDegrees - focusMinDegrees) / 255) * value) + focusMinDegrees) / 2) * (Math.PI / 180)
}
function setupScattering(shadingEffect, scatteringEffect, depthEffect, sceneEntity)
function setupScattering(sceneEntity)
{
if (sceneEntity.coneMesh.length !== distCutoff)
sceneEntity.coneMesh.length = distCutoff
shadingCone.coneEffect = shadingEffect
shadingCone.coneEffect = sceneEntity.spotlightShadingEffect
shadingCone.parent = sceneEntity
shadingCone.spotlightConeMesh = sceneEntity.coneMesh
scatteringCone.coneEffect = scatteringEffect
scatteringCone.coneEffect = sceneEntity.spotlightScatteringEffect
scatteringCone.parent = sceneEntity
scatteringCone.spotlightConeMesh = sceneEntity.coneMesh
outDepthCone.coneEffect = depthEffect
outDepthCone.coneEffect = sceneEntity.outputFrontDepthEffect
outDepthCone.parent = sceneEntity
outDepthCone.spotlightConeMesh = sceneEntity.coneMesh
}
@@ -66,17 +66,17 @@ Entity
property Transform headTransform: Transform { translation: Qt.vector3d(0.1 * headIndex, 0, 0) }
function setupScattering(shadingEffect, scatteringEffect, depthEffect, sceneEntity)
function setupScattering(sceneEntity)
{
shadingCone.coneEffect = shadingEffect
shadingCone.coneEffect = sceneEntity.spotlightShadingEffect
shadingCone.parent = sceneEntity
shadingCone.spotlightConeMesh = sceneEntity.coneMesh
//scatteringCone.coneEffect = scatteringEffect
//scatteringCone.coneEffect = sceneEntity.spotlightScatteringEffect
scatteringCone.parent = sceneEntity
scatteringCone.spotlightConeMesh = sceneEntity.coneMesh
outDepthCone.coneEffect = depthEffect
outDepthCone.coneEffect = sceneEntity.outputFrontDepthEffect
outDepthCone.parent = sceneEntity
outDepthCone.spotlightConeMesh = sceneEntity.coneMesh
}
@@ -133,14 +133,14 @@ Entity
View3D.initializeFixture(itemID, fixtureEntity, null)
}
function setupScattering(shadingEffect, scatteringEffect, depthEffect, sceneEntity)
function setupScattering(sceneEntity)
{
if (sceneEntity.coneMesh.length !== distCutoff)
sceneEntity.coneMesh.length = distCutoff
for (var i = 0; i < headsList.length; i++)
{
headsList[i].setupScattering(shadingEffect, scatteringEffect, depthEffect, sceneEntity)
headsList[i].setupScattering(sceneEntity)
}
}

0 comments on commit f00dfdf

Please sign in to comment.