summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/basicshapes-cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2016-09-21 11:22:38 +0200
committerSean Harmer <sean.harmer@kdab.com>2016-09-26 08:27:50 +0000
commit43fad72720e26385cc3c98cd118b9af80feac3e3 (patch)
tree308cd096d4cef83365f6324710228467202f50d4 /examples/qt3d/basicshapes-cpp
parent7e638edbd15640302516f9a69d20f62d26d4af06 (diff)
Basic shapes example is dark with default light
Change-Id: Ia5a7dfb860317b3fa4b5a56ad6e9351ddb979b3b Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
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);