Skip to content

Commit

Permalink
Remove duplicate QgsQImageTextureImage class
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Dec 12, 2020
1 parent 6e45597 commit 515d282
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions src/3d/materials/qgsphongtexturedmaterialsettings.cpp
Expand Up @@ -18,6 +18,7 @@
#include "qgssymbollayerutils.h"
#include "qgsapplication.h"
#include "qgsimagecache.h"
#include "qgsimagetexture.h"
#include <Qt3DExtras/QDiffuseMapMaterial>
#include <Qt3DExtras/QPhongMaterial>
#include <Qt3DRender/QPaintedTextureImage>
Expand Down Expand Up @@ -89,28 +90,6 @@ void QgsPhongTexturedMaterialSettings::writeXml( QDomElement &elem, const QgsRea
QgsAbstractMaterialSettings::writeXml( elem, context );
}

///@cond PRIVATE
class QgsQImageTextureImage : public Qt3DRender::QPaintedTextureImage
{
public:
QgsQImageTextureImage( const QImage &image, Qt3DCore::QNode *parent = nullptr )
: Qt3DRender::QPaintedTextureImage( parent )
, mImage( image )
{
setSize( mImage.size() );
}

void paint( QPainter *painter ) override
{
painter->drawImage( mImage.rect(), mImage, mImage.rect() );
}

private:

QImage mImage;

};

///@endcond
Qt3DRender::QMaterial *QgsPhongTexturedMaterialSettings::toMaterial( QgsMaterialSettingsRenderingTechnique technique, const QgsMaterialContext &context ) const
{
Expand All @@ -131,7 +110,7 @@ Qt3DRender::QMaterial *QgsPhongTexturedMaterialSettings::toMaterial( QgsMaterial
{
Qt3DExtras::QDiffuseMapMaterial *material = new Qt3DExtras::QDiffuseMapMaterial;

QgsQImageTextureImage *textureImage = new QgsQImageTextureImage( textureSourceImage );
QgsImageTexture *textureImage = new QgsImageTexture( textureSourceImage );
material->diffuse()->addTextureImage( textureImage );

material->diffuse()->wrapMode()->setX( Qt3DRender::QTextureWrapMode::Repeat );
Expand Down

0 comments on commit 515d282

Please sign in to comment.