[Interest] Qt3D How to model headlight?
Volker Enderlein
volker.enderlein at ifm-chemnitz.de
Fri Sep 7 11:50:36 CEST 2018
Hi,
I insert a light source in a scene (headlight) and connect its position
to the camera position.
But now, when I use camera->viewAll() the bounding volume of the scene
is enlarged to include the light position. camera->viewAll() changes the
camera position. And as the light source is connected to the camera
position, the bounding volume is enlarged every time I do a
camera->viewAll().
auto lightEntity = new Qt3DCore::QEntity(rootEntity());
auto light = new Qt3DRender::QPointLight(lightEntity);
light->setColor(QColor::fromRgbF(1.0, 1.0, 1.0));
light->setIntensity(1.);
light->setConstantAttenuation(1.);
light->setLinearAttenuation(0.);
light->setQuadraticAttenuation(0.);
lightEntity->addComponent(light);
auto lightTransform = new Qt3DCore::QTransform(lightEntity);
lightTransform->setTranslation(camera()->position());
lightEntity->addComponent(lightTransform);
connect(camera(), SIGNAL(positionChanged(QVector3D)),
lightTransform, SLOT(setTranslation(QVector3D)));
So the question is: How can I model a headlight that is located at the
camera position and not included in bounding volume calculation?
Cheers, Volker
--
More information about the Interest
mailing list