[−][src]Struct qt_3d_render::QMaterial
Provides an abstract class that should be the base of all material component classes in a scene.
C++ class: Qt3DRender::QMaterial
.
Provides an abstract class that should be the base of all material component classes in a scene.
QMaterial provides a way to specify the rendering of an entity. Any aspect can define its own subclass of QMaterial so 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 QMaterial doesn't do anything. It's only when it references a QEffect node that a QMaterial becomes useful.
In practice, it often happens that a single QEffect is being referenced by several QMaterial components. This allows to only create the effect, techniques, passes and shaders once while allowing to specify the material by adding QParameter instances.
A QParameter defined on a QMaterial is overridden by a QParameter (of the same name) defined in a QTechniqueFilter or a QRenderPassFilter.
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);
Methods
impl QMaterial
[src]
pub fn slot_set_effect(&self) -> Receiver<(*mut QEffect,)>
[src]
Specifies the effect to be used with the material.
Returns a built-in Qt slot Qt3DRender::QMaterial::setEffect
that can be passed to qt_core::Signal::connect
.
Specifies the effect to be used with the material.
Access functions:
QEffect * | effect() const |
void | setEffect(QEffect *effect) |
Notifier signal:
void | effectChanged(QEffect *effect) |
pub fn effect_changed(&self) -> Signal<(*mut QEffect,)>
[src]
Specifies the effect to be used with the material.
Returns a built-in Qt signal Qt3DRender::QMaterial::effectChanged
that can be passed to qt_core::Signal::connect
.
Specifies the effect to be used with the material.
Access functions:
QEffect * | effect() const |
void | setEffect(QEffect *effect) |
Notifier signal:
void | effectChanged(QEffect *effect) |
pub unsafe fn add_parameter(&self, parameter: impl CastInto<Ptr<QParameter>>)
[src]
Add a parameter to the material's parameters.
Calls C++ function: void Qt3DRender::QMaterial::addParameter(Qt3DRender::QParameter* parameter)
.
Add a parameter to the material's parameters.
pub unsafe fn effect(&self) -> QPtr<QEffect>
[src]
Specifies the effect to be used with the material.
Calls C++ function: Qt3DRender::QEffect* Qt3DRender::QMaterial::effect() const
.
Specifies the effect to be used with the material.
Access functions:
QEffect * | effect() const |
void | setEffect(QEffect *effect) |
Notifier signal:
void | effectChanged(QEffect *effect) |
pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>
[src]
Calls C++ function: virtual const QMetaObject* Qt3DRender::QMaterial::metaObject() const
.
pub unsafe fn new_1a(parent: impl CastInto<Ptr<QNode>>) -> QBox<QMaterial>
[src]
Default constructs an instance of QMaterial.
Calls C++ function: [constructor] void Qt3DRender::QMaterial::QMaterial(Qt3DCore::QNode* parent = …)
.
Default constructs an instance of QMaterial.
pub unsafe fn new_0a() -> QBox<QMaterial>
[src]
Provides an abstract class that should be the base of all material component classes in a scene.
Calls C++ function: [constructor] void Qt3DRender::QMaterial::QMaterial()
.
Provides an abstract class that should be the base of all material component classes in a scene.
QMaterial provides a way to specify the rendering of an entity. Any aspect can define its own subclass of QMaterial so 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 QMaterial doesn't do anything. It's only when it references a QEffect node that a QMaterial becomes useful.
In practice, it often happens that a single QEffect is being referenced by several QMaterial components. This allows to only create the effect, techniques, passes and shaders once while allowing to specify the material by adding QParameter instances.
A QParameter defined on a QMaterial is overridden by a QParameter (of the same name) defined in a QTechniqueFilter or a QRenderPassFilter.
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);
pub unsafe fn parameters(&self) -> CppBox<QVectorOfQParameter>
[src]
Returns a vector of the material's current parameters
Calls C++ function: QVector<Qt3DRender::QParameter*> Qt3DRender::QMaterial::parameters() const
.
Returns a vector of the material's current parameters
pub unsafe fn qt_metacall(
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
[src]
&self,
arg1: Call,
arg2: c_int,
arg3: *mut *mut c_void
) -> c_int
Calls C++ function: virtual int Qt3DRender::QMaterial::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3)
.
pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void
[src]
Calls C++ function: virtual void* Qt3DRender::QMaterial::qt_metacast(const char* arg1)
.
pub unsafe fn remove_parameter(&self, parameter: impl CastInto<Ptr<QParameter>>)
[src]
Remove a parameter from the material's parameters.
Calls C++ function: void Qt3DRender::QMaterial::removeParameter(Qt3DRender::QParameter* parameter)
.
Remove a parameter from the material's parameters.
pub unsafe fn set_effect(&self, effect: impl CastInto<Ptr<QEffect>>)
[src]
Specifies the effect to be used with the material.
Calls C++ function: [slot] void Qt3DRender::QMaterial::setEffect(Qt3DRender::QEffect* effect)
.
Specifies the effect to be used with the material.
Access functions:
QEffect * | effect() const |
void | setEffect(QEffect *effect) |
Notifier signal:
void | effectChanged(QEffect *effect) |
pub unsafe fn static_meta_object() -> Ref<QMetaObject>
[src]
Returns a reference to the staticMetaObject
field.
pub unsafe fn tr(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString Qt3DRender::QMaterial::tr(const char* s, const char* c, int n)
.
pub unsafe fn tr_utf8(
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
[src]
s: *const c_char,
c: *const c_char,
n: c_int
) -> CppBox<QString>
Calls C++ function: static QString Qt3DRender::QMaterial::trUtf8(const char* s, const char* c, int n)
.
Trait Implementations
impl CppDeletable for QMaterial
[src]
unsafe fn delete(&self)
[src]
Destroys the instance of QMaterial.
Calls C++ function: virtual [destructor] void Qt3DRender::QMaterial::~QMaterial()
.
Destroys the instance of QMaterial.
impl Deref for QMaterial
[src]
type Target = QComponent
The resulting type after dereferencing.
fn deref(&self) -> &QComponent
[src]
Calls C++ function: Qt3DCore::QComponent* static_cast<Qt3DCore::QComponent*>(Qt3DRender::QMaterial* ptr)
.
impl DynamicCast<QMaterial> for QComponent
[src]
unsafe fn dynamic_cast(ptr: Ptr<QComponent>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* dynamic_cast<Qt3DRender::QMaterial*>(Qt3DCore::QComponent* ptr)
.
impl DynamicCast<QMaterial> for QNode
[src]
unsafe fn dynamic_cast(ptr: Ptr<QNode>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* dynamic_cast<Qt3DRender::QMaterial*>(Qt3DCore::QNode* ptr)
.
impl DynamicCast<QMaterial> for QObject
[src]
unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* dynamic_cast<Qt3DRender::QMaterial*>(QObject* ptr)
.
impl StaticDowncast<QMaterial> for QComponent
[src]
unsafe fn static_downcast(ptr: Ptr<QComponent>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* static_cast<Qt3DRender::QMaterial*>(Qt3DCore::QComponent* ptr)
.
impl StaticDowncast<QMaterial> for QNode
[src]
unsafe fn static_downcast(ptr: Ptr<QNode>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* static_cast<Qt3DRender::QMaterial*>(Qt3DCore::QNode* ptr)
.
impl StaticDowncast<QMaterial> for QObject
[src]
unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QMaterial>
[src]
Calls C++ function: Qt3DRender::QMaterial* static_cast<Qt3DRender::QMaterial*>(QObject* ptr)
.
impl StaticUpcast<QComponent> for QMaterial
[src]
unsafe fn static_upcast(ptr: Ptr<QMaterial>) -> Ptr<QComponent>
[src]
Calls C++ function: Qt3DCore::QComponent* static_cast<Qt3DCore::QComponent*>(Qt3DRender::QMaterial* ptr)
.
impl StaticUpcast<QNode> for QMaterial
[src]
unsafe fn static_upcast(ptr: Ptr<QMaterial>) -> Ptr<QNode>
[src]
Calls C++ function: Qt3DCore::QNode* static_cast<Qt3DCore::QNode*>(Qt3DRender::QMaterial* ptr)
.
impl StaticUpcast<QObject> for QMaterial
[src]
Auto Trait Implementations
impl RefUnwindSafe for QMaterial
impl Send for QMaterial
impl Sync for QMaterial
impl Unpin for QMaterial
impl UnwindSafe for QMaterial
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> CastInto<U> for T where
U: CastFrom<T>,
[src]
U: CastFrom<T>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> StaticUpcast<T> for T
[src]
unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,