QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Types | Public Member Functions | List of all members
Qgs3DExportObject Class Reference

The Qgs3DExportObject class Manages the data of each object of the scene (positions, normals, texture coordinates ...) since each object. More...

#include <qgs3dexportobject.h>

Public Types

enum  ObjectType { TriangularFaces, LineStrip, Points }
 The type of exported geometry. More...
 

Public Member Functions

 Qgs3DExportObject (const QString &name)
 Qgs3DExportObject Constructs an export object that will be filled with coordinates later. More...
 
QString name () const
 Returns the object name. More...
 
void objectBounds (float &minX, float &minY, float &minZ, float &maxX, float &maxY, float &maxZ)
 Updates the box bounds explained with the current object bounds This expands the bounding box if the current object outside the bounds of the already established bounds. More...
 
QString saveMaterial (QTextStream &mtlOut, const QString &folder)
 saves the texture of the object and material information More...
 
void saveTo (QTextStream &out, float scale, const QVector3D &center)
 Saves the current object to the output stream while scaling the object and centering it to be visible in exported scene. More...
 
void setMaterialParameter (const QString &parameter, const QString &value)
 Sets a material parameter to be exported in the .mtl file. More...
 
void setName (const QString &name)
 Sets the object name. More...
 
void setSmoothEdges (bool smoothEdges)
 Sets whether triangles edges will look smooth. More...
 
void setTextureImage (const QImage &image)
 Sets the texture image used by the object. More...
 
void setType (ObjectType type)
 Sets the object type. More...
 
void setupFaces (const QVector< uint > &facesIndexes)
 Sets the faces in facesIndexes to the faces in the object. More...
 
void setupLine (const QVector< uint > &facesIndexes)
 sets line vertex indexes More...
 
void setupMaterial (QgsAbstractMaterialSettings *material)
 Sets the material parameters (diffuse color, shininess...) from phong material. More...
 
void setupNormalCoordinates (const QVector< float > &normalsBuffer)
 Sets normal coordinates for each vertex. More...
 
void setupPositionCoordinates (const QVector< float > &positionsBuffer, float scale=1.0f, const QVector3D &translation=QVector3D(0, 0, 0))
 Sets positions coordinates and does the translation and scaling. More...
 
void setupTextureCoordinates (const QVector< float > &texturesBuffer)
 Sets texture coordinates for each vertex. More...
 
bool smoothEdges ()
 Returns whether object edges will look smooth. More...
 
QImage textureImage ()
 Returns the texture image used by the object. More...
 
ObjectType type () const
 Returns the object type. More...
 

Detailed Description

The Qgs3DExportObject class Manages the data of each object of the scene (positions, normals, texture coordinates ...) since each object.

Note
Not available in Python bindings

3

Since
QGIS 3.16

Definition at line 41 of file qgs3dexportobject.h.

Member Enumeration Documentation

◆ ObjectType

The type of exported geometry.

Enumerator
TriangularFaces 
LineStrip 
Points 

Definition at line 45 of file qgs3dexportobject.h.

Constructor & Destructor Documentation

◆ Qgs3DExportObject()

Qgs3DExportObject::Qgs3DExportObject ( const QString &  name)
inline

Qgs3DExportObject Constructs an export object that will be filled with coordinates later.

Parameters
parentNameThe name of the parent (Will be useful to define scene hierarchy)
parentThe parent QObject (we use this to delete the Qgs3DExportObject instance once the exporter instance is deallocated)

Definition at line 60 of file qgs3dexportobject.h.

Member Function Documentation

◆ name()

QString Qgs3DExportObject::name ( ) const
inline

Returns the object name.

Definition at line 63 of file qgs3dexportobject.h.

◆ objectBounds()

void Qgs3DExportObject::objectBounds ( float &  minX,
float &  minY,
float &  minZ,
float &  maxX,
float &  maxY,
float &  maxZ 
)

Updates the box bounds explained with the current object bounds This expands the bounding box if the current object outside the bounds of the already established bounds.

Definition at line 87 of file qgs3dexportobject.cpp.

◆ saveMaterial()

QString Qgs3DExportObject::saveMaterial ( QTextStream &  mtlOut,
const QString &  folder 
)

saves the texture of the object and material information

Definition at line 183 of file qgs3dexportobject.cpp.

◆ saveTo()

void Qgs3DExportObject::saveTo ( QTextStream &  out,
float  scale,
const QVector3D &  center 
)

Saves the current object to the output stream while scaling the object and centering it to be visible in exported scene.

Definition at line 102 of file qgs3dexportobject.cpp.

◆ setMaterialParameter()

void Qgs3DExportObject::setMaterialParameter ( const QString &  parameter,
const QString &  value 
)
inline

Sets a material parameter to be exported in the .mtl file.

Definition at line 104 of file qgs3dexportobject.h.

◆ setName()

void Qgs3DExportObject::setName ( const QString &  name)
inline

Sets the object name.

Definition at line 65 of file qgs3dexportobject.h.

◆ setSmoothEdges()

void Qgs3DExportObject::setSmoothEdges ( bool  smoothEdges)
inline

Sets whether triangles edges will look smooth.

Definition at line 75 of file qgs3dexportobject.h.

◆ setTextureImage()

void Qgs3DExportObject::setTextureImage ( const QImage &  image)
inline

Sets the texture image used by the object.

Definition at line 92 of file qgs3dexportobject.h.

◆ setType()

void Qgs3DExportObject::setType ( ObjectType  type)
inline

Sets the object type.

Definition at line 70 of file qgs3dexportobject.h.

◆ setupFaces()

void Qgs3DExportObject::setupFaces ( const QVector< uint > &  facesIndexes)

Sets the faces in facesIndexes to the faces in the object.

Definition at line 57 of file qgs3dexportobject.cpp.

◆ setupLine()

void Qgs3DExportObject::setupLine ( const QVector< uint > &  facesIndexes)

sets line vertex indexes

Definition at line 62 of file qgs3dexportobject.cpp.

◆ setupMaterial()

void Qgs3DExportObject::setupMaterial ( QgsAbstractMaterialSettings material)

Sets the material parameters (diffuse color, shininess...) from phong material.

Definition at line 78 of file qgs3dexportobject.cpp.

◆ setupNormalCoordinates()

void Qgs3DExportObject::setupNormalCoordinates ( const QVector< float > &  normalsBuffer)

Sets normal coordinates for each vertex.

Definition at line 68 of file qgs3dexportobject.cpp.

◆ setupPositionCoordinates()

void Qgs3DExportObject::setupPositionCoordinates ( const QVector< float > &  positionsBuffer,
float  scale = 1.0f,
const QVector3D &  translation = QVector3D( 0, 0, 0 ) 
)

Sets positions coordinates and does the translation and scaling.

Definition at line 46 of file qgs3dexportobject.cpp.

◆ setupTextureCoordinates()

void Qgs3DExportObject::setupTextureCoordinates ( const QVector< float > &  texturesBuffer)

Sets texture coordinates for each vertex.

Definition at line 73 of file qgs3dexportobject.cpp.

◆ smoothEdges()

bool Qgs3DExportObject::smoothEdges ( )
inline

Returns whether object edges will look smooth.

Definition at line 73 of file qgs3dexportobject.h.

◆ textureImage()

QImage Qgs3DExportObject::textureImage ( )
inline

Returns the texture image used by the object.

Definition at line 94 of file qgs3dexportobject.h.

◆ type()

ObjectType Qgs3DExportObject::type ( ) const
inline

Returns the object type.

Definition at line 68 of file qgs3dexportobject.h.


The documentation for this class was generated from the following files: