summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/basicshapes-cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d/basicshapes-cpp')
-rw-r--r--examples/qt3d/basicshapes-cpp/main.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/examples/qt3d/basicshapes-cpp/main.cpp b/examples/qt3d/basicshapes-cpp/main.cpp
index b4b01ff30..fffb83a20 100644
--- a/examples/qt3d/basicshapes-cpp/main.cpp
+++ b/examples/qt3d/basicshapes-cpp/main.cpp
@@ -73,6 +73,7 @@
#include <Qt3DRender/qtexture.h>
#include <Qt3DRender/qrenderpass.h>
#include <Qt3DRender/qsceneloader.h>
+#include <Qt3DRender/qpointlight.h>
#include <Qt3DCore/qtransform.h>
#include <Qt3DCore/qaspectengine.h>
@@ -116,6 +117,15 @@ int main(int argc, char **argv)
cameraEntity->setUpVector(QVector3D(0, 1, 0));
cameraEntity->setViewCenter(QVector3D(0, 0, 0));
+ Qt3DCore::QEntity *lightEntity = new Qt3DCore::QEntity(rootEntity);
+ Qt3DRender::QPointLight *light = new Qt3DRender::QPointLight(lightEntity);
+ light->setColor("white");
+ light->setIntensity(1);
+ lightEntity->addComponent(light);
+ Qt3DCore::QTransform *lightTransform = new Qt3DCore::QTransform(lightEntity);
+ lightTransform->setTranslation(cameraEntity->position());
+ lightEntity->addComponent(lightTransform);
+
// For camera controls
Qt3DExtras::QFirstPersonCameraController *camController = new Qt3DExtras::QFirstPersonCameraController(rootEntity);
camController->setCamera(cameraEntity);