Qt3DRender::QSpotLight Class
class Qt3DRender::QSpotLightEin „Spot Light“-Objekt in eine „ Qt 3D “-Szene einbinden. Mehr...
| Überschrift: | #include <qspotlight.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS 3drender) target_link_libraries(mytarget PRIVATE Qt6::3drender) |
| qmake: | QT += 3drender |
| In QML: | SpotLight |
| Erbt von: | Qt3DRender::QAbstractLight |
| Status: | Veraltet |
Diese Klasse ist veraltet. Wir raten dringend davon ab, sie in neuem Code zu verwenden.
Eigenschaften
|
|
Öffentliche Funktionen
| QSpotLight(Qt3DCore::QNode *parent = nullptr) | |
| float | constantAttenuation() const |
| float | cutOffAngle() const |
| float | linearAttenuation() const |
| QVector3D | localDirection() const |
| float | quadraticAttenuation() const |
Öffentliche Slots
| void | setConstantAttenuation(float value) |
| void | setCutOffAngle(float cutOffAngle) |
| void | setLinearAttenuation(float value) |
| void | setLocalDirection(const QVector3D &localDirection) |
| void | setQuadraticAttenuation(float value) |
Signale
| void | constantAttenuationChanged(float constantAttenuation) |
| void | cutOffAngleChanged(float cutOffAngle) |
| void | linearAttenuationChanged(float linearAttenuation) |
| void | localDirectionChanged(const QVector3D &localDirection) |
| void | quadraticAttenuationChanged(float quadraticAttenuation) |
Ausführliche Beschreibung
Ein Scheinwerfer ist eine Lichtquelle, die einen Lichtkegel in eine bestimmte Richtung ausstrahlt.
Ein Scheinwerfer verwendet drei Abschwächungsfaktoren, um zu beschreiben, wie die Lichtintensität mit zunehmender Entfernung abnimmt. Diese Faktoren sind so konzipiert, dass sie gemeinsam zur Berechnung der Gesamtabschwächung herangezogen werden. Für die Materialien in Qt3D Extras wird die folgende Formel verwendet, wobei „distance“ die Entfernung von der Lichtquelle zur gerenderten Oberfläche bezeichnet:
totalAttenuation = 1.0 / (constantAttenuation + (linearAttenuation * distance) + (quadraticAttenuation * distance * distance));Benutzerdefinierte Materialien können diese Faktoren nach Belieben anders interpretieren.
Eigenschaftsdokumentation
constantAttenuation : float
Legt die konstante Abschwächung des Spotlichts fest.
Hinweis: Die genaue Bedeutung und Verwendung dieser Eigenschaft hängt von der jeweiligen Materialimplementierung ab.
Zugriffsfunktionen:
| float | constantAttenuation() const |
| void | setConstantAttenuation(float value) |
Benachrichtigungssignal:
| void | constantAttenuationChanged(float constantAttenuation) |
cutOffAngle : float
Legt den Abschneidewinkel des Spotlichts fest.
Hinweis: Die genaue Bedeutung und Verwendung dieser Eigenschaft hängt von der jeweiligen Materialimplementierung ab.
Zugriffsfunktionen:
| float | cutOffAngle() const |
| void | setCutOffAngle(float cutOffAngle) |
Benachrichtigungssignal:
| void | cutOffAngleChanged(float cutOffAngle) |
linearAttenuation : float
Legt die lineare Abschwächung des Spotlichts fest.
Hinweis: Die genaue Bedeutung und Verwendung dieser Eigenschaft hängt von der jeweiligen Materialimplementierung ab.
Zugriffsfunktionen:
| float | linearAttenuation() const |
| void | setLinearAttenuation(float value) |
Benachrichtigungssignal:
| void | linearAttenuationChanged(float linearAttenuation) |
localDirection : QVector3D
Legt die lokale Richtung des Spotlichts fest.
Hinweis: Die genaue Bedeutung und Verwendung dieser Eigenschaft hängt von der jeweiligen Materialimplementierung ab.
Zugriffsfunktionen:
| QVector3D | localDirection() const |
| void | setLocalDirection(const QVector3D &localDirection) |
Benachrichtigungssignal:
| void | localDirectionChanged(const QVector3D &localDirection) |
quadraticAttenuation : float
Legt die quadratische Abschwächung des Punktlichts fest.
Hinweis: Die genaue Bedeutung und Verwendung dieser Eigenschaft hängt von der jeweiligen Materialimplementierung ab.
Zugriffsfunktionen:
| float | quadraticAttenuation() const |
| void | setQuadraticAttenuation(float value) |
Benachrichtigungssignal:
| void | quadraticAttenuationChanged(float quadraticAttenuation) |
Dokumentation der Member-Funktionen
[explicit] QSpotLight::QSpotLight(Qt3DCore::QNode *parent = nullptr)
Erstellt ein neues QSpotLight mit dem angegebenen „ parent “.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.