PySide6.Qt3DRender.Qt3DRender.QMaterial¶
- class QMaterial¶
- Provides an abstract class that should be the base of all material component classes in a scene. More… - Inherited by: - QTextureMaterial,- QPhongMaterial,- QPhongAlphaMaterial,- QPerVertexColorMaterial,- QNormalDiffuseSpecularMapMaterial,- QNormalDiffuseMapMaterial,- QNormalDiffuseMapAlphaMaterial,- QMorphPhongMaterial,- QMetalRoughMaterial,- QGoochMaterial,- QDiffuseSpecularMaterial,- QDiffuseSpecularMapMaterial,- QDiffuseMapMaterial- Synopsis¶- Properties¶- Methods¶- def - __init__()
- def - addParameter()
- def - effect()
- def - parameters()
 - Slots¶- def - setEffect()
 - Signals¶- def - effectChanged()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- QMaterialprovides a way to specify the rendering of an- entity. Any aspect can define its own subclass of- QMaterialso that a Material can be used to describe a visual element; for example, the way sound should reflect off an element, the temperature of a surface, and so on.- In itself, a - QMaterialdoesn’t do anything. It’s only when it references a- QEffectnode that a- QMaterialbecomes useful.- In practice, it often happens that a single - QEffectis being referenced by several- QMaterialcomponents. This allows to only create the effect, techniques, passes and shaders once while allowing to specify the material by adding- QParameterinstances.- A - QParameterdefined on a- QMaterialoverrides parameter (of the same name) defined in a- QEffect,- QTechniqueand- QRenderPass, but are overridden by parameter in- QRenderPassFilterand- QTechniqueFilter.- QMaterial *material1 = new QMaterial(); QMaterial *material2 = new QMaterial(); // Create effect, technique, render pass and shader QEffect *effect = new QEffect(); QTechnique *gl3Technique = new QTechnique(); QRenderPass *gl3Pass = new QRenderPass(); QShaderProgram *glShader = new QShaderProgram(); // Set the shader on the render pass gl3Pass->setShaderProgram(glShader); // Add the pass to the technique gl3Technique->addRenderPass(gl3Pass); // Set the targeted GL version for the technique gl3Technique->graphicsApiFilter()->setApi(QGraphicsApiFilter::OpenGL); gl3Technique->graphicsApiFilter()->setMajorVersion(3); gl3Technique->graphicsApiFilter()->setMinorVersion(1); gl3Technique->graphicsApiFilter()->setProfile(QGraphicsApiFilter::CoreProfile); // Add the technique to the effect effect->addTechnique(gl3Technique); // Set the effect on the materials material1->setEffect(effect); material2->setEffect(effect); // Set different parameters on the materials const QString parameterName = QStringLiteral("color"); material1->addParameter(new QParameter(parameterName, QColor::fromRgbF(0.0f, 1.0f, 0.0f, 1.0f))); material2->addParameter(new QParameter(parameterName, QColor::fromRgbF(1.0f, 1.0f, 1.0f, 1.0f))); - See also - QEffect- QTechnique- QParameter- Note - Properties can be used directly when - from __feature__ import true_propertyis used or via accessor functions otherwise.- Specifies the effect to be used with the material. - Access functions:
- Signal - effectChanged()
 
 - __init__([parent=None])¶
- Parameters:
- parent – - QNode
 
 - addParameter(parameter)¶
- Parameters:
- parameter – - QParameter
 
 - Add a - parameterto the material’s parameters.- effect()¶
- Return type:
- QEffect
 - See also - setEffect()
 - Getter of property - effectᅟ.- effectChanged(effect)¶
- Parameters:
- effect – - QEffect
 
 - Notification signal of property - effectᅟ.- parameters()¶
- Return type:
- .list of Qt3DRender.QParameter 
 
 - Returns a vector of the material’s current parameters - removeParameter(parameter)¶
- Parameters:
- parameter – - QParameter
 
 - Remove a - parameterfrom the material’s parameters.- setEffect(effect)¶
- Parameters:
- effect – - QEffect
 - See also - effect()
 - Setter of property - effectᅟ.