[Interest] Qt3D: Problem with QSkybox basename property

Sean Harmer sean.harmer at kdab.com
Wed Apr 19 10:09:48 CEST 2017


Hi,

On 19/04/2017 01:20, Ch'Gans wrote:
> On 18 April 2017 at 22:58, Sean Harmer <sean.harmer at kdab.com> wrote:
>> Hi,
>>
>> On 18/04/2017 10:10, Ch'Gans wrote:
>>>
>>> Hi there,
>>>
>>> I have just tried the sky box entity with Qt-5.9-beta, and found a
>>> small problem:
>>> If you don't specify a basename or if the basename is malformed, the
>>> GUI will freeze.
>>> As the documentation doesn't specify that the basename should be in a
>>> QUrl compatible format, I stupidly set the basename to
>>> '/somewhere/basename', it's only after looking at the source that i
>>> realised that. Using 'file:///somewhere/basename' fixed the problem.
>>> Shouldn't the documentation be updated to reflect that? Maybe simply
>>> replacing 'basename' with 'baseUrl' would give the right clue to the
>>> user, along with plainly saying that basename + suffix + extension
>>> should form a string that can be used with QUrl.
>>
>>
>> I'm actually tempted to avoid  the entire issue and just require that the
>> user provide a QAbstractTexture object that contains a cubemap texture
>> target. It's trivial  to do this with a dds file already but we can add a
>> convenience helper if  you want to be able to build a cubemap texture object
>> from a set of 2D images. That will make the API minimal and complete by
>
> Well, how QSkyBox could be more minimal, I was able to add a sky box
> to my scene with just 3 lines of code!:
> auto skyBox = new QSkyBox(rootEntity);
> skyBox->setBasename(...);
> skyBox->setExtension(...);

Well I'm thinking of something like:

auto skyBox = new QSkyBoxEntity(rootEntity);
skyBox->setTexture(QTextureLoader("mycubemap.dds"));

or

skyBox->setTexture(QTextureCubeMap::fromImages("basename", "extension"));

or

QVector<QImage> faces = { posx, negx, ... };
skyBox->setTexture(QTextureCubeMap::fromImages(faces));

>> delegating the complexity to other classes such as QTextureLoader.
>
> I had a quick look at DDS, this looks interesting, but requires some
> extra tooling if I'm not wrong. For novice like me and certainly for
> quick prototyping and or debugging, an API similar to the current one
> is very convenient indeed.

There are plenty of tools for building multi-image dds/ktx files already 
but we are looking at shipping something along with Qt 3D in the future.

Cheers,

Sean

>
> Chris
>
>>
>> Thanks for the feedback.
>>
>> Sean
>>
>>>
>>> Thanks,
>>> Chris
>>> _______________________________________________
>>> Interest mailing list
>>> Interest at qt-project.org
>>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>

-- 
Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
KDAB (UK) Ltd, a KDAB Group company
Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
Mobile: +44 (0)7545 140604
KDAB - Qt Experts



More information about the Interest mailing list