Wrapping Texture on CuboidMesh
Unsolved
General and Desktop
-
Currently if i am applying texture on CuboidMesh it displays same texture image on each side of cuboid rather than wrapping the whole cuboid.
For example I want to make a dice but with fallowing code it display all the dots of dice (whole texture image) on each side. Fallowing is my code snippet:Qt3DExtras::QCuboidMesh *cuboid = new Qt3DExtras::QCuboidMesh(); cuboid->setXExtent(2); cuboid->setYExtent(2); cuboid->setZExtent(2); Qt3DExtras::QTextureMaterial *cuboidMaterial = new Qt3DExtras::QTextureMaterial (); Qt3DRender::QTexture3D *texture2d = new Qt3DRender::QTexture2D (); texture2d->setWidth(20); texture2d->setHeight(20); texture2d->setFormat(Qt3DRender::QAbstractTexture::TextureFormat::RGB8_UNorm); texture2d->setGenerateMipMaps(true); texture2d->setMagnificationFilter(Qt3DRender::QAbstractTexture::Filter::Linear); texture2d->setMinificationFilter(Qt3DRender::QAbstractTexture::Filter::LinearMipMapLinear); texture2d->setWrapMode(Qt3DRender::QTextureWrapMode(Qt3DRender::QTextureWrapMode::ClampToEdge)); Qt3DRender::QTextureImage *diffuseImage = new Qt3DRender::QTextureImage(); diffuseImage->setSource(QUrl::fromLocalFile("ex.png")); texture2d->addTextureImage(diffuseImage); cuboidMaterial->setTexture(texture2d);