[][src]Struct qt_3d_render::QParameter

#[repr(C)]pub struct QParameter { /* fields omitted */ }

Provides storage for a name and value pair. This maps to a shader uniform.

C++ class: Qt3DRender::QParameter.

C++ documentation:

Provides storage for a name and value pair. This maps to a shader uniform.

A QParameter can be referenced by a QRenderPass, QTechnique, QEffect, QMaterial, QTechniqueFilter, QRenderPassFilter. At runtime, depending on which shader is selected for a given step of the rendering, the value contained in a QParameter will be converted and uploaded if the shader contains a uniform with a name matching that of the QParameter.

QParameter *param = new QParameter(); param->setName(QStringLiteral("diffuseColor")); param->setValue(QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Alternatively you can create and set a QParameter this way QParameter *param2 = new QParameter(QStringLiteral("diffuseColor"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Such QParameters will work with the following GLSL uniform shader declarations // uniform vec4 diffuseColor; // uniform vec3 diffuseColor; // uniform vec2 diffuseColor; // uniform float diffuseColor;

Note: some care must be taken to ensure the value wrapped by a QParameter can actually be converted to what the real uniform expect. Giving a value stored as an int where the actual shader uniform is of type float could result in undefined behaviors.

Note: when the targeted uniform is an array, the name should be the name of the uniform with [0] appended to it.

QParameter *param = new QParameter(); QVariantList values = QVariantList() << 0.0f << 1.0f << 2.0f << 3.0f << 4.0f << 883.0f << 1340.0f << 1584.0f;

param->setName(QStringLiteral("diffuseValues[0]")); param->setValue(values);

// Matching GLSL shader uniform declaration // uniform float diffuseValues[8];

When it comes to texture support, the QParameter value should be set to the appropriate QAbstractTexture subclass that matches the sampler type of the shader uniform.

QTexture2D texture = new QTexture2D(); ... QParameter param = new QParameter(); param->setName(QStringLiteral("diffuseTexture")); param->setValue(QVariant::fromValue(texture));

// Works with the following GLSL uniform shader declaration // uniform sampler2D diffuseTexture

Methods

impl QParameter[src]

pub fn slot_set_name(&self) -> Receiver<(*const QString,)>[src]

Specifies the name of the parameter

Returns a built-in Qt slot Qt3DRender::QParameter::setName that can be passed to qt_core::Signal::connect.

C++ documentation:

Specifies the name of the parameter

Access functions:

QString name() const
void setName(const QString &name)

Notifier signal:

void nameChanged(const QString &name)

pub fn slot_set_value(&self) -> Receiver<(*const QVariant,)>[src]

Specifies the value of the parameter

Returns a built-in Qt slot Qt3DRender::QParameter::setValue that can be passed to qt_core::Signal::connect.

C++ documentation:

Specifies the value of the parameter

Access functions:

QVariant value() const
void setValue(const QVariant &dv)

Notifier signal:

void valueChanged(const QVariant &value)

pub fn value_changed(&self) -> Signal<(*const QVariant,)>[src]

Specifies the value of the parameter

Returns a built-in Qt signal Qt3DRender::QParameter::valueChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

Specifies the value of the parameter

Access functions:

QVariant value() const
void setValue(const QVariant &dv)

Notifier signal:

void valueChanged(const QVariant &value)

pub fn name_changed(&self) -> Signal<(*const QString,)>[src]

Specifies the name of the parameter

Returns a built-in Qt signal Qt3DRender::QParameter::nameChanged that can be passed to qt_core::Signal::connect.

C++ documentation:

Specifies the name of the parameter

Access functions:

QString name() const
void setName(const QString &name)

Notifier signal:

void nameChanged(const QString &name)

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* Qt3DRender::QParameter::metaObject() const.

pub unsafe fn name(&self) -> CppBox<QString>[src]

Specifies the name of the parameter

Calls C++ function: QString Qt3DRender::QParameter::name() const.

C++ documentation:

Specifies the name of the parameter

Access functions:

QString name() const
void setName(const QString &name)

Notifier signal:

void nameChanged(const QString &name)

pub unsafe fn from_q_node(parent: impl CastInto<Ptr<QNode>>) -> QBox<QParameter>[src]

Constructs a new QParameter with the specified parent.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter(Qt3DCore::QNode* parent = …).

C++ documentation:

Constructs a new QParameter with the specified parent.

pub unsafe fn from_q_string_q_variant_q_node(
    name: impl CastInto<Ref<QString>>,
    value: impl CastInto<Ref<QVariant>>,
    parent: impl CastInto<Ptr<QNode>>
) -> QBox<QParameter>
[src]

Default constructs an instance of QParameter.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter(const QString& name, const QVariant& value, Qt3DCore::QNode* parent = …).

C++ documentation:

Default constructs an instance of QParameter.

pub unsafe fn from_q_string_q_abstract_texture_q_node(
    name: impl CastInto<Ref<QString>>,
    texture: impl CastInto<Ptr<QAbstractTexture>>,
    parent: impl CastInto<Ptr<QNode>>
) -> QBox<QParameter>
[src]

Default constructs an instance of QParameter.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter(const QString& name, Qt3DRender::QAbstractTexture* texture, Qt3DCore::QNode* parent = …).

C++ documentation:

Default constructs an instance of QParameter.

pub unsafe fn new() -> QBox<QParameter>[src]

Provides storage for a name and value pair. This maps to a shader uniform.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter().

C++ documentation:

Provides storage for a name and value pair. This maps to a shader uniform.

A QParameter can be referenced by a QRenderPass, QTechnique, QEffect, QMaterial, QTechniqueFilter, QRenderPassFilter. At runtime, depending on which shader is selected for a given step of the rendering, the value contained in a QParameter will be converted and uploaded if the shader contains a uniform with a name matching that of the QParameter.

QParameter *param = new QParameter(); param->setName(QStringLiteral("diffuseColor")); param->setValue(QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Alternatively you can create and set a QParameter this way QParameter *param2 = new QParameter(QStringLiteral("diffuseColor"), QColor::fromRgbF(0.0f, 0.0f, 1.0f, 1.0f));

// Such QParameters will work with the following GLSL uniform shader declarations // uniform vec4 diffuseColor; // uniform vec3 diffuseColor; // uniform vec2 diffuseColor; // uniform float diffuseColor;

Note: some care must be taken to ensure the value wrapped by a QParameter can actually be converted to what the real uniform expect. Giving a value stored as an int where the actual shader uniform is of type float could result in undefined behaviors.

Note: when the targeted uniform is an array, the name should be the name of the uniform with [0] appended to it.

QParameter *param = new QParameter(); QVariantList values = QVariantList() << 0.0f << 1.0f << 2.0f << 3.0f << 4.0f << 883.0f << 1340.0f << 1584.0f;

param->setName(QStringLiteral("diffuseValues[0]")); param->setValue(values);

// Matching GLSL shader uniform declaration // uniform float diffuseValues[8];

When it comes to texture support, the QParameter value should be set to the appropriate QAbstractTexture subclass that matches the sampler type of the shader uniform.

QTexture2D texture = new QTexture2D(); ... QParameter param = new QParameter(); param->setName(QStringLiteral("diffuseTexture")); param->setValue(QVariant::fromValue(texture));

// Works with the following GLSL uniform shader declaration // uniform sampler2D diffuseTexture

pub unsafe fn from_q_string_q_variant(
    name: impl CastInto<Ref<QString>>,
    value: impl CastInto<Ref<QVariant>>
) -> QBox<QParameter>
[src]

Default constructs an instance of QParameter.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter(const QString& name, const QVariant& value).

C++ documentation:

Default constructs an instance of QParameter.

pub unsafe fn from_q_string_q_abstract_texture(
    name: impl CastInto<Ref<QString>>,
    texture: impl CastInto<Ptr<QAbstractTexture>>
) -> QBox<QParameter>
[src]

Default constructs an instance of QParameter.

Calls C++ function: [constructor] void Qt3DRender::QParameter::QParameter(const QString& name, Qt3DRender::QAbstractTexture* texture).

C++ documentation:

Default constructs an instance of QParameter.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int Qt3DRender::QParameter::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::QParameter::qt_metacast(const char* arg1).

pub unsafe fn set_name(&self, name: impl CastInto<Ref<QString>>)[src]

Specifies the name of the parameter

Calls C++ function: [slot] void Qt3DRender::QParameter::setName(const QString& name).

C++ documentation:

Specifies the name of the parameter

Access functions:

QString name() const
void setName(const QString &name)

Notifier signal:

void nameChanged(const QString &name)

pub unsafe fn set_value(&self, dv: impl CastInto<Ref<QVariant>>)[src]

Specifies the value of the parameter

Calls C++ function: [slot] void Qt3DRender::QParameter::setValue(const QVariant& dv).

C++ documentation:

Specifies the value of the parameter

Access functions:

QVariant value() const
void setValue(const QVariant &dv)

Notifier signal:

void valueChanged(const QVariant &value)

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]

Calls C++ function: static QString Qt3DRender::QParameter::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]

Calls C++ function: static QString Qt3DRender::QParameter::trUtf8(const char* s, const char* c, int n).

pub unsafe fn value(&self) -> CppBox<QVariant>[src]

Specifies the value of the parameter

Calls C++ function: QVariant Qt3DRender::QParameter::value() const.

C++ documentation:

Specifies the value of the parameter

Access functions:

QVariant value() const
void setValue(const QVariant &dv)

Notifier signal:

void valueChanged(const QVariant &value)

Trait Implementations

impl CppDeletable for QParameter[src]

unsafe fn delete(&self)[src]

Calls C++ function: virtual [destructor] void Qt3DRender::QParameter::~QParameter().

impl Deref for QParameter[src]

type Target = QNode

The resulting type after dereferencing.

fn deref(&self) -> &QNode[src]

Calls C++ function: Qt3DCore::QNode* static_cast<Qt3DCore::QNode*>(Qt3DRender::QParameter* ptr).

impl DynamicCast<QParameter> for QNode[src]

unsafe fn dynamic_cast(ptr: Ptr<QNode>) -> Ptr<QParameter>[src]

Calls C++ function: Qt3DRender::QParameter* dynamic_cast<Qt3DRender::QParameter*>(Qt3DCore::QNode* ptr).

impl DynamicCast<QParameter> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QParameter>[src]

Calls C++ function: Qt3DRender::QParameter* dynamic_cast<Qt3DRender::QParameter*>(QObject* ptr).

impl StaticDowncast<QParameter> for QNode[src]

unsafe fn static_downcast(ptr: Ptr<QNode>) -> Ptr<QParameter>[src]

Calls C++ function: Qt3DRender::QParameter* static_cast<Qt3DRender::QParameter*>(Qt3DCore::QNode* ptr).

impl StaticDowncast<QParameter> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QParameter>[src]

Calls C++ function: Qt3DRender::QParameter* static_cast<Qt3DRender::QParameter*>(QObject* ptr).

impl StaticUpcast<QNode> for QParameter[src]

unsafe fn static_upcast(ptr: Ptr<QParameter>) -> Ptr<QNode>[src]

Calls C++ function: Qt3DCore::QNode* static_cast<Qt3DCore::QNode*>(Qt3DRender::QParameter* ptr).

impl StaticUpcast<QObject> for QParameter[src]

unsafe fn static_upcast(ptr: Ptr<QParameter>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(Qt3DRender::QParameter* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.