Skip to content

Commit

Permalink
rename ColorRampTexture
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Dec 3, 2020
1 parent 1ca1841 commit ae749de
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/3d/mesh/qgsmesh3dmaterial_p.cpp
Expand Up @@ -152,11 +152,11 @@ void QgsMesh3dMaterial::configure()
{
case QgsMesh3dMaterial::ZValue:
// if the color shading is done with the Z value of vertices, the color ramp has to be adapted with vertical scale
colorRampTexture->addTextureImage( new ColorRampTexture( mSymbol->colorRampShader(), mSymbol->verticalScale() ) );
colorRampTexture->addTextureImage( new QgsColorRampTexture( mSymbol->colorRampShader(), mSymbol->verticalScale() ) );
break;
case QgsMesh3dMaterial::ScalarDataSet:
// if the color shading is done with scalar dataset, no vertical scale to use
colorRampTexture->addTextureImage( new ColorRampTexture( mSymbol->colorRampShader(), 1 ) );
colorRampTexture->addTextureImage( new QgsColorRampTexture( mSymbol->colorRampShader(), 1 ) );
break;
}

Expand Down
14 changes: 7 additions & 7 deletions src/3d/qgscolorramptexture.cpp
Expand Up @@ -21,13 +21,13 @@

// ColorRampTextureGenerator

ColorRampTextureGenerator::ColorRampTextureGenerator( const QgsColorRampShader &colorRampShader, double verticalScale )
QgsColorRampTextureGenerator::QgsColorRampTextureGenerator( const QgsColorRampShader &colorRampShader, double verticalScale )
: mColorRampShader( colorRampShader )
, mVerticalScale( verticalScale )
{
}

Qt3DRender::QTextureImageDataPtr ColorRampTextureGenerator::operator()()
Qt3DRender::QTextureImageDataPtr QgsColorRampTextureGenerator::operator()()
{
Qt3DRender::QTextureImageDataPtr dataPtr = Qt3DRender::QTextureImageDataPtr::create();
dataPtr->setFormat( QOpenGLTexture::RGBA32F );
Expand Down Expand Up @@ -67,9 +67,9 @@ Qt3DRender::QTextureImageDataPtr ColorRampTextureGenerator::operator()()
return dataPtr;
}

bool ColorRampTextureGenerator::operator==( const Qt3DRender::QTextureImageDataGenerator &other ) const
bool QgsColorRampTextureGenerator::operator==( const Qt3DRender::QTextureImageDataGenerator &other ) const
{
const ColorRampTextureGenerator *otherFunctor = functor_cast<ColorRampTextureGenerator>( &other );
const QgsColorRampTextureGenerator *otherFunctor = functor_cast<QgsColorRampTextureGenerator>( &other );
if ( !otherFunctor )
return false;

Expand Down Expand Up @@ -101,17 +101,17 @@ bool ColorRampTextureGenerator::operator==( const Qt3DRender::QTextureImageDataG

// ColorRampTexture

ColorRampTexture::ColorRampTexture( const QgsColorRampShader &colorRampShader, double verticalScale, Qt3DCore::QNode *parent )
QgsColorRampTexture::QgsColorRampTexture( const QgsColorRampShader &colorRampShader, double verticalScale, Qt3DCore::QNode *parent )
: Qt3DRender::QAbstractTextureImage( parent ),
mColorRampShader( colorRampShader ),
mVerticalScale( verticalScale )
{

}

Qt3DRender::QTextureImageDataGeneratorPtr ColorRampTexture::dataGenerator() const
Qt3DRender::QTextureImageDataGeneratorPtr QgsColorRampTexture::dataGenerator() const
{
return Qt3DRender::QTextureImageDataGeneratorPtr( new ColorRampTextureGenerator( mColorRampShader, mVerticalScale ) );
return Qt3DRender::QTextureImageDataGeneratorPtr( new QgsColorRampTextureGenerator( mColorRampShader, mVerticalScale ) );
}

/// @endcond
10 changes: 5 additions & 5 deletions src/3d/qgscolorramptexture.h
Expand Up @@ -36,29 +36,29 @@
#include "qgsmeshlayerutils.h"
#include "qgstriangularmesh.h"

class ColorRampTextureGenerator: public Qt3DRender::QTextureImageDataGenerator
class QgsColorRampTextureGenerator: public Qt3DRender::QTextureImageDataGenerator
{

public:
ColorRampTextureGenerator( const QgsColorRampShader &colorRampShader, double verticalScale = 1 );
QgsColorRampTextureGenerator( const QgsColorRampShader &colorRampShader, double verticalScale = 1 );

public:
Qt3DRender::QTextureImageDataPtr operator()() override;

bool operator ==( const Qt3DRender::QTextureImageDataGenerator &other ) const override;

QT3D_FUNCTOR( ColorRampTextureGenerator )
QT3D_FUNCTOR( QgsColorRampTextureGenerator )

private:
QgsColorRampShader mColorRampShader;
double mVerticalScale = 1;
};


class ColorRampTexture: public Qt3DRender::QAbstractTextureImage
class QgsColorRampTexture: public Qt3DRender::QAbstractTextureImage
{
public:
ColorRampTexture( const QgsColorRampShader &colorRampShader, double verticalScale = 1, Qt3DCore::QNode *parent = nullptr );
QgsColorRampTexture( const QgsColorRampShader &colorRampShader, double verticalScale = 1, Qt3DCore::QNode *parent = nullptr );
// QAbstractTextureImage interface
protected:
Qt3DRender::QTextureImageDataGeneratorPtr dataGenerator() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgspointcloudlayerchunkloader_p.cpp
Expand Up @@ -232,7 +232,7 @@ Qt3DRender::QMaterial *QgsPointCloud3DSymbolHandler::constructMaterial()
if ( colorRampShader.colorRampItemList().count() > 0 )
{
colorRampTexture = new Qt3DRender::QTexture1D( mat );
colorRampTexture->addTextureImage( new ColorRampTexture( colorRampShader, 1 ) );
colorRampTexture->addTextureImage( new QgsColorRampTexture( colorRampShader, 1 ) );
colorRampTexture->setMinificationFilter( Qt3DRender::QTexture1D::Linear );
colorRampTexture->setMagnificationFilter( Qt3DRender::QTexture1D::Linear );
}
Expand Down

0 comments on commit ae749de

Please sign in to comment.