forked from qt-creator/qt-creator
QmlDesigner: Add missing camera plane ring to point light model
Task-number: QDS-2037 Change-Id: Ica5a7ec2983da251d2ab75565120423288de27a2 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -73,6 +73,18 @@ Node {
|
||||
view3D: lightGizmo.view3D
|
||||
}
|
||||
|
||||
// Camera plane circle for point light mesh
|
||||
LightModel {
|
||||
id: pointRing
|
||||
geometryName: "Edit 3D Circle"
|
||||
geometryType: LightGeometry.Circle
|
||||
material: lightMaterial
|
||||
|
||||
visible: lightGizmo.targetNode instanceof PointLight
|
||||
scale: Qt.vector3d(lightGizmo.fadeScale, lightGizmo.fadeScale, lightGizmo.fadeScale)
|
||||
rotation: lightGizmo.view3D.camera.rotation
|
||||
}
|
||||
|
||||
Node {
|
||||
rotation: !lightGizmo.targetNode ? Qt.quaternion(1, 0, 0, 0)
|
||||
: lightGizmo.targetNode.sceneRotation
|
||||
@@ -86,7 +98,7 @@ Node {
|
||||
|
||||
geometryName: "Edit 3D SpotLight"
|
||||
geometryType: LightGeometry.Spot
|
||||
color: lightGizmo.color
|
||||
material: lightMaterial
|
||||
visible: lightGizmo.targetNode instanceof SpotLight
|
||||
scale: Qt.vector3d(coneScale, coneScale, lightGizmo.fadeScale)
|
||||
}
|
||||
@@ -122,26 +134,28 @@ Node {
|
||||
id: areaModel
|
||||
geometryName: "Edit 3D AreaLight"
|
||||
geometryType: LightGeometry.Area
|
||||
color: lightGizmo.color
|
||||
material: lightMaterial
|
||||
visible: lightGizmo.targetNode instanceof AreaLight
|
||||
scale: visible ? Qt.vector3d(lightGizmo.targetNode.width / 2,
|
||||
lightGizmo.targetNode.height / 2, 1)
|
||||
.times(lightGizmo.targetNode.scale)
|
||||
: Qt.vector3d(1, 1, 1)
|
||||
}
|
||||
|
||||
LightModel {
|
||||
id: directionalModel
|
||||
geometryName: "Edit 3D DirLight"
|
||||
geometryType: LightGeometry.Directional
|
||||
color: lightGizmo.color
|
||||
material: lightMaterial
|
||||
visible: lightGizmo.targetNode instanceof DirectionalLight
|
||||
scale: autoScale.getScale(Qt.vector3d(50, 50, 50))
|
||||
}
|
||||
|
||||
LightModel {
|
||||
id: pointModel
|
||||
geometryName: "Edit 3D PointLight"
|
||||
geometryType: LightGeometry.Point
|
||||
color: lightGizmo.color
|
||||
material: lightMaterial
|
||||
visible: lightGizmo.targetNode instanceof PointLight
|
||||
scale: Qt.vector3d(lightGizmo.fadeScale, lightGizmo.fadeScale, lightGizmo.fadeScale)
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ Model {
|
||||
|
||||
property alias geometryName: lightGeometry.name // Name must be unique for each geometry
|
||||
property alias geometryType: lightGeometry.lightType
|
||||
property color color
|
||||
property Material material
|
||||
|
||||
function updateGeometry()
|
||||
{
|
||||
@@ -42,14 +42,7 @@ Model {
|
||||
scale: Qt.vector3d(50, 50, 50)
|
||||
|
||||
geometry: lightGeometry
|
||||
materials: [
|
||||
DefaultMaterial {
|
||||
id: defaultMaterial
|
||||
emissiveColor: lightModel.color
|
||||
lighting: DefaultMaterial.NoLighting
|
||||
cullMode: Material.NoCulling
|
||||
}
|
||||
]
|
||||
materials: [ material ]
|
||||
|
||||
LightGeometry {
|
||||
id: lightGeometry
|
||||
|
@@ -115,6 +115,9 @@ void LightGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexData
|
||||
} else if (m_lightType == LightType::Spot) {
|
||||
vertexSize = int(sizeof(float)) * 3 * (segments + 1);
|
||||
indexSize = int(sizeof(quint16)) * (segments + dirLines) * 2;
|
||||
} else if (m_lightType == LightType::Circle) {
|
||||
vertexSize = int(sizeof(float)) * 3 * segments;
|
||||
indexSize = int(sizeof(quint16)) * segments * 2;
|
||||
}
|
||||
vertexData.resize(vertexSize);
|
||||
indexData.resize(indexSize);
|
||||
@@ -173,6 +176,8 @@ void LightGeometry::fillVertexData(QByteArray &vertexData, QByteArray &indexData
|
||||
*indexPtr++ = tipIndex;
|
||||
*indexPtr++ = i * arc;
|
||||
}
|
||||
} else if (m_lightType == LightType::Circle) {
|
||||
createCircle(0, 0.f, 0, 1, 2);
|
||||
}
|
||||
|
||||
static const float floatMin = std::numeric_limits<float>::lowest();
|
||||
|
@@ -43,7 +43,8 @@ public:
|
||||
Spot,
|
||||
Area,
|
||||
Directional,
|
||||
Point
|
||||
Point,
|
||||
Circle // Not a light type, but an auxiliary mesh for point light
|
||||
};
|
||||
Q_ENUM(LightType)
|
||||
|
||||
|
Reference in New Issue
Block a user