QGIS API Documentation
4.3.0-Master (52aa6503bed)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
3d
qgstextureatlasgenerator.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgstextureatlasgenerator.h
3
--------------------------------------
4
Date : September 2025
5
Copyright : (C) 2025 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSTEXTUREATLASGENERATOR_H
17
#define QGSTEXTUREATLASGENERATOR_H
18
19
#include <vector>
20
21
#include "qgis_3d.h"
22
23
#include <QImage>
24
#include <QRect>
25
27
class
QgsTextureRect;
29
30
42
class
_3D_EXPORT
QgsTextureAtlas
43
{
44
public
:
45
QgsTextureAtlas
();
46
~QgsTextureAtlas
();
47
48
QgsTextureAtlas
(
const
QgsTextureAtlas
&other );
49
QgsTextureAtlas
&
operator=
(
const
QgsTextureAtlas
&other );
50
54
bool
isValid
()
const
{
return
mAtlasSize.isValid(); }
55
60
QSize
atlasSize
()
const
{
return
mAtlasSize; }
61
62
#ifndef SIP_RUN
66
QRect rect(
int
index )
const
;
67
#else
68
74
QRect rect(
int
index )
const
;
75
//%MethodCode
76
const
int
count = sipCpp->count();
77
if
( a0 < 0 || a0 >= count )
78
{
79
PyErr_SetString( PyExc_IndexError, QByteArray::number( a0 ) );
80
sipIsErr = 1;
81
}
82
else
83
{
84
return
sipConvertFromNewType(
new
QRect( sipCpp->rect( a0 ) ), sipType_QRect, Py_None );
85
}
86
//%End
87
#endif
88
94
QImage renderAtlasTexture()
const
;
95
102
QImage renderDebugTexture()
const
;
103
107
int
count()
const
;
108
109
#ifdef SIP_RUN
110
// clang-format off
111
int
__len__()
const
;
112
% Docstring
113
Returns the number of textures in the atlas.
114
% End
115
//%MethodCode
116
sipRes = sipCpp->count();
117
//% End
118
// clang-format on
119
#endif
120
121
private
:
122
std::vector< QgsTextureRect > mRects;
123
QSize mAtlasSize;
124
125
friend
class
QgsTextureAtlasGenerator
;
126
};
127
138
class
_3D_EXPORT
QgsTextureAtlasGenerator
139
{
140
public
:
153
static
QgsTextureAtlas
createFromRects
(
const
QVector< QRect > &rectangles,
int
maxSide = 1000 );
154
164
static
QgsTextureAtlas
createFromImages
(
const
QVector< QImage > &images,
int
maxSide = 1000 );
165
166
private
:
174
static
QgsTextureAtlas
generateAtlas( std::vector< QgsTextureRect > rects,
int
maxSide );
175
};
176
177
#endif
// QGSTEXTUREATLASGENERATOR_H
QgsTextureAtlasGenerator
Generates texture atlases by efficient packing of multiple input rectangles/images.
Definition
qgstextureatlasgenerator.h:139
QgsTextureAtlasGenerator::createFromRects
static QgsTextureAtlas createFromRects(const QVector< QRect > &rectangles, int maxSide=1000)
Creates a texture atlas for a set of rectangles.
Definition
qgstextureatlasgenerator.cpp:114
QgsTextureAtlasGenerator::createFromImages
static QgsTextureAtlas createFromImages(const QVector< QImage > &images, int maxSide=1000)
Creates a texture atlas for a set of images.
Definition
qgstextureatlasgenerator.cpp:125
QgsTextureAtlas
Encapsulates a texture atlas.
Definition
qgstextureatlasgenerator.h:43
QgsTextureAtlas::~QgsTextureAtlas
~QgsTextureAtlas()
QgsTextureAtlas::operator=
QgsTextureAtlas & operator=(const QgsTextureAtlas &other)
QgsTextureAtlas::isValid
bool isValid() const
Returns true if the atlas is valid.
Definition
qgstextureatlasgenerator.h:54
QgsTextureAtlas::QgsTextureAtlas
QgsTextureAtlas(const QgsTextureAtlas &other)
QgsTextureAtlas::atlasSize
QSize atlasSize() const
Returns the total size required for the atlas, i.e.
Definition
qgstextureatlasgenerator.h:60
QgsTextureAtlas::QgsTextureAtlas
QgsTextureAtlas()
QgsTextureAtlas::QgsTextureAtlasGenerator
friend class QgsTextureAtlasGenerator
Definition
qgstextureatlasgenerator.h:125
Generated on
for QGIS API Documentation by
1.17.0