diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2015-01-28 08:31:29 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-02-08 11:15:35 +0000 |
commit | bfc4432f4deccb6b1287e4cc0d4aa8e34ea810c1 (patch) | |
tree | 62031b56bb903796df11f84a6df8215effe9ea8c /examples | |
parent | f49cabe35cbd89bd4e5a0e91100a96afdb5d8401 (diff) |
QTexture renamed to QAbstractTextureProvider
This is done prior to the whole texture API refactoring.
Doc was also added, might need improvement later on but a base is present at
least.
Change-Id: I75589f14dfbfba7bc4250b2e0960670e020ed38a
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'examples')
-rw-r--r-- | examples/deferred-renderer-cpp/gbuffer.cpp | 24 | ||||
-rw-r--r-- | examples/deferred-renderer-cpp/gbuffer.h | 10 | ||||
-rw-r--r-- | examples/materials-cpp/barrel.cpp | 12 | ||||
-rw-r--r-- | examples/materials-cpp/barrel.h | 6 | ||||
-rw-r--r-- | examples/materials-cpp/houseplant.cpp | 24 | ||||
-rw-r--r-- | examples/materials-cpp/main.cpp | 16 |
6 files changed, 46 insertions, 46 deletions
diff --git a/examples/deferred-renderer-cpp/gbuffer.cpp b/examples/deferred-renderer-cpp/gbuffer.cpp index 4ed1a627f..4004a4d36 100644 --- a/examples/deferred-renderer-cpp/gbuffer.cpp +++ b/examples/deferred-renderer-cpp/gbuffer.cpp @@ -44,11 +44,11 @@ GBuffer::GBuffer(Qt3D::QNode *parent) : Qt3D::QRenderTarget(parent) { - const Qt3D::QTexture::TextureFormat formats[AttachmentsCount] = { - Qt3D::QTexture::RGBA32F, - Qt3D::QTexture::RGB32F, - Qt3D::QTexture::RGB16F, - Qt3D::QTexture::D32F + const Qt3D::QAbstractTextureProvider::TextureFormat formats[AttachmentsCount] = { + Qt3D::QAbstractTextureProvider::RGBA32F, + Qt3D::QAbstractTextureProvider::RGB32F, + Qt3D::QAbstractTextureProvider::RGB16F, + Qt3D::QAbstractTextureProvider::D32F }; const Qt3D::QRenderAttachment::RenderAttachmentType attachmentTypes[AttachmentsCount] = { @@ -68,14 +68,14 @@ GBuffer::GBuffer(Qt3D::QNode *parent) for (int i = 0; i < AttachmentsCount; i++) { Qt3D::QRenderAttachment *attachment = new Qt3D::QRenderAttachment(this); - m_textures[i] = new Qt3D::QTexture(Qt3D::QTexture::Target2D); + m_textures[i] = new Qt3D::QAbstractTextureProvider(Qt3D::QAbstractTextureProvider::Target2D); m_textures[i]->setFormat(formats[i]); m_textures[i]->setWidth(1024); m_textures[i]->setHeight(1024); m_textures[i]->setGenerateMipMaps(false); m_textures[i]->setWrapMode(Qt3D::QTextureWrapMode(Qt3D::QTextureWrapMode::ClampToEdge)); - m_textures[i]->setMinificationFilter(Qt3D::QTexture::Linear); - m_textures[i]->setMagnificationFilter(Qt3D::QTexture::Linear); + m_textures[i]->setMinificationFilter(Qt3D::QAbstractTextureProvider::Linear); + m_textures[i]->setMagnificationFilter(Qt3D::QAbstractTextureProvider::Linear); attachment->setTexture(m_textures[i]); attachment->setType(attachmentTypes[i]); @@ -85,22 +85,22 @@ GBuffer::GBuffer(Qt3D::QNode *parent) } } -Qt3D::QTexture *GBuffer::colorTexture() const +Qt3D::QAbstractTextureProvider *GBuffer::colorTexture() const { return m_textures[Color]; } -Qt3D::QTexture *GBuffer::positionTexture() const +Qt3D::QAbstractTextureProvider *GBuffer::positionTexture() const { return m_textures[Position]; } -Qt3D::QTexture *GBuffer::normalTexture() const +Qt3D::QAbstractTextureProvider *GBuffer::normalTexture() const { return m_textures[Normal]; } -Qt3D::QTexture *GBuffer::depthTexture() const +Qt3D::QAbstractTextureProvider *GBuffer::depthTexture() const { return m_textures[Depth]; } diff --git a/examples/deferred-renderer-cpp/gbuffer.h b/examples/deferred-renderer-cpp/gbuffer.h index 67e42886d..ee9a86515 100644 --- a/examples/deferred-renderer-cpp/gbuffer.h +++ b/examples/deferred-renderer-cpp/gbuffer.h @@ -59,13 +59,13 @@ public: AttachmentsCount }; - Qt3D::QTexture *colorTexture() const; - Qt3D::QTexture *positionTexture() const; - Qt3D::QTexture *normalTexture() const; - Qt3D::QTexture *depthTexture() const; + Qt3D::QAbstractTextureProvider *colorTexture() const; + Qt3D::QAbstractTextureProvider *positionTexture() const; + Qt3D::QAbstractTextureProvider *normalTexture() const; + Qt3D::QAbstractTextureProvider *depthTexture() const; private: - Qt3D::QTexture *m_textures[AttachmentsCount]; + Qt3D::QAbstractTextureProvider *m_textures[AttachmentsCount]; Qt3D::QRenderAttachment *m_attachments[AttachmentsCount]; }; diff --git a/examples/materials-cpp/barrel.cpp b/examples/materials-cpp/barrel.cpp index 3af8bac89..1f2bba90d 100644 --- a/examples/materials-cpp/barrel.cpp +++ b/examples/materials-cpp/barrel.cpp @@ -140,8 +140,8 @@ void Barrel::setNormalTextureSource() QImage img; if (img.load(QStringLiteral(":/assets/metalbarrel/normal_") + bumpsName[m_bumps] + QStringLiteral(".webp"))) { m_normalTexture->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_normalTexture->setFromQImage(img); } } @@ -151,8 +151,8 @@ void Barrel::setDiffuseTextureSource() QImage img; if (img.load(QStringLiteral(":/assets/metalbarrel/diffus_") + diffuseColorsName[m_diffuseColor] + QStringLiteral(".webp"))) { m_diffuseTexture->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_diffuseTexture->setFromQImage(img); } } @@ -162,8 +162,8 @@ void Barrel::setSpecularTextureSource() QImage img; if (img.load(QStringLiteral(":/assets/metalbarrel/specular") + specularColorsName[m_specularColor] + QStringLiteral(".webp"))) { m_specularTexture->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_specularTexture->setFromQImage(img); } } diff --git a/examples/materials-cpp/barrel.h b/examples/materials-cpp/barrel.h index 6fcdb434b..0117f7451 100644 --- a/examples/materials-cpp/barrel.h +++ b/examples/materials-cpp/barrel.h @@ -88,9 +88,9 @@ private: DiffuseColor m_diffuseColor; SpecularColor m_specularColor; Qt3D::QNormalDiffuseSpecularMapMaterial *m_material; - Qt3D::QTexture *m_diffuseTexture; - Qt3D::QTexture *m_normalTexture; - Qt3D::QTexture *m_specularTexture; + Qt3D::QAbstractTextureProvider *m_diffuseTexture; + Qt3D::QAbstractTextureProvider *m_normalTexture; + Qt3D::QAbstractTextureProvider *m_specularTexture; void setNormalTextureSource(); void setDiffuseTextureSource(); diff --git a/examples/materials-cpp/houseplant.cpp b/examples/materials-cpp/houseplant.cpp index 5b6b66857..100c3f0c8 100644 --- a/examples/materials-cpp/houseplant.cpp +++ b/examples/materials-cpp/houseplant.cpp @@ -81,26 +81,26 @@ HousePlant::HousePlant(Qt3D::QNode *parent) if (img.load(QStringLiteral(":/assets/houseplants/cover.webp"))) { m_coverMaterial->diffuse()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_coverMaterial->diffuse()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/houseplants/cover_normal.webp"))) { m_coverMaterial->normal()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_coverMaterial->normal()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/houseplants/pot.webp"))) { m_potMaterial->diffuse()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_potMaterial->diffuse()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/houseplants/pot_normal.webp"))) { m_potMaterial->normal()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_potMaterial->normal()->setFromQImage(img); } @@ -195,14 +195,14 @@ void HousePlant::updatePlantType() QImage img; if (img.load(QStringLiteral(":/assets/houseplants/") + plantNames[m_plantType] + QStringLiteral(".webp"))) { m_plantMaterial->diffuse()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_plantMaterial->diffuse()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/houseplants/") + plantNames[m_plantType] + QStringLiteral("_normal.webp"))) { m_plantMaterial->normal()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); m_plantMaterial->normal()->setFromQImage(img); } } diff --git a/examples/materials-cpp/main.cpp b/examples/materials-cpp/main.cpp index c7ae96d76..06ee463f3 100644 --- a/examples/materials-cpp/main.cpp +++ b/examples/materials-cpp/main.cpp @@ -111,22 +111,22 @@ int main(int argc, char* argv[]) // Providing image loaders for textures would make sense if (img.load(QStringLiteral(":/assets/textures/pattern_09/diffuse.webp"))) { normalDiffuseSpecularMapMaterial->diffuse()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); normalDiffuseSpecularMapMaterial->diffuse()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/textures/pattern_09/specular.webp"))) { normalDiffuseSpecularMapMaterial->specular()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); normalDiffuseSpecularMapMaterial->specular()->setFromQImage(img); } if (img.load(QStringLiteral(":/assets/textures/pattern_09/normal.webp"))) { normalDiffuseSpecularMapMaterial->normal()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); normalDiffuseSpecularMapMaterial->normal()->setFromQImage(img); } planeEntity->addComponent(normalDiffuseSpecularMapMaterial); @@ -141,8 +141,8 @@ int main(int argc, char* argv[]) if (img.load(QStringLiteral(":/assets/chest/diffuse.webp"))) { diffuseMapMaterial->diffuse()->setFormat(img.hasAlphaChannel() ? - Qt3D::QTexture::RGBA8_UNorm : - Qt3D::QTexture::RGB8_UNorm); + Qt3D::QAbstractTextureProvider::RGBA8_UNorm : + Qt3D::QAbstractTextureProvider::RGB8_UNorm); diffuseMapMaterial->diffuse()->setFromQImage(img); } chest->addComponent(diffuseMapMaterial); |