[Interest] [qt3d] Loading textures from a custom file format
Xavier Bigand
flamaros.xavier at gmail.com
Sat Jun 18 02:15:56 CEST 2016
I finally make it works, but I am not sure to do everything correctly.
Firslty I change the way to attach the Texture to the QDiffuseMapMaterial :
QDiffuseMapMaterial* material = new QDiffuseMapMaterial();
Texture* diffuseTexture = new Texture();
// Instancing our custom Texture class to be able to load our
file format instead of retrieving the QAbstractTexture of material
diffuseTexture->setSource(texturePath);
// Calling our custom file loader
material->setDiffuse(diffuseTexture);
The setSource method load and fill a Qt3DRender::QTextureImageDataPtr that
is directly given at the added TextureImage.
I don't know if it's the right thing to do everything in my implementation
of QAbstractTexture.
I am also curious on how set the anisotropy level.
2016-06-17 16:21 GMT+02:00 Xavier Bigand <flamaros.xavier at gmail.com>:
> I am trying to understand how I have to use QAbstractTexture and
> QAbstractTextureImage to load textures from our custom format.
>
> Our format is pretty simple and consist in a compressed file that contains
> an header with all necessary informations :
> - texture size
> - precise texture format (PVRTCI_4bpp_RGBA, ETC1,...)
> - number of mipmaps
>
> And it's naturally followed by the pixels buffer.
>
> If I understand correctly how it works the best way to manage it is to
> create a Texture class that will load the file and instantiate TextureImage
> corresponding to the number of mipmaps level I have.
>
> Am I right?
>
> --
> Xavier
>
--
Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160618/9a7d66cc/attachment.html>
More information about the Interest
mailing list